Global

Members

ALL_SCOPES

The scopes needed to make gRPC calls to all of the methods defined in this service.

StreamType

The type of gRPC streaming.

StreamType[undefined]

Client sends a single request, server streams responses.

StreamType[undefined]

Client streams requests, server returns a single response.

StreamType[undefined]

Both client and server stream objects.

__createBinding

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2021 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2021 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2022 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

__createBinding

Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

(constant) apiCaller_1

Provides function wrappers that implement page streaming and retrying.

(constant) gapicConfig

This file defines retry strategy and timeouts for all API methods in this library.

Methods

at(field, obj)

Given an object field path that may contain dots, dig into the obj and find the value at the given path.

Parameters:
Name Type Description
field

Path to the property with . notation

obj

The object to traverse

Returns:
Type Description

the value at the given path

Example
const obj = {
  a: {
    b: 5
  }
}
const id = at(obj, 'a.b');
// id = 5

camelToSnakeCase()

Converts a given string from camelCase (used by protobuf.js and in JSON) to snake_case (normally used in proto definitions).

capitalize()

Capitalizes the first character of the given string.

computeBundleId(obj, discriminatorFields) → {String|undefined}

Compute the identifier of the obj. The objects of the same ID will be bundled together.

Parameters:
Name Type Description
obj RequestType

The request object.

discriminatorFields Array.<String>

The array of field names. A field name may include '.' as a separator, which is used to indicate object traversal.

Returns:
Type Description
String | undefined
  • the identifier string, or undefined if any discriminator fields do not exist.

constructSettings(serviceName, clientConfig, configOverrides, retryNames, otherArgs) → {Object}

Constructs a dictionary mapping method names to CallSettings.

The clientConfig parameter is parsed from a client configuration JSON file of the form:

{
  "interfaces": {
    "google.fake.v1.ServiceName": {
      "retry_codes": {
        "idempotent": ["UNAVAILABLE", "DEADLINE_EXCEEDED"],
        "non_idempotent": []
      },
      "retry_params": {
        "default": {
          "initial_retry_delay_millis": 100,
          "retry_delay_multiplier": 1.2,
          "max_retry_delay_millis": 1000,
          "initial_rpc_timeout_millis": 2000,
          "rpc_timeout_multiplier": 1.5,
          "max_rpc_timeout_millis": 30000,
          "total_timeout_millis": 45000
        }
      },
      "methods": {
        "CreateFoo": {
          "retry_codes_name": "idempotent",
          "retry_params_name": "default"
        },
        "Publish": {
          "retry_codes_name": "non_idempotent",
          "retry_params_name": "default",
          "bundling": {
            "element_count_threshold": 40,
            "element_count_limit": 200,
            "request_byte_threshold": 90000,
            "request_byte_limit": 100000,
            "delay_threshold_millis": 100
          }
        }
      }
    }
  }
}
Parameters:
Name Type Description
serviceName String

The fully-qualified name of this service, used as a key into the client config file (in the example above, this value should be 'google.fake.v1.ServiceName').

clientConfig Object

A dictionary parsed from the standard API client config file.

configOverrides Object

A dictionary in the same structure of client_config to override the settings.

retryNames Object.<string, Array.<string>>

A dictionary mapping the strings referring to response status codes to objects representing those codes.

otherArgs Object

the non-request arguments to be passed to the API calls.

Returns:
Type Description
Object

A mapping from method name to CallSettings, or null if the service is not found in the config.

convertRetryOptions(options) → {CallOptions}

Validates passed retry options in preparation for eventual parameter deprecation converts retryRequestOptions to retryOptions then sets retryRequestOptions to null

Parameters:
Name Type Description
options CallOptions

a list of passed retry option

Returns:
Type Description
CallOptions

A new CallOptions object.

createApiCall(func, settings, descriptor, _fallback) → {GaxCall}

Converts an rpc call into an API call governed by the settings.

In typical usage, func will be a promise to a callable used to make an rpc request. This will mostly likely be a bound method from a request stub used to make an rpc call. It is not a direct function but a Promise instance, because of its asynchronism (typically, obtaining the auth information).

The result is a function which manages the API call with the given settings and the options on the invocation.

Parameters:
Name Type Description
func Promise.<GRPCCall> | GRPCCall

is either a promise to be used to make a bare RPC call, or just a bare RPC call.

settings CallSettings

provides the settings for this call

descriptor Descriptor

optionally specify the descriptor for the method call.

_fallback
Returns:
Type Description
GaxCall

func - a bound method on a request stub used to make an rpc call.

createApiCall(func, settings, descriptor, _fallback) → {GaxCall}

gRPC-fallback version of createApiCall

Converts an rpc call into an API call governed by the settings.

In typical usage, func will be a promise to a callable used to make an rpc request. This will mostly likely be a bound method from a request stub used to make an rpc call. It is not a direct function but a Promise instance, because of its asynchronism (typically, obtaining the auth information).

The result is a function which manages the API call with the given settings and the options on the invocation.

Throws exception on unsupported streaming calls

Parameters:
Name Type Description
func Promise.<GRPCCall> | GRPCCall

is either a promise to be used to make a bare RPC call, or just a bare RPC call.

settings CallSettings

provides the settings for this call

descriptor Descriptor

optionally specify the descriptor for the method call.

_fallback
Returns:
Type Description
GaxCall

func - a bound method on a request stub used to make an rpc call.

createBackoffSettings(initialRetryDelayMillis, retryDelayMultiplier, maxRetryDelayMillis, initialRpcTimeoutMillis, rpcTimeoutMultiplier, maxRpcTimeoutMillis, totalTimeoutMillis) → {BackoffSettings}

Parameters to the exponential backoff algorithm for retrying.

Parameters:
Name Type Description
initialRetryDelayMillis number

the initial delay time, in milliseconds, between the completion of the first failed request and the initiation of the first retrying request.

retryDelayMultiplier number

the multiplier by which to increase the delay time between the completion of failed requests, and the initiation of the subsequent retrying request.

maxRetryDelayMillis number

the maximum delay time, in milliseconds, between requests. When this value is reached, retryDelayMultiplier will no longer be used to increase delay time.

initialRpcTimeoutMillis number

the initial timeout parameter to the request.

rpcTimeoutMultiplier number

the multiplier by which to increase the timeout parameter between failed requests.

maxRpcTimeoutMillis number

the maximum timeout parameter, in milliseconds, for a request. When this value is reached, rpcTimeoutMultiplier will no longer be used to increase the timeout.

totalTimeoutMillis number

the total time, in milliseconds, starting from when the initial request is sent, after which an error will be returned, regardless of the retrying attempts made meanwhile.

Returns:
Type Description
BackoffSettings

a new settings.

createMaxRetriesBackoffSettings(initialRetryDelayMillis, retryDelayMultiplier, maxRetryDelayMillis, initialRpcTimeoutMillis, rpcTimeoutMultiplier, maxRpcTimeoutMillis, maxRetries) → {BackoffSettings}

Parameters to the exponential backoff algorithm for retrying. This function is unsupported, and intended for internal use only.

Parameters:
Name Type Description
initialRetryDelayMillis number

the initial delay time, in milliseconds, between the completion of the first failed request and the initiation of the first retrying request.

retryDelayMultiplier number

the multiplier by which to increase the delay time between the completion of failed requests, and the initiation of the subsequent retrying request.

maxRetryDelayMillis number

the maximum delay time, in milliseconds, between requests. When this value is reached, retryDelayMultiplier will no longer be used to increase delay time.

initialRpcTimeoutMillis number

the initial timeout parameter to the request.

rpcTimeoutMultiplier number

the multiplier by which to increase the timeout parameter between failed requests.

maxRpcTimeoutMillis number

the maximum timeout parameter, in milliseconds, for a request. When this value is reached, rpcTimeoutMultiplier will no longer be used to increase the timeout.

maxRetries number

the maximum number of retrying attempts that will be made. If reached, an error will be returned.

Returns:
Type Description
BackoffSettings

a new settings.

createRetryOptions(retryCodes, backoffSettings, shouldRetryFn, getResumptionRequestFn) → {RetryOptions}

Per-call configurable settings for retrying upon transient failure.

Parameters:
Name Type Description
retryCodes Array.<number>

a list of Google API canonical error codes OR a function that returns a boolean to determine retry behavior upon which a retry should be attempted.

backoffSettings BackoffSettings

configures the retry exponential backoff algorithm.

shouldRetryFn function

a function that determines whether a call should retry. If this is defined retryCodes must be empty

getResumptionRequestFn function

a function with a resumption strategy - only used with server streaming retries

Returns:
Type Description
RetryOptions

A new RetryOptions object.

fromParams(params) → {string}

Constructs the routing header from the given params

Parameters:
Name Type Description
params Object

the request header parameters.

Returns:
Type Description
string

the routing header value.

lowercase()

Converts the first character of the given string to lower case.

lro() → {Object}

gRPC-fallback version of lro

Parameters:
Name Type Attributes Description
options.auth Object <optional>

An instance of google-auth-library.

Returns:
Type Description
Object

A OperationsClientBuilder that will return a OperationsClient

makeUUID()

Converts a given string to lower camel case (forcing the first character to be in lower case).

splitPathTemplate()

Split the path template by /. It can not be simply splitted by / because there might be / in the segments. For example: 'a/b/{a=hello/world}' we do not want to break the brackets pair so above path will be splitted as ['a', 'b', '{a=hello/world}']

toCamelCase()

Converts a given string from snake_case (normally used in proto definitions) or PascalCase (also used in proto definitions) to camelCase (used by protobuf.js). Preserves capitalization of the first character.

toLowerCamelCase()

Converts a given string to lower camel case (forcing the first character to be in lower case).

Type Definitions

CallOptions

Encapsulates the overridable settings for a particular API call.

CallOptions is an optional arg for all GAX API calls. It is used to configure the settings of a specific API call.

When provided, its values override the GAX service defaults for that particular call.

Typically the API clients will accept this as the second to the last argument. See the examples below.

Properties:
Name Type Attributes Description
timeout number <optional>

The client-side timeout for API calls.

retry RetryOptions <optional>

determines whether and how to retry on transient errors. When set to null, the call will not retry.

autoPaginate boolean <optional>

If set to false and the call is configured for paged iteration, page unrolling is not performed, instead the callback will be called with the response object.

pageToken Object <optional>

If set and the call is configured for paged iteration, paged iteration is not performed and requested with this pageToken.

maxResults number

If set and the call is configured for paged iteration, the call will stop when the number of response elements reaches to the specified size. By default, it will unroll the page to the end of the list.

isBundling boolean <optional>

If set to false and the call is configured for bundling, bundling is not performed.

longrunning BackoffSettings <optional>

BackoffSettings used for polling.

Examples
// suppress bundling for bundled method.
api.bundlingMethod(
    param, {optParam: aValue, isBundling: false}, function(err, response) {
  // handle response.
});
// suppress streaming for page-streaming method.
api.pageStreamingMethod(
    param, {optParam: aValue, autoPaginate: false}, function(err, page) {
  // not returning a stream, but callback is called with the paged response.
});

RetryOptions

Per-call configurable settings for retrying upon transient failure.

Properties:
Name Type Description
retryCodes Array.<number>
backoffSettings BackoffSettings
shouldRetryFn function
getResumptionRequestFn function
Implements:
  • RetryOptionsType