Skip to main content

CommunityMemberRoleClient

CommunityMemberRoleClient: TypedEventEmitter<CommunityMemberRoleEvents> & object

Type declaration

add()

Parameters

ParameterType
requestCommunityMemberRoleAddRequest

Returns

Promise<void>

Example

import {
CommunityMemberRoleAddRequest,
CommunityRoleGuid,
UserGuid,
rootServer,
} from "@rootsdk/server-bot";

export async function addExample(
communityRoleId: CommunityRoleGuid,
userIds: UserGuid[],
): Promise<void> {
try {
// Set up the request
const request: CommunityMemberRoleAddRequest = {
communityRoleId: communityRoleId,
userIds: userIds,
};

// Call the API
await rootServer.community.communityMemberRoles.add(request);
} catch (error) {
// Detect error
throw error;
}
}

list()

Parameters

ParameterType
requestCommunityMemberRoleListRequest

Returns

Promise<CommunityMemberRoleListResponse>

Example

import {
CommunityMemberRole,
CommunityMemberRoleListRequest,
CommunityMemberRoleListResponse,
UserGuid,
rootServer,
} from "@rootsdk/server-bot";

export async function listExample(
userId: UserGuid,
): Promise<CommunityMemberRoleListResponse> {
try {
// Set up the request
const request: CommunityMemberRoleListRequest = {
userId: userId,
};
// Call the API
const communityMemberRoles: CommunityMemberRoleListResponse =
await rootServer.community.communityMemberRoles.list(request);

return communityMemberRoles;
} catch (error) {
// Detect error
throw error;
}
}

remove()

Parameters

ParameterType
requestCommunityMemberRoleRemoveRequest

Returns

Promise<void>

Example

import {
CommunityMemberRoleRemoveRequest,
CommunityRoleGuid,
UserGuid,
rootServer,
} from "@rootsdk/server-bot";

export async function removeExample(
communityRoleId: CommunityRoleGuid,
userIds: UserGuid[],
): Promise<void> {
try {
// Set up the request
const request: CommunityMemberRoleRemoveRequest = {
communityRoleId: communityRoleId,
userIds: userIds,
};

// Call the API
await rootServer.community.communityMemberRoles.remove(request);
} catch (error) {
// Detect error
throw error;
}
}

setPrimary()

Parameters

ParameterType
requestCommunityMemberRoleSetPrimaryRequest

Returns

Promise<void>

Example

import {
CommunityMemberRole,
CommunityMemberRoleSetPrimaryRequest,
CommunityRoleGuid,
UserGuid,
rootServer,
} from "@rootsdk/server-bot";

export async function setPrimaryExample(
userId: UserGuid,
communityRoleId: CommunityRoleGuid,
): Promise<void> {
try {
// Set up the request
const request: CommunityMemberRoleSetPrimaryRequest = {
userId: userId,
communityRoleId: communityRoleId,
};

// Call the API
await rootServer.community.communityMemberRoles.setPrimary(request);
} catch (error) {
// Detect error
throw error;
}
}