Interface RestObject

Enables REST-based operations on Objects on a channel.

Hierarchy

  • RestObject

Methods

  • Reads object data from the channel in compact object response format. If no objectId is provided then the entire channel object is returned.

    Returns a RestObjectGetCompactResult representing the logical structure of your data as a JSON-like value. LiveMap instances appear as JSON objects with their entries, and LiveCounter instances appear as numbers. Binary values appear as base64 strings (JSON protocol) or Buffer/ArrayBuffer (binary protocol). JSON-typed values remain as their JSON-encoded string representation.

    Cyclic references are included as { objectId: string } rather than including the same object instance in the result more than once.

    Parameters

    Returns Promise<RestObjectGetCompactResult>

    A promise which, upon success, will be fulfilled with the object data in compact format. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

  • Reads object data from the channel in full object response format. If no objectId is provided then the entire channel object is returned.

    Returns a RestObjectGetFullResult with full object metadata and decoded object data values (bytes decoded to Buffer/ArrayBuffer, json decoded to native objects/arrays). If the path resolves to a leaf value in a map, returns the decoded ObjectData directly.

    Cyclic references are included as { objectId: string } rather than including the same object instance in the result more than once.

    Parameters

    Returns Promise<RestObjectGetFullResult>

    A promise which, upon success, will be fulfilled with the object data in full format. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

  • Reads object data from the channel. If no objectId is provided then the entire channel object is returned.

    When compact is true (the default), returns a RestObjectGetCompactResult representing the logical structure of your data as a JSON-like value. LiveMap instances appear as JSON objects with their entries, and LiveCounter instances appear as numbers. Binary values appear as base64 strings (JSON protocol) or Buffer/ArrayBuffer (binary protocol). JSON-typed values remain as their JSON-encoded string representation.

    When compact is false, returns a RestObjectGetFullResult with full object metadata and decoded object data values (bytes decoded to Buffer/ArrayBuffer, json decoded to native objects/arrays). If the path resolves to a leaf value in a map, returns the decoded ObjectData directly.

    For both formats, cyclic references in the channel object are included as { objectId: string } rather than including the same object instance in the result more than once.

    Parameters

    • Optional params: RestObjectGetParams

      Optional parameters to specify the object to fetch and the format of the returned data.

    Returns Promise<RestObjectGetCompactResult | RestObjectGetFullResult>

    A promise which, upon success, will be fulfilled with the object data in the requested format. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

  • Publishes one or more operations to modify objects on the channel. When an array is provided, all operations are published as an atomic batch.

    Operations can target objects using objectId, path, or neither (for create operations that create standalone objects):

    • objectId: The unique identifier of the object instance to create or update.
    • path: The path to the object instance within the channel object.

    Use dot-separated notation for paths (for example votes.up), relative to the channel object. An empty path "" refers to the channel object itself. Paths can contain wildcards (*) to target multiple objects at once. Wildcards match exactly one level in the channel object and can appear at the end or middle of paths (for example votes.* or posts.*.votes.up). If a key contains a dot, escape it with a backslash (for example posts.post\\.123.votes.up).

    When using path operations, the server resolves object IDs at the time it receives the request. If the object instances at the specified path change due to concurrent updates before the server processes the operation, the operation is not applied to the new object instances.

    Parameters

    Returns Promise<RestObjectPublishResult>

    A promise which, upon success, will be fulfilled with a RestObjectPublishResult containing information about the published operations. Upon failure, the promise will be rejected with an ErrorInfo object which explains the error.

Generated using TypeDoc