CommunityMemberRoleClient
CommunityMemberRoleClient:
TypedEventEmitter<CommunityMemberRoleEvents> &object
Type declaration
add()
Parameters
| Parameter | Type |
|---|---|
request | CommunityMemberRoleAddRequest |
Returns
Promise<void>
Example
import {
CommunityMemberRoleAddRequest,
CommunityRoleGuid,
UserGuid,
rootServer,
} from "@rootsdk/server-app";
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
| Parameter | Type |
|---|---|
request | CommunityMemberRoleListRequest |
Returns
Promise<CommunityMemberRoleListResponse>
Example
import {
CommunityMemberRole,
CommunityMemberRoleListRequest,
CommunityMemberRoleListResponse,
UserGuid,
rootServer,
} from "@rootsdk/server-app";
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
| Parameter | Type |
|---|---|
request | CommunityMemberRoleRemoveRequest |
Returns
Promise<void>
Example
import {
CommunityMemberRoleRemoveRequest,
CommunityRoleGuid,
UserGuid,
rootServer,
} from "@rootsdk/server-app";
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
| Parameter | Type |
|---|---|
request | CommunityMemberRoleSetPrimaryRequest |
Returns
Promise<void>
Example
import {
CommunityMemberRole,
CommunityMemberRoleSetPrimaryRequest,
CommunityRoleGuid,
UserGuid,
rootServer,
} from "@rootsdk/server-app";
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;
}
}