API client for interacting with the Virtufin Gateway service. Provides service discovery, method invocation, and event subscription capabilities.

Constructors

Methods

  • Aborts all shared reply-topic readers. Call when the client is no longer needed; pending publishWithResult callers will time out.

    Returns void

  • Gets the schema for a specific method.

    Parameters

    • service: string

      The name of the service.

    • method: string

      The name of the method.

    • type: string

      The type of schema to retrieve (e.g., "request" or "response").

    Returns Promise<GetMethodSchemaResponse>

    A promise resolving to the GetMethodSchemaResponse.

  • Invokes a method on a backend service using raw protobuf bytes.

    Parameters

    • service: string

      The name of the target service.

    • method: string

      The name of the method to invoke.

    • requestData: Uint8Array

      The serialized protobuf request data as Uint8Array.

    Returns Promise<InvokeResponse>

    A promise resolving to the InvokeResponse.

  • Invokes a method on a backend service using JSON request/response data. This is the recommended method for most use cases.

    Parameters

    • service: string

      The name of the target service.

    • method: string

      The name of the method to invoke.

    • requestData: string

      The JSON serialized request data as string.

    Returns Promise<InvokeJsonResponse>

    A promise resolving to the InvokeJsonResponse.

  • Lists all methods available for a specific service.

    Parameters

    • service: string

      The name of the service to query.

    Returns Promise<ListMethodsResponse>

    A promise resolving to the ListMethodsResponse containing method information.

  • Lists all available services registered with the gateway.

    Returns Promise<ListServicesResponse>

    A promise resolving to the ListServicesResponse containing service names.

  • Publishes a CloudEvent to a topic via the Pubsub service.

    Parameters

    • topic: string

      The topic name.

    • cloudevent: CloudEvent

      The CloudEvent message to publish.

    Returns Promise<PublishResponse>

    A promise resolving to the PublishResponse.

  • Publishes to a topic and waits for a correlated response on a reply topic. Implements the request-reply pattern over pub/sub using correlation IDs, via the shared per-reply-topic reader started by ensureReplyReader (see its documentation for why the stream is shared rather than per call).

    Parameters

    • topic: string

      The topic to publish the request to. *

    • cloudevent: CloudEvent

      The CloudEvent message to publish. *

    • replyTopic: string

      The topic to listen for responses on. *

    • Optionalopts: { correlationId?: string; timeout?: number }

      Options: timeout (ms, default 30000), correlationId. *

    Returns Promise<SubscribeResponse>

    A promise resolving to the matching SubscribeResponse. *

    TimeoutError if no response arrives within the timeout.

  • Subscribes to a single pub/sub topic via the Pubsub service.

    Parameters

    • topic: string

      The topic name.

    Returns AsyncIterable<SubscribeResponse>

    An async iterable yielding SubscribeResponse messages.

  • Subscribes to multiple pub/sub topics via the Pubsub service.

    Parameters

    • topics: string[]

      List of topic names to subscribe to.

    Returns AsyncIterable<SubscribeResponse>

    An async iterable yielding SubscribeResponse messages.