createChannel

abstract suspend fun createChannel(    name: String,     topic: String? = null,     mode: Channel.Mode? = null,     category: String? = null,     autoProvisioning: Boolean? = null,     maxItems: Int? = null): RainbowResult<Channel>

Create a new channel with specified parameters.

This method allows you to create a new channel with various configuration options. Depending on the specified mode, the channel can have different visibility, access control, and member management behaviors. You can also set an optional category, topic, and other parameters such as auto-provisioning and maximum number of items the channel can hold.

The mode determines the visibility and membership rules of the channel. If not specified, the default mode is COMPANY_PUBLIC. The following modes are available:

  • COMPANY_PUBLIC: Channel is visible to all company members and can be discovered by search.

  • COMPANY_PRIVATE: Channel is private to the company, members need to be invited to join.

  • COMPANY_CLOSED: Channel is not discoverable by search, and once users are added, they cannot leave.

  • ORGANIZATION_PUBLIC: Channel is public to the organization, discoverable by search.

  • ORGANIZATION_PRIVATE: Channel is private to the organization, with invite-only membership.

  • ORGANIZATION_CLOSED: Channel is not discoverable, and members cannot leave.

  • ALL_PUBLIC: Channel is public and discoverable by anyone. Requires special permissions to create a public channel.

  • ALL_PRIVATE: Channel is private, with invite-only membership.

Return

A RainbowResult containing the created Channel object on success. In case of failure, it contains error details.

Parameters

name

The name of the channel to be created.

topic

An optional topic or description of the channel (can be null if not provided).

mode

The desired Channel.Mode for the channel, which controls its visibility and membership rules. Default is COMPANY_PUBLIC if not specified.

category

An optional category for the channel (can be null if not specified).

autoProvisioning

An optional boolean value to specify whether all members of the company should be automatically added to the channel (only applies to certain modes, can be null if not needed).

maxItems

An optional integer specifying the maximum number of items (posts) that the channel can retain. Older items will be replaced by newer ones once the limit is reached. Default value is null (which means no limit).