UNPKG

2.87 kBTypeScriptView Raw
1/**
2 * Copyright 2020 Google LLC
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16/// <reference types="node" />
17import { Duplex } from 'stream';
18import { CancellablePromise } from './call';
19import { CallOptions } from './gax';
20import { GoogleError } from './googleError';
21import { Operation } from './longRunningCalls/longrunning';
22export interface GRPCCallResult {
23 cancel(): void;
24}
25export interface RequestType {
26 [index: string]: string | number | RequestType | Array<string | number | RequestType>;
27}
28export declare type ResponseType = {} | null;
29export declare type NextPageRequestType = {
30 [index: string]: string | number | {};
31} | null;
32export declare type RawResponseType = Operation | {} | null;
33export declare type ResultTuple = [ResponseType | [ResponseType], NextPageRequestType | undefined, RawResponseType | undefined];
34export interface SimpleCallbackFunction {
35 (request: RequestType, callback: APICallback): GRPCCallResult;
36}
37export declare type APICallback = (err: GoogleError | null, response?: ResponseType, next?: NextPageRequestType, rawResponse?: RawResponseType) => void;
38export declare type UnaryCall = (argument: {}, metadata: {}, options: {}, callback: APICallback) => GRPCCallResult;
39export declare type ServerStreamingCall = (argument: {}, metadata: {}, options: {}) => Duplex & GRPCCallResult;
40export declare type ClientStreamingCall = (metadata: {}, options: {}, callback?: APICallback) => Duplex & GRPCCallResult;
41export declare type BiDiStreamingCall = (metadata: {}, options: {}) => Duplex & GRPCCallResult;
42export declare type GRPCCall = UnaryCall | ServerStreamingCall | ClientStreamingCall | BiDiStreamingCall;
43export declare type CancellableStream = Duplex & GRPCCallResult;
44export declare type GaxCallResult = CancellablePromise<ResultTuple> | CancellableStream;
45export interface GaxCallPromise {
46 (argument: {}, callOptions?: CallOptions, callback?: APICallback): CancellablePromise<ResultTuple>;
47}
48export interface GaxCallStream {
49 (argument: {}, callOptions?: CallOptions, callback?: APICallback): CancellableStream;
50}
51export interface GaxCall {
52 (argument: {}, callOptions?: CallOptions, callback?: APICallback): GaxCallResult;
53}
54export interface GRPCCallOtherArgs {
55 options?: {
56 deadline?: Date;
57 };
58 headers?: {};
59 metadataBuilder: (abTests?: {}, headers?: {}) => {};
60}