Skip to main content

ChannelGroupClient

ChannelGroupClient: TypedEventEmitter<ChannelGroupEvents> & object

Type declaration

create()

Parameters

ParameterType
requestChannelGroupCreateRequest

Returns

Promise<ChannelGroup>

Example

import {
ChannelGroup,
ChannelGroupCreateRequest,
rootServer,
} from "@rootsdk/server-app";

export async function createExample(): Promise<ChannelGroup> {
try {
// Set up the request
const request: ChannelGroupCreateRequest = {
name: "MyChannelGroupName",
accessRuleCreates: [],
};

// Call the API
const channelGroup: ChannelGroup =
await rootServer.community.channelGroups.create(request);

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

delete()

Parameters

ParameterType
requestChannelGroupDeleteRequest

Returns

Promise<void>

Example

import {
ChannelGroupDeleteRequest,
ChannelGroupGuid,
rootServer,
} from "@rootsdk/server-app";

export async function deleteExample(
channelGroupId: ChannelGroupGuid,
): Promise<void> {
try {
// Set up the request
const request: ChannelGroupDeleteRequest = {
id: channelGroupId,
};

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

edit()

Parameters

ParameterType
requestChannelGroupEditRequest
eventHandlers?{ channelGroup.created: ChannelGroupCreatedHandler; channelGroup.deleted: ChannelGroupDeletedHandler; }
eventHandlers.channelGroup.created?ChannelGroupCreatedHandler
eventHandlers.channelGroup.deleted?ChannelGroupDeletedHandler

Returns

Promise<void>

Example

import {
ChannelGroup,
ChannelGroupEditRequest,
ChannelGroupGuid,
rootServer,
} from "@rootsdk/server-app";

export async function editExample(
channelGroupId: ChannelGroupGuid,
// events: BUG BUG BUG
): Promise<void> {
try {
// Set up the request
const request: ChannelGroupEditRequest = {
id: channelGroupId,
name: "MyChannelGroupName",
accessRuleUpdate: undefined,
};

// Call the API

await rootServer.community.channelGroups.edit(request);
} catch (error) {
// Detect error
throw error;
}
}

get()

Parameters

ParameterType
requestChannelGroupGetRequest

Returns

Promise<ChannelGroup>

Example

import {
ChannelGroup,
ChannelGroupGetRequest,
ChannelGroupGuid,
rootServer,
} from "@rootsdk/server-app";

export async function getExample(
channelGroupId: ChannelGroupGuid,
): Promise<ChannelGroup> {
try {
// Set up the request
const request: ChannelGroupGetRequest = {
id: channelGroupId,
};

// Call the API
const channelGroup: ChannelGroup =
await rootServer.community.channelGroups.get(request);

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

list()

Returns

Promise<ChannelGroup[]>

Example

import {
ChannelListRequest,
ChannelGroup,
rootServer,
} from "@rootsdk/server-app";

export async function listExample(): Promise<ChannelGroup[]> {
try {
// Call the API
const channelGroups: ChannelGroup[] =
await rootServer.community.channelGroups.list();

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

move()

Parameters

ParameterType
requestChannelGroupMoveRequest

Returns

Promise<void>

Example

import {
ChannelGroup,
ChannelGroupMoveRequest,
ChannelGroupGuid,
rootServer,
} from "@rootsdk/server-app";

export async function moveExample(
channelGroupId: ChannelGroupGuid,
beforeChannelGroupId: ChannelGroupGuid,
// events: BUG BUG BUG
): Promise<void> {
try {
// Set up the request
const request: ChannelGroupMoveRequest = {
id: channelGroupId,
beforeChannelGroupId: beforeChannelGroupId,
};

// Call the API

await rootServer.community.channelGroups.move(request);
} catch (error) {
// Detect error
throw error;
}
}