BaseChannel

@objc(SBDBaseChannel)
open class BaseChannel : NSObject, Codable, Identifiable, Cacheable, Injectable
extension BaseChannel: Serializable
extension BaseChannel: Mappable

An object represents base class for channel

  • id

    Identifier for the channel conforming to Identifiable

    Declaration

    Swift

    @objc
    open var id: String { get }
  • The channel URL.

    Declaration

    Swift

    @objc
    open internal(set) var channelURL: String { get }
  • The name of channel.

    Declaration

    Swift

    @objc
    open internal(set) var name: String { get }
  • The channel cover image URL.

    Declaration

    Swift

    @objc
    open internal(set) var coverURL: String? { get }
  • User who creates the channel

    Since

    3.0.199

    Declaration

    Swift

    @objc
    open internal(set) var creator: User? { get }
  • The timestamp when the channel is created in seconds.

    Declaration

    Swift

    @objc
    open internal(set) var createdAt: Int64 { get }
  • The custom data of the channel.

    Declaration

    Swift

    @objc
    open internal(set) var data: String? { get }
  • The custom type of the channel.

    Declaration

    Swift

    @objc
    open internal(set) var customType: String? { get }
  • The flag for a frozen channel.

    Since

    3.0.89

    Declaration

    Swift

    @objc
    open internal(set) var isFrozen: Bool { get }
  • Represents the channel is ephemeral or not.

    Since

    3.0.90

    Declaration

    Swift

    @objc
    open internal(set) var isEphemeral: Bool { get }
  • A list of messageIds of pinned messages.

    Note

    Pin functionality in OpenChannel will be supported starting from 4.20.0.

    Since

    4.2.0

    Declaration

    Swift

    @objc
    open internal(set) var pinnedMessageIds: [Int64]? { get }
  • The message that was pinned the last.

    Note

    Pin functionality in OpenChannel will be supported starting from 4.20.0.

    Since

    4.2.0

    Declaration

    Swift

    @objc
    open internal(set) var lastPinnedMessage: BaseMessage? { get }
  • Gets the current user’s muted information in this channel.

    Since

    3.0.118

    Declaration

    Swift

    @objc
    open func getMyMutedInfo(completionHandler: MuteInfoHandler?)

    Parameters

    completionHandler

    The handler block to be executed.

  • Channel type

    Declaration

    Swift

    @objc
    open var channelType: ChannelType { get }
  • Indicates possibility of outdated information

    Declaration

    Swift

    @objc
    open var isDirty: Bool
  • Checks the channel type is open channel or not.

    Declaration

    Swift

    @objc
    open func isOpenChannel() -> Bool

    Return Value

    Returns true when this is open channel.

  • Checks the channel type is group channel or not.

    Declaration

    Swift

    @objc
    open func isGroupChannel() -> Bool

    Return Value

    true if when this is a group channel.

  • Checks the channel type is feed channel or not.

    Since

    4.6.0

    Declaration

    Swift

    @objc
    open func isFeedChannel() -> Bool

    Return Value

    true if when this is a group channel.

  • Timestamp of when the MessageCollection for this channel has been created.

    Since

    4.6.0

    Declaration

    Swift

    @objc
    public internal(set) var messageCollectionLastAccessedAt: Int64 { get }
  • Encodes this object.

    Declaration

    Swift

    open func encode(to encoder: Encoder) throws

    Parameters

    encoder

    Encoder instance

  • Default constructor.

    Declaration

    Swift

    public required init(from decoder: Decoder) throws

    Parameters

    decoder

    Decoder instance

  • Description

    Declaration

    Swift

    open override var description: String { get }
  • Retrieves the changelogs since a specified token regarding the updated messages or the unique IDs of deleted messages in the channel.

    Since

    3.0.181

    Declaration

    Swift

    @objc(getMessageChangeLogsSinceToken:params:completionHandler:)
    open func getMessageChangeLogs(
        token: String?,
        params: MessageChangeLogsParams = MessageChangeLogsParams(),
        completionHandler: MessageChangeLogHandler?
    )

    Parameters

    token

    Specifies the token to be the reference point for the changelogs to retrieve.

    params

    Contains a set of parameters you can set regarding the messages in the results.

    completionHandler

    The handler block to execute. The updatedMessages retrieves the updated messages. The deletedMessageIds retrieves the unique ID of deleted messages. The hasMore indicates whether there are more changelogs to be retrieved. The token retrieves the token of the last changelog in the results. The error indicates whether there is an error. If there is no error, the value is nil.

  • Retrieves the changelogs since a specified timestamp, in Unix milliseconds format, regarding the updated messages or the unique IDs of deleted messages in the channel.

    Since

    3.0.181

    Declaration

    Swift

    @objc(getMessageChangeLogsSinceTimestamp:params:completionHandler:)
    open func getMessageChangeLogs(
        timestamp: Int64,
        params: MessageChangeLogsParams = MessageChangeLogsParams(),
        completionHandler: MessageChangeLogHandler?
    )

    Parameters

    timestamp

    Specifies the timestamp to be the reference point for changelogs to retrieve, in Unix milliseconds format.

    params

    Contains a set of parameters you can set regarding the messages in the results.

    completionHandler

    The handler block to execute. The updatedMessages retrieves the updated messages. The deletedMessageIds retrieves the unique ID of deleted messages. The hasMore indicates whether there are more changelogs to be retrieved. The token retrieves the token of the last changelog in the results. The error indicates whether there is an error. If there is no error, the value is nil.

  • Retrieves the changelogs since a specified token regarding the updated polls or the unique IDs of deleted polls in the channel.

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func getPollChangeLogs(
        token: String?,
        completionHandler: PollChangeLogsHandler?
    )

    Parameters

    token

    Specifies the token to be the reference point for the changelogs to retrieve.

    completionHandler

    The handler block to execute. The updatedPolls retrieves the updated polls. The deletedPollIds retrieves the unique ID of deleted polls. The hasMore indicates whether there are more changelogs to be retrieved. The token retrieves the token of the last changelog in the results. The error indicates whether there is an error. If there is no error, the value is nil.

  • Retrieves the changelogs since a specified timestamp regarding the updated polls or the unique IDs of deleted polls in the channel.

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func getPollChangeLogs(
        timestamp: Int64,
        completionHandler: PollChangeLogsHandler?
    )

    Parameters

    timestamp

    Specifies the timestamp to be the reference point for changelogs to retrieve, in Unix milliseconds format.

    completionHandler

    The handler block to execute. The updatedPolls retrieves the updated polls. The deletedPollIds retrieves the unique ID of deleted polls. The hasMore indicates whether there are more changelogs to be retrieved. The token retrieves the token of the last changelog in the results. The error indicates whether there is an error. If there is no error, the value is nil.

  • Compares this object with given other object.

    Declaration

    Swift

    public override func isEqual(_ object: Any?) -> Bool

    Parameters

    object

    Any instance

    Return Value

    true if same otherwise false

  • Sends a file message with file or file URL of params without progress.

    If the params has a binary file, it will upload data to Sendbird storage. If not, the params has a file url, it will send a message with file url.

    Declaration

    Swift

    @discardableResult
    open func sendFileMessage(
        params: FileMessageCreateParams,
        completionHandler: FileMessageHandler?
    ) -> FileMessage?

    Parameters

    params

    Instance of FileMessageCreateParams that can has parameters related with file.

    completionHandler

    handler block to be executed after the message was sent. This block has no return value and takes two argument, one is a file message was sent and other is an error made when there is something wrong to message.

    Return Value

    Returns a temporary file message being sent to the Sendbird server. The message has a request ID instead of a message ID. The request status of the message is pending. If you try to send a message with an invalid parameter, the returned message is a file message with no properties. You can perform a validation of pending message by checking for the existence of the request ID.

  • Sends a file message with file or file URL of params without progress.

    If the params has a binary file, it will upload data to Sendbird storage. If not, the params has a file url, it will send a message with file url.

    Declaration

    Swift

    @discardableResult
    open func sendFileMessage(
        params: FileMessageCreateParams,
        progressHandler: MultiProgressHandler?,
        completionHandler: FileMessageHandler?
    ) -> FileMessage?

    Parameters

    params

    Instance of FileMessageCreateParams that can has parameters related with file.

    progressHandler

    progress handler

    completionHandler

    handler block to be executed after the message was sent. This block has no return value and takes two argument, one is a file message was sent and other is an error made when there is something wrong to message.

    Return Value

    Returns a temporary file message being sent to the Sendbird server. The message has a request ID instead of a message ID. The request status of the message is pending. If you try to send a message with an invalid parameter, the returned message is a user message with no properties. You can perform a validation of pending message by checking for the existence of the request ID.

  • Sends a file message with file or file URL of params with progress.

    If the params has a binary file, it will upload data to Sendbird storage. If not, the params has a file url, it will send a message with file url.

    Since

    3.0.116

    Declaration

    Swift

    @discardableResult
    open func sendFileMessages(
        params: [FileMessageCreateParams],
        progressHandler: MultiProgressHandler?,
        sentMessageHandler: FileMessageHandler?,
        completionHandler: SBErrorHandler?
    ) -> [FileMessage]

    Parameters

    params

    The instance of FileMessageCreateParams that can has parameters related with file.

    progressHandler

    The handler block to be used to monitor progression. requestId is a unique identifier for the message send request. bytesSent is the number of bytes sent since this method was called. totalBytesSent is the total number of bytes sent so far. totalBytesExpectedToSend is the expected length of the body data. These parameters are the same to the declaration of urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:).

    sentMessageHandler

    The handler block to be executed after each message was sent. This block has no return value and takes two argument, one is a file message was sent and other is an error made when there is something wrong to message.

    completionHandler

    The handler block to be executed after every message was sent. This block has no return value and takes an error. If the sending message can’t start at all because of the connection issue, the error isn’t nil.

    Return Value

    Returns a temporary file message being sent to the Sendbird server. The message has a request ID instead of a message ID. The request status of the message is pending. If you try to send a message with an invalid parameter, the returned message is a user message with no properties. You can perform a validation of pending message by checking for the existence of the request ID.

  • Updates a file message. The data, custom type from file message params can be updated.

    Since

    3.0.110

    Declaration

    Swift

    open func updateFileMessage(
        messageId: Int64,
        params: FileMessageUpdateParams,
        completionHandler: FileMessageHandler?
    )

    Parameters

    messageId

    The message ID of the message to be updated.

    params

    The file message params that has updating fields.

    completionHandler

    The handler block to be executed after update.

  • Attempts to resend a failed file message received by the failure callback.

    Only failed message MUST be passed, not a succeeded message or a pending message. If the failed message has a file URL, it means the failed message was created after failure of sending a file message command. So the method retries to send a file message command. If the failed message does not have a file URL, it means the failed message was created from failure of uploading a binary data. So the method retries to upload a binary data frist.

    Since

    3.0.147

    Declaration

    Swift

    @discardableResult
    @objc(resendFileMessageWithMessage:binaryData:completionHandler:)
    open func resendFileMessage(
        _ message: FileMessage,
        binaryData: Data?,
        completionHandler: FileMessageHandler?
    ) -> FileMessage?

    Parameters

    message

    A message to send. A failed message is passed to the callback when fails to send a message

    binaryData

    Data to resend. If the failed message has a file URL, the method will not send binary data. If the failed message does not have a file URL, the method will send binary data first and send a file message command with file url.

    completionHandler

    Handler block to be executed after the message is sent. This block has no return value and takes two arguments. One is a file message. If the message is successfully sent, the complete message instance is delivered. If the message fails to be sent, a failed message based on the pending message is delivered except invalid parameter error. If failed because of invalid parameter, message is nil. Another factor is errors. If the message fails to be sent, a message error is dispatched.

    Return Value

    Returns a temporary file message being sent to the Sendbird server.

  • Attempts to resend a failed file message received by the failure callback.

    Only failed message MUST be passed, not a succeeded message or a pending message. If the failed message has a file URL, it means the failed message was created after failure of sending a file message command. So the method retries to send a file message command. If the failed message does not have a file URL, it means the failed message was created from failure of uploading a binary data. So the method retries to upload a binary data frist.

    Since

    3.0.147

    Declaration

    Swift

    @discardableResult
    @objc(resendFileMessageWithMessage:binaryData:progressHandler:completionHandler:)
    open func resendFileMessage(
        _ message: FileMessage,
        binaryData: Data?,
        progressHandler: MultiProgressHandler?,
        completionHandler: FileMessageHandler?
    ) -> FileMessage?

    Parameters

    message

    A message to send. A failed message is passed to the callback when fails to send a message

    binaryData

    Data to resend. If the failed message has a file URL, the method will not send binary data. If the failed message does not have a file URL, the method will send binary data first and send a file message command with file url.

    progressHandler

    The handler block to be used to monitor progression. requestId is a unique identifier for the message send request. bytesSent is the number of bytes sent since this method was called. totalBytesSent is the total number of bytes sent so far. totalBytesExpectedToSend is the expected length of the body data. These parameters are the same to the declaration of urlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:).

    completionHandler

    The handler block to be executed after the message is sent. This block has no return value and takes two arguments. One is a file message. If the message is successfully sent, the complete message instance is delivered. If the message fails to be sent, a failed message based on the pending message is delivered except invalid parameter error. If failed because of invalid parameter, message is nil. Another factor is errors. If the message fails to be sent, a message error is dispatched.

    Return Value

    Returns a temporary file message being sent to the Sendbird server.

  • Copies a file message to the target channel.

    Note

    Only accpets messages whose sendingStatus is .succeeded.

    Declaration

    Swift

    @discardableResult
    @objc(copyFileMessage:toTargetChannel:completionHandler:)
    open func copyFileMessage(
        _ message: FileMessage,
        toTargetChannel targetChannel: BaseChannel,
        completionHandler: FileMessageHandler?
    ) -> FileMessage?

    Parameters

    message

    File message object.

    targetChannel

    Target channel object.

    completionHandler

    The handler block to execute. The fileMessage is a user message which is returned from the Sendbird server. The message has a message ID.

    Return Value

    Returns the temporary file message with a request ID. It doesn’t have a message ID. If there is any error, nil could be returned.

  • Cancels the file message uploading.

    Declaration

    Swift

    @objc(cancelUploadingFileMessageWithRequestId:completionHandler:)
    open class func cancelUploadingFileMessage(
        requestId: String,
        completionHandler: ((_ result: Bool, _ error: SBError?) -> Void)?
    )

    Parameters

    requestId

    The request ID of the file message that is been uploading.

    completionHandler

    The handler block to execute. If the result is true, then the uploading task of the requestId has been cancelled.

Get Messages with Params

  • Retrieves previous or next messages based on a specified timestamp in the channel.

    Since

    3.0.181

    Declaration

    Swift

    open func getMessagesByTimestamp(
        _ timestamp: Int64,
        params: MessageListParams,
        completionHandler: MessageListHandler?
    )

    Parameters

    timestamp

    Specifies the timestamp to be the reference point for messages to retrieve, in Unix milliseconds format. Messages sent before or after the timestamp can be retrieved.

    params

    Contains a set of parameters you can set regarding the messages in the results.

    completionHandler

    The handler block to be executed. The messages is the messages of the channel. The error indicates whether there is an error. If there is no error, the value is null.

  • Retrieves previous or next messages based on their message ID in a specific channel.

    Since

    3.0.181

    Declaration

    Swift

    open func getMessagesByMessageId(
        _ messageId: Int64,
        params: MessageListParams,
        completionHandler: MessageListHandler?
    )

    Parameters

    messageId

    Specifies the message ID to be the reference point for messages to retrieve. Messages sent before or after the message with the matching message ID can be retrieved.

    params

    Contains a set of parameters you can set regarding the messages in the results.

    completionHandler

    The handler block to be executed. The messages is the messages of the channel. The error indicates whether there is an error. If there is no error, the value is null.

  • Deletes a message. The message’s sender has to be the current user.

    Note

    When using the moderation feature in ephemeral open channel, you should use this function that uses the message object, not the function that uses the messageId.

    Declaration

    Swift

    @objc(deleteMessage:completionHandler:)
    open func deleteMessage(_ message: BaseMessage, completionHandler: SBErrorHandler?)

    Parameters

    message

    The message to be deleted.

    completionHandler

    The handler block to execute.

  • Deletes a message. The message’s sender has to be the current user.

    Note

    When using the moderation feature in ephemeral open channel, you should use the deleteMessage(:completionHandler:) function that uses the message object, not the function that uses the messageId.

    Since

    3.0.179

    Declaration

    Swift

    open func deleteMessage(messageId: Int64, completionHandler: SBErrorHandler?)

    Parameters

    messageId

    The message ID to be deleted.

    completionHandler

    The handler block to execute.

  • Creates keys of meta array for the message.

    Since

    3.0.116

    Declaration

    Swift

    @objc(createMessageMetaArrayKeysWithMessage:keys:completionHandler:)
    open func createMessageMetaArrayKeys(
        message: BaseMessage,
        keys: [String],
        completionHandler: BaseMessageHandler?
    )

    Parameters

    message

    The message object. This method creates keys in it.

    keys

    Keys of meta array.

    completionHandler

    The handler block to execute. The message is a base message object that has the keys for its meta array.

  • Deletes keys from meta array of the message.

    Since

    3.0.116

    Declaration

    Swift

    @objc(deleteMessageMetaArrayKeysWithMessage:keys:completionHandler:)
    open func deleteMessageMetaArrayKeys(
        message: BaseMessage,
        keys: [String],
        completionHandler: BaseMessageHandler?
    )

    Parameters

    message

    The message object. This method deletes keys of meta array of it.

    keys

    Keys to be deleted.

    completionHandler

    The handler block to execute.

  • Adds meta array to the message.

    Since

    3.0.116

    Declaration

    Swift

    @objc(addMessageMetaArrayValuesWithMessage:keyValues:completionHandler:)
    open func addMessageMetaArrayValues(
        message: BaseMessage,
        keyValues: [String: [String]],
        completionHandler: BaseMessageHandler?
    )

    Parameters

    message

    The message object. This method adds pairs of key and value to this message.

    keyValues

    Pairs of key-value to be added.

    completionHandler

    The handler block to execute.

  • Adds the array of meta array into the message.

    Note

    The metaArrays are upserted into the message. If a key in the metaArrays is new, the key will be inserted with the value. If a key in the metaArrays is already created, the value of the messageMetaArray will be inserted so strings in the value MUST be new one.

    Since

    3.0.148

    Declaration

    Swift

    @objc(addMessageMetaArrayValuesWithMessage:metaArrays:completionHandler:)
    open func addMessageMetaArrayValues(
        message: BaseMessage,
        metaArrays: [MessageMetaArray],
        completionHandler: BaseMessageHandler?
    )

    Parameters

    message

    The message instance. The metaArrays will added into the message.

    metaArrays

    An array of message meta array will be added into the message. the string of the value in the metaArray MUST NOT exist with same key.

    completionHandler

    The handler block to execute after adding message meta arrays. The message of the handler is updated message. If failed to add message meta arrays, the error of the handler is not nil(null).

  • Removes meta array from the message.

    Since

    3.0.116

    Declaration

    Swift

    @objc(removeMessageMetaArrayValuesWithMessage:keyValues:completionHandler:)
    open func removeMessageMetaArrayValues(
        message: BaseMessage,
        keyValues: [String: [String]],
        completionHandler: BaseMessageHandler?
    )
  • Removes the array of meta array from the message.

    Note

    The metaArrays are removed from the message. If a key in the metaArrays has an emtpy array of the value, the key will be removed. If not, the value of the messageMetaArray will be removed from the message.

    Note

    The order of the meta array is guaranteed.

    Since

    3.0.148

    Declaration

    Swift

    @objc(removeMessageMetaArrayValuesWithMessage:metaArrays:completionHandler:)
    open func removeMessageMetaArrayValues(
        message: BaseMessage,
        metaArrays: [MessageMetaArray],
        completionHandler: BaseMessageHandler?
    )

    Parameters

    message

    The message instance. The metaArrays will removed from the message.

    metaArrays

    An array of message meta array will be removed from the message. the string of the value in the metaArray MUST exist with same key.

    completionHandler

    The handler block to execute after removing message meta arrays. The message of the handler is removed message. If failed to remove message meta arrays, the error of the handler is not nil(null).

  • Creates the meta counters for the channel.

    Declaration

    Swift

    open func createMetaCounters(
        _ metaCounters: [String: Int],
        completionHandler: MetaCountersHandler?
    )

    Parameters

    metaCounters

    The meta counters to be set

    completionHandler

    The handler block to execute. metaCounters is the meta counters which are set on Sendbird server.

  • Gets the meta counters with keys for the channel.

    Declaration

    Swift

    open func getMetaCounters(
        keys: [String]?,
        completionHandler: MetaCountersHandler?
    )

    Parameters

    keys

    The keys to get meta counters.

    completionHandler

    The handler block to execute. metaCounters is the meta counters which are set on Sendbird server.

  • Gets all meta counters for the channel.

    Declaration

    Swift

    open func getAllMetaCounters(completionHandler: MetaCountersHandler?)

    Parameters

    completionHandler

    handler block to execute. metaCounters is the meta counters which are returned from Sendbird server.

  • Updates the meta counters for the channel.

    Declaration

    Swift

    open func updateMetaCounters(
        _ metaCounters: [String: Int],
        completionHandler: MetaCountersHandler?
    )

    Parameters

    metaCounters

    The meta counters to be updated.

    completionHandler

    The handler block to execute. metaCounters is the meta counters which are updated on Sendbird server.

  • Increases the meta counters for the channel.

    Declaration

    Swift

    open func increaseMetaCounters(
        _ metaCounters: [String: Int],
        completionHandler: MetaCountersHandler?
    )

    Parameters

    metaCounters

    The meta counters to be increased.

    completionHandler

    The handler block to execute. metaCounters is the meta counters which are increased on Sendbird server.

  • Decreases the meta counters for the channel.

    Declaration

    Swift

    open func decreaseMetaCounters(
        _ metaCounters: [String: Int],
        completionHandler: MetaCountersHandler?
    )

    Parameters

    metaCounters

    The meta counters to be decreased.

    completionHandler

    The handler block to execute. metaCounters is the meta counters which are decreased on Sendbird server.

  • Deletes the meta counters with key for the channel.

    Declaration

    Swift

    open func deleteMetaCounters(
        key: String,
        completionHandler: SBErrorHandler?
    )

    Parameters

    key

    The key to be deleted.

    completionHandler

    The handler block to execute.

  • Deletes all meta counters for the channel.

    Declaration

    Swift

    open func deleteAllMetaCounters(completionHandler: SBErrorHandler?)

    Parameters

    completionHandler

    The handler block to execute.

  • Creates the meta data for the channel.

    Declaration

    Swift

    open func createMetaData(
        _ metaData: [String: String],
        completionHandler: MetaDataHandler?
    )

    Parameters

    metaData

    The meta data to be set.

    completionHandler

    The handler block to execute. metaData is the meta data which are set on Sendbird server.

  • Gets the meta data for the channel.

    Declaration

    Swift

    open func getMetaData(
        keys: [String],
        completionHandler: MetaDataHandler?
    )

    Parameters

    keys

    The keys to get meta data.

    completionHandler

    The handler block to execute. metaData is the meta data which are set on Sendbird server.

  • Gets all meta data for the channel.

    Declaration

    Swift

    open func getAllMetaData(completionHandler: MetaDataHandler?)

    Parameters

    completionHandler

    The handler block to execute. metaData is the meta data which are set on Sendbird server.

  • Updates the meta data for the channel.

    Declaration

    Swift

    open func updateMetaData(
        _ metaData: [String: String],
        completionHandler: MetaDataHandler?
    )

    Parameters

    metaData

    The meta data to be updated.

    completionHandler

    The handler block to execute. metaData is the meta counters which are updated on Sendbird server.

  • Deletes meta data with key for the channel.

    Declaration

    Swift

    open func deleteMetaData(key: String, completionHandler: SBErrorHandler?)

    Parameters

    key

    The key to be deleted.

    completionHandler

    The handler block to execute.

  • Deletes all meta data for the channel.

    Declaration

    Swift

    open func deleteAllMetaData(completionHandler: SBErrorHandler?)

    Parameters

    completionHandler

    The handler block to execute.

  • Return cached channel meta data.

    Since

    3.0.216

    Declaration

    Swift

    open func getCachedMetaData() -> [String : String]

    Return Value

    Dictionary meta data.

Ban & Unban User

  • Bans a user for seconds. Let a user out and prevent to join again.

    If the user is already banned, duration will be updated from the time that was initialized.

    Since

    3.0.89

    Declaration

    Swift

    open func banUser(
        _ user: User,
        seconds: Int,
        description: String?,
        completionHandler: SBErrorHandler?
    )

    Parameters

    user

    The user to be banned.

    seconds

    Seconds of ducation to be banned. Seconds should be larger than -1. If it is -1, user is banned forever. If it is 0, duration is set 10 years by default.

    description

    The reason why the user was banned.

    completionHandler

    The handler block to be executed after the user is banned. This block has no return value and takes an argument that is an error madewhen there is something wrong to ban.

  • Bans a user for seconds. Let a user out and prevent to join again. If the user is already banned, duration will be updated from the time that was initialized.

    Since

    3.0.89

    Declaration

    Swift

    open func banUser(
        userId: String,
        seconds: Int,
        description: String?,
        completionHandler: SBErrorHandler?
    )

    Parameters

    userId

    The user ID to be banned.

    seconds

    Seconds of ducation to be banned. Seconds should be larger than -1. If it is -1, user is banned forever. If it is 0, duration is set 10 years by default.

    description

    The reason why the user was banned.

    completionHandler

    The handler block to be executed after the user is banned. This block has no return value and takes an argument that is an error made when there is something wrong to ban.

  • Removes ban for a user.

    Since

    3.0.89

    Declaration

    Swift

    open func unbanUser(_ user: User, completionHandler: SBErrorHandler?)

    Parameters

    user

    The user to be removed ban.

    completionHandler

    The handler block to be executed after remove ban. This block has no return value and takes an argument that is an error made when there is something wrong to remove ban.

  • Removes ban for a user.

    Since

    3.0.89

    Declaration

    Swift

    open func unbanUser(userId: String, completionHandler: SBErrorHandler?)

    Parameters

    userId

    The user ID to be removed ban.

    completionHandler

    The handler block to be executed after remove ban. This block has no return value and takes an argument that is an error made when there is something wrong to remove ban.

Mute & Unmute User

  • Mutes a user with additional options. Muted user cannot send any messages to the group channel.

    Since

    3.0.118

    Declaration

    Swift

    open func muteUser(
        _ user: User,
        seconds: Int,
        description: String?,
        completionHandler: SBErrorHandler?
    )

    Parameters

    user

    The user to be muted.

    seconds

    The user cannot send any messages for this time.

    description

    The description that explains the reason why the user is muted.

    completionHandler

    The handler block to be executed after mute. This block has no return value and takes an argument that is an error made when there is something wrong to mute the user.

  • Mutes a user with additional options. Muted user cannot send any messages to the group channel.

    Since

    3.0.118

    Declaration

    Swift

    open func muteUser(
        userId: String,
        seconds: Int,
        description: String?,
        completionHandler: SBErrorHandler?
    )

    Parameters

    userId

    The user ID to be muted.

    seconds

    The user cannot send any messages for this time.

    description

    The description that explains the reason why the user is muted.

    completionHandler

    The handler block to be executed after mute. This block has no return value and takes an argument that is an error made when there is something wrong to mute the user.

  • Unmutes a user.

    Since

    3.0.89

    Declaration

    Swift

    open func unmuteUser(userId: String, completionHandler: SBErrorHandler?)

    Parameters

    userId

    The user ID to be turned off mute.

    completionHandler

    The handler block to be executed after turn off mute. This block has no return value and takes an argument that is an error made when there is something wrong to turn off mute.

  • Unmutes a user.

    Since

    3.0.89

    Declaration

    Swift

    open func unmuteUser(_ user: User, completionHandler: SBErrorHandler?)

    Parameters

    user

    The user to be turned off mute.

    completionHandler

    The handler block to be executed after turn off mute. This block has no return value and takes an argument that is an error made when there is something wrong to turn off mute.

  • Adds operators to the channel.

    Since

    3.0.189

    Declaration

    Swift

    open func addOperators(userIds: [String], completionHandler: SBErrorHandler?)

    Parameters

    userIds

    The user IDs to be operators.

    completionHandler

    The handler block to be executed.

  • Removes operators from the channel.

    Since

    3.0.189

    Declaration

    Swift

    open func removeOperators(userIds: [String], completionHandler: SBErrorHandler?)

    Parameters

    userIds

    The user IDs to be removed from the operators.

    completionHandler

    The handler block to be executed.

  • Removes all operators from the channel.

    Since

    3.0.189

    Declaration

    Swift

    open func removeAllOperators(completionHandler: SBErrorHandler?)

    Parameters

    completionHandler

    The handler block to be executed.

  • Pins the message to the channel.

    Note

    Pin functionality in OpenChannel will be supported starting from 4.20.0.

    Since

    4.2.0

    Declaration

    Swift

    open func pinMessage(messageId: Int64, completionHandler: SBErrorHandler?)

    Parameters

    messageId

    The message ID of the message to be pinned.

    completionHandler

    The handler block to be executed after pinning the message.

  • Unpins the message from the channel.

    Note

    Pin functionality in OpenChannel will be supported starting from 4.20.0.

    Since

    4.2.0

    Declaration

    Swift

    open func unpinMessage(messageId: Int64, completionHandler: SBErrorHandler?)

    Parameters

    messageId

    The message ID of the message to be unpinned.

    completionHandler

    The handler block to be executed after unpinning the message.

  • Updates a poll with params.

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func updatePoll(
        pollId: Int64,
        params: PollUpdateParams,
        completionHandler: PollHandler?
    )

    Parameters

    pollId

    ID of Poll to update

    params

    PollUpdateParams instance.

    completionHandler

    Completion block.

  • Deletes a poll.

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func deletePoll(
        pollId: Int64,
        completionHandler: SBErrorHandler?
    )

    Parameters

    pollId

    ID of Poll to remove

    completionHandler

    Completion block.

  • Closes a poll.

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func closePoll(
        pollId: Int64,
        completionHandler: PollHandler?
    )

    Parameters

    pollId

    ID of Poll to close

    completionHandler

    Completion block

  • Adds an option to a poll.

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func addPollOption(
        pollId: Int64,
        optionText: String,
        completionHandler: PollHandler?
    )

    Parameters

    pollId

    ID of Poll to add the poll option

    optionText

    Option text of the poll option

    completionHandler

    Completion block

  • Updates an option to a poll.

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func updatePollOption(
        pollId: Int64,
        pollOptionId: Int64,
        optionText: String,
        completionHandler: PollHandler?
    )

    Parameters

    pollId

    ID of poll to update the poll option

    pollOptionId

    ID of the poll option

    optionText

    Option text of the poll option

    completionHandler

    Completion block

  • Removes Poll option

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func deletePollOption(
        pollId: Int64,
        pollOptionId: Int64,
        completionHandler: SBErrorHandler?
    )

    Parameters

    pollId

    ID of the poll to delete poll option of

    pollOptionId

    poll option id to delete

    completionHandler

    Completion block

  • Votes poll

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func votePoll(
        pollId: Int64,
        pollOptionIds: [Int64],
        completionHandler: PollVoteEventHandler
    )

    Parameters

    pollId

    Poll ID to vote

    pollOptionIds

    List of poll option IDs to vote

    completionHandler

    Completion block

  • Creates a query instance for banned user list of the channel.

    Since

    3.0.89

    Declaration

    Swift

    @objc
    open func createBannedUserListQuery() -> BannedUserListQuery?

    Return Value

    The instance for the banned user list. Query only banned user list.

  • Creates a query instance for banned user list of the channel.

    Since

    4.0.1

    Declaration

    Swift

    @objc
    open func createBannedUserListQuery(
        paramsBuilder: (BannedUserListQueryParams) -> Void
    ) -> BannedUserListQuery?

    Parameters

    paramsBuilder

    The builder closure for setting BannedUserListQueryParams.

    Return Value

    The instance for the banned user list. Query only banned user list.

  • Creates a query instance for banned user list of the channel.

    Since

    3.0.89

    Declaration

    Swift

    @objc
    open func createBannedUserListQuery(
        params: BannedUserListQueryParams
    ) -> BannedUserListQuery?

    Parameters

    params

    Return Value

    The instance for the banned user list. Query only banned user list.

  • Creates a query instance for banned user list of the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createBannedUserListQuery(
        channelType: ChannelType,
        channelURL: String
    ) -> BannedUserListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    Return Value

    The instance for the banned user list. Query only banned user list.

  • Creates a query instance for banned user list of the channel.

    Since

    4.0.1

    Declaration

    Swift

    @objc
    open class func createBannedUserListQuery(
        channelType: ChannelType,
        channelURL: String,
        paramsBuilder: (BannedUserListQueryParams) -> Void
    ) -> BannedUserListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    paramsBuilder

    The builder closure for setting BannedUserListQueryParams.

    Return Value

    The instance for the banned user list. Query only banned user list.

  • Creates a query instance for banned user list of the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createBannedUserListQuery(
        channelType: ChannelType,
        channelURL: String,
        params: BannedUserListQueryParams
    ) -> BannedUserListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    params

    Return Value

    The instance for the banned user list. Query only banned user list.

  • Creates a query instance for getting muted user list of the channel instance.

    Declaration

    Swift

    @objc
    open func createMutedUserListQuery() -> MutedUserListQuery?

    Return Value

    UserListQuery instance for the muted user list.

  • Creates a query instance for getting muted user list of the channel instance.

    Declaration

    Swift

    @objc
    open func createMutedUserListQuery(paramsBuilder: (MutedUserListQueryParams) -> Void) -> MutedUserListQuery?

    Parameters

    paramsBuilder

    The builder closure for setting MutedUserListQueryParams.

    Return Value

    UserListQuery instance for the muted user list.

  • Creates a query instance for getting muted user list of the channel instance.

    Declaration

    Swift

    @objc
    open func createMutedUserListQuery(params: MutedUserListQueryParams) -> MutedUserListQuery?

    Parameters

    params

    The params object to change query condition.

    Return Value

    UserListQuery instance for the muted user list.

  • Creates a query instance for getting muted user list of the channel instance.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createMutedUserListQuery(channelType: ChannelType, channelURL: String) -> MutedUserListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    Return Value

    UserListQuery instance for the muted user list.

  • Creates a query instance for getting muted user list of the channel instance.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createMutedUserListQuery(
           channelType: ChannelType,
           channelURL: String,
           paramsBuilder: (MutedUserListQueryParams) -> Void
       ) -> MutedUserListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    paramsBuilder

    The builder closure for setting MutedUserListQueryParams.

    Return Value

    UserListQuery instance for the muted user list.

  • Creates a query instance for getting muted user list of the channel instance.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createMutedUserListQuery(channelType: ChannelType, channelURL: String, params: MutedUserListQueryParams) -> MutedUserListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    params

    The params object to change query condition.

    Return Value

    UserListQuery instance for the muted user list.

  • Creates PreviousMessageListQuery instance for getting the previous messages list of the channel.

    Declaration

    Swift

    @objc
    open func createPreviousMessageListQuery() -> PreviousMessageListQuery?

    Return Value

    Returns the message list of the channel.

  • Creates PreviousMessageListQuery instance for getting the previous messages list of the channel.

    Declaration

    Swift

    @objc
    open func createPreviousMessageListQuery(paramsBuilder: (PreviousMessageListQueryParams) -> Void) -> PreviousMessageListQuery?

    Parameters

    paramsBuilder

    The builder closure for setting PreviousMessageListQueryParams.

    Return Value

    Returns the message list of the channel.

  • Creates PreviousMessageListQuery instance for getting the previous messages list of the channel.

    Declaration

    Swift

    @objc
    open func createPreviousMessageListQuery(params: PreviousMessageListQueryParams) -> PreviousMessageListQuery?

    Parameters

    params

    The params object to change query condition.

    Return Value

    Returns the message list of the channel.

  • Creates PreviousMessageListQuery instance for getting the previous messages list of the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createPreviousMessageListQuery(
        channelType: ChannelType,
        channelURL: String
    ) -> PreviousMessageListQuery

    Parameters

    channelType

    channel type

    channelURL

    channel url

    Return Value

    Returns the message list of the channel.

  • Creates PreviousMessageListQuery instance for getting the previous messages list of the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createPreviousMessageListQuery(
        channelType: ChannelType,
        channelURL: String,
        paramsBuilder: (PreviousMessageListQueryParams) -> Void
    ) -> PreviousMessageListQuery

    Parameters

    channelType

    channel type

    channelURL

    channel url

    paramsBuilder

    The builder closure for setting ParticipantListQueryParams.

    Return Value

    Returns the message list of the channel.

  • Creates PreviousMessageListQuery instance for getting the previous messages list of the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createPreviousMessageListQuery(
        channelType: ChannelType,
        channelURL: String,
        params: PreviousMessageListQueryParams
    ) -> PreviousMessageListQuery

    Parameters

    channelType

    channel type

    channelURL

    channel url

    params

    The params object to change query condition.

    Return Value

    Returns the message list of the channel.

  • Creates OperatorListQuery instance for getting operators in the channel.

    Since

    3.0.94

    Declaration

    Swift

    @objc
    open func createOperatorListQuery() -> OperatorListQuery?

    Return Value

    The operator list in the channel.

  • Creates OperatorListQuery instance for getting operators in the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open func createOperatorListQuery(paramsBuilder: (OperatorListQueryParams) -> Void) -> OperatorListQuery?

    Return Value

    The operator list in the channel.

  • Creates OperatorListQuery instance for getting operators in the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open func createOperatorListQuery(params: OperatorListQueryParams) -> OperatorListQuery?

    Parameters

    params

    The params object to change query condition.

    Return Value

    The operator list in the channel.

  • Creates OperatorListQuery instance for getting operators in the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createOperatorListQuery(
           channelType: ChannelType,
           channelURL: String
       ) -> OperatorListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    Return Value

    The operator list in the channel.

  • Creates OperatorListQuery instance for getting operators in the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createOperatorListQuery(
           channelType: ChannelType,
           channelURL: String,
           paramsBuilder: (OperatorListQueryParams) -> Void
       ) -> OperatorListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    paramsBuilder

    The builder closure for setting OperatorListQueryParams.

    Return Value

    The operator list in the channel.

  • Creates OperatorListQuery instance for getting operators in the channel.

    Since

    4.0.0

    Declaration

    Swift

    @objc
    open class func createOperatorListQuery(
           channelType: ChannelType,
           channelURL: String,
           params: OperatorListQueryParams
       ) -> OperatorListQuery

    Parameters

    channelType

    The Type of channel, types of open channel or group channel.

    channelURL

    The channel URL.

    params

    The params object to change query condition.

    Return Value

    The operator list in the channel.

  • Creates PollListQuery instance for getting poll list in this channel.

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func createPollListQuery(limit: UInt = 20) -> PollListQuery?

    Return Value

    poll list query object.

  • Creates PollVoterListQuery instance for getting user list on given poll option

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func createPollVoterListQuery(
        pollId: Int64,
        pollOptionId: Int64,
        limit: UInt = 20
    ) -> PollVoterListQuery

    Parameters

    pollId

    poll ID.

    pollOptionId

    poll option ID.

    limit

    voter list length

    Return Value

    poll voter list query object.

  • Creates PollVoterListQuery instance for getting user list on given poll option

    Since

    4.5.0

    Declaration

    Swift

    @objc
    open func createPollVoterListQuery(
        pollId: Int64,
        pollOptionId: Int64
    ) -> PollVoterListQuery

    Parameters

    pollId

    poll ID.

    pollOptionId

    poll option ID.

    Return Value

    poll voter list query object.

  • Creates a PinnedMessageListQuery object that can be used to retrieve a list of pinned messages in the group channel.

    Note

    Pin functionality in OpenChannel will be supported starting from 4.20.0.

    Since

    4.8.0

    Declaration

    Swift

    @objc
    open func createPinnedMessageListQuery() -> PinnedMessageListQuery?

    Return Value

    A PinnedMessageListQuery object that can be used to retrieve a list of pinned messages.

  • Creates a PinnedMessageListQuery object that can be used to retrieve a list of pinned messages in the group channel.

    Note

    Pin functionality in OpenChannel will be supported starting from 4.20.0.

    Since

    4.8.0

    Declaration

    Swift

    @objc
    open func createPinnedMessageListQuery(paramsBuilder: (PinnedMessageListQueryParams) -> Void) -> PinnedMessageListQuery?

    Parameters

    paramsBuilder

    The builder closure for setting PinnedMessageListQueryParams.

    Return Value

    A PinnedMessageListQuery object that can be used to retrieve a list of pinned messages.

  • Creates a PinnedMessageListQuery object that can be used to retrieve a list of pinned messages in the group channel.

    Note

    Pin functionality in OpenChannel will be supported starting from 4.20.0.

    Since

    4.8.0

    Declaration

    Swift

    @objc
    open func createPinnedMessageListQuery(
        params: PinnedMessageListQueryParams
    ) -> PinnedMessageListQuery?

    Parameters

    params

    A PinnedMessageListQueryParams object containing the parameters for the query.

    Return Value

    A PinnedMessageListQuery object that can be used to retrieve a list of pinned messages.

  • Adds a reaction to a message.

    Messages with sendingStatus is not .success will handler to return error.

    Note

    This is idempotent.

    Note

    This feature is only available in group channels.

    Since

    3.0.169

    Declaration

    Swift

    @objc(addReactionWithMessage:key:completionHandler:)
    open func addReaction(
        with message: BaseMessage,
        key: String,
        completionHandler: ReactionEventHandler?
    )

    Parameters

    message

    The message object that the reaction will be added.

    key

    The reaction key to be added.

    completionHandler

    The handler block to be executed. If succeeded, the reactionEvent will have the information of the reaction.

  • Deletes a reaction from a message.

    Note

    This is idempotent.

    Note

    This feature is only available in group channels.

    Since

    3.0.169

    Declaration

    Swift

    @objc(deleteReactionWithMessage:key:completionHandler:)
    open func deleteReaction(
        with message: BaseMessage,
        key: String,
        completionHandler: ReactionEventHandler?
    )

    Parameters

    message

    The message object that has the reaction key.

    key

    The reaction key to be deleted.

    completionHandler

    The handler block to be executed. If succeeded, the reactionEvent will have the information of the reaction.

  • Reports a user in a channel of inappropriate activities.

    Since

    3.0.154

    Declaration

    Swift

    @objc(reportUser:reportCategory:reportDescription:completionHandler:)
    open func report(
        offendingUser: User,
        reportCategory: ReportCategory,
        reportDescription: String?,
        completionHandler: SBErrorHandler?
    )

    Parameters

    offendingUser

    The user who is being reported.

    reportCategory

    The category in which the report is being submitted. Valid choices are suspicious, harassing, spam, and inappropriate.

    reportDescription

    An open ended description for why the report is being submitted.

    completionHandler

    The handler block to execute.

  • Reports current channel instance of inappropriate activities.

    Since

    3.0.154

    Declaration

    Swift

    @objc(reportChannelWithCategory:reportDescription:completionHandler:)
    open func report(
        category: ReportCategory,
        reportDescription: String?,
        completionHandler: SBErrorHandler?
    )

    Parameters

    category

    The category in which the report is being submitted. Valid choices are suspicious, harassing, spam and inappropriate.

    reportDescription

    An open ended description for why the report is being submitted.

    completionHandler

    The handler block to execute.

  • Reports a malicious message in the channel

    Since

    3.0.154

    Declaration

    Swift

    @objc(reportMessage:reportCategory:reportDescription:completionHandler:)
    open func report(
        message: BaseMessage,
        reportCategory: ReportCategory,
        reportDescription: String?,
        completionHandler: SBErrorHandler?
    )

    Parameters

    message

    The message object which is being reported.

    reportCategory

    The category in which the report is being submitted. Valid choices are suspicious, harassing, spam and inappropriate.

    reportDescription

    An open ended description for why the report is being submitted.

    completionHandler

    The handler block to execute.

  • Sends a user message.

    Declaration

    Swift

    @discardableResult
    open func sendUserMessage(
        _ message: String,
        completionHandler: UserMessageHandler?
    ) -> UserMessage

    Parameters

    message

    The message text.

    completionHandler

    The handler block to execute. userMessage is a user message which is returned from the Sendbird server. The message has a message ID.

    Return Value

    Returns a temporary user message being sent to the Sendbird server. The message has a request ID instead of a message ID. The request status of the message is pending. If you try to send a message with an invalid parameter, the returned message is a user message with no properties. You can perform a validation of pending message by checking for the existence of the request ID.

  • Sends a string message of params.

    Declaration

    Swift

    @discardableResult
    @objc(sendUserMessageWithParams:completionHandler:)
    open func sendUserMessage(
        params: UserMessageCreateParams,
        completionHandler: UserMessageHandler?
    ) -> UserMessage

    Parameters

    params

    The instance of UserMessageCreateParams that can has parameters related with string message.

    completionHandler

    The handler block to be executed after the message was sent. This block has no return value and takes two argument, one is a file message was sent and other is an error made when there is something wrong to message.

    Return Value

    Returns a temporary user message being sent to the Sendbird server. The message has a request ID instead of a message ID. The request status of the message is pending. If you try to send a message with an invalid parameter, the returned message is a user message with no properties. You can perform a validation of pending message by checking for the existence of the request ID..

  • Attempts to resend a failed user message received by the failure callback.

    Only failed message MUST be passed, not a succeeded message or a pending message.

    Since

    3.0.141

    Declaration

    Swift

    @discardableResult
    @objc(resendUserMessageWithMessage:completionHandler:)
    open func resendUserMessage(
        _ message: UserMessage,
        completionHandler: UserMessageHandler?
    ) -> UserMessage

    Parameters

    message

    A message to send. A failed message is passed to the callback when fails to send a message

    completionHandler

    The handler block to be executed after the message is sent. This block has no return value and takes two arguments. One is a user message. If the message is successfully sent, the complete message instance is delivered. If the message fails to be sent, a failed message based on the pending message is delivered. Another factor is errors. If the message fails to be sent, a message error is dispatched.

    Return Value

    Returns a temporary user message being sent to the Sendbird server.

  • Copies a user message to the target channel.

    Note

    Only accpets messages whose sendingStatus is .succeeded.

    Declaration

    Swift

    @discardableResult
    @objc(copyUserMessage:toTargetChannel:completionHandler:)
    open func copyUserMessage(
        _ message: UserMessage,
        toTargetChannel targetChannel: BaseChannel,
        completionHandler: UserMessageHandler?
    ) -> UserMessage?

    Parameters

    message

    User message object.

    targetChannel

    Target channel object.

    completionHandler

    The handler block to execute. The userMessage is a user message which is returned from the Sendbird server. The message has a message ID.

    Return Value

    Returns the temporary user message with a request ID. It doesn’t have a message ID. If there is any error, nil could be returned.

  • Updates a user message. The text message, data, custom type from user message params can be updated.

    Since

    3.0.110

    Declaration

    Swift

    open func updateUserMessage(
        messageId: Int64,
        params: UserMessageUpdateParams,
        completionHandler: UserMessageHandler?
    )

    Parameters

    messageId

    The message ID of the message to be updated.

    params

    UserMessageUpdateParams with updating fields.

    completionHandler

    The handler block to be executed after update. This block has no return value and takes two argument. the one is updated message type of UserMessage. the other is an error made when there is something wrong to process.

  • Requests to translate the text message into the target languages.

    You can get a user message with the translations property after the request, but the request does not trigger an update event on the message and does not get the message by getMessageChangeLogs(token:params:completionHandler:).

    A translation request can affect not only your message, but also other people’s messages.

    Since

    3.0.148

    Declaration

    Swift

    open func translateUserMessage(
        _ message: UserMessage,
        targetLanguages: [String],
        completionHandler: UserMessageHandler?
    )

    Parameters

    message

    The string type of the message of the user message instance will be translated.

    targetLanguages

    The target languages that the message will be translated into. e.g. “en”, “es”, “ch”

    completionHandler

    The handler block to be executed after translation. This block has no return value and takes two arguments. One is a user message. If succeeded to translate text of the message, the message instance with translations is delivered. If failed to translate, nil is delivered. Another factor is an error. If failed to request, an error is dispatched.

  • Serializes this object into data

    Declaration

    Swift

    open func serialize() -> Data?

    Return Value

    optional Data instance

  • Deserializes and reconstructs the object

    Declaration

    Swift

    open class func build(fromSerializedData data: Data?) -> `Self`?

    Parameters

    data

    Data instance

    Return Value

    BaseChannel if parameter is valid, otherwise nil

  • Initialize with json dictionary

    Declaration

    Swift

    public func initWithDictionary(_ json: [String : Any]) -> `Self`?
  • Converts the object into dictionary

    Declaration

    Swift

    public func _toDictionary() -> [String : Any]