Class v1.AccountLimitsServiceClient (0.9.0)

Service to retrieve account limits. v1

Package

@google-shopping/quota

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of AccountLimitsServiceClient.

Parameters
Name Description
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 AccountLimitsServiceClient({fallback: true}, gax); ```

Properties

accountLimitsServiceStub

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

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.

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

accountLimitPath(account, limit)

accountLimitPath(account: string, limit: string): string;

Return a fully-qualified accountLimit resource name string.

Parameters
Name Description
account string
limit string
Returns
Type Description
string

{string} Resource name string.

accountPath(account)

accountPath(account: string): string;

Return a fully-qualified account resource name string.

Parameter
Name Description
account string
Returns
Type Description
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
Type Description
Promise<void>

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

getAccountLimit(request, options)

getAccountLimit(request?: protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest, options?: CallOptions): Promise<[
        protos.google.shopping.merchant.quota.v1.IAccountLimit,
        protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest | undefined,
        {} | undefined
    ]>;

Retrieves an account limit.

Parameters
Name Description
request IGetAccountLimitRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.shopping.merchant.quota.v1.IAccountLimit, protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest | undefined, {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AccountLimit. 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 name of the limit to retrieve.
   *  Format: `accounts/{account}/limits/{limit}`
   *  For example: `accounts/123/limits/products~ADS_NON_EEA`
   */
  // const name = 'abc123'

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

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

  async function callGetAccountLimit() {
    // Construct request
    const request = {
      name,
    };

    // Run request
    const response = await quotaClient.getAccountLimit(request);
    console.log(response);
  }

  callGetAccountLimit();

getAccountLimit(request, options, callback)

getAccountLimit(request: protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest, options: CallOptions, callback: Callback<protos.google.shopping.merchant.quota.v1.IAccountLimit, protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetAccountLimitRequest
options CallOptions
callback Callback<protos.google.shopping.merchant.quota.v1.IAccountLimit, protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getAccountLimit(request, callback)

getAccountLimit(request: protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest, callback: Callback<protos.google.shopping.merchant.quota.v1.IAccountLimit, protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetAccountLimitRequest
callback Callback<protos.google.shopping.merchant.quota.v1.IAccountLimit, protos.google.shopping.merchant.quota.v1.IGetAccountLimitRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getProjectId()

getProjectId(): Promise<string>;
Returns
Type Description
Promise<string>

getProjectId(callback)

getProjectId(callback: Callback<string, undefined, undefined>): void;
Parameter
Name Description
callback Callback<string, undefined, undefined>
Returns
Type Description
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
Type Description
Promise<{ [name: string]: Function; }>

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

listAccountLimits(request, options)

listAccountLimits(request?: protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, options?: CallOptions): Promise<[
        protos.google.shopping.merchant.quota.v1.IAccountLimit[],
        protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest | null,
        protos.google.shopping.merchant.quota.v1.IListAccountLimitsResponse
    ]>;

Lists the limits of an account.

Parameters
Name Description
request IListAccountLimitsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.shopping.merchant.quota.v1.IAccountLimit[], protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest | null, protos.google.shopping.merchant.quota.v1.IListAccountLimitsResponse ]>

{Promise} - The promise which resolves to an array. The first element of the array is Array of AccountLimit. 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 listAccountLimitsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

listAccountLimits(request, options, callback)

listAccountLimits(request: protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, options: CallOptions, callback: PaginationCallback<protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, protos.google.shopping.merchant.quota.v1.IListAccountLimitsResponse | null | undefined, protos.google.shopping.merchant.quota.v1.IAccountLimit>): void;
Parameters
Name Description
request IListAccountLimitsRequest
options CallOptions
callback PaginationCallback<protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, protos.google.shopping.merchant.quota.v1.IListAccountLimitsResponse | null | undefined, protos.google.shopping.merchant.quota.v1.IAccountLimit>
Returns
Type Description
void

listAccountLimits(request, callback)

listAccountLimits(request: protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, callback: PaginationCallback<protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, protos.google.shopping.merchant.quota.v1.IListAccountLimitsResponse | null | undefined, protos.google.shopping.merchant.quota.v1.IAccountLimit>): void;
Parameters
Name Description
request IListAccountLimitsRequest
callback PaginationCallback<protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, protos.google.shopping.merchant.quota.v1.IListAccountLimitsResponse | null | undefined, protos.google.shopping.merchant.quota.v1.IAccountLimit>
Returns
Type Description
void

listAccountLimitsAsync(request, options)

listAccountLimitsAsync(request?: protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, options?: CallOptions): AsyncIterable<protos.google.shopping.merchant.quota.v1.IAccountLimit>;

Equivalent to listAccountLimits, but returns an iterable object.

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

Parameters
Name Description
request IListAccountLimitsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.shopping.merchant.quota.v1.IAccountLimit>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing AccountLimit. 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 parent account.
   *  Format: `accounts/{account}`
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of limits to return. The service may return
   *  fewer than this value. If unspecified, at most 100 limits will be returned.
   *  The maximum value is 100; values above 100 will be coerced to 100.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous `ListAccountLimits` call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to `ListAccountLimits` must
   *  match the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  Required. A filter on the limit `type` is required, for example, `type =
   *  "products"`.
   */
  // const filter = 'abc123'

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

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

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

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

  callListAccountLimits();

listAccountLimitsStream(request, options)

listAccountLimitsStream(request?: protos.google.shopping.merchant.quota.v1.IListAccountLimitsRequest, options?: CallOptions): Transform;

Equivalent to listAccountLimits, but returns a NodeJS Stream object.

Parameters
Name Description
request IListAccountLimitsRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Transform

{Stream} An object stream which emits an object representing AccountLimit 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 listAccountLimitsAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchAccountFromAccountLimitName(accountLimitName)

matchAccountFromAccountLimitName(accountLimitName: string): string | number;

Parse the account from AccountLimit resource.

Parameter
Name Description
accountLimitName string

A fully-qualified path representing AccountLimit resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchAccountFromAccountName(accountName)

matchAccountFromAccountName(accountName: string): string | number;

Parse the account from Account resource.

Parameter
Name Description
accountName string

A fully-qualified path representing Account resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchAccountFromQuotaGroupName(quotaGroupName)

matchAccountFromQuotaGroupName(quotaGroupName: string): string | number;

Parse the account from QuotaGroup resource.

Parameter
Name Description
quotaGroupName string

A fully-qualified path representing QuotaGroup resource.

Returns
Type Description
string | number

{string} A string representing the account.

matchGroupFromQuotaGroupName(quotaGroupName)

matchGroupFromQuotaGroupName(quotaGroupName: string): string | number;

Parse the group from QuotaGroup resource.

Parameter
Name Description
quotaGroupName string

A fully-qualified path representing QuotaGroup resource.

Returns
Type Description
string | number

{string} A string representing the group.

matchLimitFromAccountLimitName(accountLimitName)

matchLimitFromAccountLimitName(accountLimitName: string): string | number;

Parse the limit from AccountLimit resource.

Parameter
Name Description
accountLimitName string

A fully-qualified path representing AccountLimit resource.

Returns
Type Description
string | number

{string} A string representing the limit.

quotaGroupPath(account, group)

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

Return a fully-qualified quotaGroup resource name string.

Parameters
Name Description
account string
group string
Returns
Type Description
string

{string} Resource name string.