Skip to content

Commit 3dbb659

Browse files
committed
Update swift API references docs for protocol v5 changes.
1 parent ab9f3e7 commit 3dbb659

2 files changed

Lines changed: 255 additions & 3 deletions

File tree

src/pages/docs/api/realtime-sdk/channels.mdx

Lines changed: 126 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -824,7 +824,7 @@ Failure to retrieve the message history will trigger the `errback` callbacks of
824824

825825
</If>
826826

827-
<If lang="javascript,nodejs,java,python">
827+
<If lang="javascript,nodejs,java,python,swift">
828828

829829
#### getMessage
830830

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

843+
<If lang="swift">
844+
`getMessageWithSerial(_ serial: String, callback: (ARTMessage?, ARTErrorInfo?) -> Void)`
845+
</If>
846+
843847
Retrieves the latest version of a specific message by its serial identifier. Requires the **history** [capability](/docs/auth/capabilities).
844848

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

885+
<If lang="swift">
886+
| Parameter | Description | Type |
887+
|-----------|-------------|------|
888+
| serial | A serial identifier string of the message to retrieve | `String` |
889+
| 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 | - |
890+
891+
##### Callback result
892+
On success, the callback receives a [`Message`](/docs/api/realtime-sdk/messages) object representing the latest version of the message.
893+
894+
On failure, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
895+
</If>
896+
881897
#### updateMessage
882898

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

911+
<If lang="swift">
912+
`update(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String: ARTStringifiable]?, callback: ((ARTUpdateDeleteResult?, ARTErrorInfo?) -> Void)?)`
913+
</If>
914+
895915
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).
896916

917+
<If lang="swift">
918+
Note: Note that this publishes an update, it does not mutate the original message if passed in.
919+
</If>
920+
897921
See [updating and deleting messages: updates](/docs/messages/updates-deletes#update) for more information.
898922

899923
##### Parameters
900924

925+
<If lang="javascript,nodejs,java,python">
926+
927+
| Parameter | Description | Type |
928+
|-----------|-------------|------|
929+
| 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) |
930+
| operation | An optional `MessageOperation` object containing metadata about the update operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
931+
932+
</If>
933+
934+
<If lang="swift">
935+
901936
| Parameter | Description | Type |
902937
|-----------|-------------|------|
903938
| 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) |
904939
| operation | An optional `MessageOperation` object containing metadata about the update operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
940+
| 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) |
941+
| callback | A success or failure callback function. On success, it receives an `UpdateDeleteResult` object containing the new version of the message | (optional) |
942+
943+
</If>
905944

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

965+
<If lang="swift">
966+
##### Callback result
967+
968+
On success, the callback receives an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.
969+
970+
On failure, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
971+
</If>
972+
926973
#### deleteMessage
927974

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

987+
<If lang="swift">
988+
`delete(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String: ARTStringifiable]?, callback: ((ARTUpdateDeleteResult?, ARTErrorInfo?) -> Void)?)`
989+
</If>
990+
940991
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).
941992

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

944995
##### Parameters
945996

997+
<If lang="javascript,nodejs,java,python">
998+
999+
| Parameter | Description | Type |
1000+
|-----------|-------------|------|
1001+
| message | A [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field | [`Message`](/docs/api/realtime-sdk/messages) |
1002+
| operation | An optional `MessageOperation` object containing metadata about the delete operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
1003+
1004+
</If>
1005+
1006+
<If lang="swift">
1007+
9461008
| Parameter | Description | Type |
9471009
|-----------|-------------|------|
9481010
| message | A [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field | [`Message`](/docs/api/realtime-sdk/messages) |
9491011
| operation | An optional `MessageOperation` object containing metadata about the delete operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
1012+
| 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) |
1013+
| callback | A success or failure callback function. On success, it receives an `UpdateDeleteResult` object containing the new version of the message | (optional) |
1014+
1015+
</If>
9501016

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

1037+
<If lang="swift">
1038+
##### Callback result
1039+
1040+
On success, the callback receives an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.
1041+
1042+
On failure, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
1043+
</If>
1044+
9711045
#### appendMessage
9721046

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

1059+
<If lang="swift">
1060+
`append(_ message: ARTMessage, operation: ARTMessageOperation?, params: [String: ARTStringifiable]?, callback: ((ARTUpdateDeleteResult?, ARTErrorInfo?) -> Void)?)`
1061+
</If>
1062+
9851063
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).
9861064

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

9891067
##### Parameters
9901068

1069+
<If lang="javascript,nodejs,java,python">
1070+
1071+
| Parameter | Description | Type |
1072+
|-----------|-------------|------|
1073+
| 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) |
1074+
| operation | An optional `MessageOperation` object containing metadata about the append operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
1075+
1076+
</If>
1077+
1078+
<If lang="swift">
1079+
9911080
| Parameter | Description | Type |
9921081
|-----------|-------------|------|
9931082
| 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) |
9941083
| operation | An optional `MessageOperation` object containing metadata about the append operation. Can include `clientId`, `description`, and `metadata` fields | `MessageOperation` (optional) |
1084+
| 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) |
1085+
| callback | A success or failure callback function. On success, it receives an `UpdateDeleteResult` object containing the new version of the message | - |
1086+
1087+
</If>
9951088

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

1109+
<If lang="swift">
1110+
##### Callback result
1111+
1112+
On success, the callback receives an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.
1113+
1114+
On failure, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
1115+
</If>
1116+
10161117
#### getMessageVersions
10171118

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

1131+
<If lang="swift">
1132+
`getMessageVersions(withSerial serial: String, callback: (ARTPaginatedResult<ARTMessage>?, ARTErrorInfo?) -> Void)?)`
1133+
</If>
1134+
10301135
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).
10311136

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

10341139
##### Parameters
10351140

1141+
<If lang="javascript,nodejs,java,python">
1142+
10361143
| Parameter | Description | Type |
10371144
|-----------|-------------|------|
10381145
| 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) |
10391146
| params | Optional parameters sent as part of the query string | <If lang="javascript,nodejs">`Record<string, any>`</If><If lang="java">`Param[]`</If> (optional) |
10401147

1148+
</If>
1149+
1150+
<If lang="swift">
1151+
1152+
| Parameter | Description | Type |
1153+
|-----------|-------------|------|
1154+
| serial | A serial identifier string of the message whose versions are to be retrieved | `String` |
1155+
| 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. | - |
1156+
1157+
</If>
1158+
10411159
<If lang="javascript,nodejs">
10421160
##### Returns
10431161

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

1173+
<If lang="swift">
1174+
##### Callback result
1175+
1176+
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.
1177+
1178+
On failure to retrieve message versions, the callback receives an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object with the failure reason.
1179+
</If>
10551180
</If>
10561181

10571182
<If lang="javascript,nodejs">

0 commit comments

Comments
 (0)