/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { channelsCreate } from "../funcs/channels-create.js"; import { channelsDelete } from "../funcs/channels-delete.js"; import { channelsDuplicate } from "../funcs/channels-duplicate.js"; import { channelsList } from "../funcs/channels-list.js"; import { channelsRetrieve } from "../funcs/channels-retrieve.js"; import { channelsUpdate } from "../funcs/channels-update.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import * as models from "../models/index.js"; import * as operations from "../models/operations/index.js"; import { unwrapAsync } from "../types/fp.js"; import { PageIterator, unwrapResultIterator } from "../types/operations.js"; export class Channels extends ClientSDK { /** * List channels * * @remarks * List the channels in a project. The list is paginated. Needs the `channels:read` permission. */ async list( projectId: string, page?: number | undefined, pageSize?: number | undefined, options?: RequestOptions, ): Promise> { return unwrapResultIterator(channelsList( this, projectId, page, pageSize, options, )); } /** * Create a channel * * @remarks * Create a channel in a project, with the default rules. The project's first channel becomes its default. Needs the `channels:write` permission. */ async create( projectId: string, body: operations.CreateChannelRequestBody, options?: RequestOptions, ): Promise { return unwrapAsync(channelsCreate( this, projectId, body, options, )); } /** * Get a channel * * @remarks * Get a channel by ID. Needs the `channels:read` permission. */ async retrieve( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(channelsRetrieve( this, id, options, )); } /** * Update a channel * * @remarks * Update a channel. Fields you leave out keep their value. Needs the `channels:write` permission. */ async update( id: string, body: operations.UpdateChannelRequestBody, options?: RequestOptions, ): Promise { return unwrapAsync(channelsUpdate( this, id, body, options, )); } /** * Delete a channel * * @remarks * Delete a channel. Its key is freed for a new channel. When it was the default, the oldest remaining channel becomes the default. A channel that still moderates a Slack workspace must be disconnected first. Needs the `channels:write` permission. */ async delete( id: string, options?: RequestOptions, ): Promise { return unwrapAsync(channelsDelete( this, id, options, )); } /** * Duplicate a channel * * @remarks * Copy a channel in its project, with every setting, policy, rule and wordlist. Integrations (Discord, Slack, WordPress) are not copied. Needs the `channels:write` permission. */ async duplicate( id: string, body: operations.DuplicateChannelRequestBody, options?: RequestOptions, ): Promise { return unwrapAsync(channelsDuplicate( this, id, body, options, )); } }