Table of Contents

Namespace Virtufin.Api.Client

Classes

ApiClient

High-level API client for the Virtufin Gateway. Provides synchronous and asynchronous access to gateway operations.

ApiEndpoint

Configuration constants for the virtufin-api gRPC endpoint that other services call. The endpoint is configured via env vars (HostEnvVar and PortEnvVar) with defaults suitable for local development.

CloudEvents

Constants for CloudEvents v1.0 metadata keys and standard values. Used by services that publish lifecycle events to the virtufin-api via Pubsub.PublishEvent with the per-service topic name from the publishing service's Configuration/Topics.cs. All values are spelled per the CloudEvents v1.0 spec (https://github.com/cloudevents/spec/blob/v1.0/spec.md).

GatewayClient

Dynamic proxy for the API Gateway. Service names are accessed as properties, and backend RPC methods are called dynamically on the returned ServiceClient.

client.Gateway.workmanager triggers TryGetMember(GetMemberBinder, out object?), which creates or returns a cached ServiceClient for "workmanager". service.ListWorkers() triggers TryGetMember(GetMemberBinder, out object?), which returns a callable that invokes via the Gateway's InvokeJson RPC.

Provides service discovery, method listing, invocation, publishing, and streaming capabilities.

PortConstants
ServiceClient

Dynamic client for invoking methods on a specific service through the gateway. Allows syntax like: client.Gateway.workmanager.SomeMethod().

RPC method names are accessed as dynamic members. Each member returns a Func<Dictionary, Task<Dictionary>> that invokes the method via the Gateway's InvokeJson RPC.

ServiceClient instances are created by TryGetMember(GetMemberBinder, out object?) (i.e. client.Gateway.workmanager) and cached per service name.

StreamEventHandler

Handles stream events with callback methods.

Interfaces

IAsyncStreamEventHandler

Async callback interface for receiving stream events. Handlers that implement this interface are awaited by SubscribeAsync(IStreamEventHandler, IEnumerable<string>?, IEnumerable<string>?, IEnumerable<string>?, CancellationToken), preventing slow handlers from causing gRPC stream backpressure.

IStreamEventHandler

Callback interface for receiving stream events.