UNPKG

1.76 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 */
16import { GaxCall, GRPCCall } from './apitypes';
17import { Descriptor } from './descriptor';
18import { CallSettings } from './gax';
19/**
20 * Converts an rpc call into an API call governed by the settings.
21 *
22 * In typical usage, `func` will be a promise to a callable used to make an rpc
23 * request. This will mostly likely be a bound method from a request stub used
24 * to make an rpc call. It is not a direct function but a Promise instance,
25 * because of its asynchronism (typically, obtaining the auth information).
26 *
27 * The result is a function which manages the API call with the given settings
28 * and the options on the invocation.
29 *
30 * @param {Promise<GRPCCall>|GRPCCall} func - is either a promise to be used to make
31 * a bare RPC call, or just a bare RPC call.
32 * @param {CallSettings} settings - provides the settings for this call
33 * @param {Descriptor} descriptor - optionally specify the descriptor for
34 * the method call.
35 * @return {GaxCall} func - a bound method on a request stub used
36 * to make an rpc call.
37 */
38export declare function createApiCall(func: Promise<GRPCCall> | GRPCCall, settings: CallSettings, descriptor?: Descriptor): GaxCall;