@protobuf-ts/twirp-transport
Version:
Twirp transport for clients generated by the protoc plugin "protobuf-ts".
36 lines (35 loc) • 1.6 kB
TypeScript
import { TwirpOptions } from "./twirp-options";
import { ClientStreamingCall, DuplexStreamingCall, MethodInfo, RpcOptions, RpcTransport, ServerStreamingCall, UnaryCall } from "@protobuf-ts/runtime-rpc";
/**
* Implements the Twirp protocol, supporting JSON or binary format on
* the wire. Uses the fetch API to do the HTTP requests.
*
* See https://twitchtv.github.io/twirp/docs/spec_v5.html
*/
export declare class TwirpFetchTransport implements RpcTransport {
protected readonly defaultOptions: TwirpOptions;
constructor(options: TwirpOptions);
mergeOptions(options?: Partial<RpcOptions>): RpcOptions;
unary<I extends object, O extends object>(method: MethodInfo<I, O>, input: I, options: RpcOptions): UnaryCall<I, O>;
/**
* Create an URI for a RPC call.
*
* Takes the `baseUrl` option and appends:
* - slash "/"
* - package name
* - dot "."
* - service name
* - slash "/"
* - method name
*
* If the service was declared without a package, the package name and dot
* are omitted.
*
* The method name is CamelCased just as it would be in Go, unless the
* option `useProtoMethodName` is `true`.
*/
protected makeUrl(method: MethodInfo, options: TwirpOptions): string;
clientStreaming<I extends object, O extends object>(method: MethodInfo<I, O>): ClientStreamingCall<I, O>;
duplex<I extends object, O extends object>(method: MethodInfo<I, O>): DuplexStreamingCall<I, O>;
serverStreaming<I extends object, O extends object>(method: MethodInfo<I, O>): ServerStreamingCall<I, O>;
}