Class v1beta.QuotaServiceClient (0.1.1)

Service to get method call quota information per Merchant API method. v1beta

Package

@google-shopping/quota

Constructors

(constructor)(opts, gaxInstance)

constructor(opts?: ClientOptions, gaxInstance?: typeof gax | typeof gax.fallback);

Construct an instance of QuotaServiceClient.

Parameters
NameDescription
opts ClientOptions
gaxInstance typeof gax | typeof fallback

: loaded instance of google-gax. Useful if you need to avoid loading the default gRPC version and want to use the fallback HTTP implementation. Load only fallback version and pass it to the constructor: ``` const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC const client = new QuotaServiceClient({fallback: true}, gax); ```

Properties

apiEndpoint

get apiEndpoint(): string;

The DNS address for this API service.

apiEndpoint

static get apiEndpoint(): string;

The DNS address for this API service - same as servicePath.

auth

auth: gax.GoogleAuth;

descriptors

descriptors: Descriptors;

innerApiCalls

innerApiCalls: {
        [name: string]: Function;
    };

pathTemplates

pathTemplates: {
        [name: string]: gax.PathTemplate;
    };

port

static get port(): number;

The port for this API service.

quotaServiceStub

quotaServiceStub?: Promise<{
        [name: string]: Function;
    }>;

scopes

static get scopes(): string[];

The scopes needed to make gRPC calls for every method defined in this service.

servicePath

static get servicePath(): string;

The DNS address for this API service.

universeDomain

get universeDomain(): string;

warn

warn: (code: string, message: string, warnType?: string) => void;

Methods

accountPath(account)

accountPath(account: string): string;

Return a fully-qualified account resource name string.

Parameter
NameDescription
account string
Returns
TypeDescription
string

{string} Resource name string.

close()

close(): Promise<void>;

Terminate the gRPC channel and close the client.

The client will no longer be usable and all future behavior is undefined.

Returns
TypeDescription
Promise<void>

{Promise} A promise that resolves when the client is closed.

getProjectId()

getProjectId(): Promise<string>;
Returns
TypeDescription
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
NameDescription
callback Callback<string, undefined, undefined>
Returns
TypeDescription
void

initialize()

initialize(): Promise<{
        [name: string]: Function;
    }>;

Initialize the client. Performs asynchronous operations (such as authentication) and prepares the client. This function will be called automatically when any class method is called for the first time, but if you need to initialize it before calling an actual method, feel free to call initialize() directly.

You can await on this method if you want to make sure the client is initialized.

Returns
TypeDescription
Promise<{ [name: string]: Function; }>

{Promise} A promise that resolves to an authenticated service stub.

listQuotaGroups(request, options)

listQuotaGroups(request?: protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, options?: CallOptions): Promise<[
        protos.google.shopping.merchant.quota.v1beta.IQuotaGroup[],
        protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest | null,
        protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsResponse
    ]>;

Lists the daily call quota and usage per group for your Merchant Center account.

Parameters
NameDescription
request IListQuotaGroupsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Promise<[ protos.google.shopping.merchant.quota.v1beta.IQuotaGroup[], protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest | null, protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of QuotaGroup. The client library will perform auto-pagination by default: it will call the API as many times as needed and will merge results from all the pages into this array. Note that it can affect your quota. We recommend using listQuotaGroupsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listQuotaGroups(request, options, callback)

listQuotaGroups(request: protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, options: CallOptions, callback: PaginationCallback<protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsResponse | null | undefined, protos.google.shopping.merchant.quota.v1beta.IQuotaGroup>): void;
Parameters
NameDescription
request IListQuotaGroupsRequest
options CallOptions
callback PaginationCallback<protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsResponse | null | undefined, protos.google.shopping.merchant.quota.v1beta.IQuotaGroup>
Returns
TypeDescription
void

listQuotaGroups(request, callback)

listQuotaGroups(request: protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, callback: PaginationCallback<protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsResponse | null | undefined, protos.google.shopping.merchant.quota.v1beta.IQuotaGroup>): void;
Parameters
NameDescription
request IListQuotaGroupsRequest
callback PaginationCallback<protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsResponse | null | undefined, protos.google.shopping.merchant.quota.v1beta.IQuotaGroup>
Returns
TypeDescription
void

listQuotaGroupsAsync(request, options)

listQuotaGroupsAsync(request?: protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, options?: CallOptions): AsyncIterable<protos.google.shopping.merchant.quota.v1beta.IQuotaGroup>;

Equivalent to listQuotaGroups, but returns an iterable object.

for-await-of syntax is used with the iterable to get response elements on-demand.

Parameters
NameDescription
request IListQuotaGroupsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
AsyncIterable<protos.google.shopping.merchant.quota.v1beta.IQuotaGroup>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing QuotaGroup. The API will be called under the hood as needed, once per the page, so you can stop the iteration when you don't need more results. Please see the documentation for more details and examples.

Example

  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The merchant account who owns the collection of method quotas
   *  Format: accounts/{account}
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of quotas to return in the response, used
   *  for paging. Defaults to 500; values above 1000 will be coerced to 1000.
   */
  // const pageSize = 1234
  /**
   *  Optional. Token (if provided) to retrieve the subsequent page. All other
   *  parameters must match the original call that provided the page token.
   */
  // const pageToken = 'abc123'

  // Imports the Quota library
  const {QuotaServiceClient} = require('@google-shopping/quota').v1beta;

  // Instantiates a client
  const quotaClient = new QuotaServiceClient();

  async function callListQuotaGroups() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = quotaClient.listQuotaGroupsAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListQuotaGroups();

listQuotaGroupsStream(request, options)

listQuotaGroupsStream(request?: protos.google.shopping.merchant.quota.v1beta.IListQuotaGroupsRequest, options?: CallOptions): Transform;

Equivalent to method.name.toCamelCase(), but returns a NodeJS Stream object.

Parameters
NameDescription
request IListQuotaGroupsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
TypeDescription
Transform

{Stream} An object stream which emits an object representing QuotaGroup on 'data' event. The client library will perform auto-pagination by default: it will call the API as many times as needed. Note that it can affect your quota. We recommend using listQuotaGroupsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchAccountFromAccountName(accountName)

matchAccountFromAccountName(accountName: string): string | number;

Parse the account from Account resource.

Parameter
NameDescription
accountName string

A fully-qualified path representing Account resource.

Returns
TypeDescription
string | number

{string} A string representing the account.

matchAccountFromQuotaGroupName(quotaGroupName)

matchAccountFromQuotaGroupName(quotaGroupName: string): string | number;

Parse the account from QuotaGroup resource.

Parameter
NameDescription
quotaGroupName string

A fully-qualified path representing QuotaGroup resource.

Returns
TypeDescription
string | number

{string} A string representing the account.

matchGroupFromQuotaGroupName(quotaGroupName)

matchGroupFromQuotaGroupName(quotaGroupName: string): string | number;

Parse the group from QuotaGroup resource.

Parameter
NameDescription
quotaGroupName string

A fully-qualified path representing QuotaGroup resource.

Returns
TypeDescription
string | number

{string} A string representing the group.

quotaGroupPath(account, group)

quotaGroupPath(account: string, group: string): string;

Return a fully-qualified quotaGroup resource name string.

Parameters
NameDescription
account string
group string
Returns
TypeDescription
string

{string} Resource name string.