1 |
|
2 | import { ClientDuplexStream, ClientReadableStream, ClientUnaryCall, ClientWritableStream, ServiceError, SurfaceCall } from './call';
|
3 | import { CallCredentials } from './call-credentials';
|
4 | import { Channel } from './channel';
|
5 | import { ChannelCredentials } from './channel-credentials';
|
6 | import { ChannelOptions } from './channel-options';
|
7 | import { Metadata } from './metadata';
|
8 | import { ClientMethodDefinition } from './make-client';
|
9 | import { Interceptor, InterceptorProvider } from './client-interceptors';
|
10 | import { ServerUnaryCall, ServerReadableStream, ServerWritableStream, ServerDuplexStream } from './server-call';
|
11 | import { Deadline } from './deadline';
|
12 | declare const CHANNEL_SYMBOL: unique symbol;
|
13 | declare const INTERCEPTOR_SYMBOL: unique symbol;
|
14 | declare const INTERCEPTOR_PROVIDER_SYMBOL: unique symbol;
|
15 | declare const CALL_INVOCATION_TRANSFORMER_SYMBOL: unique symbol;
|
16 | export interface UnaryCallback<ResponseType> {
|
17 | (err: ServiceError | null, value?: ResponseType): void;
|
18 | }
|
19 | export interface CallOptions {
|
20 | deadline?: Deadline;
|
21 | host?: string;
|
22 | parent?: ServerUnaryCall<any, any> | ServerReadableStream<any, any> | ServerWritableStream<any, any> | ServerDuplexStream<any, any>;
|
23 | propagate_flags?: number;
|
24 | credentials?: CallCredentials;
|
25 | interceptors?: Interceptor[];
|
26 | interceptor_providers?: InterceptorProvider[];
|
27 | }
|
28 | export interface CallProperties<RequestType, ResponseType> {
|
29 | argument?: RequestType;
|
30 | metadata: Metadata;
|
31 | call: SurfaceCall;
|
32 | channel: Channel;
|
33 | methodDefinition: ClientMethodDefinition<RequestType, ResponseType>;
|
34 | callOptions: CallOptions;
|
35 | callback?: UnaryCallback<ResponseType>;
|
36 | }
|
37 | export interface CallInvocationTransformer {
|
38 | (callProperties: CallProperties<any, any>): CallProperties<any, any>;
|
39 | }
|
40 | export type ClientOptions = Partial<ChannelOptions> & {
|
41 | channelOverride?: Channel;
|
42 | channelFactoryOverride?: (address: string, credentials: ChannelCredentials, options: ClientOptions) => Channel;
|
43 | interceptors?: Interceptor[];
|
44 | interceptor_providers?: InterceptorProvider[];
|
45 | callInvocationTransformer?: CallInvocationTransformer;
|
46 | };
|
47 |
|
48 |
|
49 |
|
50 |
|
51 | export declare class Client {
|
52 | private readonly [CHANNEL_SYMBOL];
|
53 | private readonly [INTERCEPTOR_SYMBOL];
|
54 | private readonly [INTERCEPTOR_PROVIDER_SYMBOL];
|
55 | private readonly [CALL_INVOCATION_TRANSFORMER_SYMBOL]?;
|
56 | constructor(address: string, credentials: ChannelCredentials, options?: ClientOptions);
|
57 | close(): void;
|
58 | getChannel(): Channel;
|
59 | waitForReady(deadline: Deadline, callback: (error?: Error) => void): void;
|
60 | private checkOptionalUnaryResponseArguments;
|
61 | makeUnaryRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, options: CallOptions, callback: UnaryCallback<ResponseType>): ClientUnaryCall;
|
62 | makeUnaryRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, callback: UnaryCallback<ResponseType>): ClientUnaryCall;
|
63 | makeUnaryRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, options: CallOptions, callback: UnaryCallback<ResponseType>): ClientUnaryCall;
|
64 | makeUnaryRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, callback: UnaryCallback<ResponseType>): ClientUnaryCall;
|
65 | makeClientStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, options: CallOptions, callback: UnaryCallback<ResponseType>): ClientWritableStream<RequestType>;
|
66 | makeClientStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, callback: UnaryCallback<ResponseType>): ClientWritableStream<RequestType>;
|
67 | makeClientStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, options: CallOptions, callback: UnaryCallback<ResponseType>): ClientWritableStream<RequestType>;
|
68 | makeClientStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, callback: UnaryCallback<ResponseType>): ClientWritableStream<RequestType>;
|
69 | private checkMetadataAndOptions;
|
70 | makeServerStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, metadata: Metadata, options?: CallOptions): ClientReadableStream<ResponseType>;
|
71 | makeServerStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, argument: RequestType, options?: CallOptions): ClientReadableStream<ResponseType>;
|
72 | makeBidiStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, metadata: Metadata, options?: CallOptions): ClientDuplexStream<RequestType, ResponseType>;
|
73 | makeBidiStreamRequest<RequestType, ResponseType>(method: string, serialize: (value: RequestType) => Buffer, deserialize: (value: Buffer) => ResponseType, options?: CallOptions): ClientDuplexStream<RequestType, ResponseType>;
|
74 | }
|
75 | export {};
|