Skip to content
Merged
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
10 changes: 5 additions & 5 deletions src/data/languages/languageData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ export default {
react: '2.16',
csharp: '1.2',
flutter: '1.2',
java: '1.4',
kotlin: '1.4',
java: '1.6',
kotlin: '1.6',
objc: '1.2',
php: '1.1',
python: '2.1',
Expand All @@ -25,8 +25,8 @@ export default {
react: '2.16',
csharp: '1.2',
flutter: '1.2',
java: '1.4',
kotlin: '1.4',
java: '1.6',
kotlin: '1.6',
objc: '1.2',
php: '1.1',
python: '2.1',
Expand All @@ -52,7 +52,7 @@ export default {
liveObjects: {
javascript: '2.16',
swift: '0.2',
java: '1.4',
java: '1.6',
},
liveSync: {
javascript: '0.4',
Expand Down
80 changes: 78 additions & 2 deletions src/pages/docs/api/realtime-sdk/channels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -824,29 +824,53 @@ Failure to retrieve the message history will trigger the `errback` callbacks of

</If>

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

#### getMessage

<If lang="javascript,nodejs">
`getMessage(serialOrMessage: string | Message): Promise<Message>`
</If>

<If lang="java">
`Message getMessage(String serial)`
</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.

##### Parameters

<If lang="javascript,nodejs">
| Parameter | Description | Type |
|-----------|-------------|------|
| serialOrMessage | Either the serial identifier string of the message to retrieve, or a [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field | `string` or [`Message`](/docs/api/realtime-sdk/messages) |

##### Returns

Returns a promise which, upon success, will be fulfilled with a [`Message`](/docs/api/realtime-sdk/messages) object representing the latest version of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<If lang="java">
<If lang="java,kotlin">

If kotlin snippet is same as java, then we can share them right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's do in other PR, kotlin syntax a bit different

| Parameter | Description | Type |
|-----------|-------------|------|
| serial | Serial identifier string of the message to retrieve | `String` |

##### Returns

Returns a [`Message`](/docs/api/realtime-sdk/messages) object representing the latest version of the message.
</If>

#### updateMessage

<If lang="javascript,nodejs">
`updateMessage(message: Message, operation?: MessageOperation): Promise<UpdateDeleteResult>`
</If>

<If lang="java">
`void updateMessage(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)`
</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).

Expand All @@ -859,13 +883,27 @@ See [updating and deleting messages: updates](/docs/messages/updates-deletes#upd
| 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 lang="javascript,nodejs">
##### Returns

Returns a promise which, upon success, will be fulfilled with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
##### Returns

Invokes the provided `Callback<UpdateDeleteResult>` with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message on success, or with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object describing the error on failure.
</If>

#### deleteMessage

<If lang="javascript,nodejs">
`deleteMessage(message: Message, operation?: MessageOperation): Promise<UpdateDeleteResult>`
</If>

<If lang="java">
`void deleteMessage(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)`
</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).

Expand All @@ -878,13 +916,27 @@ See [updating and deleting messages: deletes](/docs/messages/updates-deletes#del
| 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 lang="javascript,nodejs">
##### Returns

Returns a promise which, upon success, will be fulfilled with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
##### Returns

Invokes the provided `Callback<UpdateDeleteResult>` with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message on success, or with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object describing the error on failure.
</If>

#### appendMessage

<If lang="javascript,nodejs">
`appendMessage(message: Message, operation?: MessageOperation): Promise<UpdateDeleteResult>`
</If>

<If lang="java">
`void appendMessage(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback)`
</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).

Expand All @@ -897,13 +949,27 @@ See [updating and deleting messages: appends](/docs/messages/updates-deletes#app
| 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 lang="javascript,nodejs">
##### Returns

Returns a promise which, upon success, will be fulfilled with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
##### Returns

Invokes the provided `Callback<UpdateDeleteResult>` with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message on success, or with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object describing the error on failure.
</If>

#### getMessageVersions

<If lang="javascript,nodejs">
`getMessageVersions(serialOrMessage: string | Message, params?: Record<string, any>): Promise<PaginatedResult<Message>>`
</If>

<If lang="java">
`PaginatedResult<Message> getMessageVersions(String serial, Param[] params)`
</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).

Expand All @@ -914,11 +980,21 @@ See [updating and deleting messages: message versions](/docs/messages/updates-de
| 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 | `Record<string, any>` (optional) |
| 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 lang="javascript,nodejs">
##### Returns

Returns a promise which, upon success, will be fulfilled with a [`PaginatedResult`](#paginated-result) object containing an array of [`Message`](/docs/api/realtime-sdk/messages) objects representing all versions of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
##### Returns

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

Failure to retrieve the message versions will raise an [`AblyException`](/docs/api/realtime-sdk/types#ably-exception)
</If>

</If>

Expand Down
79 changes: 77 additions & 2 deletions src/pages/docs/api/rest-sdk/channels.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -469,25 +469,49 @@ On failure to retrieve message history, the `error` contains an [`ErrorInfo`](#e

#### getMessage <a id="get-message" />

<If lang="javascript,nodejs">
`getMessage(serialOrMessage: string | Message): Promise<Message>`
</If>

<If lang="java">
`Message getMessage(String serial)`
</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.

##### Parameters

<If lang="javascript,nodejs">
| Parameter | Description | Type |
|-----------|-------------|------|
| serialOrMessage | Either the serial identifier string of the message to retrieve, or a [`Message`](/docs/api/realtime-sdk/messages) object containing a populated `serial` field | `string` or [`Message`](/docs/api/realtime-sdk/messages) |

##### Returns

Returns a promise which, upon success, will be fulfilled with a [`Message`](/docs/api/realtime-sdk/messages) object representing the latest version of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
| Parameter | Description | Type |
|-----------|-------------|------|
| serial | Serial identifier string of the message to retrieve | `String` |

##### Returns

Returns a [`Message`](/docs/api/realtime-sdk/messages) object representing the latest version of the message.
</If>

#### updateMessage <a id="update-message" />

<If lang="javascript,nodejs">
`updateMessage(message: Message, operation?: MessageOperation, params?: Record<string, any>): Promise<UpdateDeleteResult>`
</If>

<If lang="java">
`UpdateDeleteResult updateMessage(Message message, MessageOperation operation)`
</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).

Expand All @@ -501,13 +525,27 @@ See [updating and deleting messages: updates](/docs/messages/updates-deletes#upd
| 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 query string | `Record<string, any>` (optional) |

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

Returns a promise which, upon success, will be fulfilled with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
##### Returns

Returns an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.
</If>

#### deleteMessage

<If lang="javascript,nodejs">
`deleteMessage(message: Message, operation?: MessageOperation, params?: Record<string, any>): Promise<UpdateDeleteResult>`
</If>

<If lang="java">
`UpdateDeleteResult deleteMessage(Message message, MessageOperation operation)`
</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).

Expand All @@ -521,13 +559,27 @@ See [updating and deleting messages: deletes](/docs/messages/updates-deletes#del
| 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 query string | `Record<string, any>` (optional) |

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

Returns a promise which, upon success, will be fulfilled with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
##### Returns

Returns an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.
</If>

#### appendMessage

<If lang="javascript,nodejs">
`appendMessage(message: Message, operation?: MessageOperation, params?: Record<string, any>): Promise<UpdateDeleteResult>`
</If>

<If lang="java">
`UpdateDeleteResult appendMessage(Message message, MessageOperation operation)`
</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).

Expand All @@ -543,13 +595,27 @@ See [updating and deleting messages: appends](/docs/messages/updates-deletes#app
| 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 query string | `Record<string, any>` (optional) |

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

Returns a promise which, upon success, will be fulfilled with an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
##### Returns

Returns an [`UpdateDeleteResult`](/docs/api/realtime-sdk/types#update-delete-result) object containing the new version of the message.
</If>

#### getMessageVersions

<If lang="javascript,nodejs">
`getMessageVersions(serialOrMessage: string | Message, params?: Record<string, any>): Promise<PaginatedResult<Message>>`
</If>

<If lang="java">
`PaginatedResult<Message> getMessageVersions(String serial, Param[] params)`
</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).

Expand All @@ -562,9 +628,19 @@ See [updating and deleting messages: versions](/docs/messages/updates-deletes#ve
| 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 | `Record<string, any>` (optional) |

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

Returns a promise which, upon success, will be fulfilled with a [`PaginatedResult`](#paginated-result) object containing an array of [`Message`](/docs/api/realtime-sdk/messages) objects representing all versions of the message. Upon failure, the promise will be rejected with an [`ErrorInfo`](/docs/api/realtime-sdk/types#error-info) object which explains the error.
</If>

<If lang="java">
##### Returns

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

Failure to retrieve the message versions will raise an [`AblyException`](/docs/api/realtime-sdk/types#ably-exception)
</If>

</If>

Expand Down Expand Up @@ -986,8 +1062,7 @@ console.log('Last page?: ' + nextPage.isLast());
<Code>
```nodejs
const paginatedResult = await channel.history();
conn m,./ 2
\sole.log('Page 0 item 0:' + paginatedResult.items[0].data);
console.log('Page 0 item 0:' + paginatedResult.items[0].data);
const nextPage = await paginatedResult.next();
console.log('Page 1 item 1: ' + nextPage.items[1].data);
console.log('Last page?: ' + nextPage.isLast());
Expand Down
Loading