Creates a new ApiClient instance.
Configuration options for the client.
Gets the schema for a specific method.
The name of the service.
The name of the method.
The type of schema to retrieve (e.g., "request" or "response").
A promise resolving to the GetMethodSchemaResponse.
Invokes a method on a backend service using raw protobuf bytes.
The name of the target service.
The name of the method to invoke.
The serialized protobuf request data as Uint8Array.
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.
The name of the target service.
The name of the method to invoke.
The JSON serialized request data as string.
A promise resolving to the InvokeJsonResponse.
Lists all methods available for a specific service.
The name of the service to query.
A promise resolving to the ListMethodsResponse containing method information.
Lists all available services registered with the gateway.
A promise resolving to the ListServicesResponse containing service names.
Publishes an event to a topic via the Pubsub service.
The topic name.
The event data as Uint8Array.
Optionalmetadata: Record<string, string>Optional metadata key-value pairs (CloudEvents extensions).
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.
The Subscribe RPC is initiated and the server's response headers are awaited BEFORE the publish, so that the server-side PubsubService.Subscribe handler is running and the Dapr subscription is registered with daprd by the time we publish. The server sends its gRPC initial metadata eagerly via WriteResponseHeadersAsync once the dapr subscription is registered, so the onHeader callback is the readiness signal we use here.
Without this, a fast worker (e.g. WSM controller in virtufin-examples) can publish the response to the reply topic before the server-side subscription chain is established, causing the response to be dropped after the client has already torn down the gRPC stream on timeout — the "Error processing Redis message ...: context canceled" race that broke Run 2 of the Binance example.
The topic to publish the request to.
The event data as Uint8Array.
The topic to listen for responses on.
Optionalopts: { correlationId?: string; metadata?: Record<string, string>; timeout?: number }Options: timeout (ms, default 30000), metadata, correlationId.
A promise resolving to the matching PubsubSubscribeResponse.
Subscribes to events from specified services and topics.
List of service names to subscribe to (empty for all).
List of topics to subscribe to (empty for all).
List of event types to subscribe to (empty for all).
An async iterable yielding TopicEventRequest messages.
Subscribes to a pub/sub topic via the Pubsub service.
The topic name.
An async iterable yielding PubsubSubscribeResponse messages.
API client for interacting with the Virtufin Gateway service. Provides service discovery, method invocation, and event subscription capabilities.