Skip to content

@ubstream/ubstream-node-client-sdk / Exports / OrganizationsGroupsClient

Class: OrganizationsGroupsClient

This class provides access to methods to manage groups in an organization.

Hierarchy

  • AbstractClient

OrganizationsGroupsClient

Table of contents

Methods

Methods

addMembers

addMembers(orgId, groupId, usersIds): Promise<void>

Parameters

Name Type Description
orgId string The uuid of the targeted organization.
groupId string The uuid of the targeted group.
usersIds string[] The uuids of the users to be attached.

Returns

Promise<void>

Promise void.

Summary

Add members to a group (one or several).

Example

await client.organizations.groups.addMembers("organization_id", "group_id", ["user_id_1", "user_id_2"]);

createGroup

createGroup(orgId, groupToCreate): Promise<IPublicGroupData>

Parameters

Name Type Description
orgId string The uuid of the targeted organization.
groupToCreate IPublicGroupForm The group to be created.

Returns

Promise<IPublicGroupData>

Promise object representing the new group.

Summary

Create a new group in organization.

Example

const groupToCreate: IPublicGroupForm = {
     name: 'test',
};
const newGroup = await client.organizations.groups.createGroup("organization_id", groupToCreate);

deleteGroup

deleteGroup(orgId, groupId): Promise<IPublicHttpResponseDataWithRequestId>

Parameters

Name Type Description
orgId string The uuid of the targeted organization.
groupId string The uuid of the targeted group.

Returns

Promise<IPublicHttpResponseDataWithRequestId>

Promise object with the requestId.

Summary

Delete a group.

Example

await client.organizations.groups.deleteGroup("organization_id", "group_id");

getGroup

getGroup(orgId, groupId): Promise<IPublicGroupData>

Parameters

Name Type Description
orgId string The uuid of the targeted organization.
groupId string The uuid of the targeted group.

Returns

Promise<IPublicGroupData>

Promise object representing the fetched group.

Summary

Retrieve a group of a specified organization.

Example

const group = await client.organizations.groups.getGroup("organization_id", "group_id");

listGroups

listGroups(orgId): Promise<IPublicGroupQuery>

Parameters

Name Type Description
orgId string The uuid of the targeted organization.

Returns

Promise<IPublicGroupQuery>

Promise object representing the organization's groups.

Summary

List all groups of a specified organization.

Example

const result = await client.organizations.groups.listGroups("organization_id");
const groups = result.$resources;

listMembers

listMembers(orgId, groupId): Promise<IPublicUserQuery>

Parameters

Name Type Description
orgId string The uuid of the targeted organization.
groupId string The uuid of the targeted group.

Returns

Promise<IPublicUserQuery>

Promise object representing users of the specified group.

Summary

Retrieve all members of a specified group.

Example

const result = await client.organizations.groups.listMembers("organization_id", "group_id");
const members = result.$resources;

removeMembers

removeMembers(orgId, groupId, usersIds): Promise<void>

Parameters

Name Type Description
orgId string The uuid of the targeted organization.
groupId string The uuid of the targeted group.
usersIds string[] The uuids of the users to be detached.

Returns

Promise<void>

Summary

Remove members from a group. (one or several)

Example

await client.organizations.groups.removeMembers("organization_id", "group_id", ["user_id_1", "user_id_2"]);

updateGroup

updateGroup(orgId, groupId, group): Promise<IPublicGroupData>

Parameters

Name Type Description
orgId string The uuid of the targeted organization.
groupId string The uuid of the targeted group.
group IPublicUpdateGroupForm Data to update the targeted group.

Returns

Promise<IPublicGroupData>

Promise object representing the updated group.

Summary

Update group of a specified organization.

Example

const group = await client.organizations.groups.getGroup("organization_id", "group_id");
const updatedGroup = await client.organizations.groups.updateGroup("organization_id", group.id, {
     ...group,
     name: 'test',
});