import type { DescMessage, DescService, MessageInitShape, MessageShape, DescMethodBiDiStreaming, DescMethodClientStreaming, DescMethodServerStreaming, DescMethodUnary } from "@bufbuild/protobuf"; import type { Transport } from "./transport.js"; import type { CallOptions } from "./call-options.js"; /** * Client is a simple client that supports unary and server-streaming * methods. Methods will produce a promise for the response message, * or an asynchronous iterable of response messages. */ export type Client = { [P in keyof Desc["method"]]: Desc["method"][P] extends DescMethodUnary ? (request: MessageInitShape, options?: CallOptions) => Promise> : Desc["method"][P] extends DescMethodServerStreaming ? (request: MessageInitShape, options?: CallOptions) => AsyncIterable> : Desc["method"][P] extends DescMethodClientStreaming ? (request: AsyncIterable>, options?: CallOptions) => Promise> : Desc["method"][P] extends DescMethodBiDiStreaming ? (request: AsyncIterable>, options?: CallOptions) => AsyncIterable> : never; }; /** * Create a Client for the given service, invoking RPCs through the * given transport. */ export declare function createClient(service: T, transport: Transport): Client; /** * UnaryFn is the method signature for a unary method of a PromiseClient. */ type UnaryFn = (request: MessageInitShape, options?: CallOptions) => Promise>; export declare function createUnaryFn(transport: Transport, method: DescMethodUnary): UnaryFn; /** * ServerStreamingFn is the method signature for a server-streaming method of * a PromiseClient. */ type ServerStreamingFn = (request: MessageInitShape, options?: CallOptions) => AsyncIterable>; export declare function createServerStreamingFn(transport: Transport, method: DescMethodServerStreaming): ServerStreamingFn; /** * ClientStreamFn is the method signature for a client streaming method of a * PromiseClient. */ type ClientStreamingFn = (request: AsyncIterable>, options?: CallOptions) => Promise>; export declare function createClientStreamingFn(transport: Transport, method: DescMethodClientStreaming): ClientStreamingFn; /** * BiDiStreamFn is the method signature for a bi-directional streaming method * of a PromiseClient. */ type BiDiStreamingFn = (request: AsyncIterable>, options?: CallOptions) => AsyncIterable>; export declare function createBiDiStreamingFn(transport: Transport, method: DescMethodBiDiStreaming): BiDiStreamingFn; export {};