BaseChannel
open class BaseChannel: NSObject, Codable, Identifiable, Cacheable, Injectable
extension BaseChannel: Serializable
extension BaseChannel: Mappable
An object represents base class for channel
-
Identifier for the channel conforming to
IdentifiableDeclaration
Swift
open var id: String -
The channel URL.
Declaration
Swift
open internal(set) var channelURL: String = "" -
The name of channel.
Declaration
Swift
open internal(set) var name: String = "" -
The channel cover image URL.
Declaration
Swift
open internal(set) var coverURL: String? -
User who creates the channel
Since
3.0.199Declaration
Swift
open internal(set) var creator: User? -
The timestamp when the channel is created in seconds.
Declaration
Swift
open internal(set) var createdAt: Int64 = 0 -
The custom data of the channel.
Declaration
Swift
open internal(set) var data: String? -
The custom type of the channel.
Declaration
Swift
open internal(set) var customType: String? -
The flag for a frozen channel.
Since
3.0.89Declaration
Swift
open internal(set) var isFrozen: Bool = false -
Represents the channel is ephemeral or not.
Since
3.0.90Declaration
Swift
open internal(set) var isEphemeral: Bool = false -
A list of messageIds of pinned messages.
Note
Pin functionality inOpenChannelwill be supported starting from 4.20.0.Since
4.2.0Declaration
Swift
open internal(set) var pinnedMessageIds: [Int64]? -
The message that was pinned the last.
Note
Pin functionality inOpenChannelwill be supported starting from 4.20.0.Since
4.2.0Declaration
Swift
open internal(set) var lastPinnedMessage: BaseMessage? -
Gets the current user’s muted information in this channel.
Since
3.0.118Declaration
Swift
open func getMyMutedInfo(completionHandler: MuteInfoHandler?)Parameters
completionHandlerThe handler block to be executed.
-
Channel type
Declaration
Swift
open var channelType: ChannelType -
Indicates possibility of outdated information
Declaration
Swift
open var isDirty: Bool = false -
Checks the channel type is open channel or not.
Declaration
Swift
open func isOpenChannel() -> BoolReturn Value
Returns true when this is open channel.
-
Checks the channel type is group channel or not.
Declaration
Swift
open func isGroupChannel() -> BoolReturn Value
trueif when this is a group channel. -
Checks the channel type is feed channel or not.
Since
4.6.0Declaration
Swift
open func isFeedChannel() -> BoolReturn Value
trueif when this is a group channel. -
Timestamp of when the
MessageCollectionfor this channel has been created.Since
4.6.0Declaration
Swift
public internal(set) var messageCollectionLastAccessedAt: Int64 = 0 -
Encodes this object.
Declaration
Swift
open func encode(to encoder: Encoder) throwsParameters
encoderEncoderinstance -
Default constructor.
Declaration
Swift
public required init(from decoder: Decoder) throwsParameters
decoderDecoderinstance -
Description
Declaration
Swift
open override var description: String -
Compares this object with given other object.
Declaration
Swift
public override func isEqual(_ object: Any?) -> BoolParameters
objectAnyinstanceReturn Value
trueif same otherwisefalse
-
Retrieves previous or next messages based on a specified timestamp in the channel.
Since
3.0.181Declaration
Swift
open func getMessagesByTimestamp( _ timestamp: Int64, params: MessageListParams, completionHandler: MessageListHandler? )Parameters
timestampSpecifies 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.
paramsContains a set of parameters you can set regarding the messages in the results.
completionHandlerThe handler block to be executed. The
messagesis the messages of the channel. Theerrorindicates 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.181Declaration
Swift
open func getMessagesByMessageId( _ messageId: Int64, params: MessageListParams, completionHandler: MessageListHandler? )Parameters
messageIdSpecifies 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.
paramsContains a set of parameters you can set regarding the messages in the results.
completionHandlerThe handler block to be executed. The
messagesis the messages of the channel. Theerrorindicates whether there is an error. If there is no error, the value is null.
-
Sends a user message.
Declaration
Swift
open func sendUserMessage( _ message: String, completionHandler: UserMessageHandler? ) -> UserMessageParameters
messageThe message text.
completionHandlerThe handler block to execute.
userMessageis 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
open func sendUserMessage( params: UserMessageCreateParams, completionHandler: UserMessageHandler? ) -> UserMessageParameters
paramsThe instance of
UserMessageCreateParamsthat can has parameters related with string message.completionHandlerThe 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.141Declaration
Swift
open func resendUserMessage( _ message: UserMessage, completionHandler: UserMessageHandler? ) -> UserMessageParameters
messageA message to send. A failed message is passed to the callback when fails to send a message
completionHandlerThe 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 whosesendingStatusis.succeeded.Declaration
Swift
open func copyUserMessage( _ message: UserMessage, toTargetChannel targetChannel: BaseChannel, completionHandler: UserMessageHandler? ) -> UserMessage?Parameters
messageUser message object.
targetChannelTarget channel object.
completionHandlerThe handler block to execute. The
userMessageis 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.110Declaration
Swift
open func updateUserMessage( messageId: Int64, params: UserMessageUpdateParams, completionHandler: UserMessageHandler? )Parameters
messageIdThe message ID of the message to be updated.
paramsUserMessageUpdateParamswith updating fields.completionHandlerThe 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
translationsproperty after the request, but the request does not trigger an update event on the message and does not get the message bygetMessageChangeLogs(token:params:completionHandler:).A translation request can affect not only your message, but also other people’s messages.
Since
3.0.148Declaration
Swift
open func translateUserMessage( _ message: UserMessage, targetLanguages: [String], completionHandler: UserMessageHandler? )Parameters
messageThe string type of the message of the user message instance will be translated.
targetLanguagesThe target languages that the message will be translated into. e.g. “en”, “es”, “ch”
completionHandlerThe 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.
-
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
open func sendFileMessage( params: FileMessageCreateParams, completionHandler: FileMessageHandler? ) -> FileMessage?Parameters
paramsInstance of
FileMessageCreateParamsthat can has parameters related with file.completionHandlerhandler 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
open func sendFileMessage( params: FileMessageCreateParams, progressHandler: MultiProgressHandler?, completionHandler: FileMessageHandler? ) -> FileMessage?Parameters
paramsInstance of
FileMessageCreateParamsthat can has parameters related with file.progressHandlerprogress handler
completionHandlerhandler 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
open func sendFileMessages( params: [FileMessageCreateParams], progressHandler: MultiProgressHandler?, sentMessageHandler: FileMessageHandler?, completionHandler: SBErrorHandler? ) -> [FileMessage]Parameters
paramsThe instance of
FileMessageCreateParamsthat can has parameters related with file.progressHandlerThe handler block to be used to monitor progression.
requestIdis a unique identifier for the message send request.bytesSentis the number of bytes sent since this method was called.totalBytesSentis the total number of bytes sent so far.totalBytesExpectedToSendis the expected length of the body data. These parameters are the same to the declaration ofurlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:).sentMessageHandlerThe 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.
completionHandlerThe 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.110Declaration
Swift
open func updateFileMessage( messageId: Int64, params: FileMessageUpdateParams, completionHandler: FileMessageHandler? )Parameters
messageIdThe message ID of the message to be updated.
paramsThe file message params that has updating fields.
completionHandlerThe 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.147Declaration
Swift
open func resendFileMessage( _ message: FileMessage, binaryData: Data?, completionHandler: FileMessageHandler? ) -> FileMessage?Parameters
messageA message to send. A failed message is passed to the callback when fails to send a message
binaryDataData 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.
completionHandlerHandler 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.147Declaration
Swift
open func resendFileMessage( _ message: FileMessage, binaryData: Data?, progressHandler: MultiProgressHandler?, completionHandler: FileMessageHandler? ) -> FileMessage?Parameters
messageA message to send. A failed message is passed to the callback when fails to send a message
binaryDataData 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.
progressHandlerThe handler block to be used to monitor progression.
requestIdis a unique identifier for the message send request.bytesSentis the number of bytes sent since this method was called.totalBytesSentis the total number of bytes sent so far.totalBytesExpectedToSendis the expected length of the body data. These parameters are the same to the declaration ofurlSession(_:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:).completionHandlerThe 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 whosesendingStatusis.succeeded.Declaration
Swift
open func copyFileMessage( _ message: FileMessage, toTargetChannel targetChannel: BaseChannel, completionHandler: FileMessageHandler? ) -> FileMessage?Parameters
messageFile message object.
targetChannelTarget channel object.
completionHandlerThe handler block to execute. The
fileMessageis 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
open class func cancelUploadingFileMessage( requestId: String, completionHandler: ((_ result: Bool, _ error: SBError?) -> Void)? )Parameters
requestIdThe request ID of the file message that is been uploading.
completionHandlerThe handler block to execute. If the
resultistrue, then the uploading task of therequestIdhas been cancelled.
-
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
messageobject, not the function that uses themessageId.Declaration
Swift
open func deleteMessage(_ message: BaseMessage, completionHandler: SBErrorHandler?)Parameters
messageThe message to be deleted.
completionHandlerThe 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 themessageobject, not the function that uses themessageId.Since
3.0.179
Declaration
Swift
open func deleteMessage(messageId: Int64, completionHandler: SBErrorHandler?)Parameters
messageIdThe message ID to be deleted.
completionHandlerThe 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 themessageobject, not the function that uses themessageId.Since
4.22.0
Declaration
Swift
open func deleteMessage(messageId: Int64, hardDelete: Bool, completionHandler: SBErrorHandler?)Parameters
messageIdThe message ID to be deleted.
completionHandlerThe handler block to execute.
hardDeleteWhether to hard delete the message. Enabling this option will delete messages from the database as well as their contents. It’s set to
falseby default.
-
Pins the message to the channel.
Note
Pin functionality inOpenChannelwill be supported starting from 4.20.0.Since
4.2.0Declaration
Swift
open func pinMessage(messageId: Int64, completionHandler: SBErrorHandler?)Parameters
messageIdThe message ID of the message to be pinned.
completionHandlerThe handler block to be executed after pinning the message.
-
Unpins the message from the channel.
Note
Pin functionality inOpenChannelwill be supported starting from 4.20.0.Since
4.2.0Declaration
Swift
open func unpinMessage(messageId: Int64, completionHandler: SBErrorHandler?)Parameters
messageIdThe message ID of the message to be unpinned.
completionHandlerThe handler block to be executed after unpinning the message.
-
Creates keys of meta array for the message.
Since
3.0.116Declaration
Swift
open func createMessageMetaArrayKeys( message: BaseMessage, keys: [String], completionHandler: BaseMessageHandler? )Parameters
messageThe message object. This method creates
keysin it.keysKeys of meta array.
completionHandlerThe handler block to execute. The
messageis a base message object that has the keys for its meta array. -
Deletes keys from meta array of the message.
Since
3.0.116Declaration
Swift
open func deleteMessageMetaArrayKeys( message: BaseMessage, keys: [String], completionHandler: BaseMessageHandler? )Parameters
messageThe message object. This method deletes keys of meta array of it.
keysKeys to be deleted.
completionHandlerThe handler block to execute.
-
Adds meta array to the message.
Since
3.0.116
Note
use
addMessageMetaArrayValues(message:metaArrays:completionHandler:)as possible.Declaration
Swift
open func addMessageMetaArrayValues( message: BaseMessage, keyValues: [String: [String]], completionHandler: BaseMessageHandler? )Parameters
messageThe message object. This method adds pairs of key and value to this message.
keyValuesPairs of key-value to be added.
completionHandlerThe handler block to execute.
-
Adds the array of meta array into the message.
Note
ThemetaArraysare 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.148Declaration
Swift
open func addMessageMetaArrayValues( message: BaseMessage, metaArrays: [MessageMetaArray], completionHandler: BaseMessageHandler? )Parameters
messageThe message instance. The metaArrays will added into the message.
metaArraysAn 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.
completionHandlerThe handler block to execute after adding message meta arrays. The
messageof the handler is updated message. If failed to add message meta arrays, theerrorof the handler is not nil(null). -
Removes meta array from the message.
Since
3.0.116Note
useremoveMessageMetaArrayValues(message:metaArrays:completionHandler:)as possible.Declaration
Swift
open func removeMessageMetaArrayValues( message: BaseMessage, keyValues: [String: [String]], completionHandler: BaseMessageHandler? ) -
Removes the array of meta array from the message.
Note
ThemetaArraysare 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.148Declaration
Swift
open func removeMessageMetaArrayValues( message: BaseMessage, metaArrays: [MessageMetaArray], completionHandler: BaseMessageHandler? )Parameters
messageThe message instance. The metaArrays will removed from the message.
metaArraysAn array of message meta array will be removed from the message. the string of the value in the metaArray MUST exist with same key.
completionHandlerThe handler block to execute after removing message meta arrays. The
messageof the handler is removed message. If failed to remove message meta arrays, theerrorof the handler is not nil(null).
-
Creates the meta counters for the channel.
Declaration
Swift
open func createMetaCounters( _ metaCounters: [String: Int], completionHandler: MetaCountersHandler? )Parameters
metaCountersThe meta counters to be set
completionHandlerThe handler block to execute.
metaCountersis 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
keysThe keys to get meta counters.
completionHandlerThe handler block to execute.
metaCountersis the meta counters which are set on Sendbird server. -
Gets all meta counters for the channel.
Declaration
Swift
open func getAllMetaCounters(completionHandler: MetaCountersHandler?)Parameters
completionHandlerhandler block to execute.
metaCountersis 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
metaCountersThe meta counters to be updated.
completionHandlerThe handler block to execute.
metaCountersis 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
metaCountersThe meta counters to be increased.
completionHandlerThe handler block to execute.
metaCountersis 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
metaCountersThe meta counters to be decreased.
completionHandlerThe handler block to execute.
metaCountersis 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
keyThe key to be deleted.
completionHandlerThe handler block to execute.
-
Deletes all meta counters for the channel.
Declaration
Swift
open func deleteAllMetaCounters(completionHandler: SBErrorHandler?)Parameters
completionHandlerThe handler block to execute.
-
Creates the meta data for the channel.
Declaration
Swift
open func createMetaData( _ metaData: [String: String], completionHandler: MetaDataHandler? )Parameters
metaDataThe meta data to be set.
completionHandlerThe handler block to execute.
metaDatais 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
keysThe keys to get meta data.
completionHandlerThe handler block to execute.
metaDatais the meta data which are set on Sendbird server. -
Gets all meta data for the channel.
Declaration
Swift
open func getAllMetaData(completionHandler: MetaDataHandler?)Parameters
completionHandlerThe handler block to execute.
metaDatais 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
metaDataThe meta data to be updated.
completionHandlerThe handler block to execute.
metaDatais 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
keyThe key to be deleted.
completionHandlerThe handler block to execute.
-
Deletes all meta data for the channel.
Declaration
Swift
open func deleteAllMetaData(completionHandler: SBErrorHandler?)Parameters
completionHandlerThe handler block to execute.
-
Return cached channel meta data.
Since
3.0.216Declaration
Swift
open func getCachedMetaData() -> [String: String]Return Value
Dictionary meta data.
-
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.89Declaration
Swift
open func banUser( _ user: User, seconds: Int, description: String?, completionHandler: SBErrorHandler? )Parameters
userThe user to be banned.
secondsSeconds 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.
descriptionThe reason why the user was banned.
completionHandlerThe 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.89Declaration
Swift
open func banUser( userId: String, seconds: Int, description: String?, completionHandler: SBErrorHandler? )Parameters
userIdThe user ID to be banned.
secondsSeconds 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.
descriptionThe reason why the user was banned.
completionHandlerThe 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.89Declaration
Swift
open func unbanUser(_ user: User, completionHandler: SBErrorHandler?)Parameters
userThe user to be removed ban.
completionHandlerThe 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.89Declaration
Swift
open func unbanUser(userId: String, completionHandler: SBErrorHandler?)Parameters
userIdThe user ID to be removed ban.
completionHandlerThe 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.
-
Reports a user in a channel of inappropriate activities.
Since
3.0.154Declaration
Swift
@available(*, deprecated, renamed: "reportUser(_:reportCategoryInfo:reportDescription:completionHandler:﹚", message: "This method is deprecated in 4.23.0. Retrieve report categories from `getReportCategoryInfoList(completionHandler:﹚` and use `reportUser(_:reportCategoryInfo:reportDescription:completionHandler:﹚` instead.") open func report( offendingUser: User, reportCategory: ReportCategory, reportDescription: String?, completionHandler: SBErrorHandler? )Parameters
offendingUserThe user who is being reported.
reportCategoryThe category in which the report is being submitted. Valid choices are
suspicious,harassing,spam, andinappropriate.reportDescriptionAn open ended description for why the report is being submitted.
completionHandlerThe handler block to execute.
-
Reports current channel instance of inappropriate activities.
Since
3.0.154Declaration
Swift
@available(*, deprecated, renamed: "report(reportCategoryInfo:reportDescription:completionHandler:﹚", message: "This method is deprecated in 4.23.0. Retrieve report categories from `getReportCategoryInfoList(completionHandler:﹚` and use `report(reportCategoryInfo:reportDescription:completionHandler:﹚` instead.") open func report( category: ReportCategory, reportDescription: String?, completionHandler: SBErrorHandler? )Parameters
categoryThe category in which the report is being submitted. Valid choices are
suspicious,harassing,spamandinappropriate.reportDescriptionAn open ended description for why the report is being submitted.
completionHandlerThe handler block to execute.
-
Reports a malicious message in the channel
Since
3.0.154Declaration
Swift
@available(*, deprecated, renamed: "reportMessage(_:reportCategoryInfo:reportDescription:completionHandler:﹚", message: "This method is deprecated in 4.23.0. Retrieve report categories from `getReportCategoryInfoList(completionHandler:﹚` and use `reportMessage(_:reportCategoryInfo:reportDescription:completionHandler:﹚` instead.") open func report( message: BaseMessage, reportCategory: ReportCategory, reportDescription: String?, completionHandler: SBErrorHandler? )Parameters
messageThe message object which is being reported.
reportCategoryThe category in which the report is being submitted. Valid choices are
suspicious,harassing,spamandinappropriate.reportDescriptionAn open ended description for why the report is being submitted.
completionHandlerThe handler block to execute.
-
Reports a user in a channel of inappropriate activities.
Since
4.23.0Declaration
Swift
public func reportUser( _ offendingUser: User, reportCategoryInfo: ReportCategoryInfo, reportDescription: String?, completionHandler: SBErrorHandler? )Parameters
offendingUserThe user who is being reported.
reportCategoryInfoThe
ReportCategoryInfoin which the report is being submitted. It can be retrieved fromSendbirdChat.getReportCategoryInfoList.reportDescriptionAn open ended description for why the report is being submitted.
completionHandlerThe handler block to execute.
-
Reports current channel instance of inappropriate activities.
Since
4.23.0Declaration
Swift
public func report( reportCategoryInfo: ReportCategoryInfo, reportDescription: String?, completionHandler: SBErrorHandler? )Parameters
reportCategoryInfoThe
ReportCategoryInfoin which the report is being submitted. It can be retrieved fromSendbirdChat.getReportCategoryInfoList.reportDescriptionAn open ended description for why the report is being submitted.
completionHandlerThe handler block to execute.
-
Reports a malicious message in the channel
Since
4.23.0Declaration
Swift
public func reportMessage( _ message: BaseMessage, reportCategoryInfo: ReportCategoryInfo, reportDescription: String?, completionHandler: SBErrorHandler? )Parameters
messageThe message object which is being reported.
reportCategoryInfoThe
ReportCategoryInfoin which the report is being submitted. It can be retrieved fromSendbirdChat.getReportCategoryInfoList.reportDescriptionAn open ended description for why the report is being submitted.
completionHandlerThe handler block to execute.
-
Mutes a user with additional options. Muted user cannot send any messages to the group channel.
Since
3.0.118Declaration
Swift
open func muteUser( _ user: User, seconds: Int, description: String?, completionHandler: SBErrorHandler? )Parameters
userThe user to be muted.
secondsThe user cannot send any messages for this time.
descriptionThe description that explains the reason why the user is muted.
completionHandlerThe 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.118Declaration
Swift
open func muteUser( userId: String, seconds: Int, description: String?, completionHandler: SBErrorHandler? )Parameters
userIdThe user ID to be muted.
secondsThe user cannot send any messages for this time.
descriptionThe description that explains the reason why the user is muted.
completionHandlerThe 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.89Declaration
Swift
open func unmuteUser(userId: String, completionHandler: SBErrorHandler?)Parameters
userIdThe user ID to be turned off mute.
completionHandlerThe 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.89Declaration
Swift
open func unmuteUser(_ user: User, completionHandler: SBErrorHandler?)Parameters
userThe user to be turned off mute.
completionHandlerThe 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.189Declaration
Swift
open func addOperators(userIds: [String], completionHandler: SBErrorHandler?)Parameters
userIdsThe user IDs to be operators.
completionHandlerThe handler block to be executed.
-
Removes operators from the channel.
Since
3.0.189Declaration
Swift
open func removeOperators(userIds: [String], completionHandler: SBErrorHandler?)Parameters
userIdsThe user IDs to be removed from the operators.
completionHandlerThe handler block to be executed.
-
Removes all operators from the channel.
Since
3.0.189Declaration
Swift
open func removeAllOperators(completionHandler: SBErrorHandler?)Parameters
completionHandlerThe handler block to be executed.
-
Updates a poll with params.
Since
4.5.0Declaration
Swift
open func updatePoll( pollId: Int64, params: PollUpdateParams, completionHandler: PollHandler? )Parameters
pollIdID of Poll to update
paramsPollUpdateParamsinstance.completionHandlerCompletion block.
-
Deletes a poll.
Since
4.5.0Declaration
Swift
open func deletePoll( pollId: Int64, completionHandler: SBErrorHandler? )Parameters
pollIdID of Poll to remove
completionHandlerCompletion block.
-
Closes a poll.
Since
4.5.0Declaration
Swift
open func closePoll( pollId: Int64, completionHandler: PollHandler? )Parameters
pollIdID of Poll to close
completionHandlerCompletion block
-
Adds an option to a poll.
Since
4.5.0Declaration
Swift
open func addPollOption( pollId: Int64, optionText: String, completionHandler: PollHandler? )Parameters
pollIdID of Poll to add the poll option
optionTextOption text of the poll option
completionHandlerCompletion block
-
Updates an option to a poll.
Since
4.5.0Declaration
Swift
open func updatePollOption( pollId: Int64, pollOptionId: Int64, optionText: String, completionHandler: PollHandler? )Parameters
pollIdID of poll to update the poll option
pollOptionIdID of the poll option
optionTextOption text of the poll option
completionHandlerCompletion block
-
Removes Poll option
Since
4.5.0Declaration
Swift
open func deletePollOption( pollId: Int64, pollOptionId: Int64, completionHandler: SBErrorHandler? )Parameters
pollIdID of the poll to delete poll option of
pollOptionIdpoll option id to delete
completionHandlerCompletion block
-
Votes poll
Since
4.5.0Declaration
Swift
open func votePoll( pollId: Int64, pollOptionIds: [Int64], completionHandler: PollVoteEventHandler )Parameters
pollIdPoll ID to vote
pollOptionIdsList of poll option IDs to vote
completionHandlerCompletion block
-
Adds a reaction to a message.
Messages with
sendingStatusis not.successwill handler to return error.Note
This is idempotent.Note
This feature is only available in group channels.Since
3.0.169Declaration
Swift
open func addReaction( with message: BaseMessage, key: String, completionHandler: ReactionEventHandler? )Parameters
messageThe message object that the reaction will be added.
keyThe reaction key to be added.
completionHandlerThe handler block to be executed. If succeeded, the
reactionEventwill 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.169Declaration
Swift
open func deleteReaction( with message: BaseMessage, key: String, completionHandler: ReactionEventHandler? )Parameters
messageThe message object that has the reaction key.
keyThe reaction key to be deleted.
completionHandlerThe handler block to be executed. If succeeded, the
reactionEventwill have the information of the reaction.
-
Creates a query instance for banned user list of the channel.
Since
3.0.89Declaration
Swift
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.1Declaration
Swift
open func createBannedUserListQuery( paramsBuilder: (BannedUserListQueryParams) -> Void ) -> BannedUserListQuery?Parameters
paramsBuilderThe 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.89Declaration
Swift
open func createBannedUserListQuery( params: BannedUserListQueryParams ) -> BannedUserListQuery?Parameters
paramsBannedUserListQueryParamsinstance.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.0Declaration
Swift
open class func createBannedUserListQuery( channelType: ChannelType, channelURL: String ) -> BannedUserListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe 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.1Declaration
Swift
open class func createBannedUserListQuery( channelType: ChannelType, channelURL: String, paramsBuilder: (BannedUserListQueryParams) -> Void ) -> BannedUserListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe channel URL.
paramsBuilderThe 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.0Declaration
Swift
open class func createBannedUserListQuery( channelType: ChannelType, channelURL: String, params: BannedUserListQueryParams ) -> BannedUserListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe channel URL.
paramsBannedUserListQueryParamsinstance.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
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
open func createMutedUserListQuery(paramsBuilder: (MutedUserListQueryParams) -> Void) -> MutedUserListQuery?Parameters
paramsBuilderThe 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
open func createMutedUserListQuery(params: MutedUserListQueryParams) -> MutedUserListQuery?Parameters
paramsThe 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.0Declaration
Swift
open class func createMutedUserListQuery(channelType: ChannelType, channelURL: String) -> MutedUserListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe 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.0Declaration
Swift
open class func createMutedUserListQuery( channelType: ChannelType, channelURL: String, paramsBuilder: (MutedUserListQueryParams) -> Void ) -> MutedUserListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe channel URL.
paramsBuilderThe 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.0Declaration
Swift
open class func createMutedUserListQuery(channelType: ChannelType, channelURL: String, params: MutedUserListQueryParams) -> MutedUserListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe channel URL.
paramsThe params object to change query condition.
Return Value
UserListQuery instance for the muted user list.
-
Creates
PreviousMessageListQueryinstance for getting the previous messages list of the channel.Declaration
Swift
open func createPreviousMessageListQuery() -> PreviousMessageListQuery?Return Value
Returns the message list of the channel.
-
Creates
PreviousMessageListQueryinstance for getting the previous messages list of the channel.Declaration
Swift
open func createPreviousMessageListQuery(paramsBuilder: (PreviousMessageListQueryParams) -> Void) -> PreviousMessageListQuery?Parameters
paramsBuilderThe builder closure for setting
PreviousMessageListQueryParams.Return Value
Returns the message list of the channel.
-
Creates
PreviousMessageListQueryinstance for getting the previous messages list of the channel.Declaration
Swift
open func createPreviousMessageListQuery(params: PreviousMessageListQueryParams) -> PreviousMessageListQuery?Parameters
paramsThe params object to change query condition.
Return Value
Returns the message list of the channel.
-
Creates
PreviousMessageListQueryinstance for getting the previous messages list of the channel.Since
4.0.0Declaration
Swift
open class func createPreviousMessageListQuery( channelType: ChannelType, channelURL: String ) -> PreviousMessageListQueryParameters
channelTypechannel type
channelURLchannel url
Return Value
Returns the message list of the channel.
-
Creates
PreviousMessageListQueryinstance for getting the previous messages list of the channel.Since
4.0.0Declaration
Swift
open class func createPreviousMessageListQuery( channelType: ChannelType, channelURL: String, paramsBuilder: (PreviousMessageListQueryParams) -> Void ) -> PreviousMessageListQueryParameters
channelTypechannel type
channelURLchannel url
paramsBuilderThe builder closure for setting
ParticipantListQueryParams.Return Value
Returns the message list of the channel.
-
Creates
PreviousMessageListQueryinstance for getting the previous messages list of the channel.Since
4.0.0Declaration
Swift
open class func createPreviousMessageListQuery( channelType: ChannelType, channelURL: String, params: PreviousMessageListQueryParams ) -> PreviousMessageListQueryParameters
channelTypechannel type
channelURLchannel url
paramsThe params object to change query condition.
Return Value
Returns the message list of the channel.
-
Creates
OperatorListQueryinstance for getting operators in the channel.Since
3.0.94Declaration
Swift
open func createOperatorListQuery() -> OperatorListQuery?Return Value
The operator list in the channel.
-
Creates
OperatorListQueryinstance for getting operators in the channel.Since
4.0.0Declaration
Swift
open func createOperatorListQuery(paramsBuilder: (OperatorListQueryParams) -> Void) -> OperatorListQuery?Return Value
The operator list in the channel.
-
Creates
OperatorListQueryinstance for getting operators in the channel.Since
4.0.0Declaration
Swift
open func createOperatorListQuery(params: OperatorListQueryParams) -> OperatorListQuery?Parameters
paramsThe params object to change query condition.
Return Value
The operator list in the channel.
-
Creates
OperatorListQueryinstance for getting operators in the channel.Since
4.0.0Declaration
Swift
open class func createOperatorListQuery( channelType: ChannelType, channelURL: String ) -> OperatorListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe channel URL.
Return Value
The operator list in the channel.
-
Creates
OperatorListQueryinstance for getting operators in the channel.Since
4.0.0Declaration
Swift
open class func createOperatorListQuery( channelType: ChannelType, channelURL: String, paramsBuilder: (OperatorListQueryParams) -> Void ) -> OperatorListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe channel URL.
paramsBuilderThe builder closure for setting
OperatorListQueryParams.Return Value
The operator list in the channel.
-
Creates
OperatorListQueryinstance for getting operators in the channel.Since
4.0.0Declaration
Swift
open class func createOperatorListQuery( channelType: ChannelType, channelURL: String, params: OperatorListQueryParams ) -> OperatorListQueryParameters
channelTypeThe Type of channel, types of open channel or group channel.
channelURLThe channel URL.
paramsThe params object to change query condition.
Return Value
The operator list in the channel.
-
Creates
PollListQueryinstance for getting poll list in this channel.Since
4.5.0Declaration
Swift
open func createPollListQuery(limit: UInt = 20) -> PollListQuery?Return Value
poll list query object.
-
Creates
PollVoterListQueryinstance for getting user list on given poll optionSince
4.5.0Declaration
Swift
open func createPollVoterListQuery( pollId: Int64, pollOptionId: Int64, limit: UInt = 20 ) -> PollVoterListQueryParameters
pollIdpoll ID.
pollOptionIdpoll option ID.
limitvoter list length
Return Value
poll voter list query object.
-
Creates
PollVoterListQueryinstance for getting user list on given poll optionSince
4.5.0Declaration
Swift
open func createPollVoterListQuery( pollId: Int64, pollOptionId: Int64 ) -> PollVoterListQueryParameters
pollIdpoll ID.
pollOptionIdpoll option ID.
Return Value
poll voter list query object.
-
Creates a
PinnedMessageListQueryobject that can be used to retrieve a list of pinned messages in the group channel.Note
Pin functionality inOpenChannelwill be supported starting from 4.20.0.Since
4.8.0Declaration
Swift
open func createPinnedMessageListQuery() -> PinnedMessageListQuery?Return Value
A
PinnedMessageListQueryobject that can be used to retrieve a list of pinned messages. -
Creates a
PinnedMessageListQueryobject that can be used to retrieve a list of pinned messages in the group channel.Note
Pin functionality inOpenChannelwill be supported starting from 4.20.0.Since
4.8.0Declaration
Swift
open func createPinnedMessageListQuery(paramsBuilder: (PinnedMessageListQueryParams) -> Void) -> PinnedMessageListQuery?Parameters
paramsBuilderThe builder closure for setting
PinnedMessageListQueryParams.Return Value
A
PinnedMessageListQueryobject that can be used to retrieve a list of pinned messages. -
Creates a
PinnedMessageListQueryobject that can be used to retrieve a list of pinned messages in the group channel.Note
Pin functionality inOpenChannelwill be supported starting from 4.20.0.Since
4.8.0Declaration
Swift
open func createPinnedMessageListQuery( params: PinnedMessageListQueryParams ) -> PinnedMessageListQuery?Parameters
paramsA
PinnedMessageListQueryParamsobject containing the parameters for the query.Return Value
A
PinnedMessageListQueryobject that can be used to retrieve a list of pinned messages.
-
Retrieves the changelogs since a specified token regarding the updated messages or the unique IDs of deleted messages in the channel.
Since
3.0.181Declaration
Swift
open func getMessageChangeLogs( token: String?, params: MessageChangeLogsParams = MessageChangeLogsParams(), completionHandler: MessageChangeLogHandler? )Parameters
tokenSpecifies the token to be the reference point for the changelogs to retrieve.
paramsContains a set of parameters you can set regarding the messages in the results.
completionHandlerThe handler block to execute. The
updatedMessagesretrieves the updated messages. ThedeletedMessageIdsretrieves the unique ID of deleted messages. ThehasMoreindicates whether there are more changelogs to be retrieved. Thetokenretrieves the token of the last changelog in the results. Theerrorindicates whether there is an error. If there is no error, the value isnil. -
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.181Declaration
Swift
open func getMessageChangeLogs( timestamp: Int64, params: MessageChangeLogsParams = MessageChangeLogsParams(), completionHandler: MessageChangeLogHandler? )Parameters
timestampSpecifies the timestamp to be the reference point for changelogs to retrieve, in Unix milliseconds format.
paramsContains a set of parameters you can set regarding the messages in the results.
completionHandlerThe handler block to execute. The
updatedMessagesretrieves the updated messages. ThedeletedMessageIdsretrieves the unique ID of deleted messages. ThehasMoreindicates whether there are more changelogs to be retrieved. Thetokenretrieves the token of the last changelog in the results. Theerrorindicates whether there is an error. If there is no error, the value isnil. -
Retrieves the changelogs since a specified token regarding the updated polls or the unique IDs of deleted polls in the channel.
Since
4.5.0Declaration
Swift
open func getPollChangeLogs( token: String?, completionHandler: PollChangeLogsHandler? )Parameters
tokenSpecifies the token to be the reference point for the changelogs to retrieve.
completionHandlerThe handler block to execute. The
updatedPollsretrieves the updated polls. ThedeletedPollIdsretrieves the unique ID of deleted polls. ThehasMoreindicates whether there are more changelogs to be retrieved. Thetokenretrieves the token of the last changelog in the results. Theerrorindicates whether there is an error. If there is no error, the value isnil. -
Retrieves the changelogs since a specified timestamp regarding the updated polls or the unique IDs of deleted polls in the channel.
Since
4.5.0Declaration
Swift
open func getPollChangeLogs( timestamp: Int64, completionHandler: PollChangeLogsHandler? )Parameters
timestampSpecifies the timestamp to be the reference point for changelogs to retrieve, in Unix milliseconds format.
completionHandlerThe handler block to execute. The
updatedPollsretrieves the updated polls. ThedeletedPollIdsretrieves the unique ID of deleted polls. ThehasMoreindicates whether there are more changelogs to be retrieved. Thetokenretrieves the token of the last changelog in the results. Theerrorindicates whether there is an error. If there is no error, the value isnil. -
Serializes this object into data
Declaration
Swift
open func serialize() -> Data?Return Value
optional
Datainstance -
Deserializes and reconstructs the object
Declaration
Swift
open class func build(fromSerializedData data: Data?) -> Self?Parameters
dataDatainstanceReturn Value
BaseChannelif parameter is valid, otherwisenil -
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]
View on GitHub
Install in Dash