MembershipsManager
July 28, 2025 ยท View on GitHub
- List user's groups
- List members of group
- Add user to group
- Get group membership
- Update group membership
- Remove user from group
List user's groups
Retrieves all the groups for a user. Only members of this group or users with admin-level permissions will be able to use this API.
This operation is performed by calling function getUserMemberships.
See the endpoint docs at API Reference.
await client.memberships.getUserMemberships(user.id);
Arguments
- userId
string- The ID of the user. Example: "12345"
- optionalsInput
GetUserMembershipsOptionalsInput
Returns
This function returns a value of type GroupMemberships.
Returns a collection of membership objects. If there are no memberships, an empty collection will be returned.
List members of group
Retrieves all the members for a group. Only members of this group or users with admin-level permissions will be able to use this API.
This operation is performed by calling function getGroupMemberships.
See the endpoint docs at API Reference.
await client.memberships.getGroupMemberships(group.id);
Arguments
- groupId
string- The ID of the group. Example: "57645"
- optionalsInput
GetGroupMembershipsOptionalsInput
Returns
This function returns a value of type GroupMemberships.
Returns a collection of membership objects. If there are no memberships, an empty collection will be returned.
Add user to group
Creates a group membership. Only users with admin-level permissions will be able to use this API.
This operation is performed by calling function createGroupMembership.
See the endpoint docs at API Reference.
await client.memberships.createGroupMembership({
user: { id: user.id } satisfies CreateGroupMembershipRequestBodyUserField,
group: { id: group.id } satisfies CreateGroupMembershipRequestBodyGroupField,
} satisfies CreateGroupMembershipRequestBody);
Arguments
- requestBody
CreateGroupMembershipRequestBody- Request body of createGroupMembership method
- optionalsInput
CreateGroupMembershipOptionalsInput
Returns
This function returns a value of type GroupMembership.
Returns a new group membership object.
Get group membership
Retrieves a specific group membership. Only admins of this group or users with admin-level permissions will be able to use this API.
This operation is performed by calling function getGroupMembershipById.
See the endpoint docs at API Reference.
await client.memberships.getGroupMembershipById(groupMembership.id!);
Arguments
- groupMembershipId
string- The ID of the group membership. Example: "434534"
- optionalsInput
GetGroupMembershipByIdOptionalsInput
Returns
This function returns a value of type GroupMembership.
Returns the group membership object.
Update group membership
Updates a user's group membership. Only admins of this group or users with admin-level permissions will be able to use this API.
This operation is performed by calling function updateGroupMembershipById.
See the endpoint docs at API Reference.
await client.memberships.updateGroupMembershipById(groupMembership.id!, {
requestBody: {
role: 'admin' as UpdateGroupMembershipByIdRequestBodyRoleField,
} satisfies UpdateGroupMembershipByIdRequestBody,
} satisfies UpdateGroupMembershipByIdOptionalsInput);
Arguments
- groupMembershipId
string- The ID of the group membership. Example: "434534"
- optionalsInput
UpdateGroupMembershipByIdOptionalsInput
Returns
This function returns a value of type GroupMembership.
Returns a new group membership object.
Remove user from group
Deletes a specific group membership. Only admins of this group or users with admin-level permissions will be able to use this API.
This operation is performed by calling function deleteGroupMembershipById.
See the endpoint docs at API Reference.
await client.memberships.deleteGroupMembershipById(groupMembership.id!);
Arguments
- groupMembershipId
string- The ID of the group membership. Example: "434534"
- optionalsInput
DeleteGroupMembershipByIdOptionalsInput
Returns
This function returns a value of type undefined.
A blank response is returned if the membership was successfully deleted.