Exposes the Ocelloids Agent API.

Type Parameters

  • T

Methods

  • Lists all subscriptions.

    Parameters

    • Optionaloptions: Options

      The ky request options (fetch compatible)

    Returns Promise<Subscription<T>[]>

    A promise that resolves with an array of subscriptions.

  • Creates a subscription.

    Parameters

    • subscription: Omit<Subscription<T>, "agent">

      The subscription to create.

    • Optionaloptions: Options

      The ky request options (fetch compatible)

    Returns Promise<unknown>

    A promise that resolves when the subscription is created.

  • Deletes a subscription.

    Parameters

    • id: string

      The subscription ID.

    • Optionaloptions: Options

      The ky request options (fetch compatible)

    Returns Promise<unknown>

  • Gets a subscription by its ID.

    Parameters

    • id: string

      The subscription ID.

    • Optionaloptions: Options

      The ky request options (fetch compatible)

    Returns Promise<Subscription<T>>

    A promise that resolves with the subscription or rejects if not found.

  • Executes a query on the specified agent.

    Type Parameters

    • P = AnyQueryArgs
    • R = AnyQueryResultItem

    Parameters

    • args: P

      The query arguments.

    • Optionalpagination: QueryPagination

      The pagination configuration.

    • Optionaloptions: Options

      The ky request options (fetch compatible).

    Returns Promise<QueryResult<R>>

    A promise that resolves to the results of the query.

  • Creates an on-demand subscription or connects to an existing one.

    Type Parameters

    • P = AnyJson

    Parameters

    Returns Promise<WebSocket>

    A promise that resolves with the WebSocket instance.