Simulators
Tags
A tag names a group of a team’s members, so a message can mention them all at once. Load the teams_launch_hub scenario, create a tag with one member and read it back:
H='Authorization: Bearer placeholder-token'
J='Content-Type: application/json'
curl -s -o /dev/null -w '%{http_code}\n' -X POST "$RYSTIC_URL/_rystic/scenario" -d '{"name":"teams_launch_hub"}'
# -> 204
TAGS="$RYSTIC_URL/v1.0/teams/3dd52548-ef0b-41b9-896b-e62254b098ed/tags"
TAG=$(curl -s "$TAGS" -H "$H" -H "$J" -d '{"displayName":"Reviewers","members":[{"userId":"a82cbb3c-d24e-4dcc-a753-2ccdf8135a5d"}]}' | jq -r .id)
curl -s "$TAGS/$TAG" -H "$H" | jq -c '{displayName, memberCount, tagType}'
# -> {"displayName":"Reviewers","memberCount":1,"tagType":"standard"}
curl -s "$TAGS" -H "$H" | jq -c '[.value[].displayName]'
# -> ["On-call","Design Review","Reviewers"]
Each userId must belong to a member of the team.
Test a tag member who is not on the team
A userId outside the team returns 404, and no tag is created:
curl -s -o /dev/null -w '%{http_code}\n' "$TAGS" -H "$H" -H "$J" -d '{"displayName":"Outsiders","members":[{"userId":"00000000-0000-4000-8000-00000000abcd"}]}'
# -> 404
curl -s "$TAGS" -H "$H" | jq -c '[.value[].displayName]'
# -> ["On-call","Design Review","Reviewers"]
Add and remove members
memberCount follows each change:
curl -s "$TAGS/$TAG/members" -H "$H" -H "$J" -d '{"userId":"ccd2836b-cda8-4183-ae08-f03b3611851e"}' | jq -c '{displayName, userId}'
# -> {"displayName":"Aiko Tanaka","userId":"ccd2836b-cda8-4183-ae08-f03b3611851e"}
curl -s "$TAGS/$TAG/members" -H "$H" | jq -c '[.value[].displayName]'
# -> ["Hannah Weiss","Aiko Tanaka"]
AIKO=$(curl -s "$TAGS/$TAG/members" -H "$H" | jq -r '.value[] | select(.displayName == "Aiko Tanaka") | .id')
curl -s -o /dev/null -w '%{http_code}\n' -X DELETE "$TAGS/$TAG/members/$AIKO" -H "$H"
# -> 204
curl -s "$TAGS/$TAG" -H "$H" | jq -c .memberCount
# -> 1
Remove a tag’s last member
A tag cannot stand empty: removing its last member deletes the tag, and the next read returns 404:
LAST=$(curl -s "$TAGS" -H "$H" -H "$J" -d '{"displayName":"Short-lived","members":[{"userId":"a82cbb3c-d24e-4dcc-a753-2ccdf8135a5d"}]}' | jq -r .id)
ONLY=$(curl -s "$TAGS/$LAST/members" -H "$H" | jq -r '.value[0].id')
curl -s -o /dev/null -w '%{http_code}\n' -X DELETE "$TAGS/$LAST/members/$ONLY" -H "$H"
# -> 204
curl -s -o /dev/null -w '%{http_code}\n' "$TAGS/$LAST" -H "$H"
# -> 404
Rename a tag
PATCH returns 200, and the next read shows the new name:
curl -s -o /dev/null -w '%{http_code}\n' -X PATCH "$TAGS/$TAG" -H "$H" -H "$J" -d '{"displayName":"Doc reviewers"}'
# -> 200
curl -s "$TAGS/$TAG" -H "$H" | jq -c '{displayName, memberCount}'
# -> {"displayName":"Doc reviewers","memberCount":1}
Delete a tag
A deleted tag returns 404 to the next read:
curl -s -o /dev/null -w '%{http_code}\n' -X DELETE "$TAGS/$TAG" -H "$H"
# -> 204
curl -s -o /dev/null -w '%{http_code}\n' "$TAGS/$TAG" -H "$H"
# -> 404
Last updated on