BaseChannel

@objc(SBDBaseChannel)
public 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
    public var id: String { get }
  • The channel URL.

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Since

    3.0.199

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

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

    Since

    3.0.89

    Declaration

    Swift

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

    Since

    3.0.90

    Declaration

    Swift

    @objc
    public internal(set) var isEphemeral: Bool { get }
  • Gets the current user’s muted information in this channel.

    Since

    3.0.118

    Declaration

    Swift

    @objc
    public func getMyMutedInfo(completionHandler: MuteInfoHandler?)

    Parameters

    completionHandler

    The handler block to be executed.

  • Channel type

    Declaration

    Swift

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

    Declaration

    Swift

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

    Declaration

    Swift

    @objc
    public func isOpenChannel() -> Bool

    Return Value

    Returns true when this is open channel.

  • Checks the channel type is group channel or not.

    Declaration

    Swift

    @objc
    public func isGroupChannel() -> Bool

    Return Value

    true if when this is a group channel.

  • Encodes this object.

    Declaration

    Swift

    public 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

    public 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:)
    func getMessageChangeLogs(
        token: String?,
        params: 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:)
    func getMessageChangeLogs(
        timestamp: Int64,
        params: 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.

  • 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
    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 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 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
    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
    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

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

    Parameters

    messageId

    The message ID of the message to be updated.

    FileMessageCreateParams

    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:)
    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:)
    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.

    Declaration

    Swift

    @discardableResult
    @objc(copyFileMessage:toTargetChannel:completionHandler:)
    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.

  • Cancels the file message uploading.

    Declaration

    Swift

    @objc(cancelUploadingFileMessageWithRequestId:completionHandler:)
    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

    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

    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.

    Declaration

    Swift

    @objc(deleteMessage:completionHandler:)
    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.

    Since

    3.0.179

    Declaration

    Swift

    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.

    Declaration

    Swift

    @objc(createMessageMetaArrayKeysWithMessage:keys:completionHandler:)
    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:)
    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:)
    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:)
    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:)
    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:)
    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

    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

    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

    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

    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

    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

    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

    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

    func deleteAllMetaCounters(completionHandler: SBErrorHandler?)

    Parameters

    completionHandler

    The handler block to execute.

  • Creates the meta data for the channel.

    Declaration

    Swift

    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

    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

    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

    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

    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

    func deleteAllMetaData(completionHandler: SBErrorHandler?)

    Parameters

    completionHandler

    The handler block to execute.

  • Return cached channel meta data.

    Since

    3.0.216

    Declaration

    Swift

    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

    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

    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

    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

    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

    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

    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

    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

    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

    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

    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

    func removeAllOperators(completionHandler: SBErrorHandler?)

    Parameters

    completionHandler

    The handler block to be executed.

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

    Since

    3.0.89

    Declaration

    Swift

    @objc
    public 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

    3.0.89

    Declaration

    Swift

    @objc
    public 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
    public 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.

    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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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
    public 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

    3.0.232

    Declaration

    Swift

    @objc
    public func createPollListQuery() -> PollListQuery?

    Parameters

    channelType

    channel type.

    channelURL

    channel url.

    Return Value

    poll list query object.

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

    Since

    4.0.0

    Declaration

    Swift

    @objc
    public class func createPollListQuery(channelType: ChannelType, channelURL: String) -> PollListQuery

    Parameters

    channelType

    Channel type of the channel URL.

    channelURL

    Channel URL that you want to query poll list.

    Return Value

    poll list query object.

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

    Since

    3.0.232

    Declaration

    Swift

    @objc
    public func createPollVoterListQuery(pollId: Int64, optionId: Int64) -> PollVoterListQuery?

    Parameters

    pollId

    poll ID.

    optionId

    option ID.

    Return Value

    poll voter list query object.

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

    Since

    4.0.0

    Declaration

    Swift

    @objc
    public class func createPollVoterListQuery(pollId: Int64, optionId: Int64, channelType: ChannelType, channelURL: String) -> PollVoterListQuery

    Parameters

    pollId

    poll ID.

    optionId

    option ID.

    channelType

    Channel type of the channel URL.

    channelURL

    Channel URL.

    Return Value

    poll voter list query object.

  • 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:)
    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.

    Declaration

    Swift

    @objc(deleteReactionWithMessage:key:completionHandler:)
    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:)
    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:)
    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:)
    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
    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:)
    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:)
    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.

    Declaration

    Swift

    @discardableResult
    @objc(copyUserMessage:toTargetChannel:completionHandler:)
    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.

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

    Since

    3.0.110

    Declaration

    Swift

    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

    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

    public func serialize() -> Data?

    Return Value

    optioanal Data instance

  • Deserializes and reconstructs the object

    Declaration

    Swift

    public 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]