import{Duplex}from'stream';import{CancellablePromise}from'./call';import{CallOptions}from'./gax';import{GoogleError}from'./googleError';import{Operation}from'./longRunningCalls/longrunning';// gRPC functions return object with `.cancel()` method that can be used for// canceling the ongoing call.exportinterfaceGRPCCallResult{cancel():void;}// All GAX calls take RequestType and return ResultTuple, which can contain up// to three elements. The first element is always a response (post-processed for// special types of call such as pagination or long-running), the second// parameter is defined for paginated calls and stores the next page request// object, the third parameter stores raw (unprocessed) response object in cases// when it might be useful for users.exportinterfaceRequestType{}exporttype ResponseType ={}|null;exporttype NextPageRequestType ={[index:string]:string;}|null;exporttype RawResponseType = Operation |{};exporttype ResultTuple =[
ResponseType,
NextPageRequestType | undefined,
RawResponseType | undefined
];exportinterfaceSimpleCallbackFunction{(argument: RequestType, callback: APICallback): GRPCCallResult;}exporttypeAPICallback=(
err: GoogleError |null,
response?: ResponseType,
next?: NextPageRequestType,
rawResponse?: RawResponseType
)=>void;// The following five types mimic various gRPC calls (regular UnaryCall and// various streaming calls).exporttypeUnaryCall=(
argument:{},
metadata:{},
options:{},
callback: APICallback
)=> GRPCCallResult;exporttypeServerStreamingCall=(
argument:{},
metadata:{},
options:{})=> Duplex & GRPCCallResult;exporttypeClientStreamingCall=(
metadata:{},
options:{},
callback?: APICallback
)=> Duplex & GRPCCallResult;exporttypeBiDiStreamingCall=(
metadata:{},
options:{})=> Duplex & GRPCCallResult;exporttype GRPCCall =| UnaryCall
| ServerStreamingCall
| ClientStreamingCall
| BiDiStreamingCall;// GAX wraps gRPC calls so that the wrapper functions return either a// cancellable promise, or a stream (also cancellable!)exporttype CancellableStream = Duplex & GRPCCallResult;exporttype GaxCallResult = CancellablePromise<ResultTuple>| CancellableStream;exportinterfaceGaxCallPromise{(
argument:{},
callOptions?: CallOptions,
callback?: APICallback
): CancellablePromise<ResultTuple>;}exportinterfaceGaxCallStream{(
argument:{},
callOptions?: CallOptions,
callback?: APICallback
): CancellableStream;}exportinterfaceGaxCall{(
argument:{},
callOptions?: CallOptions,
callback?: APICallback
): GaxCallResult;}exportinterfaceGRPCCallOtherArgs{
options?:{deadline?: Date};
headers?:{};
metadataBuilder:(abTests?:{}, headers?:{})=>{};}