Table of Contents

Interface IGatewayApi

Namespace
Virtufin.Api.Client
Assembly
Virtufin.Api.Client.dll

The gateway itself: service discovery and typed dispatch to a backend service.

public interface IGatewayApi

Methods

GetPayloadSchemaAsync(GetPayloadSchemaRequest, CancellationToken)

A payload schema by content type (its current one) or by hash; null when there is none (or no gateway).

Task<PayloadSchema?> GetPayloadSchemaAsync(GetPayloadSchemaRequest request, CancellationToken cancellationToken = default)

Parameters

request GetPayloadSchemaRequest
cancellationToken CancellationToken

Returns

Task<PayloadSchema>

InvokeAsync<TRequest, TResponse>(string, string, TRequest, MessageParser<TResponse>, TimeSpan?, CancellationToken)

Calls method on the backend service through Gateway.Invoke, protobuf bytes in and out. A backend failure the gateway reports in-band (its status/message) is thrown as GatewayInvokeException. No JSON and no reflection: safe under NativeAOT, unlike the dynamic client.service.Method(dictionary) form. parser is the response message's Parser (e.g. CreateWorkerResponse.Parser); a null timeout leaves the deadline to the gateway's default (30 s).

Task<TResponse> InvokeAsync<TRequest, TResponse>(string service, string method, TRequest request, MessageParser<TResponse> parser, TimeSpan? timeout = null, CancellationToken cancellationToken = default) where TRequest : IMessage where TResponse : IMessage<TResponse>

Parameters

service string
method string
request TRequest
parser MessageParser<TResponse>
timeout TimeSpan?
cancellationToken CancellationToken

Returns

Task<TResponse>

Type Parameters

TRequest
TResponse

ListPayloadSchemasAsync(CancellationToken)

Every registered payload content type, without the schemas' bytes; empty without a gateway.

Task<IReadOnlyList<PayloadSchemaEntry>> ListPayloadSchemasAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<IReadOnlyList<PayloadSchemaEntry>>

ListServicesAsync(CancellationToken)

Task<List<string>> ListServicesAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

Returns

Task<List<string>>

RegisterPayloadSchemaAsync(PayloadSchema, CancellationToken)

Registers the schema of a binary payload the caller emits (openspec api-gateway, Payload Schema Registry); registering the same schema again changes nothing. The default does nothing: an in-process host has no gateway registry. ApiClient registers with the gateway.

Task<RegisterPayloadSchemaResponse> RegisterPayloadSchemaAsync(PayloadSchema schema, CancellationToken cancellationToken = default)

Parameters

schema PayloadSchema
cancellationToken CancellationToken

Returns

Task<RegisterPayloadSchemaResponse>