Interface RestAnnotations

Functionality for annotating messages with small pieces of data, such as emoji reactions, that the server will roll up into the message as a summary.

Hierarchy

  • RestAnnotations

Methods

Methods

  • Publish an annotation removal request for a message, to remove it from the message's annotation summary. The semantics of a delete, and the fields it requires, differ by annotation type.

    It sets action to annotation.delete on the annotation object you pass, overwriting any action you set.

    The supplied Message must carry a populated serial. A newly constructed Message has none, so the call rejects with an ErrorInfo.

    Message annotations must be enabled for the channel's namespace by a rule, and the key or token must have the annotation-publish capability. Without either the server rejects the operation, so the call rejects with an ErrorInfo.

    Parameters

    • message: Message

      The message which has an annotation that you want to delete.

    • annotation: OutboundAnnotation

      The annotation deletion request. It must include at least the type. Other required fields depend on the type.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

    Example

    await channel.annotations.delete(message, { type: 'emoji:distinct.v1', name: '👍' });
    

    See

    https://ably.com/docs/pub-sub/api/javascript/rest/rest-annotations#annotations-delete

  • Publish an annotation removal request for a message, to remove it from the message's annotation summary. The semantics of a delete, and the fields it requires, differ by annotation type.

    It sets action to annotation.delete on the annotation object you pass, overwriting any action you set.

    The supplied serial must be a non-empty string, otherwise the call rejects with an ErrorInfo.

    Message annotations must be enabled for the channel's namespace by a rule, and the key or token must have the annotation-publish capability. Without either the server rejects the operation, so the call rejects with an ErrorInfo.

    Parameters

    • messageSerial: string

      The serial field of the message which has an annotation that you want to delete.

    • annotation: OutboundAnnotation

      The annotation deletion request. It must include at least the type. Other required fields depend on the type.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

    Example

    await channel.annotations.delete(messageSerial, { type: 'emoji:distinct.v1', name: '👍' });
    

    See

    https://ably.com/docs/pub-sub/api/javascript/rest/rest-annotations#annotations-delete

  • Publish a new annotation for a message. If the annotation specifies no action, it defaults to annotation.create.

    The supplied Message must carry a populated serial. A newly constructed Message has none, so the call rejects with an ErrorInfo.

    Message annotations must be enabled for the channel's namespace by a rule, and the key or token must have the annotation-publish capability. Without either the server rejects the operation, so the call rejects with an ErrorInfo.

    Annotation data is never encrypted, even when cipher is set, because the server must be able to read it to build summaries.

    Parameters

    • message: Message

      The message to annotate.

    • annotation: OutboundAnnotation

      The annotation to publish. It must include at least the type. Other required fields depend on the annotation type.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

    Example

    await channel.annotations.publish(message, { type: 'emoji:distinct.v1', name: '👍' });
    

    See

    https://ably.com/docs/pub-sub/api/javascript/rest/rest-annotations#annotations-publish

  • Publish a new annotation for a message. If the annotation specifies no action, it defaults to annotation.create.

    The supplied serial must be a non-empty string, otherwise the call rejects with an ErrorInfo.

    Message annotations must be enabled for the channel's namespace by a rule, and the key or token must have the annotation-publish capability. Without either the server rejects the operation, so the call rejects with an ErrorInfo.

    Annotation data is never encrypted, even when cipher is set, because the server must be able to read it to build summaries.

    Parameters

    • messageSerial: string

      The serial field of the message to annotate.

    • annotation: OutboundAnnotation

      The annotation to publish. It must include at least the type. Other required fields depend on the annotation type.

    Returns Promise<void>

    A promise which resolves upon success of the operation and rejects with an ErrorInfo object upon its failure.

    Example

    await channel.annotations.publish(messageSerial, { type: 'emoji:distinct.v1', name: '👍' });
    

    See

    https://ably.com/docs/pub-sub/api/javascript/rest/rest-annotations#annotations-publish

Generated using TypeDoc