Skip to content

Commit c408dc2

Browse files
umair-ablyclaude
andcommitted
DX-1211: declare delete() on the RestAnnotations interface
delete() has existed in the RestAnnotations implementation since 04fed9c (which declared it only on RealtimeAnnotations), so the method works at runtime but TypeScript users cannot call it. Verified live that the server accepts REST-published deletes. Co-Authored-By: Claude Fable 5 (1M context) <noreply@anthropic.com>
1 parent 189df50 commit c408dc2

1 file changed

Lines changed: 12 additions & 6 deletions

File tree

ably.d.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2728,24 +2728,30 @@ export declare interface RestAnnotations {
27282728
*/
27292729
publish(messageSerial: string, annotation: OutboundAnnotation): Promise<void>;
27302730
/**
2731-
* Publish an annotation removal request for a message, to remove it from the summary
2732-
* summaries. The semantics of the delete (and what fields are required) are different
2733-
* for each annotation type; see annotation types documentation for more details.
2731+
* Publish an annotation removal request for a message, to remove it from the message's annotation summary. The semantics of the delete (and what fields are required) are different for each annotation type; see annotation types documentation for more details. This is a {@link RestAnnotations.publish | `publish()`} with the `action` set to `annotation.delete`, and it mutates the passed annotation object to carry that action, overwriting any `action` you set. Message annotations must be enabled for the channel's namespace by a channel rule and the key or token must have the `annotation-publish` capability; without these the server rejects the operation and the call rejects with an {@link ErrorInfo}. Rejects with a hinted {@link ErrorInfo} unless the first argument is a message serial string or a {@link Message} carrying a `serial`, such as one received from a subscription or history; newly constructed `Message` objects have no serial.
27342732
*
27352733
* @param message - The message which has an annotation that you want to delete.
27362734
* @param annotation - The annotation deletion request. (Must include at least the
27372735
* `type`, other required fields depend on the type).
2736+
* @returns A promise which resolves upon success of the operation and rejects with an {@link ErrorInfo} object upon its failure.
2737+
* @example
2738+
* ```ts
2739+
* await channel.annotations.delete(message, { type: 'emoji:distinct.v1', name: '👍' });
2740+
* ```
27382741
*/
27392742
delete(message: Message, annotation: OutboundAnnotation): Promise<void>;
27402743
/**
2741-
* Publish an annotation removal request for a message, to remove it from the summary
2742-
* summaries. The semantics of the delete (and what fields are required) are different
2743-
* for each annotation type; see annotation types documentation for more details.
2744+
* Publish an annotation removal request for a message, to remove it from the message's annotation summary (alternative form where you only have the serial of the message, not a complete Message object). The semantics of the delete (and what fields are required) are different for each annotation type; see annotation types documentation for more details. This is a {@link RestAnnotations.publish | `publish()`} with the `action` set to `annotation.delete`, and it mutates the passed annotation object to carry that action, overwriting any `action` you set. Message annotations must be enabled for the channel's namespace by a channel rule and the key or token must have the `annotation-publish` capability; without these the server rejects the operation and the call rejects with an {@link ErrorInfo}. Rejects with a hinted {@link ErrorInfo} unless the first argument is a message serial string or a {@link Message} carrying a `serial`, such as one received from a subscription or history; newly constructed `Message` objects have no serial.
27442745
*
27452746
* @param messageSerial - The serial field of the message which has an annotation that
27462747
* you want to delete.
27472748
* @param annotation - The annotation deletion request. (Must include at least the
27482749
* `type`, other required fields depend on the type).
2750+
* @returns A promise which resolves upon success of the operation and rejects with an {@link ErrorInfo} object upon its failure.
2751+
* @example
2752+
* ```ts
2753+
* await channel.annotations.delete(messageSerial, { type: 'emoji:distinct.v1', name: '👍' });
2754+
* ```
27492755
*/
27502756
delete(messageSerial: string, annotation: OutboundAnnotation): Promise<void>;
27512757
/**

0 commit comments

Comments
 (0)