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 | import { Descriptor } from '../descriptor';
|
17 | import { CallSettings } from '../gax';
|
18 | import { NormalApiCaller } from '../normalCalls/normalApiCaller';
|
19 | import { BundleApiCaller } from './bundleApiCaller';
|
20 | /**
|
21 | * A descriptor for calls that can be bundled into one call.
|
22 | */
|
23 | export declare class BundleDescriptor implements Descriptor {
|
24 | bundledField: string;
|
25 | requestDiscriminatorFields: string[];
|
26 | subresponseField: string | null;
|
27 | byteLengthFunction: Function;
|
28 | /**
|
29 | * Describes the structure of bundled call.
|
30 | *
|
31 | * requestDiscriminatorFields may include '.' as a separator, which is used to
|
32 | * indicate object traversal. This allows fields in nested objects to be used
|
33 | * to determine what request to bundle.
|
34 | *
|
35 | * @property {String} bundledField
|
36 | * @property {String} requestDiscriminatorFields
|
37 | * @property {String} subresponseField
|
38 | * @property {Function} byteLengthFunction
|
39 | *
|
40 | * @param {String} bundledField - the repeated field in the request message
|
41 | * that will have its elements aggregated by bundling.
|
42 | * @param {String} requestDiscriminatorFields - a list of fields in the
|
43 | * target request message class that are used to detemrine which request
|
44 | * messages should be bundled together.
|
45 | * @param {String} subresponseField - an optional field, when present it
|
46 | * indicates the field in the response message that should be used to
|
47 | * demultiplex the response into multiple response messages.
|
48 | * @param {Function} byteLengthFunction - a function to obtain the byte
|
49 | * length to be consumed for the bundled field messages. Because Node.JS
|
50 | * protobuf.js/gRPC uses builtin Objects for the user-visible data and
|
51 | * internally they are encoded/decoded in protobuf manner, this function
|
52 | * is actually necessary to calculate the byte length.
|
53 | * @constructor
|
54 | */
|
55 | constructor(bundledField: string, requestDiscriminatorFields: string[], subresponseField: string | null, byteLengthFunction: Function);
|
56 | getApiCaller(settings: CallSettings): NormalApiCaller | BundleApiCaller;
|
57 | }
|