Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 126 additions & 1 deletion src/pages/docs/api/realtime-sdk/channels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ Failure to retrieve the message history will trigger the `errback` callbacks of

</If>

<If lang="javascript,nodejs,java,python">
<If lang="javascript,nodejs,java,python,swift">

#### getMessage

Expand All @@ -840,6 +840,10 @@ Failure to retrieve the message history will trigger the `errback` callbacks of
`Message get_message(serial_or_message)`
</If>

<If lang="swift">
`getMessageWithSerial(_ serial: String, callback: (ARTMessage?, ARTErrorInfo?) -> Void)`
</If>

Retrieves the latest version of a specific message by its serial identifier. Requires the **history** [capability](/docs/auth/capabilities).

See [updating and deleting messages: retrieving the latest version](/docs/messages/updates-deletes#get) for more information.
Expand Down Expand Up @@ -878,6 +882,18 @@ Returns a [`Message`](/docs/api/realtime-sdk/messages) object representing the l
On failure, raises an [`AblyException`](/docs/api/realtime-sdk/types#ably-exception).
</If>

<If lang="swift">
| Parameter | Description | Type |
|-----------|-------------|------|
| serial | A serial identifier string of the message to retrieve | `String` |
| callback | A success or failure callback function. On success, it receives an [`Message`](/docs/api/realtime-sdk/messages) object representing the latest version of the message | - |

##### Callback result
On success, the callback receives a [`Message`](/docs/api/realtime-sdk/messages) object representing the latest version of the message.

On failure, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

#### updateMessage

<If lang="javascript,nodejs">
Expand All @@ -892,16 +908,39 @@ On failure, raises an [`AblyException`](/docs/api/realtime-sdk/types#ably-except
`UpdateDeleteResult update_message(message, operation=None, params=dict())`
</If>

<If lang="swift">
`update(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String: ARTStringifiable]?, callback: ((ARTUpdateDeleteResult?, ARTErrorInfo?) -> Void)?)`
</If>

Publishes an update to an existing message with shallow mixin semantics. Non-null `name`, `data`, and `extras` fields in the provided message will replace the corresponding fields in the existing message, while null fields will be left unchanged. Requires the **message-update-own** or **message-update-any** [capability](/docs/auth/capabilities).

<If lang="swift">
Note: Note that this publishes an update, it does not mutate the original message if passed in.
</If>

See [updating and deleting messages: updates](/docs/messages/updates-deletes#update) for more information.

##### Parameters

<If lang="javascript,nodejs,java,python">

| Parameter | Description | Type |
|-----------|-------------|------|
| message | A [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field and the fields to update | [`Message`](/docs/api/realtime-sdk/messages) |
| operation | An optional `MessageOperation` object containing metadata about the update operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |

</If>

<If lang="swift">

| Parameter | Description | Type |
|-----------|-------------|------|
| message | A [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field and the fields to update | [`Message`](/docs/api/realtime-sdk/messages) |
| operation | An optional `MessageOperation` object containing metadata about the update operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
| params | Optional parameters sent as part of the request. As Ably adds supported parameters, they will be documented on the [docs pages](https://ably.com/docs) | `[String: Stringifiable]` (optional) |
| callback | A success or failure callback function. On success, it receives an `UpdateDeleteResult` object containing the new version of the message | (optional) |

</If>

<If lang="javascript,nodejs">
##### Returns
Expand All @@ -923,6 +962,14 @@ Returns an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-res
On failure, raises an [`AblyException`](/docs/api/realtime-sdk/types#ably-exception).
</If>

<If lang="swift">
##### Callback result

On success, the callback receives an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.

On failure, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

#### deleteMessage

<If lang="javascript,nodejs">
Expand All @@ -937,16 +984,35 @@ On failure, raises an [`AblyException`](/docs/api/realtime-sdk/types#ably-except
`UpdateDeleteResult delete_message(message, operation=None, params=dict())`
</If>

<If lang="swift">
`delete(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String: ARTStringifiable]?, callback: ((ARTUpdateDeleteResult?, ARTErrorInfo?) -> Void)?)`
</If>

Marks a message as deleted by publishing an update with an action of `MESSAGE_DELETE`. This does not remove the message from the server, and the full message history remains accessible. Uses shallow mixin semantics: non-null `name`, `data`, and `extras` fields in the provided message will replace the corresponding fields in the existing message, while null fields will be left unchanged. Requires the **message-delete-own** or **message-delete-any** [capability](/docs/auth/capabilities).

See [updating and deleting messages: deletes](/docs/messages/updates-deletes#delete) for more information.

##### Parameters

<If lang="javascript,nodejs,java,python">

| Parameter | Description | Type |
|-----------|-------------|------|
| message | A [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field | [`Message`](/docs/api/realtime-sdk/messages) |
| operation | An optional `MessageOperation` object containing metadata about the delete operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |

</If>

<If lang="swift">

| Parameter | Description | Type |
|-----------|-------------|------|
| message | A [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field | [`Message`](/docs/api/realtime-sdk/messages) |
| operation | An optional `MessageOperation` object containing metadata about the delete operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
| params | Optional parameters sent as part of the request. As Ably adds supported parameters, they will be documented on the [docs pages](https://ably.com/docs) | `[String: Stringifiable]` (optional) |
| callback | A success or failure callback function. On success, it receives an `UpdateDeleteResult` object containing the new version of the message | (optional) |

</If>

<If lang="javascript,nodejs">
##### Returns
Expand All @@ -968,6 +1034,14 @@ Returns an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-res
On failure, raises an [`AblyException`](/docs/api/realtime-sdk/types#ably-exception).
</If>

<If lang="swift">
##### Callback result

On success, the callback receives an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.

On failure, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

#### appendMessage

<If lang="javascript,nodejs">
Expand All @@ -982,16 +1056,35 @@ On failure, raises an [`AblyException`](/docs/api/realtime-sdk/types#ably-except
`UpdateDeleteResult append_message(message, operation=None, params=dict())`
</If>

<If lang="swift">
`append(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String: ARTStringifiable]?, callback: ((ARTUpdateDeleteResult?, ARTErrorInfo?) -> Void)?)`
</If>

Appends data to an existing message. The supplied `data` field is appended to the previous message's data, while all other fields (`name`, `extras`) replace the previous values if provided. Requires the **message-update-own** or **message-update-any** [capability](/docs/auth/capabilities).

See [updating and deleting messages: appends](/docs/messages/updates-deletes#append) for more information.

##### Parameters

<If lang="javascript,nodejs,java,python">

| Parameter | Description | Type |
|-----------|-------------|------|
| message | A [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field and the data to append | [`Message`](/docs/api/realtime-sdk/messages) |
| operation | An optional `MessageOperation` object containing metadata about the append operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |

</If>

<If lang="swift">

| Parameter | Description | Type |
|-----------|-------------|------|
| message | A [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field and the data to append | [`Message`](/docs/api/realtime-sdk/messages) |
| operation | An optional `MessageOperation` object containing metadata about the append operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
| params | Optional parameters sent as part of the request. As Ably adds supported parameters, they will be documented on the [docs pages](https://ably.com/docs) | `[String: Stringifiable]` (optional) |
| callback | A success or failure callback function. On success, it receives an `UpdateDeleteResult` object containing the new version of the message | - |

</If>

<If lang="javascript,nodejs">
##### Returns
Expand All @@ -1013,6 +1106,14 @@ Returns an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-res
On failure, raises an [`AblyException`](/docs/api/realtime-sdk/types#ably-exception).
</If>

<If lang="swift">
##### Callback result

On success, the callback receives an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.

On failure, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

#### getMessageVersions

<If lang="javascript,nodejs">
Expand All @@ -1027,17 +1128,34 @@ On failure, raises an [`AblyException`](/docs/api/realtime-sdk/types#ably-except
`PaginatedResult get_message_versions(serial_or_message, params = dict())`
</If>

<If lang="swift">
`getMessageVersions(withSerial serial: String, callback: (ARTPaginatedResult<ARTMessage>?, ARTErrorInfo?) -> Void)?)`
</If>

Retrieves all historical versions of a specific message, ordered by version. This includes the original message and all subsequent updates or delete operations. Requires the **history** [capability](/docs/auth/capabilities).

See [updating and deleting messages: message versions](/docs/messages/updates-deletes#versions) for more information.

##### Parameters

<If lang="javascript,nodejs,java,python">

| Parameter | Description | Type |
|-----------|-------------|------|
| serialOrMessage | Either the serial identifier string of the message whose versions are to be retrieved, or a [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field | `string` or [`Message`](/docs/api/realtime-sdk/messages) |
| params | Optional parameters sent as part of the query string | <If lang="javascript,nodejs">`Record<string, any>`</If><If lang="java">`Param[]`</If> (optional) |

</If>

<If lang="swift">

| Parameter | Description | Type |
|-----------|-------------|------|
| serial | A serial identifier string of the message whose versions are to be retrieved | `String` |
| callback | A success or failure callback function. On success, it receives an [`PaginatedResult`](#paginated-result) object containing an array of [`Message`](#message) objects representing all versions of the message. | - |

</If>

<If lang="javascript,nodejs">
##### Returns

Expand All @@ -1052,6 +1170,13 @@ On success, the returned [`PaginatedResult`](#paginated-result) encapsulates an
Failure to retrieve the message versions will raise an [`AblyException`](/docs/api/realtime-sdk/types#ably-exception)
</If>

<If lang="swift">
##### Callback result

On success, the callback receives a [`PaginatedResult`](#paginated-result) encapsulating an array of [`Message`](#message) version objects corresponding to the current page of results. [`PaginatedResult`](#paginated-result) supports pagination using [`next()`](#paginated-result) and [`first()`](#paginated-result) methods.

On failure to retrieve message versions, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object with the failure reason.
</If>
</If>

<If lang="javascript,nodejs">
Expand Down
Loading