UNPKG

google-ads-node

Version:
873 lines 238 kB
"use strict"; // 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 // // https://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. // // ** This file is automatically generated by gapic-generator-typescript. ** // ** https://github.com/googleapis/gapic-generator-typescript ** // ** All changes to this file may be overwritten. ** Object.defineProperty(exports, "__esModule", { value: true }); exports.ConversionCustomVariableServiceClient = void 0; /* global window */ const gax = require("google-gax"); const jsonProtos = require("../../protos/protos.json"); /** * Client JSON configuration object, loaded from * `src/v7/conversion_custom_variable_service_client_config.json`. * This file defines retry strategy and timeouts for all API methods in this library. */ const gapicConfig = require("./conversion_custom_variable_service_client_config.json"); const version = require('../../../package.json').version; /** * Service to manage conversion custom variables. * @class * @memberof v7 */ class ConversionCustomVariableServiceClient { /** * Construct an instance of ConversionCustomVariableServiceClient. * * @param {object} [options] - The configuration object. * The options accepted by the constructor are described in detail * in [this document](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#creating-the-client-instance). * The common options are: * @param {object} [options.credentials] - Credentials object. * @param {string} [options.credentials.client_email] * @param {string} [options.credentials.private_key] * @param {string} [options.email] - Account email address. Required when * using a .pem or .p12 keyFilename. * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or * .p12 key downloaded from the Google Developers Console. If you provide * a path to a JSON file, the projectId option below is not necessary. * NOTE: .pem and .p12 require you to specify options.email as well. * @param {number} [options.port] - The port on which to connect to * the remote host. * @param {string} [options.projectId] - The project ID from the Google * Developer's Console, e.g. 'grape-spaceship-123'. We will also check * the environment variable GCLOUD_PROJECT for your project ID. If your * app is running in an environment which supports * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, * your project ID will be detected automatically. * @param {string} [options.apiEndpoint] - The domain name of the * API remote host. * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. * Follows the structure of {@link gapicConfig}. * @param {boolean} [options.fallback] - Use HTTP fallback mode. * In fallback mode, a special browser-compatible transport implementation is used * instead of gRPC transport. In browser context (if the `window` object is defined) * the fallback mode is enabled automatically; set `options.fallback` to `false` * if you need to override this behavior. */ constructor(opts) { var _a, _b; this._terminated = false; this.descriptors = { page: {}, stream: {}, longrunning: {}, batching: {}, }; // Ensure that options include all the required fields. const staticMembers = this.constructor; const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath; const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {}; const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { opts['scopes'] = staticMembers.scopes; } // Choose either gRPC or proto-over-HTTP implementation of google-gax. this._gaxModule = opts.fallback ? gax.fallback : gax; // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. this._gaxGrpc = new this._gaxModule.GrpcClient(opts); // Save options to use in initialize() method. this._opts = opts; // Save the auth object to the client, for use by other methods. this.auth = this._gaxGrpc.auth; // Set the default scopes in auth client if needed. if (servicePath === staticMembers.servicePath) { this.auth.defaultScopes = staticMembers.scopes; } // Determine the client header string. const clientHeader = [ `gax/${this._gaxModule.version}`, `gapic/${version}`, ]; if (typeof process !== 'undefined' && 'versions' in process) { clientHeader.push(`gl-node/${process.versions.node}`); } else { clientHeader.push(`gl-web/${this._gaxModule.version}`); } if (!opts.fallback) { clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); } else if (opts.fallback === 'rest') { clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); } if (opts.libName && opts.libVersion) { clientHeader.push(`${opts.libName}/${opts.libVersion}`); } // Load the applicable protos. this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); // This API contains "path templates"; forward-slash-separated // identifiers to uniquely identify resources within the API. // Create useful helper objects for these. this.pathTemplates = { accountBudgetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/accountBudgets/{account_budget_id}'), accountBudgetProposalPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/accountBudgetProposals/{account_budget_proposal_id}'), accountLinkPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/accountLinks/{account_link_id}'), adPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/ads/{ad_id}'), adGroupPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroups/{ad_group_id}'), adGroupAdPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupAds/{ad_group_id}~{ad_id}'), adGroupAdAssetViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupAdAssetViews/{ad_group_id}~{ad_id}~{asset_id}~{field_type}'), adGroupAdLabelPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupAdLabels/{ad_group_id}~{ad_id}~{label_id}'), adGroupAssetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupAssets/{ad_group_id}~{asset_id}~{field_type}'), adGroupAudienceViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupAudienceViews/{ad_group_id}~{criterion_id}'), adGroupBidModifierPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupBidModifiers/{ad_group_id}~{criterion_id}'), adGroupCriterionPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupCriteria/{ad_group_id}~{criterion_id}'), adGroupCriterionLabelPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupCriterionLabels/{ad_group_id}~{criterion_id}~{label_id}'), adGroupCriterionSimulationPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupCriterionSimulations/{ad_group_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}'), adGroupExtensionSettingPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupExtensionSettings/{ad_group_id}~{extension_type}'), adGroupFeedPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupFeeds/{ad_group_id}~{feed_id}'), adGroupLabelPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupLabels/{ad_group_id}~{label_id}'), adGroupSimulationPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adGroupSimulations/{ad_group_id}~{type}~{modification_method}~{start_date}~{end_date}'), adParameterPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adParameters/{ad_group_id}~{criterion_id}~{parameter_index}'), adScheduleViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/adScheduleViews/{campaign_id}~{criterion_id}'), ageRangeViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/ageRangeViews/{ad_group_id}~{criterion_id}'), assetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/assets/{asset_id}'), batchJobPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/batchJobs/{batch_job_id}'), biddingStrategyPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/biddingStrategies/{bidding_strategy_id}'), biddingStrategySimulationPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/biddingStrategySimulations/{bidding_strategy_id}~{type}~{modification_method}~{start_date}~{end_date}'), billingSetupPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/billingSetups/{billing_setup_id}'), callViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/callViews/{call_detail_id}'), campaignPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaigns/{campaign_id}'), campaignAssetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignAssets/{campaign_id}~{asset_id}~{field_type}'), campaignAudienceViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignAudienceViews/{campaign_id}~{criterion_id}'), campaignBidModifierPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignBidModifiers/{campaign_id}~{criterion_id}'), campaignBudgetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignBudgets/{campaign_budget_id}'), campaignCriterionPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignCriteria/{campaign_id}~{criterion_id}'), campaignCriterionSimulationPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignCriterionSimulations/{campaign_id}~{criterion_id}~{type}~{modification_method}~{start_date}~{end_date}'), campaignDraftPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignDrafts/{base_campaign_id}~{draft_id}'), campaignExperimentPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignExperiments/{campaign_experiment_id}'), campaignExtensionSettingPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignExtensionSettings/{campaign_id}~{extension_type}'), campaignFeedPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignFeeds/{campaign_id}~{feed_id}'), campaignLabelPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignLabels/{campaign_id}~{label_id}'), campaignSharedSetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignSharedSets/{campaign_id}~{shared_set_id}'), campaignSimulationPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/campaignSimulations/{campaign_id}~{type}~{modification_method}~{start_date}~{end_date}'), carrierConstantPathTemplate: new this._gaxModule.PathTemplate('carrierConstants/{criterion_id}'), changeEventPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/changeEvents/{timestamp_micros}~{command_index}~{mutate_index}'), changeStatusPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/changeStatus/{change_status_id}'), clickViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/clickViews/{date}~{gclid}'), combinedAudiencePathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/combinedAudiences/{combined_audience_id}'), conversionActionPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/conversionActions/{conversion_action_id}'), conversionCustomVariablePathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/conversionCustomVariables/{conversion_custom_variable_id}'), currencyConstantPathTemplate: new this._gaxModule.PathTemplate('currencyConstants/{code}'), customAudiencePathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customAudiences/{custom_audience_id}'), customInterestPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customInterests/{custom_interest_id}'), customerPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}'), customerAssetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerAssets/{asset_id}~{field_type}'), customerClientPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerClients/{client_customer_id}'), customerClientLinkPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerClientLinks/{client_customer_id}~{manager_link_id}'), customerExtensionSettingPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerExtensionSettings/{extension_type}'), customerFeedPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerFeeds/{feed_id}'), customerLabelPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerLabels/{label_id}'), customerManagerLinkPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerManagerLinks/{manager_customer_id}~{manager_link_id}'), customerNegativeCriterionPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerNegativeCriteria/{criterion_id}'), customerUserAccessPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerUserAccesses/{user_id}'), customerUserAccessInvitationPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/customerUserAccessInvitations/{invitation_id}'), detailPlacementViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/detailPlacementViews/{ad_group_id}~{base64_placement}'), displayKeywordViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/displayKeywordViews/{ad_group_id}~{criterion_id}'), distanceViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/distanceViews/{placeholder_chain_id}~{distance_bucket}'), domainCategoryPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/domainCategories/{campaign_id}~{base64_category}~{language_code}'), dynamicSearchAdsSearchTermViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/dynamicSearchAdsSearchTermViews/{ad_group_id}~{search_term_fingerprint}~{headline_fingerprint}~{landing_page_fingerprint}~{page_url_fingerprint}'), expandedLandingPageViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/expandedLandingPageViews/{expanded_final_url_fingerprint}'), extensionFeedItemPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/extensionFeedItems/{feed_item_id}'), feedPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/feeds/{feed_id}'), feedItemPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/feedItems/{feed_id}~{feed_item_id}'), feedItemSetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/feedItemSets/{feed_id}~{feed_item_set_id}'), feedItemSetLinkPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/feedItemSetLinks/{feed_id}~{feed_item_set_id}~{feed_item_id}'), feedItemTargetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/feedItemTargets/{feed_id}~{feed_item_id}~{feed_item_target_type}~{feed_item_target_id}'), feedMappingPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/feedMappings/{feed_id}~{feed_mapping_id}'), feedPlaceholderViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/feedPlaceholderViews/{placeholder_type}'), genderViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/genderViews/{ad_group_id}~{criterion_id}'), geoTargetConstantPathTemplate: new this._gaxModule.PathTemplate('geoTargetConstants/{criterion_id}'), geographicViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/geographicViews/{country_criterion_id}~{location_type}'), googleAdsFieldPathTemplate: new this._gaxModule.PathTemplate('googleAdsFields/{google_ads_field}'), groupPlacementViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/groupPlacementViews/{ad_group_id}~{base64_placement}'), hotelGroupViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/hotelGroupViews/{ad_group_id}~{criterion_id}'), hotelPerformanceViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/hotelPerformanceView'), incomeRangeViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/incomeRangeViews/{ad_group_id}~{criterion_id}'), invoicePathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/invoices/{invoice_id}'), keywordPlanPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/keywordPlans/{keyword_plan_id}'), keywordPlanAdGroupPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/keywordPlanAdGroups/{keyword_plan_ad_group_id}'), keywordPlanAdGroupKeywordPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/keywordPlanAdGroupKeywords/{keyword_plan_ad_group_keyword_id}'), keywordPlanCampaignPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/keywordPlanCampaigns/{keyword_plan_campaign_id}'), keywordPlanCampaignKeywordPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/keywordPlanCampaignKeywords/{keyword_plan_campaign_keyword_id}'), keywordViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/keywordViews/{ad_group_id}~{criterion_id}'), labelPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/labels/{label_id}'), landingPageViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/landingPageViews/{unexpanded_final_url_fingerprint}'), languageConstantPathTemplate: new this._gaxModule.PathTemplate('languageConstants/{criterion_id}'), lifeEventPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/lifeEvents/{life_event_id}'), locationViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/locationViews/{campaign_id}~{criterion_id}'), managedPlacementViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/managedPlacementViews/{ad_group_id}~{criterion_id}'), mediaFilePathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/mediaFiles/{media_file_id}'), merchantCenterLinkPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/merchantCenterLinks/{merchant_center_id}'), mobileAppCategoryConstantPathTemplate: new this._gaxModule.PathTemplate('mobileAppCategoryConstants/{mobile_app_category_id}'), mobileDeviceConstantPathTemplate: new this._gaxModule.PathTemplate('mobileDeviceConstants/{criterion_id}'), offlineUserDataJobPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/offlineUserDataJobs/{offline_user_data_update_id}'), operatingSystemVersionConstantPathTemplate: new this._gaxModule.PathTemplate('operatingSystemVersionConstants/{criterion_id}'), paidOrganicSearchTermViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/paidOrganicSearchTermViews/{campaign_id}~{ad_group_id}~{base64_search_term}'), parentalStatusViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/parentalStatusViews/{ad_group_id}~{criterion_id}'), paymentsAccountPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/paymentsAccounts/{payments_account_id}'), productBiddingCategoryConstantPathTemplate: new this._gaxModule.PathTemplate('productBiddingCategoryConstants/{country_code}~{level}~{id}'), productGroupViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/productGroupViews/{adgroup_id}~{criterion_id}'), recommendationPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/recommendations/{recommendation_id}'), remarketingActionPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/remarketingActions/{remarketing_action_id}'), searchTermViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/searchTermViews/{campaign_id}~{ad_group_id}~{query}'), sharedCriterionPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/sharedCriteria/{shared_set_id}~{criterion_id}'), sharedSetPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/sharedSets/{shared_set_id}'), shoppingPerformanceViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/shoppingPerformanceView'), thirdPartyAppAnalyticsLinkPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/thirdPartyAppAnalyticsLinks/{customer_link_id}'), topicConstantPathTemplate: new this._gaxModule.PathTemplate('topicConstants/{topic_id}'), topicViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/topicViews/{ad_group_id}~{criterion_id}'), userInterestPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/userInterests/{user_interest_id}'), userListPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/userLists/{user_list_id}'), userLocationViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/userLocationViews/{country_criterion_id}~{is_targeting_location}'), videoPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/videos/{video_id}'), webpageViewPathTemplate: new this._gaxModule.PathTemplate('customers/{customer_id}/webpageViews/{ad_group_id}~{criterion_id}'), }; // Put together the default options sent with requests. this._defaults = this._gaxGrpc.constructSettings('google.ads.googleads.v7.services.ConversionCustomVariableService', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') }); // Set up a dictionary of "inner API calls"; the core implementation // of calling the API is handled in `google-gax`, with this code // merely providing the destination and request information. this.innerApiCalls = {}; } /** * 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 {Promise} A promise that resolves to an authenticated service stub. */ initialize() { // If the client stub promise is already initialized, return immediately. if (this.conversionCustomVariableServiceStub) { return this.conversionCustomVariableServiceStub; } // Put together the "service stub" for // google.ads.googleads.v7.services.ConversionCustomVariableService. this.conversionCustomVariableServiceStub = this._gaxGrpc.createStub(this._opts.fallback ? this._protos.lookupService('google.ads.googleads.v7.services.ConversionCustomVariableService') : // eslint-disable-next-line @typescript-eslint/no-explicit-any this._protos.google.ads.googleads.v7.services.ConversionCustomVariableService, this._opts); // Iterate over each of the methods that the service provides // and create an API call method for each. const conversionCustomVariableServiceStubMethods = ['getConversionCustomVariable', 'mutateConversionCustomVariables']; for (const methodName of conversionCustomVariableServiceStubMethods) { const callPromise = this.conversionCustomVariableServiceStub.then(stub => (...args) => { if (this._terminated) { return Promise.reject('The client has already been closed.'); } const func = stub[methodName]; return func.apply(stub, args); }, (err) => () => { throw err; }); const descriptor = undefined; const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor); this.innerApiCalls[methodName] = apiCall; } return this.conversionCustomVariableServiceStub; } /** * The DNS address for this API service. * @returns {string} The DNS address for this service. */ static get servicePath() { return 'googleads.googleapis.com'; } /** * The DNS address for this API service - same as servicePath(), * exists for compatibility reasons. * @returns {string} The DNS address for this service. */ static get apiEndpoint() { return 'googleads.googleapis.com'; } /** * The port for this API service. * @returns {number} The default port for this service. */ static get port() { return 443; } /** * The scopes needed to make gRPC calls for every method defined * in this service. * @returns {string[]} List of default scopes. */ static get scopes() { return [ 'https://www.googleapis.com/auth/adwords' ]; } /** * Return the project ID used by this class. * @returns {Promise} A promise that resolves to string containing the project ID. */ getProjectId(callback) { if (callback) { this.auth.getProjectId(callback); return; } return this.auth.getProjectId(); } /** * Returns the requested conversion custom variable. * * List of thrown errors: * [AuthenticationError]() * [AuthorizationError]() * [HeaderError]() * [InternalError]() * [QuotaError]() * [RequestError]() * * @param {Object} request * The request object that will be sent. * @param {string} request.resource_name * Required. The resource name of the conversion custom variable to fetch. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [ConversionCustomVariable]{@link google.ads.googleads.v7.resources.ConversionCustomVariable}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. * @example * const [response] = await client.getConversionCustomVariable(request); */ getConversionCustomVariable(request, optionsOrCallback, callback) { request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ 'resource_name': request.resource_name || '', }); this.initialize(); return this.innerApiCalls.getConversionCustomVariable(request, options, callback); } /** * Creates or updates conversion custom variables. Operation statuses are * returned. * * List of thrown errors: * [AuthenticationError]() * [AuthorizationError]() * [ConversionCustomVariableError]() * [DatabaseError]() * [HeaderError]() * [InternalError]() * [QuotaError]() * [RequestError]() * * @param {Object} request * The request object that will be sent. * @param {string} request.customer_id * Required. The ID of the customer whose conversion custom variables are being * modified. * @param {number[]} request.operations * Required. The list of operations to perform on individual conversion custom * variables. * @param {boolean} request.partialFailure * If true, successful operations will be carried out and invalid * operations will return errors. If false, all operations will be carried * out in one transaction if and only if they are all valid. * Default is false. * @param {boolean} request.validateOnly * If true, the request is validated but not executed. Only errors are * returned, not results. * @param {google.ads.googleads.v7.enums.ResponseContentTypeEnum.ResponseContentType} request.responseContentType * The response content type setting. Determines whether the mutable resource * or just the resource name should be returned post mutation. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array. * The first element of the array is an object representing [MutateConversionCustomVariablesResponse]{@link google.ads.googleads.v7.services.MutateConversionCustomVariablesResponse}. * Please see the * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) * for more details and examples. * @example * const [response] = await client.mutateConversionCustomVariables(request); */ mutateConversionCustomVariables(request, optionsOrCallback, callback) { request = request || {}; let options; if (typeof optionsOrCallback === 'function' && callback === undefined) { callback = optionsOrCallback; options = {}; } else { options = optionsOrCallback; } options = options || {}; options.otherArgs = options.otherArgs || {}; options.otherArgs.headers = options.otherArgs.headers || {}; options.otherArgs.headers['x-goog-request-params'] = gax.routingHeader.fromParams({ 'customer_id': request.customer_id || '', }); this.initialize(); return this.innerApiCalls.mutateConversionCustomVariables(request, options, callback); } // -------------------- // -- Path templates -- // -------------------- /** * Return a fully-qualified accountBudget resource name string. * * @param {string} customer_id * @param {string} account_budget_id * @returns {string} Resource name string. */ accountBudgetPath(customerId, accountBudgetId) { return this.pathTemplates.accountBudgetPathTemplate.render({ customer_id: customerId, account_budget_id: accountBudgetId, }); } /** * Parse the customer_id from AccountBudget resource. * * @param {string} accountBudgetName * A fully-qualified path representing AccountBudget resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAccountBudgetName(accountBudgetName) { return this.pathTemplates.accountBudgetPathTemplate.match(accountBudgetName).customer_id; } /** * Parse the account_budget_id from AccountBudget resource. * * @param {string} accountBudgetName * A fully-qualified path representing AccountBudget resource. * @returns {string} A string representing the account_budget_id. */ matchAccountBudgetIdFromAccountBudgetName(accountBudgetName) { return this.pathTemplates.accountBudgetPathTemplate.match(accountBudgetName).account_budget_id; } /** * Return a fully-qualified accountBudgetProposal resource name string. * * @param {string} customer_id * @param {string} account_budget_proposal_id * @returns {string} Resource name string. */ accountBudgetProposalPath(customerId, accountBudgetProposalId) { return this.pathTemplates.accountBudgetProposalPathTemplate.render({ customer_id: customerId, account_budget_proposal_id: accountBudgetProposalId, }); } /** * Parse the customer_id from AccountBudgetProposal resource. * * @param {string} accountBudgetProposalName * A fully-qualified path representing AccountBudgetProposal resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAccountBudgetProposalName(accountBudgetProposalName) { return this.pathTemplates.accountBudgetProposalPathTemplate.match(accountBudgetProposalName).customer_id; } /** * Parse the account_budget_proposal_id from AccountBudgetProposal resource. * * @param {string} accountBudgetProposalName * A fully-qualified path representing AccountBudgetProposal resource. * @returns {string} A string representing the account_budget_proposal_id. */ matchAccountBudgetProposalIdFromAccountBudgetProposalName(accountBudgetProposalName) { return this.pathTemplates.accountBudgetProposalPathTemplate.match(accountBudgetProposalName).account_budget_proposal_id; } /** * Return a fully-qualified accountLink resource name string. * * @param {string} customer_id * @param {string} account_link_id * @returns {string} Resource name string. */ accountLinkPath(customerId, accountLinkId) { return this.pathTemplates.accountLinkPathTemplate.render({ customer_id: customerId, account_link_id: accountLinkId, }); } /** * Parse the customer_id from AccountLink resource. * * @param {string} accountLinkName * A fully-qualified path representing AccountLink resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAccountLinkName(accountLinkName) { return this.pathTemplates.accountLinkPathTemplate.match(accountLinkName).customer_id; } /** * Parse the account_link_id from AccountLink resource. * * @param {string} accountLinkName * A fully-qualified path representing AccountLink resource. * @returns {string} A string representing the account_link_id. */ matchAccountLinkIdFromAccountLinkName(accountLinkName) { return this.pathTemplates.accountLinkPathTemplate.match(accountLinkName).account_link_id; } /** * Return a fully-qualified ad resource name string. * * @param {string} customer_id * @param {string} ad_id * @returns {string} Resource name string. */ adPath(customerId, adId) { return this.pathTemplates.adPathTemplate.render({ customer_id: customerId, ad_id: adId, }); } /** * Parse the customer_id from Ad resource. * * @param {string} adName * A fully-qualified path representing Ad resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAdName(adName) { return this.pathTemplates.adPathTemplate.match(adName).customer_id; } /** * Parse the ad_id from Ad resource. * * @param {string} adName * A fully-qualified path representing Ad resource. * @returns {string} A string representing the ad_id. */ matchAdIdFromAdName(adName) { return this.pathTemplates.adPathTemplate.match(adName).ad_id; } /** * Return a fully-qualified adGroup resource name string. * * @param {string} customer_id * @param {string} ad_group_id * @returns {string} Resource name string. */ adGroupPath(customerId, adGroupId) { return this.pathTemplates.adGroupPathTemplate.render({ customer_id: customerId, ad_group_id: adGroupId, }); } /** * Parse the customer_id from AdGroup resource. * * @param {string} adGroupName * A fully-qualified path representing AdGroup resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAdGroupName(adGroupName) { return this.pathTemplates.adGroupPathTemplate.match(adGroupName).customer_id; } /** * Parse the ad_group_id from AdGroup resource. * * @param {string} adGroupName * A fully-qualified path representing AdGroup resource. * @returns {string} A string representing the ad_group_id. */ matchAdGroupIdFromAdGroupName(adGroupName) { return this.pathTemplates.adGroupPathTemplate.match(adGroupName).ad_group_id; } /** * Return a fully-qualified adGroupAd resource name string. * * @param {string} customer_id * @param {string} ad_group_id * @param {string} ad_id * @returns {string} Resource name string. */ adGroupAdPath(customerId, adGroupId, adId) { return this.pathTemplates.adGroupAdPathTemplate.render({ customer_id: customerId, ad_group_id: adGroupId, ad_id: adId, }); } /** * Parse the customer_id from AdGroupAd resource. * * @param {string} adGroupAdName * A fully-qualified path representing AdGroupAd resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAdGroupAdName(adGroupAdName) { return this.pathTemplates.adGroupAdPathTemplate.match(adGroupAdName).customer_id; } /** * Parse the ad_group_id from AdGroupAd resource. * * @param {string} adGroupAdName * A fully-qualified path representing AdGroupAd resource. * @returns {string} A string representing the ad_group_id. */ matchAdGroupIdFromAdGroupAdName(adGroupAdName) { return this.pathTemplates.adGroupAdPathTemplate.match(adGroupAdName).ad_group_id; } /** * Parse the ad_id from AdGroupAd resource. * * @param {string} adGroupAdName * A fully-qualified path representing AdGroupAd resource. * @returns {string} A string representing the ad_id. */ matchAdIdFromAdGroupAdName(adGroupAdName) { return this.pathTemplates.adGroupAdPathTemplate.match(adGroupAdName).ad_id; } /** * Return a fully-qualified adGroupAdAssetView resource name string. * * @param {string} customer_id * @param {string} ad_group_id * @param {string} ad_id * @param {string} asset_id * @param {string} field_type * @returns {string} Resource name string. */ adGroupAdAssetViewPath(customerId, adGroupId, adId, assetId, fieldType) { return this.pathTemplates.adGroupAdAssetViewPathTemplate.render({ customer_id: customerId, ad_group_id: adGroupId, ad_id: adId, asset_id: assetId, field_type: fieldType, }); } /** * Parse the customer_id from AdGroupAdAssetView resource. * * @param {string} adGroupAdAssetViewName * A fully-qualified path representing AdGroupAdAssetView resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAdGroupAdAssetViewName(adGroupAdAssetViewName) { return this.pathTemplates.adGroupAdAssetViewPathTemplate.match(adGroupAdAssetViewName).customer_id; } /** * Parse the ad_group_id from AdGroupAdAssetView resource. * * @param {string} adGroupAdAssetViewName * A fully-qualified path representing AdGroupAdAssetView resource. * @returns {string} A string representing the ad_group_id. */ matchAdGroupIdFromAdGroupAdAssetViewName(adGroupAdAssetViewName) { return this.pathTemplates.adGroupAdAssetViewPathTemplate.match(adGroupAdAssetViewName).ad_group_id; } /** * Parse the ad_id from AdGroupAdAssetView resource. * * @param {string} adGroupAdAssetViewName * A fully-qualified path representing AdGroupAdAssetView resource. * @returns {string} A string representing the ad_id. */ matchAdIdFromAdGroupAdAssetViewName(adGroupAdAssetViewName) { return this.pathTemplates.adGroupAdAssetViewPathTemplate.match(adGroupAdAssetViewName).ad_id; } /** * Parse the asset_id from AdGroupAdAssetView resource. * * @param {string} adGroupAdAssetViewName * A fully-qualified path representing AdGroupAdAssetView resource. * @returns {string} A string representing the asset_id. */ matchAssetIdFromAdGroupAdAssetViewName(adGroupAdAssetViewName) { return this.pathTemplates.adGroupAdAssetViewPathTemplate.match(adGroupAdAssetViewName).asset_id; } /** * Parse the field_type from AdGroupAdAssetView resource. * * @param {string} adGroupAdAssetViewName * A fully-qualified path representing AdGroupAdAssetView resource. * @returns {string} A string representing the field_type. */ matchFieldTypeFromAdGroupAdAssetViewName(adGroupAdAssetViewName) { return this.pathTemplates.adGroupAdAssetViewPathTemplate.match(adGroupAdAssetViewName).field_type; } /** * Return a fully-qualified adGroupAdLabel resource name string. * * @param {string} customer_id * @param {string} ad_group_id * @param {string} ad_id * @param {string} label_id * @returns {string} Resource name string. */ adGroupAdLabelPath(customerId, adGroupId, adId, labelId) { return this.pathTemplates.adGroupAdLabelPathTemplate.render({ customer_id: customerId, ad_group_id: adGroupId, ad_id: adId, label_id: labelId, }); } /** * Parse the customer_id from AdGroupAdLabel resource. * * @param {string} adGroupAdLabelName * A fully-qualified path representing AdGroupAdLabel resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAdGroupAdLabelName(adGroupAdLabelName) { return this.pathTemplates.adGroupAdLabelPathTemplate.match(adGroupAdLabelName).customer_id; } /** * Parse the ad_group_id from AdGroupAdLabel resource. * * @param {string} adGroupAdLabelName * A fully-qualified path representing AdGroupAdLabel resource. * @returns {string} A string representing the ad_group_id. */ matchAdGroupIdFromAdGroupAdLabelName(adGroupAdLabelName) { return this.pathTemplates.adGroupAdLabelPathTemplate.match(adGroupAdLabelName).ad_group_id; } /** * Parse the ad_id from AdGroupAdLabel resource. * * @param {string} adGroupAdLabelName * A fully-qualified path representing AdGroupAdLabel resource. * @returns {string} A string representing the ad_id. */ matchAdIdFromAdGroupAdLabelName(adGroupAdLabelName) { return this.pathTemplates.adGroupAdLabelPathTemplate.match(adGroupAdLabelName).ad_id; } /** * Parse the label_id from AdGroupAdLabel resource. * * @param {string} adGroupAdLabelName * A fully-qualified path representing AdGroupAdLabel resource. * @returns {string} A string representing the label_id. */ matchLabelIdFromAdGroupAdLabelName(adGroupAdLabelName) { return this.pathTemplates.adGroupAdLabelPathTemplate.match(adGroupAdLabelName).label_id; } /** * Return a fully-qualified adGroupAsset resource name string. * * @param {string} customer_id * @param {string} ad_group_id * @param {string} asset_id * @param {string} field_type * @returns {string} Resource name string. */ adGroupAssetPath(customerId, adGroupId, assetId, fieldType) { return this.pathTemplates.adGroupAssetPathTemplate.render({ customer_id: customerId, ad_group_id: adGroupId, asset_id: assetId, field_type: fieldType, }); } /** * Parse the customer_id from AdGroupAsset resource. * * @param {string} adGroupAssetName * A fully-qualified path representing AdGroupAsset resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAdGroupAssetName(adGroupAssetName) { return this.pathTemplates.adGroupAssetPathTemplate.match(adGroupAssetName).customer_id; } /** * Parse the ad_group_id from AdGroupAsset resource. * * @param {string} adGroupAssetName * A fully-qualified path representing AdGroupAsset resource. * @returns {string} A string representing the ad_group_id. */ matchAdGroupIdFromAdGroupAssetName(adGroupAssetName) { return this.pathTemplates.adGroupAssetPathTemplate.match(adGroupAssetName).ad_group_id; } /** * Parse the asset_id from AdGroupAsset resource. * * @param {string} adGroupAssetName * A fully-qualified path representing AdGroupAsset resource. * @returns {string} A string representing the asset_id. */ matchAssetIdFromAdGroupAssetName(adGroupAssetName) { return this.pathTemplates.adGroupAssetPathTemplate.match(adGroupAssetName).asset_id; } /** * Parse the field_type from AdGroupAsset resource. * * @param {string} adGroupAssetName * A fully-qualified path representing AdGroupAsset resource. * @returns {string} A string representing the field_type. */ matchFieldTypeFromAdGroupAssetName(adGroupAssetName) { return this.pathTemplates.adGroupAssetPathTemplate.match(adGroupAssetName).field_type; } /** * Return a fully-qualified adGroupAudienceView resource name string. * * @param {string} customer_id * @param {string} ad_group_id * @param {string} criterion_id * @returns {string} Resource name string. */ adGroupAudienceViewPath(customerId, adGroupId, criterionId) { return this.pathTemplates.adGroupAudienceViewPathTemplate.render({ customer_id: customerId, ad_group_id: adGroupId, criterion_id: criterionId, }); } /** * Parse the customer_id from AdGroupAudienceView resource. * * @param {string} adGroupAudienceViewName * A fully-qualified path representing AdGroupAudienceView resource. * @returns {string} A string representing the customer_id. */ matchCustomerIdFromAdGroupAudienceViewName(adGroupAudienceViewName) { return this.pathTemplates.adGroupAudienceViewPathTemplate.match(adGroupAudienceViewName).customer_id; } /** * Parse the ad_group_id from AdGroupAudienceView resource. * * @param {string}