Class v1alpha.MarketingplatformAdminServiceClient (0.1.0)

Service Interface for the Google Marketing Platform Admin API. v1alpha

Package

@google-ads/marketing-platform-admin

Constructors

(constructor)(opts, gaxInstance)

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

Construct an instance of MarketingplatformAdminServiceClient.

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 MarketingplatformAdminServiceClient({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;
    };

marketingplatformAdminServiceStub

marketingplatformAdminServiceStub?: Promise<{
        [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

analyticsAccountLinkPath(organization, analyticsAccountLink)

analyticsAccountLinkPath(organization: string, analyticsAccountLink: string): string;

Return a fully-qualified analyticsAccountLink resource name string.

Parameters
Name Description
organization string
analyticsAccountLink 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.

createAnalyticsAccountLink(request?: protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest, options?: CallOptions): Promise<[
        protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink,
        (protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest | undefined),
        {} | undefined
    ]>;

Creates the link between the Analytics account and the Google Marketing Platform organization.

User needs to be an org user, and admin on the Analytics account to create the link. If the account is already linked to an organization, user needs to unlink the account from the current organization, then try link again.

Parameters
Name Description
request ICreateAnalyticsAccountLinkRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink, (protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing AnalyticsAccountLink. 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 resource where this Analytics account link will be
   *  created. Format: organizations/{org_id}
   */
  // const parent = 'abc123'
  /**
   *  Required. The Analytics account link to create.
   */
  // const analyticsAccountLink = {}

  // Imports the Admin library
  const {MarketingplatformAdminServiceClient} = require('@google-ads/marketing-platform-admin').v1alpha;

  // Instantiates a client
  const adminClient = new MarketingplatformAdminServiceClient();

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

    // Run request
    const response = await adminClient.createAnalyticsAccountLink(request);
    console.log(response);
  }

  callCreateAnalyticsAccountLink();

createAnalyticsAccountLink(request: protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest, options: CallOptions, callback: Callback<protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink, protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateAnalyticsAccountLinkRequest
options CallOptions
callback Callback<protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink, protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
createAnalyticsAccountLink(request: protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest, callback: Callback<protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink, protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ICreateAnalyticsAccountLinkRequest
callback Callback<protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink, protos.google.marketingplatform.admin.v1alpha.ICreateAnalyticsAccountLinkRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
deleteAnalyticsAccountLink(request?: protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest, options?: CallOptions): Promise<[
        protos.google.protobuf.IEmpty,
        (protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest | undefined),
        {} | undefined
    ]>;

Deletes the AnalyticsAccountLink, which detaches the Analytics account from the Google Marketing Platform organization.

User needs to be an org user, and admin on the Analytics account in order to delete the link.

Parameters
Name Description
request IDeleteAnalyticsAccountLinkRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.protobuf.IEmpty, (protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Empty. 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 Analytics account link to delete.
   *  Format:
   *  organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
   */
  // const name = 'abc123'

  // Imports the Admin library
  const {MarketingplatformAdminServiceClient} = require('@google-ads/marketing-platform-admin').v1alpha;

  // Instantiates a client
  const adminClient = new MarketingplatformAdminServiceClient();

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

    // Run request
    const response = await adminClient.deleteAnalyticsAccountLink(request);
    console.log(response);
  }

  callDeleteAnalyticsAccountLink();

deleteAnalyticsAccountLink(request: protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest, options: CallOptions, callback: Callback<protos.google.protobuf.IEmpty, protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAnalyticsAccountLinkRequest
options CallOptions
callback Callback<protos.google.protobuf.IEmpty, protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void
deleteAnalyticsAccountLink(request: protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest, callback: Callback<protos.google.protobuf.IEmpty, protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IDeleteAnalyticsAccountLinkRequest
callback Callback<protos.google.protobuf.IEmpty, protos.google.marketingplatform.admin.v1alpha.IDeleteAnalyticsAccountLinkRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getOrganization(request, options)

getOrganization(request?: protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest, options?: CallOptions): Promise<[
        protos.google.marketingplatform.admin.v1alpha.IOrganization,
        (protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest | undefined),
        {} | undefined
    ]>;

Lookup for a single organization.

Parameters
Name Description
request IGetOrganizationRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.marketingplatform.admin.v1alpha.IOrganization, (protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing Organization. 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 Organization to retrieve.
   *  Format: organizations/{org_id}
   */
  // const name = 'abc123'

  // Imports the Admin library
  const {MarketingplatformAdminServiceClient} = require('@google-ads/marketing-platform-admin').v1alpha;

  // Instantiates a client
  const adminClient = new MarketingplatformAdminServiceClient();

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

    // Run request
    const response = await adminClient.getOrganization(request);
    console.log(response);
  }

  callGetOrganization();

getOrganization(request, options, callback)

getOrganization(request: protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest, options: CallOptions, callback: Callback<protos.google.marketingplatform.admin.v1alpha.IOrganization, protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetOrganizationRequest
options CallOptions
callback Callback<protos.google.marketingplatform.admin.v1alpha.IOrganization, protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

getOrganization(request, callback)

getOrganization(request: protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest, callback: Callback<protos.google.marketingplatform.admin.v1alpha.IOrganization, protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request IGetOrganizationRequest
callback Callback<protos.google.marketingplatform.admin.v1alpha.IOrganization, protos.google.marketingplatform.admin.v1alpha.IGetOrganizationRequest | 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.

listAnalyticsAccountLinks(request?: protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, options?: CallOptions): Promise<[
        protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink[],
        protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest | null,
        protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksResponse
    ]>;

Lists the Google Analytics accounts link to the specified Google Marketing Platform organization.

Parameters
Name Description
request IListAnalyticsAccountLinksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink[], protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest | null, protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksResponse ]>

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

listAnalyticsAccountLinks(request: protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, options: CallOptions, callback: PaginationCallback<protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksResponse | null | undefined, protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink>): void;
Parameters
Name Description
request IListAnalyticsAccountLinksRequest
options CallOptions
callback PaginationCallback<protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksResponse | null | undefined, protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink>
Returns
Type Description
void
listAnalyticsAccountLinks(request: protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, callback: PaginationCallback<protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksResponse | null | undefined, protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink>): void;
Parameters
Name Description
request IListAnalyticsAccountLinksRequest
callback PaginationCallback<protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksResponse | null | undefined, protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink>
Returns
Type Description
void

listAnalyticsAccountLinksAsync(request, options)

listAnalyticsAccountLinksAsync(request?: protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, options?: CallOptions): AsyncIterable<protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink>;

Equivalent to listAnalyticsAccountLinks, but returns an iterable object.

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

Parameters
Name Description
request IListAnalyticsAccountLinksRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
AsyncIterable<protos.google.marketingplatform.admin.v1alpha.IAnalyticsAccountLink>

{Object} An iterable Object that allows async iteration. When you iterate the returned iterable, each element will be an object representing AnalyticsAccountLink. 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 organization, which owns this collection of Analytics
   *  account links. Format: organizations/{org_id}
   */
  // const parent = 'abc123'
  /**
   *  Optional. The maximum number of Analytics account links to return in one
   *  call. The service may return fewer than this value.
   *  If unspecified, at most 50 Analytics account links will be returned. The
   *  maximum value is 1000; values above 1000 will be coerced to 1000.
   */
  // const pageSize = 1234
  /**
   *  Optional. A page token, received from a previous ListAnalyticsAccountLinks
   *  call. Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to
   *  `ListAnalyticsAccountLinks` must match the call that provided the page
   *  token.
   */
  // const pageToken = 'abc123'

  // Imports the Admin library
  const {MarketingplatformAdminServiceClient} = require('@google-ads/marketing-platform-admin').v1alpha;

  // Instantiates a client
  const adminClient = new MarketingplatformAdminServiceClient();

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

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

  callListAnalyticsAccountLinks();

listAnalyticsAccountLinksStream(request, options)

listAnalyticsAccountLinksStream(request?: protos.google.marketingplatform.admin.v1alpha.IListAnalyticsAccountLinksRequest, options?: CallOptions): Transform;

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

Parameters
Name Description
request IListAnalyticsAccountLinksRequest

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 AnalyticsAccountLink 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 listAnalyticsAccountLinksAsync() method described below for async iteration which you can stop as needed. Please see the documentation for more details and examples.

matchAnalyticsAccountLinkFromAnalyticsAccountLinkName(analyticsAccountLinkName)

matchAnalyticsAccountLinkFromAnalyticsAccountLinkName(analyticsAccountLinkName: string): string | number;

Parse the analytics_account_link from AnalyticsAccountLink resource.

Parameter
Name Description
analyticsAccountLinkName string

A fully-qualified path representing AnalyticsAccountLink resource.

Returns
Type Description
string | number

{string} A string representing the analytics_account_link.

matchOrganizationFromAnalyticsAccountLinkName(analyticsAccountLinkName)

matchOrganizationFromAnalyticsAccountLinkName(analyticsAccountLinkName: string): string | number;

Parse the organization from AnalyticsAccountLink resource.

Parameter
Name Description
analyticsAccountLinkName string

A fully-qualified path representing AnalyticsAccountLink resource.

Returns
Type Description
string | number

{string} A string representing the organization.

matchOrganizationFromOrganizationName(organizationName)

matchOrganizationFromOrganizationName(organizationName: string): string | number;

Parse the organization from Organization resource.

Parameter
Name Description
organizationName string

A fully-qualified path representing Organization resource.

Returns
Type Description
string | number

{string} A string representing the organization.

matchPropertyFromPropertyName(propertyName)

matchPropertyFromPropertyName(propertyName: string): string | number;

Parse the property from Property resource.

Parameter
Name Description
propertyName string

A fully-qualified path representing Property resource.

Returns
Type Description
string | number

{string} A string representing the property.

organizationPath(organization)

organizationPath(organization: string): string;

Return a fully-qualified organization resource name string.

Parameter
Name Description
organization string
Returns
Type Description
string

{string} Resource name string.

propertyPath(property)

propertyPath(property: string): string;

Return a fully-qualified property resource name string.

Parameter
Name Description
property string
Returns
Type Description
string

{string} Resource name string.

setPropertyServiceLevel(request, options)

setPropertyServiceLevel(request?: protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest, options?: CallOptions): Promise<[
        protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelResponse,
        (protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest | undefined),
        {} | undefined
    ]>;

Updates the service level for an Analytics property.

Parameters
Name Description
request ISetPropertyServiceLevelRequest

The request object that will be sent.

options CallOptions

Call options. See CallOptions for more details.

Returns
Type Description
Promise<[ protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelResponse, (protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest | undefined), {} | undefined ]>

{Promise} - The promise which resolves to an array. The first element of the array is an object representing SetPropertyServiceLevelResponse. 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 AnalyticsAccountLink scope where this property is in.
   *  Format:
   *  organizations/{org_id}/analyticsAccountLinks/{analytics_account_link_id}
   */
  // const analyticsAccountLink = 'abc123'
  /**
   *  Required. The Analytics property to change the ServiceLevel setting. This
   *  field is the name of the Google Analytics Admin API property resource.
   *  Format: analyticsadmin.googleapis.com/properties/{property_id}
   */
  // const analyticsProperty = 'abc123'
  /**
   *  Required. The service level to set for this property.
   */
  // const serviceLevel = {}

  // Imports the Admin library
  const {MarketingplatformAdminServiceClient} = require('@google-ads/marketing-platform-admin').v1alpha;

  // Instantiates a client
  const adminClient = new MarketingplatformAdminServiceClient();

  async function callSetPropertyServiceLevel() {
    // Construct request
    const request = {
      analyticsAccountLink,
      analyticsProperty,
      serviceLevel,
    };

    // Run request
    const response = await adminClient.setPropertyServiceLevel(request);
    console.log(response);
  }

  callSetPropertyServiceLevel();

setPropertyServiceLevel(request, options, callback)

setPropertyServiceLevel(request: protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest, options: CallOptions, callback: Callback<protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelResponse, protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISetPropertyServiceLevelRequest
options CallOptions
callback Callback<protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelResponse, protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void

setPropertyServiceLevel(request, callback)

setPropertyServiceLevel(request: protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest, callback: Callback<protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelResponse, protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest | null | undefined, {} | null | undefined>): void;
Parameters
Name Description
request ISetPropertyServiceLevelRequest
callback Callback<protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelResponse, protos.google.marketingplatform.admin.v1alpha.ISetPropertyServiceLevelRequest | null | undefined, {} | null | undefined>
Returns
Type Description
void