From d685a7981a7dbc3059744911f4401aacde339564 Mon Sep 17 00:00:00 2001 From: Midnight-Conqueror Date: Wed, 26 May 2021 16:31:18 +0100 Subject: [PATCH] release: upgrading Google Ads API to v7.0.0 (#271) * v7.0.0 * extracted null or undefined logic to a function * compiled protos Co-authored-by: Kritzware * removed timeouts * linting Co-authored-by: William Cooter Co-authored-by: Kritzware --- README.md | 8 +- package.json | 6 +- scripts/fields.spec.ts | 6 +- scripts/fields.ts | 45 +- scripts/index.ts | 7 +- scripts/services.ts | 2 +- src/customer.spec.ts | 2 +- src/customer.ts | 10 +- src/protos/autogen/enums.ts | 1025 +- src/protos/autogen/fields.ts | 1376 +- src/protos/autogen/resourceNames.ts | 420 +- src/protos/autogen/serviceFactory.ts | 33368 +++++++++++++------------ src/protos/index.ts | 12 +- src/service.spec.ts | 22 +- src/service.ts | 27 +- src/version.ts | 2 +- yarn.lock | 167 +- 17 files changed, 19560 insertions(+), 16945 deletions(-) diff --git a/README.md b/README.md index 49251c32..343d4d72 100644 --- a/README.md +++ b/README.md @@ -7,7 +7,7 @@

- + @@ -113,7 +113,7 @@ const customer = client.Customer({ ## List accessible customers -This is a special client method for listing the accessible customers for a given refresh token, and is equivalent to [CustomerService.listAccessibleCustomers](https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerService#listaccessiblecustomers). It returns the resource names of available customer accounts. +This is a special client method for listing the accessible customers for a given refresh token, and is equivalent to [CustomerService.listAccessibleCustomers](https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerService#listaccessiblecustomers). It returns the resource names of available customer accounts. ```ts const client = new GoogleAdsApi({ @@ -571,9 +571,9 @@ const customer = client.Customer({ ## Error handling -All errors, apart from GRPC specific cases (such as a connection problem or timeout, [see more here](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)), are instances of a [GoogleAdsFailure](https://developers.google.com/google-ads/api/reference/rpc/v6/GoogleAdsFailure). +All errors, apart from GRPC specific cases (such as a connection problem or timeout, [see more here](https://github.com/grpc/grpc/blob/master/doc/statuscodes.md)), are instances of a [GoogleAdsFailure](https://developers.google.com/google-ads/api/reference/rpc/v7/GoogleAdsFailure). -You can find a list of all error types for a specific version in [the official documentation](https://developers.google.com/google-ads/api/reference/rpc/v6/AccessInvitationErrorEnum.AccessInvitationError), as well as more information about [handling errors here](https://developers.google.com/google-ads/api/docs/best-practices/error-types). +You can find a list of all error types for a specific version in [the official documentation](https://developers.google.com/google-ads/api/reference/rpc/v7/AccessInvitationErrorEnum.AccessInvitationError), as well as more information about [handling errors here](https://developers.google.com/google-ads/api/docs/best-practices/error-types). ```ts import { errors } from "google-ads-api"; diff --git a/package.json b/package.json index a4320ab2..5634e05c 100644 --- a/package.json +++ b/package.json @@ -17,9 +17,9 @@ "author": "Opteo", "license": "MIT", "dependencies": { - "google-ads-node": "^4.0.2", - "google-auth-library": "^6.1.3", - "google-gax": "^2.10.2", + "google-ads-node": "^5.0.0", + "google-auth-library": "^7.1.0", + "google-gax": "^2.14.0", "long": "^4.0.0" }, "devDependencies": { diff --git a/scripts/fields.spec.ts b/scripts/fields.spec.ts index 4e4f6492..10787c57 100644 --- a/scripts/fields.spec.ts +++ b/scripts/fields.spec.ts @@ -81,14 +81,14 @@ describe("other checkers", () => { it("getEnumName", () => { const attributeEnumField = new resources.GoogleAdsField({ type_url: - "google.ads.googleads.v6.enums.CampaignStatusEnum.CampaignStatus", + "google.ads.googleads.v7.enums.CampaignStatusEnum.CampaignStatus", }); const metricEnumField = new resources.GoogleAdsField({ type_url: - "google.ads.googleads.v6.enums.QualityScoreBucketEnum.QualityScoreBucket", + "google.ads.googleads.v7.enums.QualityScoreBucketEnum.QualityScoreBucket", }); const segmentEnumField = new resources.GoogleAdsField({ - type_url: "google.ads.googleads.v6.enums.DayOfWeekEnum.DayOfWeek", + type_url: "google.ads.googleads.v7.enums.DayOfWeekEnum.DayOfWeek", }); expect(getEnumName(attributeEnumField)).toEqual("CampaignStatus"); diff --git a/scripts/fields.ts b/scripts/fields.ts index b2b10c71..752aa527 100644 --- a/scripts/fields.ts +++ b/scripts/fields.ts @@ -62,6 +62,12 @@ export async function compileFields(): Promise { const metrics: string[] = []; fields.forEach((field: resources.GoogleAdsField) => { + if (!isDefinedAndNotNull(field.name)) { + return; + } + + const field_name = field.name as string; + if (isResource(field)) { const resource: Resource = { attributes: [], @@ -70,7 +76,7 @@ export async function compileFields(): Promise { }; const selectableResources: string[] = [ - field.name, + field_name, ...field.selectable_with.filter( (selectable: string) => !selectable.includes("segments.") && @@ -83,24 +89,29 @@ export async function compileFields(): Promise { const correctResource = selectableResources.find((resource: string) => field.resource_name.includes(`/${resource}.`) ); - return isAttribute(field) && correctResource && field.selectable; + return ( + isAttribute(field) && + isDefinedAndNotNull(field.name) && + correctResource && + field.selectable + ); }) - .map((field: resources.GoogleAdsField): string => field.name); + .map((field: resources.GoogleAdsField): string => field.name as string); - resourceConstructs[field.name] = resource; + resourceConstructs[field_name] = resource; } else if (isAttribute(field) && field.selectable) { - attributes.push(field.name); + attributes.push(field_name); if (isResourceName(field)) { - resourceNames.push(field.name); + resourceNames.push(field_name); } } else if (isMetric(field) && field.selectable) { - metrics.push(field.name); + metrics.push(field_name); } else if (isSegment(field) && field.selectable) { - segments.push(field.name); + segments.push(field_name); } if (hasEnumDataType(field)) { - enumFields[field.name] = getEnumName(field); + enumFields[field_name] = getEnumName(field); } }); @@ -208,7 +219,11 @@ export function isSegment(field: resources.GoogleAdsField): boolean { const resourceNameRegex = new RegExp(/^.*\.resource_name$/g); export function isResourceName(field: resources.GoogleAdsField): boolean { - return resourceNameRegex.test(field.name); + if (isDefinedAndNotNull(field.name)) { + return resourceNameRegex.test(field.name as string); + } else { + return false; + } } export function hasEnumDataType(field: resources.GoogleAdsField): boolean { @@ -216,5 +231,13 @@ export function hasEnumDataType(field: resources.GoogleAdsField): boolean { } export function getEnumName(field: resources.GoogleAdsField): string { - return field.type_url.replace(/.*(?=\.)\./g, ""); + if (isDefinedAndNotNull(field.type_url)) { + return (field.type_url as string).replace(/.*(?=\.)\./g, ""); + } else { + return "FIELD_HAS_NO_ENUM_NAME"; + } +} + +function isDefinedAndNotNull(input: string | null | undefined): boolean { + return typeof input !== "undefined" && input !== null; } diff --git a/scripts/index.ts b/scripts/index.ts index 98f0614a..6eea02fc 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -29,11 +29,12 @@ async function compileAll(): Promise { console.log(`compiling only "${onlyRun}"`); await scripts[onlyRun](); } else { - console.log("compiling all scripts"); - for (const script of Object.values(scripts)) { - console.log(script); + console.log("compiling all scripts..."); + for (const [name, script] of Object.entries(scripts)) { await script(); + console.log(`${name} compiled successfully`); } + console.log("done"); } } diff --git a/scripts/services.ts b/scripts/services.ts index 56fd4981..ac3b67f0 100644 --- a/scripts/services.ts +++ b/scripts/services.ts @@ -24,7 +24,7 @@ interface ProtoDefinition { [fieldName: string]: { type: string; id: number; - options?: Record; + options?: Record; }; }; } diff --git a/src/customer.spec.ts b/src/customer.spec.ts index 8626886a..a7924234 100644 --- a/src/customer.spec.ts +++ b/src/customer.spec.ts @@ -1114,7 +1114,7 @@ describe("mutateResources", () => { partial_failure_error: new google.rpc.Status({ details: [ { - type_url: "google.ads.googleads.v6.errors.GoogleAdsFailure", + type_url: "google.ads.googleads.v7.errors.GoogleAdsFailure", value: failureBuffer, }, ], diff --git a/src/customer.ts b/src/customer.ts index a22a9292..898b7737 100644 --- a/src/customer.ts +++ b/src/customer.ts @@ -25,10 +25,9 @@ export class Customer extends ServiceFactory { constructor( clientOptions: ClientOptions, customerOptions: CustomerOptions, - hooks?: Hooks, - timeout = 3600000 // 1 hour + hooks?: Hooks ) { - super(clientOptions, customerOptions, hooks ?? {}, timeout); + super(clientOptions, customerOptions, hooks ?? {}); } /** @@ -129,7 +128,6 @@ export class Customer extends ServiceFactory { const stream = service.searchStream(request, { otherArgs: { headers: this.callHeaders }, - timeout: this.timeout, }); let streamFinished = false; @@ -230,7 +228,6 @@ export class Customer extends ServiceFactory { return service.searchStream(request, { otherArgs: { headers: this.callHeaders }, - timeout: this.timeout, }); } @@ -249,7 +246,6 @@ export class Customer extends ServiceFactory { const searchResponse = await service.search(request, { otherArgs: { headers: this.callHeaders }, - timeout: this.timeout, autoPaginate: false, // autoPaginate doesn't work }); @@ -356,7 +352,7 @@ export class Customer extends ServiceFactory { } } - return { response: (response as unknown) as T, totalResultsCount }; + return { response: response as unknown as T, totalResultsCount }; } catch (searchError) { const googleAdsError = this.getGoogleAdsError(searchError); if (this.hooks.onQueryError && useHooks) { diff --git a/src/protos/autogen/enums.ts b/src/protos/autogen/enums.ts index f097f974..50a4ee4b 100644 --- a/src/protos/autogen/enums.ts +++ b/src/protos/autogen/enums.ts @@ -4,7 +4,7 @@ export namespace enums { /** * @name PolicyTopicEntryTypeEnum.PolicyTopicEntryType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PolicyTopicEntryTypeEnum.PolicyTopicEntryType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PolicyTopicEntryTypeEnum.PolicyTopicEntryType */ export enum PolicyTopicEntryType { UNSPECIFIED = 0, // UNSPECIFIED @@ -19,7 +19,7 @@ export namespace enums { /** * @name PolicyTopicEvidenceDestinationMismatchUrlTypeEnum.PolicyTopicEvidenceDestinationMismatchUrlType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PolicyTopicEvidenceDestinationMismatchUrlTypeEnum.PolicyTopicEvidenceDestinationMismatchUrlType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PolicyTopicEvidenceDestinationMismatchUrlTypeEnum.PolicyTopicEvidenceDestinationMismatchUrlType */ export enum PolicyTopicEvidenceDestinationMismatchUrlType { UNSPECIFIED = 0, // UNSPECIFIED @@ -33,7 +33,7 @@ export namespace enums { /** * @name PolicyTopicEvidenceDestinationNotWorkingDeviceEnum.PolicyTopicEvidenceDestinationNotWorkingDevice - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PolicyTopicEvidenceDestinationNotWorkingDeviceEnum.PolicyTopicEvidenceDestinationNotWorkingDevice + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PolicyTopicEvidenceDestinationNotWorkingDeviceEnum.PolicyTopicEvidenceDestinationNotWorkingDevice */ export enum PolicyTopicEvidenceDestinationNotWorkingDevice { UNSPECIFIED = 0, // UNSPECIFIED @@ -45,7 +45,7 @@ export namespace enums { /** * @name PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum.PolicyTopicEvidenceDestinationNotWorkingDnsErrorType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum.PolicyTopicEvidenceDestinationNotWorkingDnsErrorType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PolicyTopicEvidenceDestinationNotWorkingDnsErrorTypeEnum.PolicyTopicEvidenceDestinationNotWorkingDnsErrorType */ export enum PolicyTopicEvidenceDestinationNotWorkingDnsErrorType { UNSPECIFIED = 0, // UNSPECIFIED @@ -56,7 +56,7 @@ export namespace enums { /** * @name PolicyApprovalStatusEnum.PolicyApprovalStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PolicyApprovalStatusEnum.PolicyApprovalStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PolicyApprovalStatusEnum.PolicyApprovalStatus */ export enum PolicyApprovalStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -69,7 +69,7 @@ export namespace enums { /** * @name PolicyReviewStatusEnum.PolicyReviewStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PolicyReviewStatusEnum.PolicyReviewStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PolicyReviewStatusEnum.PolicyReviewStatus */ export enum PolicyReviewStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -82,7 +82,7 @@ export namespace enums { /** * @name AssetPerformanceLabelEnum.AssetPerformanceLabel - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AssetPerformanceLabelEnum.AssetPerformanceLabel + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AssetPerformanceLabelEnum.AssetPerformanceLabel */ export enum AssetPerformanceLabel { UNSPECIFIED = 0, // UNSPECIFIED @@ -96,7 +96,7 @@ export namespace enums { /** * @name ServedAssetFieldTypeEnum.ServedAssetFieldType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ServedAssetFieldTypeEnum.ServedAssetFieldType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ServedAssetFieldTypeEnum.ServedAssetFieldType */ export enum ServedAssetFieldType { UNSPECIFIED = 0, // UNSPECIFIED @@ -110,7 +110,7 @@ export namespace enums { /** * @name CallConversionReportingStateEnum.CallConversionReportingState - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CallConversionReportingStateEnum.CallConversionReportingState + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CallConversionReportingStateEnum.CallConversionReportingState */ export enum CallConversionReportingState { UNSPECIFIED = 0, // UNSPECIFIED @@ -122,7 +122,7 @@ export namespace enums { /** * @name DisplayAdFormatSettingEnum.DisplayAdFormatSetting - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DisplayAdFormatSettingEnum.DisplayAdFormatSetting + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DisplayAdFormatSettingEnum.DisplayAdFormatSetting */ export enum DisplayAdFormatSetting { UNSPECIFIED = 0, // UNSPECIFIED @@ -134,7 +134,7 @@ export namespace enums { /** * @name DisplayUploadProductTypeEnum.DisplayUploadProductType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DisplayUploadProductTypeEnum.DisplayUploadProductType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DisplayUploadProductTypeEnum.DisplayUploadProductType */ export enum DisplayUploadProductType { UNSPECIFIED = 0, // UNSPECIFIED @@ -153,7 +153,7 @@ export namespace enums { /** * @name LegacyAppInstallAdAppStoreEnum.LegacyAppInstallAdAppStore - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LegacyAppInstallAdAppStoreEnum.LegacyAppInstallAdAppStore + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LegacyAppInstallAdAppStoreEnum.LegacyAppInstallAdAppStore */ export enum LegacyAppInstallAdAppStore { UNSPECIFIED = 0, // UNSPECIFIED @@ -167,7 +167,7 @@ export namespace enums { /** * @name MimeTypeEnum.MimeType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MimeTypeEnum.MimeType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MimeTypeEnum.MimeType */ export enum MimeType { UNSPECIFIED = 0, // UNSPECIFIED @@ -186,137 +186,9 @@ export namespace enums { HTML5_AD_ZIP = 13, // HTML5_AD_ZIP } - /** - * @name LeadFormCallToActionTypeEnum.LeadFormCallToActionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LeadFormCallToActionTypeEnum.LeadFormCallToActionType - */ - export enum LeadFormCallToActionType { - UNSPECIFIED = 0, // UNSPECIFIED - UNKNOWN = 1, // UNKNOWN - LEARN_MORE = 2, // LEARN_MORE - GET_QUOTE = 3, // GET_QUOTE - APPLY_NOW = 4, // APPLY_NOW - SIGN_UP = 5, // SIGN_UP - CONTACT_US = 6, // CONTACT_US - SUBSCRIBE = 7, // SUBSCRIBE - DOWNLOAD = 8, // DOWNLOAD - BOOK_NOW = 9, // BOOK_NOW - GET_OFFER = 10, // GET_OFFER - REGISTER = 11, // REGISTER - GET_INFO = 12, // GET_INFO - REQUEST_DEMO = 13, // REQUEST_DEMO - JOIN_NOW = 14, // JOIN_NOW - GET_STARTED = 15, // GET_STARTED - } - - /** - * @name LeadFormDesiredIntentEnum.LeadFormDesiredIntent - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LeadFormDesiredIntentEnum.LeadFormDesiredIntent - */ - export enum LeadFormDesiredIntent { - UNSPECIFIED = 0, // UNSPECIFIED - UNKNOWN = 1, // UNKNOWN - LOW_INTENT = 2, // LOW_INTENT - HIGH_INTENT = 3, // HIGH_INTENT - } - - /** - * @name LeadFormFieldUserInputTypeEnum.LeadFormFieldUserInputType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LeadFormFieldUserInputTypeEnum.LeadFormFieldUserInputType - */ - export enum LeadFormFieldUserInputType { - UNSPECIFIED = 0, // UNSPECIFIED - UNKNOWN = 1, // UNKNOWN - FULL_NAME = 2, // FULL_NAME - GIVEN_NAME = 6, // GIVEN_NAME - FAMILY_NAME = 7, // FAMILY_NAME - EMAIL = 3, // EMAIL - PHONE_NUMBER = 4, // PHONE_NUMBER - POSTAL_CODE = 5, // POSTAL_CODE - CITY = 9, // CITY - REGION = 10, // REGION - COUNTRY = 11, // COUNTRY - WORK_EMAIL = 12, // WORK_EMAIL - COMPANY_NAME = 13, // COMPANY_NAME - WORK_PHONE = 14, // WORK_PHONE - JOB_TITLE = 15, // JOB_TITLE - VEHICLE_MODEL = 1001, // VEHICLE_MODEL - VEHICLE_TYPE = 1002, // VEHICLE_TYPE - PREFERRED_DEALERSHIP = 1003, // PREFERRED_DEALERSHIP - VEHICLE_PURCHASE_TIMELINE = 1004, // VEHICLE_PURCHASE_TIMELINE - VEHICLE_OWNERSHIP = 1005, // VEHICLE_OWNERSHIP - VEHICLE_PAYMENT_TYPE = 1009, // VEHICLE_PAYMENT_TYPE - VEHICLE_CONDITION = 1010, // VEHICLE_CONDITION - COMPANY_SIZE = 1006, // COMPANY_SIZE - ANNUAL_SALES = 1007, // ANNUAL_SALES - YEARS_IN_BUSINESS = 1008, // YEARS_IN_BUSINESS - JOB_DEPARTMENT = 1011, // JOB_DEPARTMENT - JOB_ROLE = 1012, // JOB_ROLE - EDUCATION_PROGRAM = 1013, // EDUCATION_PROGRAM - EDUCATION_COURSE = 1014, // EDUCATION_COURSE - PRODUCT = 1016, // PRODUCT - SERVICE = 1017, // SERVICE - OFFER = 1018, // OFFER - CATEGORY = 1019, // CATEGORY - PREFERRED_CONTACT_METHOD = 1020, // PREFERRED_CONTACT_METHOD - PREFERRED_LOCATION = 1021, // PREFERRED_LOCATION - PREFERRED_CONTACT_TIME = 1022, // PREFERRED_CONTACT_TIME - PURCHASE_TIMELINE = 1023, // PURCHASE_TIMELINE - YEARS_OF_EXPERIENCE = 1048, // YEARS_OF_EXPERIENCE - JOB_INDUSTRY = 1049, // JOB_INDUSTRY - LEVEL_OF_EDUCATION = 1050, // LEVEL_OF_EDUCATION - PROPERTY_TYPE = 1024, // PROPERTY_TYPE - REALTOR_HELP_GOAL = 1025, // REALTOR_HELP_GOAL - PROPERTY_COMMUNITY = 1026, // PROPERTY_COMMUNITY - PRICE_RANGE = 1027, // PRICE_RANGE - NUMBER_OF_BEDROOMS = 1028, // NUMBER_OF_BEDROOMS - FURNISHED_PROPERTY = 1029, // FURNISHED_PROPERTY - PETS_ALLOWED_PROPERTY = 1030, // PETS_ALLOWED_PROPERTY - NEXT_PLANNED_PURCHASE = 1031, // NEXT_PLANNED_PURCHASE - EVENT_SIGNUP_INTEREST = 1033, // EVENT_SIGNUP_INTEREST - PREFERRED_SHOPPING_PLACES = 1034, // PREFERRED_SHOPPING_PLACES - FAVORITE_BRAND = 1035, // FAVORITE_BRAND - TRANSPORTATION_COMMERCIAL_LICENSE_TYPE = 1036, // TRANSPORTATION_COMMERCIAL_LICENSE_TYPE - EVENT_BOOKING_INTEREST = 1038, // EVENT_BOOKING_INTEREST - DESTINATION_COUNTRY = 1039, // DESTINATION_COUNTRY - DESTINATION_CITY = 1040, // DESTINATION_CITY - DEPARTURE_COUNTRY = 1041, // DEPARTURE_COUNTRY - DEPARTURE_CITY = 1042, // DEPARTURE_CITY - DEPARTURE_DATE = 1043, // DEPARTURE_DATE - RETURN_DATE = 1044, // RETURN_DATE - NUMBER_OF_TRAVELERS = 1045, // NUMBER_OF_TRAVELERS - TRAVEL_BUDGET = 1046, // TRAVEL_BUDGET - TRAVEL_ACCOMMODATION = 1047, // TRAVEL_ACCOMMODATION - } - - /** - * @name LeadFormPostSubmitCallToActionTypeEnum.LeadFormPostSubmitCallToActionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LeadFormPostSubmitCallToActionTypeEnum.LeadFormPostSubmitCallToActionType - */ - export enum LeadFormPostSubmitCallToActionType { - UNSPECIFIED = 0, // UNSPECIFIED - UNKNOWN = 1, // UNKNOWN - VISIT_SITE = 2, // VISIT_SITE - DOWNLOAD = 3, // DOWNLOAD - LEARN_MORE = 4, // LEARN_MORE - SHOP_NOW = 5, // SHOP_NOW - } - - /** - * @name TargetImpressionShareLocationEnum.TargetImpressionShareLocation - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TargetImpressionShareLocationEnum.TargetImpressionShareLocation - */ - export enum TargetImpressionShareLocation { - UNSPECIFIED = 0, // UNSPECIFIED - UNKNOWN = 1, // UNKNOWN - ANYWHERE_ON_PAGE = 2, // ANYWHERE_ON_PAGE - TOP_OF_PAGE = 3, // TOP_OF_PAGE - ABSOLUTE_TOP_OF_PAGE = 4, // ABSOLUTE_TOP_OF_PAGE - } - /** * @name AgeRangeTypeEnum.AgeRangeType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AgeRangeTypeEnum.AgeRangeType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AgeRangeTypeEnum.AgeRangeType */ export enum AgeRangeType { UNSPECIFIED = 0, // UNSPECIFIED @@ -332,7 +204,7 @@ export namespace enums { /** * @name AppPaymentModelTypeEnum.AppPaymentModelType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AppPaymentModelTypeEnum.AppPaymentModelType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AppPaymentModelTypeEnum.AppPaymentModelType */ export enum AppPaymentModelType { UNSPECIFIED = 0, // UNSPECIFIED @@ -342,7 +214,7 @@ export namespace enums { /** * @name ContentLabelTypeEnum.ContentLabelType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ContentLabelTypeEnum.ContentLabelType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ContentLabelTypeEnum.ContentLabelType */ export enum ContentLabelType { UNSPECIFIED = 0, // UNSPECIFIED @@ -366,7 +238,7 @@ export namespace enums { /** * @name DayOfWeekEnum.DayOfWeek - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DayOfWeekEnum.DayOfWeek + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DayOfWeekEnum.DayOfWeek */ export enum DayOfWeek { UNSPECIFIED = 0, // UNSPECIFIED @@ -382,7 +254,7 @@ export namespace enums { /** * @name DeviceEnum.Device - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DeviceEnum.Device + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DeviceEnum.Device */ export enum Device { UNSPECIFIED = 0, // UNSPECIFIED @@ -396,7 +268,7 @@ export namespace enums { /** * @name GenderTypeEnum.GenderType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GenderTypeEnum.GenderType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GenderTypeEnum.GenderType */ export enum GenderType { UNSPECIFIED = 0, // UNSPECIFIED @@ -408,7 +280,7 @@ export namespace enums { /** * @name HotelDateSelectionTypeEnum.HotelDateSelectionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/HotelDateSelectionTypeEnum.HotelDateSelectionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/HotelDateSelectionTypeEnum.HotelDateSelectionType */ export enum HotelDateSelectionType { UNSPECIFIED = 0, // UNSPECIFIED @@ -419,7 +291,7 @@ export namespace enums { /** * @name IncomeRangeTypeEnum.IncomeRangeType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/IncomeRangeTypeEnum.IncomeRangeType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/IncomeRangeTypeEnum.IncomeRangeType */ export enum IncomeRangeType { UNSPECIFIED = 0, // UNSPECIFIED @@ -435,7 +307,7 @@ export namespace enums { /** * @name InteractionTypeEnum.InteractionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/InteractionTypeEnum.InteractionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/InteractionTypeEnum.InteractionType */ export enum InteractionType { UNSPECIFIED = 0, // UNSPECIFIED @@ -445,7 +317,7 @@ export namespace enums { /** * @name KeywordMatchTypeEnum.KeywordMatchType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordMatchTypeEnum.KeywordMatchType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordMatchTypeEnum.KeywordMatchType */ export enum KeywordMatchType { UNSPECIFIED = 0, // UNSPECIFIED @@ -457,7 +329,7 @@ export namespace enums { /** * @name ListingGroupTypeEnum.ListingGroupType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ListingGroupTypeEnum.ListingGroupType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ListingGroupTypeEnum.ListingGroupType */ export enum ListingGroupType { UNSPECIFIED = 0, // UNSPECIFIED @@ -468,7 +340,7 @@ export namespace enums { /** * @name LocationGroupRadiusUnitsEnum.LocationGroupRadiusUnits - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LocationGroupRadiusUnitsEnum.LocationGroupRadiusUnits + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LocationGroupRadiusUnitsEnum.LocationGroupRadiusUnits */ export enum LocationGroupRadiusUnits { UNSPECIFIED = 0, // UNSPECIFIED @@ -480,7 +352,7 @@ export namespace enums { /** * @name MinuteOfHourEnum.MinuteOfHour - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MinuteOfHourEnum.MinuteOfHour + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MinuteOfHourEnum.MinuteOfHour */ export enum MinuteOfHour { UNSPECIFIED = 0, // UNSPECIFIED @@ -493,7 +365,7 @@ export namespace enums { /** * @name ParentalStatusTypeEnum.ParentalStatusType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ParentalStatusTypeEnum.ParentalStatusType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ParentalStatusTypeEnum.ParentalStatusType */ export enum ParentalStatusType { UNSPECIFIED = 0, // UNSPECIFIED @@ -505,7 +377,7 @@ export namespace enums { /** * @name PreferredContentTypeEnum.PreferredContentType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PreferredContentTypeEnum.PreferredContentType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PreferredContentTypeEnum.PreferredContentType */ export enum PreferredContentType { UNSPECIFIED = 0, // UNSPECIFIED @@ -515,7 +387,7 @@ export namespace enums { /** * @name ProductBiddingCategoryLevelEnum.ProductBiddingCategoryLevel - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductBiddingCategoryLevelEnum.ProductBiddingCategoryLevel + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductBiddingCategoryLevelEnum.ProductBiddingCategoryLevel */ export enum ProductBiddingCategoryLevel { UNSPECIFIED = 0, // UNSPECIFIED @@ -529,7 +401,7 @@ export namespace enums { /** * @name ProductChannelEnum.ProductChannel - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductChannelEnum.ProductChannel + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductChannelEnum.ProductChannel */ export enum ProductChannel { UNSPECIFIED = 0, // UNSPECIFIED @@ -540,7 +412,7 @@ export namespace enums { /** * @name ProductChannelExclusivityEnum.ProductChannelExclusivity - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductChannelExclusivityEnum.ProductChannelExclusivity + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductChannelExclusivityEnum.ProductChannelExclusivity */ export enum ProductChannelExclusivity { UNSPECIFIED = 0, // UNSPECIFIED @@ -551,7 +423,7 @@ export namespace enums { /** * @name ProductConditionEnum.ProductCondition - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductConditionEnum.ProductCondition + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductConditionEnum.ProductCondition */ export enum ProductCondition { UNSPECIFIED = 0, // UNSPECIFIED @@ -563,7 +435,7 @@ export namespace enums { /** * @name ProductCustomAttributeIndexEnum.ProductCustomAttributeIndex - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductCustomAttributeIndexEnum.ProductCustomAttributeIndex + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductCustomAttributeIndexEnum.ProductCustomAttributeIndex */ export enum ProductCustomAttributeIndex { UNSPECIFIED = 0, // UNSPECIFIED @@ -577,7 +449,7 @@ export namespace enums { /** * @name ProductTypeLevelEnum.ProductTypeLevel - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductTypeLevelEnum.ProductTypeLevel + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductTypeLevelEnum.ProductTypeLevel */ export enum ProductTypeLevel { UNSPECIFIED = 0, // UNSPECIFIED @@ -591,7 +463,7 @@ export namespace enums { /** * @name ProximityRadiusUnitsEnum.ProximityRadiusUnits - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProximityRadiusUnitsEnum.ProximityRadiusUnits + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProximityRadiusUnitsEnum.ProximityRadiusUnits */ export enum ProximityRadiusUnits { UNSPECIFIED = 0, // UNSPECIFIED @@ -602,7 +474,7 @@ export namespace enums { /** * @name WebpageConditionOperandEnum.WebpageConditionOperand - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/WebpageConditionOperandEnum.WebpageConditionOperand + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/WebpageConditionOperandEnum.WebpageConditionOperand */ export enum WebpageConditionOperand { UNSPECIFIED = 0, // UNSPECIFIED @@ -616,7 +488,7 @@ export namespace enums { /** * @name WebpageConditionOperatorEnum.WebpageConditionOperator - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/WebpageConditionOperatorEnum.WebpageConditionOperator + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/WebpageConditionOperatorEnum.WebpageConditionOperator */ export enum WebpageConditionOperator { UNSPECIFIED = 0, // UNSPECIFIED @@ -625,9 +497,193 @@ export namespace enums { CONTAINS = 3, // CONTAINS } + /** + * @name LeadFormCallToActionTypeEnum.LeadFormCallToActionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LeadFormCallToActionTypeEnum.LeadFormCallToActionType + */ + export enum LeadFormCallToActionType { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + LEARN_MORE = 2, // LEARN_MORE + GET_QUOTE = 3, // GET_QUOTE + APPLY_NOW = 4, // APPLY_NOW + SIGN_UP = 5, // SIGN_UP + CONTACT_US = 6, // CONTACT_US + SUBSCRIBE = 7, // SUBSCRIBE + DOWNLOAD = 8, // DOWNLOAD + BOOK_NOW = 9, // BOOK_NOW + GET_OFFER = 10, // GET_OFFER + REGISTER = 11, // REGISTER + GET_INFO = 12, // GET_INFO + REQUEST_DEMO = 13, // REQUEST_DEMO + JOIN_NOW = 14, // JOIN_NOW + GET_STARTED = 15, // GET_STARTED + } + + /** + * @name LeadFormDesiredIntentEnum.LeadFormDesiredIntent + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LeadFormDesiredIntentEnum.LeadFormDesiredIntent + */ + export enum LeadFormDesiredIntent { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + LOW_INTENT = 2, // LOW_INTENT + HIGH_INTENT = 3, // HIGH_INTENT + } + + /** + * @name LeadFormFieldUserInputTypeEnum.LeadFormFieldUserInputType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LeadFormFieldUserInputTypeEnum.LeadFormFieldUserInputType + */ + export enum LeadFormFieldUserInputType { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + FULL_NAME = 2, // FULL_NAME + GIVEN_NAME = 6, // GIVEN_NAME + FAMILY_NAME = 7, // FAMILY_NAME + EMAIL = 3, // EMAIL + PHONE_NUMBER = 4, // PHONE_NUMBER + POSTAL_CODE = 5, // POSTAL_CODE + CITY = 9, // CITY + REGION = 10, // REGION + COUNTRY = 11, // COUNTRY + WORK_EMAIL = 12, // WORK_EMAIL + COMPANY_NAME = 13, // COMPANY_NAME + WORK_PHONE = 14, // WORK_PHONE + JOB_TITLE = 15, // JOB_TITLE + VEHICLE_MODEL = 1001, // VEHICLE_MODEL + VEHICLE_TYPE = 1002, // VEHICLE_TYPE + PREFERRED_DEALERSHIP = 1003, // PREFERRED_DEALERSHIP + VEHICLE_PURCHASE_TIMELINE = 1004, // VEHICLE_PURCHASE_TIMELINE + VEHICLE_OWNERSHIP = 1005, // VEHICLE_OWNERSHIP + VEHICLE_PAYMENT_TYPE = 1009, // VEHICLE_PAYMENT_TYPE + VEHICLE_CONDITION = 1010, // VEHICLE_CONDITION + COMPANY_SIZE = 1006, // COMPANY_SIZE + ANNUAL_SALES = 1007, // ANNUAL_SALES + YEARS_IN_BUSINESS = 1008, // YEARS_IN_BUSINESS + JOB_DEPARTMENT = 1011, // JOB_DEPARTMENT + JOB_ROLE = 1012, // JOB_ROLE + EDUCATION_PROGRAM = 1013, // EDUCATION_PROGRAM + EDUCATION_COURSE = 1014, // EDUCATION_COURSE + PRODUCT = 1016, // PRODUCT + SERVICE = 1017, // SERVICE + OFFER = 1018, // OFFER + CATEGORY = 1019, // CATEGORY + PREFERRED_CONTACT_METHOD = 1020, // PREFERRED_CONTACT_METHOD + PREFERRED_LOCATION = 1021, // PREFERRED_LOCATION + PREFERRED_CONTACT_TIME = 1022, // PREFERRED_CONTACT_TIME + PURCHASE_TIMELINE = 1023, // PURCHASE_TIMELINE + YEARS_OF_EXPERIENCE = 1048, // YEARS_OF_EXPERIENCE + JOB_INDUSTRY = 1049, // JOB_INDUSTRY + LEVEL_OF_EDUCATION = 1050, // LEVEL_OF_EDUCATION + PROPERTY_TYPE = 1024, // PROPERTY_TYPE + REALTOR_HELP_GOAL = 1025, // REALTOR_HELP_GOAL + PROPERTY_COMMUNITY = 1026, // PROPERTY_COMMUNITY + PRICE_RANGE = 1027, // PRICE_RANGE + NUMBER_OF_BEDROOMS = 1028, // NUMBER_OF_BEDROOMS + FURNISHED_PROPERTY = 1029, // FURNISHED_PROPERTY + PETS_ALLOWED_PROPERTY = 1030, // PETS_ALLOWED_PROPERTY + NEXT_PLANNED_PURCHASE = 1031, // NEXT_PLANNED_PURCHASE + EVENT_SIGNUP_INTEREST = 1033, // EVENT_SIGNUP_INTEREST + PREFERRED_SHOPPING_PLACES = 1034, // PREFERRED_SHOPPING_PLACES + FAVORITE_BRAND = 1035, // FAVORITE_BRAND + TRANSPORTATION_COMMERCIAL_LICENSE_TYPE = 1036, // TRANSPORTATION_COMMERCIAL_LICENSE_TYPE + EVENT_BOOKING_INTEREST = 1038, // EVENT_BOOKING_INTEREST + DESTINATION_COUNTRY = 1039, // DESTINATION_COUNTRY + DESTINATION_CITY = 1040, // DESTINATION_CITY + DEPARTURE_COUNTRY = 1041, // DEPARTURE_COUNTRY + DEPARTURE_CITY = 1042, // DEPARTURE_CITY + DEPARTURE_DATE = 1043, // DEPARTURE_DATE + RETURN_DATE = 1044, // RETURN_DATE + NUMBER_OF_TRAVELERS = 1045, // NUMBER_OF_TRAVELERS + TRAVEL_BUDGET = 1046, // TRAVEL_BUDGET + TRAVEL_ACCOMMODATION = 1047, // TRAVEL_ACCOMMODATION + } + + /** + * @name LeadFormPostSubmitCallToActionTypeEnum.LeadFormPostSubmitCallToActionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LeadFormPostSubmitCallToActionTypeEnum.LeadFormPostSubmitCallToActionType + */ + export enum LeadFormPostSubmitCallToActionType { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + VISIT_SITE = 2, // VISIT_SITE + DOWNLOAD = 3, // DOWNLOAD + LEARN_MORE = 4, // LEARN_MORE + SHOP_NOW = 5, // SHOP_NOW + } + + /** + * @name PromotionExtensionDiscountModifierEnum.PromotionExtensionDiscountModifier + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PromotionExtensionDiscountModifierEnum.PromotionExtensionDiscountModifier + */ + export enum PromotionExtensionDiscountModifier { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + UP_TO = 2, // UP_TO + } + + /** + * @name PromotionExtensionOccasionEnum.PromotionExtensionOccasion + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PromotionExtensionOccasionEnum.PromotionExtensionOccasion + */ + export enum PromotionExtensionOccasion { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + NEW_YEARS = 2, // NEW_YEARS + CHINESE_NEW_YEAR = 3, // CHINESE_NEW_YEAR + VALENTINES_DAY = 4, // VALENTINES_DAY + EASTER = 5, // EASTER + MOTHERS_DAY = 6, // MOTHERS_DAY + FATHERS_DAY = 7, // FATHERS_DAY + LABOR_DAY = 8, // LABOR_DAY + BACK_TO_SCHOOL = 9, // BACK_TO_SCHOOL + HALLOWEEN = 10, // HALLOWEEN + BLACK_FRIDAY = 11, // BLACK_FRIDAY + CYBER_MONDAY = 12, // CYBER_MONDAY + CHRISTMAS = 13, // CHRISTMAS + BOXING_DAY = 14, // BOXING_DAY + INDEPENDENCE_DAY = 15, // INDEPENDENCE_DAY + NATIONAL_DAY = 16, // NATIONAL_DAY + END_OF_SEASON = 17, // END_OF_SEASON + WINTER_SALE = 18, // WINTER_SALE + SUMMER_SALE = 19, // SUMMER_SALE + FALL_SALE = 20, // FALL_SALE + SPRING_SALE = 21, // SPRING_SALE + RAMADAN = 22, // RAMADAN + EID_AL_FITR = 23, // EID_AL_FITR + EID_AL_ADHA = 24, // EID_AL_ADHA + SINGLES_DAY = 25, // SINGLES_DAY + WOMENS_DAY = 26, // WOMENS_DAY + HOLI = 27, // HOLI + PARENTS_DAY = 28, // PARENTS_DAY + ST_NICHOLAS_DAY = 29, // ST_NICHOLAS_DAY + CARNIVAL = 30, // CARNIVAL + EPIPHANY = 31, // EPIPHANY + ROSH_HASHANAH = 32, // ROSH_HASHANAH + PASSOVER = 33, // PASSOVER + HANUKKAH = 34, // HANUKKAH + DIWALI = 35, // DIWALI + NAVRATRI = 36, // NAVRATRI + SONGKRAN = 37, // SONGKRAN + YEAR_END_GIFT = 38, // YEAR_END_GIFT + } + + /** + * @name TargetImpressionShareLocationEnum.TargetImpressionShareLocation + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TargetImpressionShareLocationEnum.TargetImpressionShareLocation + */ + export enum TargetImpressionShareLocation { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + ANYWHERE_ON_PAGE = 2, // ANYWHERE_ON_PAGE + TOP_OF_PAGE = 3, // TOP_OF_PAGE + ABSOLUTE_TOP_OF_PAGE = 4, // ABSOLUTE_TOP_OF_PAGE + } + /** * @name AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdvertisingChannelSubTypeEnum.AdvertisingChannelSubType */ export enum AdvertisingChannelSubType { UNSPECIFIED = 0, // UNSPECIFIED @@ -652,7 +708,7 @@ export namespace enums { /** * @name AdvertisingChannelTypeEnum.AdvertisingChannelType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdvertisingChannelTypeEnum.AdvertisingChannelType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdvertisingChannelTypeEnum.AdvertisingChannelType */ export enum AdvertisingChannelType { UNSPECIFIED = 0, // UNSPECIFIED @@ -669,7 +725,7 @@ export namespace enums { /** * @name CriterionCategoryChannelAvailabilityModeEnum.CriterionCategoryChannelAvailabilityMode - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CriterionCategoryChannelAvailabilityModeEnum.CriterionCategoryChannelAvailabilityMode + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CriterionCategoryChannelAvailabilityModeEnum.CriterionCategoryChannelAvailabilityMode */ export enum CriterionCategoryChannelAvailabilityMode { UNSPECIFIED = 0, // UNSPECIFIED @@ -681,7 +737,7 @@ export namespace enums { /** * @name CriterionCategoryLocaleAvailabilityModeEnum.CriterionCategoryLocaleAvailabilityMode - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CriterionCategoryLocaleAvailabilityModeEnum.CriterionCategoryLocaleAvailabilityMode + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CriterionCategoryLocaleAvailabilityModeEnum.CriterionCategoryLocaleAvailabilityMode */ export enum CriterionCategoryLocaleAvailabilityMode { UNSPECIFIED = 0, // UNSPECIFIED @@ -692,9 +748,30 @@ export namespace enums { COUNTRY_AND_LANGUAGE = 5, // COUNTRY_AND_LANGUAGE } + /** + * @name MonthOfYearEnum.MonthOfYear + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MonthOfYearEnum.MonthOfYear + */ + export enum MonthOfYear { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + JANUARY = 2, // JANUARY + FEBRUARY = 3, // FEBRUARY + MARCH = 4, // MARCH + APRIL = 5, // APRIL + MAY = 6, // MAY + JUNE = 7, // JUNE + JULY = 8, // JULY + AUGUST = 9, // AUGUST + SEPTEMBER = 10, // SEPTEMBER + OCTOBER = 11, // OCTOBER + NOVEMBER = 12, // NOVEMBER + DECEMBER = 13, // DECEMBER + } + /** * @name AppStoreEnum.AppStore - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AppStoreEnum.AppStore + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AppStoreEnum.AppStore */ export enum AppStore { UNSPECIFIED = 0, // UNSPECIFIED @@ -705,7 +782,7 @@ export namespace enums { /** * @name PriceExtensionPriceQualifierEnum.PriceExtensionPriceQualifier - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PriceExtensionPriceQualifierEnum.PriceExtensionPriceQualifier + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PriceExtensionPriceQualifierEnum.PriceExtensionPriceQualifier */ export enum PriceExtensionPriceQualifier { UNSPECIFIED = 0, // UNSPECIFIED @@ -717,7 +794,7 @@ export namespace enums { /** * @name PriceExtensionPriceUnitEnum.PriceExtensionPriceUnit - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PriceExtensionPriceUnitEnum.PriceExtensionPriceUnit + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PriceExtensionPriceUnitEnum.PriceExtensionPriceUnit */ export enum PriceExtensionPriceUnit { UNSPECIFIED = 0, // UNSPECIFIED @@ -732,7 +809,7 @@ export namespace enums { /** * @name PriceExtensionTypeEnum.PriceExtensionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PriceExtensionTypeEnum.PriceExtensionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PriceExtensionTypeEnum.PriceExtensionType */ export enum PriceExtensionType { UNSPECIFIED = 0, // UNSPECIFIED @@ -748,65 +825,9 @@ export namespace enums { SERVICE_TIERS = 10, // SERVICE_TIERS } - /** - * @name PromotionExtensionDiscountModifierEnum.PromotionExtensionDiscountModifier - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PromotionExtensionDiscountModifierEnum.PromotionExtensionDiscountModifier - */ - export enum PromotionExtensionDiscountModifier { - UNSPECIFIED = 0, // UNSPECIFIED - UNKNOWN = 1, // UNKNOWN - UP_TO = 2, // UP_TO - } - - /** - * @name PromotionExtensionOccasionEnum.PromotionExtensionOccasion - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PromotionExtensionOccasionEnum.PromotionExtensionOccasion - */ - export enum PromotionExtensionOccasion { - UNSPECIFIED = 0, // UNSPECIFIED - UNKNOWN = 1, // UNKNOWN - NEW_YEARS = 2, // NEW_YEARS - CHINESE_NEW_YEAR = 3, // CHINESE_NEW_YEAR - VALENTINES_DAY = 4, // VALENTINES_DAY - EASTER = 5, // EASTER - MOTHERS_DAY = 6, // MOTHERS_DAY - FATHERS_DAY = 7, // FATHERS_DAY - LABOR_DAY = 8, // LABOR_DAY - BACK_TO_SCHOOL = 9, // BACK_TO_SCHOOL - HALLOWEEN = 10, // HALLOWEEN - BLACK_FRIDAY = 11, // BLACK_FRIDAY - CYBER_MONDAY = 12, // CYBER_MONDAY - CHRISTMAS = 13, // CHRISTMAS - BOXING_DAY = 14, // BOXING_DAY - INDEPENDENCE_DAY = 15, // INDEPENDENCE_DAY - NATIONAL_DAY = 16, // NATIONAL_DAY - END_OF_SEASON = 17, // END_OF_SEASON - WINTER_SALE = 18, // WINTER_SALE - SUMMER_SALE = 19, // SUMMER_SALE - FALL_SALE = 20, // FALL_SALE - SPRING_SALE = 21, // SPRING_SALE - RAMADAN = 22, // RAMADAN - EID_AL_FITR = 23, // EID_AL_FITR - EID_AL_ADHA = 24, // EID_AL_ADHA - SINGLES_DAY = 25, // SINGLES_DAY - WOMENS_DAY = 26, // WOMENS_DAY - HOLI = 27, // HOLI - PARENTS_DAY = 28, // PARENTS_DAY - ST_NICHOLAS_DAY = 29, // ST_NICHOLAS_DAY - CARNIVAL = 30, // CARNIVAL - EPIPHANY = 31, // EPIPHANY - ROSH_HASHANAH = 32, // ROSH_HASHANAH - PASSOVER = 33, // PASSOVER - HANUKKAH = 34, // HANUKKAH - DIWALI = 35, // DIWALI - NAVRATRI = 36, // NAVRATRI - SONGKRAN = 37, // SONGKRAN - YEAR_END_GIFT = 38, // YEAR_END_GIFT - } - /** * @name FeedItemSetStringFilterTypeEnum.FeedItemSetStringFilterType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemSetStringFilterTypeEnum.FeedItemSetStringFilterType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemSetStringFilterTypeEnum.FeedItemSetStringFilterType */ export enum FeedItemSetStringFilterType { UNSPECIFIED = 0, // UNSPECIFIED @@ -816,7 +837,7 @@ export namespace enums { /** * @name AppUrlOperatingSystemTypeEnum.AppUrlOperatingSystemType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AppUrlOperatingSystemTypeEnum.AppUrlOperatingSystemType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AppUrlOperatingSystemTypeEnum.AppUrlOperatingSystemType */ export enum AppUrlOperatingSystemType { UNSPECIFIED = 0, // UNSPECIFIED @@ -827,7 +848,7 @@ export namespace enums { /** * @name FrequencyCapEventTypeEnum.FrequencyCapEventType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FrequencyCapEventTypeEnum.FrequencyCapEventType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FrequencyCapEventTypeEnum.FrequencyCapEventType */ export enum FrequencyCapEventType { UNSPECIFIED = 0, // UNSPECIFIED @@ -838,7 +859,7 @@ export namespace enums { /** * @name FrequencyCapLevelEnum.FrequencyCapLevel - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FrequencyCapLevelEnum.FrequencyCapLevel + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FrequencyCapLevelEnum.FrequencyCapLevel */ export enum FrequencyCapLevel { UNSPECIFIED = 0, // UNSPECIFIED @@ -850,7 +871,7 @@ export namespace enums { /** * @name FrequencyCapTimeUnitEnum.FrequencyCapTimeUnit - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FrequencyCapTimeUnitEnum.FrequencyCapTimeUnit + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FrequencyCapTimeUnitEnum.FrequencyCapTimeUnit */ export enum FrequencyCapTimeUnit { UNSPECIFIED = 0, // UNSPECIFIED @@ -860,9 +881,19 @@ export namespace enums { MONTH = 4, // MONTH } + /** + * @name KeywordPlanAggregateMetricTypeEnum.KeywordPlanAggregateMetricType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanAggregateMetricTypeEnum.KeywordPlanAggregateMetricType + */ + export enum KeywordPlanAggregateMetricType { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + DEVICE = 2, // DEVICE + } + /** * @name KeywordPlanCompetitionLevelEnum.KeywordPlanCompetitionLevel - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanCompetitionLevelEnum.KeywordPlanCompetitionLevel + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanCompetitionLevelEnum.KeywordPlanCompetitionLevel */ export enum KeywordPlanCompetitionLevel { UNSPECIFIED = 0, // UNSPECIFIED @@ -873,29 +904,20 @@ export namespace enums { } /** - * @name MonthOfYearEnum.MonthOfYear - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MonthOfYearEnum.MonthOfYear + * @name KeywordPlanConceptGroupTypeEnum.KeywordPlanConceptGroupType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanConceptGroupTypeEnum.KeywordPlanConceptGroupType */ - export enum MonthOfYear { + export enum KeywordPlanConceptGroupType { UNSPECIFIED = 0, // UNSPECIFIED UNKNOWN = 1, // UNKNOWN - JANUARY = 2, // JANUARY - FEBRUARY = 3, // FEBRUARY - MARCH = 4, // MARCH - APRIL = 5, // APRIL - MAY = 6, // MAY - JUNE = 7, // JUNE - JULY = 8, // JULY - AUGUST = 9, // AUGUST - SEPTEMBER = 10, // SEPTEMBER - OCTOBER = 11, // OCTOBER - NOVEMBER = 12, // NOVEMBER - DECEMBER = 13, // DECEMBER + BRAND = 2, // BRAND + OTHER_BRANDS = 3, // OTHER_BRANDS + NON_BRAND = 4, // NON_BRAND } /** * @name MatchingFunctionContextTypeEnum.MatchingFunctionContextType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MatchingFunctionContextTypeEnum.MatchingFunctionContextType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MatchingFunctionContextTypeEnum.MatchingFunctionContextType */ export enum MatchingFunctionContextType { UNSPECIFIED = 0, // UNSPECIFIED @@ -907,7 +929,7 @@ export namespace enums { /** * @name MatchingFunctionOperatorEnum.MatchingFunctionOperator - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MatchingFunctionOperatorEnum.MatchingFunctionOperator + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MatchingFunctionOperatorEnum.MatchingFunctionOperator */ export enum MatchingFunctionOperator { UNSPECIFIED = 0, // UNSPECIFIED @@ -921,7 +943,7 @@ export namespace enums { /** * @name InteractionEventTypeEnum.InteractionEventType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/InteractionEventTypeEnum.InteractionEventType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/InteractionEventTypeEnum.InteractionEventType */ export enum InteractionEventType { UNSPECIFIED = 0, // UNSPECIFIED @@ -934,7 +956,7 @@ export namespace enums { /** * @name QualityScoreBucketEnum.QualityScoreBucket - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/QualityScoreBucketEnum.QualityScoreBucket + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/QualityScoreBucketEnum.QualityScoreBucket */ export enum QualityScoreBucket { UNSPECIFIED = 0, // UNSPECIFIED @@ -946,7 +968,7 @@ export namespace enums { /** * @name UserIdentifierSourceEnum.UserIdentifierSource - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserIdentifierSourceEnum.UserIdentifierSource + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserIdentifierSourceEnum.UserIdentifierSource */ export enum UserIdentifierSource { UNSPECIFIED = 0, // UNSPECIFIED @@ -957,7 +979,7 @@ export namespace enums { /** * @name AdDestinationTypeEnum.AdDestinationType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdDestinationTypeEnum.AdDestinationType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdDestinationTypeEnum.AdDestinationType */ export enum AdDestinationType { UNSPECIFIED = 0, // UNSPECIFIED @@ -977,7 +999,7 @@ export namespace enums { /** * @name AdNetworkTypeEnum.AdNetworkType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdNetworkTypeEnum.AdNetworkType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdNetworkTypeEnum.AdNetworkType */ export enum AdNetworkType { UNSPECIFIED = 0, // UNSPECIFIED @@ -992,7 +1014,7 @@ export namespace enums { /** * @name BudgetCampaignAssociationStatusEnum.BudgetCampaignAssociationStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BudgetCampaignAssociationStatusEnum.BudgetCampaignAssociationStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BudgetCampaignAssociationStatusEnum.BudgetCampaignAssociationStatus */ export enum BudgetCampaignAssociationStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1003,7 +1025,7 @@ export namespace enums { /** * @name ClickTypeEnum.ClickType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ClickTypeEnum.ClickType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ClickTypeEnum.ClickType */ export enum ClickType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1065,7 +1087,7 @@ export namespace enums { /** * @name ConversionActionCategoryEnum.ConversionActionCategory - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionActionCategoryEnum.ConversionActionCategory + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionActionCategoryEnum.ConversionActionCategory */ export enum ConversionActionCategory { UNSPECIFIED = 0, // UNSPECIFIED @@ -1094,7 +1116,7 @@ export namespace enums { /** * @name ConversionAttributionEventTypeEnum.ConversionAttributionEventType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionAttributionEventTypeEnum.ConversionAttributionEventType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionAttributionEventTypeEnum.ConversionAttributionEventType */ export enum ConversionAttributionEventType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1105,7 +1127,7 @@ export namespace enums { /** * @name ConversionLagBucketEnum.ConversionLagBucket - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionLagBucketEnum.ConversionLagBucket + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionLagBucketEnum.ConversionLagBucket */ export enum ConversionLagBucket { UNSPECIFIED = 0, // UNSPECIFIED @@ -1133,7 +1155,7 @@ export namespace enums { /** * @name ConversionOrAdjustmentLagBucketEnum.ConversionOrAdjustmentLagBucket - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionOrAdjustmentLagBucketEnum.ConversionOrAdjustmentLagBucket + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionOrAdjustmentLagBucketEnum.ConversionOrAdjustmentLagBucket */ export enum ConversionOrAdjustmentLagBucket { UNSPECIFIED = 0, // UNSPECIFIED @@ -1183,7 +1205,7 @@ export namespace enums { /** * @name ExternalConversionSourceEnum.ExternalConversionSource - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ExternalConversionSourceEnum.ExternalConversionSource + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ExternalConversionSourceEnum.ExternalConversionSource */ export enum ExternalConversionSource { UNSPECIFIED = 0, // UNSPECIFIED @@ -1214,11 +1236,12 @@ export namespace enums { GOOGLE_HOSTED = 27, // GOOGLE_HOSTED FLOODLIGHT = 29, // FLOODLIGHT ANALYTICS_SEARCH_ADS_360 = 31, // ANALYTICS_SEARCH_ADS_360 + FIREBASE_SEARCH_ADS_360 = 33, // FIREBASE_SEARCH_ADS_360 } /** * @name HotelPriceBucketEnum.HotelPriceBucket - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/HotelPriceBucketEnum.HotelPriceBucket + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/HotelPriceBucketEnum.HotelPriceBucket */ export enum HotelPriceBucket { UNSPECIFIED = 0, // UNSPECIFIED @@ -1231,7 +1254,7 @@ export namespace enums { /** * @name HotelRateTypeEnum.HotelRateType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/HotelRateTypeEnum.HotelRateType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/HotelRateTypeEnum.HotelRateType */ export enum HotelRateType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1244,7 +1267,7 @@ export namespace enums { /** * @name PlaceholderTypeEnum.PlaceholderType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PlaceholderTypeEnum.PlaceholderType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PlaceholderTypeEnum.PlaceholderType */ export enum PlaceholderType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1273,7 +1296,7 @@ export namespace enums { /** * @name SearchEngineResultsPageTypeEnum.SearchEngineResultsPageType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SearchEngineResultsPageTypeEnum.SearchEngineResultsPageType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SearchEngineResultsPageTypeEnum.SearchEngineResultsPageType */ export enum SearchEngineResultsPageType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1285,7 +1308,7 @@ export namespace enums { /** * @name SearchTermMatchTypeEnum.SearchTermMatchType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SearchTermMatchTypeEnum.SearchTermMatchType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SearchTermMatchTypeEnum.SearchTermMatchType */ export enum SearchTermMatchType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1299,7 +1322,7 @@ export namespace enums { /** * @name SlotEnum.Slot - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SlotEnum.Slot + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SlotEnum.Slot */ export enum Slot { UNSPECIFIED = 0, // UNSPECIFIED @@ -1315,7 +1338,7 @@ export namespace enums { /** * @name TrackingCodePageFormatEnum.TrackingCodePageFormat - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TrackingCodePageFormatEnum.TrackingCodePageFormat + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TrackingCodePageFormatEnum.TrackingCodePageFormat */ export enum TrackingCodePageFormat { UNSPECIFIED = 0, // UNSPECIFIED @@ -1326,7 +1349,7 @@ export namespace enums { /** * @name TrackingCodeTypeEnum.TrackingCodeType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TrackingCodeTypeEnum.TrackingCodeType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TrackingCodeTypeEnum.TrackingCodeType */ export enum TrackingCodeType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1339,7 +1362,7 @@ export namespace enums { /** * @name TargetingDimensionEnum.TargetingDimension - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TargetingDimensionEnum.TargetingDimension + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TargetingDimensionEnum.TargetingDimension */ export enum TargetingDimension { UNSPECIFIED = 0, // UNSPECIFIED @@ -1356,7 +1379,7 @@ export namespace enums { /** * @name CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerMatchUploadKeyTypeEnum.CustomerMatchUploadKeyType */ export enum CustomerMatchUploadKeyType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1368,7 +1391,7 @@ export namespace enums { /** * @name UserListCombinedRuleOperatorEnum.UserListCombinedRuleOperator - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListCombinedRuleOperatorEnum.UserListCombinedRuleOperator + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListCombinedRuleOperatorEnum.UserListCombinedRuleOperator */ export enum UserListCombinedRuleOperator { UNSPECIFIED = 0, // UNSPECIFIED @@ -1379,7 +1402,7 @@ export namespace enums { /** * @name UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListCrmDataSourceTypeEnum.UserListCrmDataSourceType */ export enum UserListCrmDataSourceType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1391,7 +1414,7 @@ export namespace enums { /** * @name UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListDateRuleItemOperatorEnum.UserListDateRuleItemOperator */ export enum UserListDateRuleItemOperator { UNSPECIFIED = 0, // UNSPECIFIED @@ -1404,7 +1427,7 @@ export namespace enums { /** * @name UserListLogicalRuleOperatorEnum.UserListLogicalRuleOperator - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListLogicalRuleOperatorEnum.UserListLogicalRuleOperator + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListLogicalRuleOperatorEnum.UserListLogicalRuleOperator */ export enum UserListLogicalRuleOperator { UNSPECIFIED = 0, // UNSPECIFIED @@ -1416,7 +1439,7 @@ export namespace enums { /** * @name UserListNumberRuleItemOperatorEnum.UserListNumberRuleItemOperator - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListNumberRuleItemOperatorEnum.UserListNumberRuleItemOperator + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListNumberRuleItemOperatorEnum.UserListNumberRuleItemOperator */ export enum UserListNumberRuleItemOperator { UNSPECIFIED = 0, // UNSPECIFIED @@ -1431,7 +1454,7 @@ export namespace enums { /** * @name UserListPrepopulationStatusEnum.UserListPrepopulationStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListPrepopulationStatusEnum.UserListPrepopulationStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListPrepopulationStatusEnum.UserListPrepopulationStatus */ export enum UserListPrepopulationStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1443,7 +1466,7 @@ export namespace enums { /** * @name UserListRuleTypeEnum.UserListRuleType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListRuleTypeEnum.UserListRuleType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListRuleTypeEnum.UserListRuleType */ export enum UserListRuleType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1454,7 +1477,7 @@ export namespace enums { /** * @name UserListStringRuleItemOperatorEnum.UserListStringRuleItemOperator - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListStringRuleItemOperatorEnum.UserListStringRuleItemOperator + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListStringRuleItemOperatorEnum.UserListStringRuleItemOperator */ export enum UserListStringRuleItemOperator { UNSPECIFIED = 0, // UNSPECIFIED @@ -1471,7 +1494,7 @@ export namespace enums { /** * @name AccessInvitationStatusEnum.AccessInvitationStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccessInvitationStatusEnum.AccessInvitationStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccessInvitationStatusEnum.AccessInvitationStatus */ export enum AccessInvitationStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1483,7 +1506,7 @@ export namespace enums { /** * @name AccessReasonEnum.AccessReason - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccessReasonEnum.AccessReason + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccessReasonEnum.AccessReason */ export enum AccessReason { UNSPECIFIED = 0, // UNSPECIFIED @@ -1497,7 +1520,7 @@ export namespace enums { /** * @name AccessRoleEnum.AccessRole - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccessRoleEnum.AccessRole + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccessRoleEnum.AccessRole */ export enum AccessRole { UNSPECIFIED = 0, // UNSPECIFIED @@ -1510,7 +1533,7 @@ export namespace enums { /** * @name AccountBudgetProposalStatusEnum.AccountBudgetProposalStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccountBudgetProposalStatusEnum.AccountBudgetProposalStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccountBudgetProposalStatusEnum.AccountBudgetProposalStatus */ export enum AccountBudgetProposalStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1524,7 +1547,7 @@ export namespace enums { /** * @name AccountBudgetProposalTypeEnum.AccountBudgetProposalType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccountBudgetProposalTypeEnum.AccountBudgetProposalType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccountBudgetProposalTypeEnum.AccountBudgetProposalType */ export enum AccountBudgetProposalType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1537,7 +1560,7 @@ export namespace enums { /** * @name AccountBudgetStatusEnum.AccountBudgetStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccountBudgetStatusEnum.AccountBudgetStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccountBudgetStatusEnum.AccountBudgetStatus */ export enum AccountBudgetStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1549,7 +1572,7 @@ export namespace enums { /** * @name AccountLinkStatusEnum.AccountLinkStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccountLinkStatusEnum.AccountLinkStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccountLinkStatusEnum.AccountLinkStatus */ export enum AccountLinkStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1564,7 +1587,7 @@ export namespace enums { /** * @name AdCustomizerPlaceholderFieldEnum.AdCustomizerPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdCustomizerPlaceholderFieldEnum.AdCustomizerPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdCustomizerPlaceholderFieldEnum.AdCustomizerPlaceholderField */ export enum AdCustomizerPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -1577,7 +1600,7 @@ export namespace enums { /** * @name AdGroupAdRotationModeEnum.AdGroupAdRotationMode - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupAdRotationModeEnum.AdGroupAdRotationMode + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupAdRotationModeEnum.AdGroupAdRotationMode */ export enum AdGroupAdRotationMode { UNSPECIFIED = 0, // UNSPECIFIED @@ -1588,7 +1611,7 @@ export namespace enums { /** * @name AdGroupAdStatusEnum.AdGroupAdStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupAdStatusEnum.AdGroupAdStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupAdStatusEnum.AdGroupAdStatus */ export enum AdGroupAdStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1600,7 +1623,7 @@ export namespace enums { /** * @name AdGroupCriterionApprovalStatusEnum.AdGroupCriterionApprovalStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupCriterionApprovalStatusEnum.AdGroupCriterionApprovalStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupCriterionApprovalStatusEnum.AdGroupCriterionApprovalStatus */ export enum AdGroupCriterionApprovalStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1613,7 +1636,7 @@ export namespace enums { /** * @name AdGroupCriterionStatusEnum.AdGroupCriterionStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupCriterionStatusEnum.AdGroupCriterionStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupCriterionStatusEnum.AdGroupCriterionStatus */ export enum AdGroupCriterionStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1625,7 +1648,7 @@ export namespace enums { /** * @name AdGroupStatusEnum.AdGroupStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupStatusEnum.AdGroupStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupStatusEnum.AdGroupStatus */ export enum AdGroupStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1637,7 +1660,7 @@ export namespace enums { /** * @name AdGroupTypeEnum.AdGroupType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupTypeEnum.AdGroupType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupTypeEnum.AdGroupType */ export enum AdGroupType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1656,11 +1679,12 @@ export namespace enums { SHOPPING_COMPARISON_LISTING_ADS = 14, // SHOPPING_COMPARISON_LISTING_ADS PROMOTED_HOTEL_ADS = 15, // PROMOTED_HOTEL_ADS VIDEO_RESPONSIVE = 16, // VIDEO_RESPONSIVE + VIDEO_EFFICIENT_REACH = 17, // VIDEO_EFFICIENT_REACH } /** * @name AdServingOptimizationStatusEnum.AdServingOptimizationStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdServingOptimizationStatusEnum.AdServingOptimizationStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdServingOptimizationStatusEnum.AdServingOptimizationStatus */ export enum AdServingOptimizationStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1674,7 +1698,7 @@ export namespace enums { /** * @name AdStrengthEnum.AdStrength - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdStrengthEnum.AdStrength + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdStrengthEnum.AdStrength */ export enum AdStrength { UNSPECIFIED = 0, // UNSPECIFIED @@ -1689,7 +1713,7 @@ export namespace enums { /** * @name AdTypeEnum.AdType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdTypeEnum.AdType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdTypeEnum.AdType */ export enum AdType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1724,7 +1748,7 @@ export namespace enums { /** * @name AffiliateLocationFeedRelationshipTypeEnum.AffiliateLocationFeedRelationshipType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AffiliateLocationFeedRelationshipTypeEnum.AffiliateLocationFeedRelationshipType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AffiliateLocationFeedRelationshipTypeEnum.AffiliateLocationFeedRelationshipType */ export enum AffiliateLocationFeedRelationshipType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1734,7 +1758,7 @@ export namespace enums { /** * @name AffiliateLocationPlaceholderFieldEnum.AffiliateLocationPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AffiliateLocationPlaceholderFieldEnum.AffiliateLocationPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AffiliateLocationPlaceholderFieldEnum.AffiliateLocationPlaceholderField */ export enum AffiliateLocationPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -1754,7 +1778,7 @@ export namespace enums { /** * @name AppCampaignAppStoreEnum.AppCampaignAppStore - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AppCampaignAppStoreEnum.AppCampaignAppStore + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AppCampaignAppStoreEnum.AppCampaignAppStore */ export enum AppCampaignAppStore { UNSPECIFIED = 0, // UNSPECIFIED @@ -1765,7 +1789,7 @@ export namespace enums { /** * @name AppCampaignBiddingStrategyGoalTypeEnum.AppCampaignBiddingStrategyGoalType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AppCampaignBiddingStrategyGoalTypeEnum.AppCampaignBiddingStrategyGoalType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AppCampaignBiddingStrategyGoalTypeEnum.AppCampaignBiddingStrategyGoalType */ export enum AppCampaignBiddingStrategyGoalType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1778,7 +1802,7 @@ export namespace enums { /** * @name AppPlaceholderFieldEnum.AppPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AppPlaceholderFieldEnum.AppPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AppPlaceholderFieldEnum.AppPlaceholderField */ export enum AppPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -1795,7 +1819,7 @@ export namespace enums { /** * @name AssetFieldTypeEnum.AssetFieldType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AssetFieldTypeEnum.AssetFieldType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AssetFieldTypeEnum.AssetFieldType */ export enum AssetFieldType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1808,22 +1832,27 @@ export namespace enums { YOUTUBE_VIDEO = 7, // YOUTUBE_VIDEO BOOK_ON_GOOGLE = 8, // BOOK_ON_GOOGLE LEAD_FORM = 9, // LEAD_FORM + PROMOTION = 10, // PROMOTION + CALLOUT = 11, // CALLOUT + STRUCTURED_SNIPPET = 12, // STRUCTURED_SNIPPET + SITELINK = 13, // SITELINK } /** * @name AssetLinkStatusEnum.AssetLinkStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AssetLinkStatusEnum.AssetLinkStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AssetLinkStatusEnum.AssetLinkStatus */ export enum AssetLinkStatus { UNSPECIFIED = 0, // UNSPECIFIED UNKNOWN = 1, // UNKNOWN ENABLED = 2, // ENABLED REMOVED = 3, // REMOVED + PAUSED = 4, // PAUSED } /** * @name AssetTypeEnum.AssetType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AssetTypeEnum.AssetType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AssetTypeEnum.AssetType */ export enum AssetType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1834,11 +1863,15 @@ export namespace enums { TEXT = 5, // TEXT LEAD_FORM = 6, // LEAD_FORM BOOK_ON_GOOGLE = 7, // BOOK_ON_GOOGLE + PROMOTION = 8, // PROMOTION + CALLOUT = 9, // CALLOUT + STRUCTURED_SNIPPET = 10, // STRUCTURED_SNIPPET + SITELINK = 11, // SITELINK } /** * @name AttributionModelEnum.AttributionModel - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AttributionModelEnum.AttributionModel + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AttributionModelEnum.AttributionModel */ export enum AttributionModel { UNSPECIFIED = 0, // UNSPECIFIED @@ -1854,7 +1887,7 @@ export namespace enums { /** * @name BatchJobStatusEnum.BatchJobStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BatchJobStatusEnum.BatchJobStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BatchJobStatusEnum.BatchJobStatus */ export enum BatchJobStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1866,7 +1899,7 @@ export namespace enums { /** * @name BidModifierSourceEnum.BidModifierSource - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BidModifierSourceEnum.BidModifierSource + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BidModifierSourceEnum.BidModifierSource */ export enum BidModifierSource { UNSPECIFIED = 0, // UNSPECIFIED @@ -1877,7 +1910,7 @@ export namespace enums { /** * @name BiddingSourceEnum.BiddingSource - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BiddingSourceEnum.BiddingSource + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BiddingSourceEnum.BiddingSource */ export enum BiddingSource { UNSPECIFIED = 0, // UNSPECIFIED @@ -1889,7 +1922,7 @@ export namespace enums { /** * @name BiddingStrategyStatusEnum.BiddingStrategyStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BiddingStrategyStatusEnum.BiddingStrategyStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BiddingStrategyStatusEnum.BiddingStrategyStatus */ export enum BiddingStrategyStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1900,7 +1933,7 @@ export namespace enums { /** * @name BiddingStrategyTypeEnum.BiddingStrategyType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BiddingStrategyTypeEnum.BiddingStrategyType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BiddingStrategyTypeEnum.BiddingStrategyType */ export enum BiddingStrategyType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1924,7 +1957,7 @@ export namespace enums { /** * @name BillingSetupStatusEnum.BillingSetupStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BillingSetupStatusEnum.BillingSetupStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BillingSetupStatusEnum.BillingSetupStatus */ export enum BillingSetupStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1937,7 +1970,7 @@ export namespace enums { /** * @name BrandSafetySuitabilityEnum.BrandSafetySuitability - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BrandSafetySuitabilityEnum.BrandSafetySuitability + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BrandSafetySuitabilityEnum.BrandSafetySuitability */ export enum BrandSafetySuitability { UNSPECIFIED = 0, // UNSPECIFIED @@ -1949,7 +1982,7 @@ export namespace enums { /** * @name BudgetDeliveryMethodEnum.BudgetDeliveryMethod - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BudgetDeliveryMethodEnum.BudgetDeliveryMethod + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BudgetDeliveryMethodEnum.BudgetDeliveryMethod */ export enum BudgetDeliveryMethod { UNSPECIFIED = 0, // UNSPECIFIED @@ -1960,7 +1993,7 @@ export namespace enums { /** * @name BudgetPeriodEnum.BudgetPeriod - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BudgetPeriodEnum.BudgetPeriod + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BudgetPeriodEnum.BudgetPeriod */ export enum BudgetPeriod { UNSPECIFIED = 0, // UNSPECIFIED @@ -1971,7 +2004,7 @@ export namespace enums { /** * @name BudgetStatusEnum.BudgetStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BudgetStatusEnum.BudgetStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BudgetStatusEnum.BudgetStatus */ export enum BudgetStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -1982,7 +2015,7 @@ export namespace enums { /** * @name BudgetTypeEnum.BudgetType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BudgetTypeEnum.BudgetType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BudgetTypeEnum.BudgetType */ export enum BudgetType { UNSPECIFIED = 0, // UNSPECIFIED @@ -1994,7 +2027,7 @@ export namespace enums { /** * @name CallPlaceholderFieldEnum.CallPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CallPlaceholderFieldEnum.CallPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CallPlaceholderFieldEnum.CallPlaceholderField */ export enum CallPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2008,7 +2041,7 @@ export namespace enums { /** * @name CallTrackingDisplayLocationEnum.CallTrackingDisplayLocation - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CallTrackingDisplayLocationEnum.CallTrackingDisplayLocation + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CallTrackingDisplayLocationEnum.CallTrackingDisplayLocation */ export enum CallTrackingDisplayLocation { UNSPECIFIED = 0, // UNSPECIFIED @@ -2019,7 +2052,7 @@ export namespace enums { /** * @name CallTypeEnum.CallType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CallTypeEnum.CallType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CallTypeEnum.CallType */ export enum CallType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2030,7 +2063,7 @@ export namespace enums { /** * @name CalloutPlaceholderFieldEnum.CalloutPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CalloutPlaceholderFieldEnum.CalloutPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CalloutPlaceholderFieldEnum.CalloutPlaceholderField */ export enum CalloutPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2040,7 +2073,7 @@ export namespace enums { /** * @name CampaignCriterionStatusEnum.CampaignCriterionStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignCriterionStatusEnum.CampaignCriterionStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignCriterionStatusEnum.CampaignCriterionStatus */ export enum CampaignCriterionStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2052,7 +2085,7 @@ export namespace enums { /** * @name CampaignDraftStatusEnum.CampaignDraftStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignDraftStatusEnum.CampaignDraftStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignDraftStatusEnum.CampaignDraftStatus */ export enum CampaignDraftStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2066,7 +2099,7 @@ export namespace enums { /** * @name CampaignExperimentStatusEnum.CampaignExperimentStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentStatusEnum.CampaignExperimentStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentStatusEnum.CampaignExperimentStatus */ export enum CampaignExperimentStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2084,7 +2117,7 @@ export namespace enums { /** * @name CampaignExperimentTrafficSplitTypeEnum.CampaignExperimentTrafficSplitType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentTrafficSplitTypeEnum.CampaignExperimentTrafficSplitType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentTrafficSplitTypeEnum.CampaignExperimentTrafficSplitType */ export enum CampaignExperimentTrafficSplitType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2095,7 +2128,7 @@ export namespace enums { /** * @name CampaignExperimentTypeEnum.CampaignExperimentType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentTypeEnum.CampaignExperimentType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentTypeEnum.CampaignExperimentType */ export enum CampaignExperimentType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2107,7 +2140,7 @@ export namespace enums { /** * @name CampaignServingStatusEnum.CampaignServingStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignServingStatusEnum.CampaignServingStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignServingStatusEnum.CampaignServingStatus */ export enum CampaignServingStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2121,7 +2154,7 @@ export namespace enums { /** * @name CampaignSharedSetStatusEnum.CampaignSharedSetStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignSharedSetStatusEnum.CampaignSharedSetStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignSharedSetStatusEnum.CampaignSharedSetStatus */ export enum CampaignSharedSetStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2132,7 +2165,7 @@ export namespace enums { /** * @name CampaignStatusEnum.CampaignStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignStatusEnum.CampaignStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignStatusEnum.CampaignStatus */ export enum CampaignStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2144,7 +2177,7 @@ export namespace enums { /** * @name ChangeClientTypeEnum.ChangeClientType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ChangeClientTypeEnum.ChangeClientType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ChangeClientTypeEnum.ChangeClientType */ export enum ChangeClientType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2165,7 +2198,7 @@ export namespace enums { /** * @name ChangeEventResourceTypeEnum.ChangeEventResourceType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ChangeEventResourceTypeEnum.ChangeEventResourceType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ChangeEventResourceTypeEnum.ChangeEventResourceType */ export enum ChangeEventResourceType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2186,7 +2219,7 @@ export namespace enums { /** * @name ChangeStatusOperationEnum.ChangeStatusOperation - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ChangeStatusOperationEnum.ChangeStatusOperation + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ChangeStatusOperationEnum.ChangeStatusOperation */ export enum ChangeStatusOperation { UNSPECIFIED = 0, // UNSPECIFIED @@ -2198,7 +2231,7 @@ export namespace enums { /** * @name ChangeStatusResourceTypeEnum.ChangeStatusResourceType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ChangeStatusResourceTypeEnum.ChangeStatusResourceType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ChangeStatusResourceTypeEnum.ChangeStatusResourceType */ export enum ChangeStatusResourceType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2217,7 +2250,7 @@ export namespace enums { /** * @name CombinedAudienceStatusEnum.CombinedAudienceStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CombinedAudienceStatusEnum.CombinedAudienceStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CombinedAudienceStatusEnum.CombinedAudienceStatus */ export enum CombinedAudienceStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2228,7 +2261,7 @@ export namespace enums { /** * @name ConversionActionCountingTypeEnum.ConversionActionCountingType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionActionCountingTypeEnum.ConversionActionCountingType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionActionCountingTypeEnum.ConversionActionCountingType */ export enum ConversionActionCountingType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2239,7 +2272,7 @@ export namespace enums { /** * @name ConversionActionStatusEnum.ConversionActionStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionActionStatusEnum.ConversionActionStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionActionStatusEnum.ConversionActionStatus */ export enum ConversionActionStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2251,7 +2284,7 @@ export namespace enums { /** * @name ConversionActionTypeEnum.ConversionActionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionActionTypeEnum.ConversionActionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionActionTypeEnum.ConversionActionType */ export enum ConversionActionType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2295,7 +2328,7 @@ export namespace enums { /** * @name ConversionAdjustmentTypeEnum.ConversionAdjustmentType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionAdjustmentTypeEnum.ConversionAdjustmentType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionAdjustmentTypeEnum.ConversionAdjustmentType */ export enum ConversionAdjustmentType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2304,9 +2337,21 @@ export namespace enums { RESTATEMENT = 3, // RESTATEMENT } + /** + * @name ConversionCustomVariableStatusEnum.ConversionCustomVariableStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionCustomVariableStatusEnum.ConversionCustomVariableStatus + */ + export enum ConversionCustomVariableStatus { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + ACTIVATION_NEEDED = 2, // ACTIVATION_NEEDED + ENABLED = 3, // ENABLED + PAUSED = 4, // PAUSED + } + /** * @name CriterionSystemServingStatusEnum.CriterionSystemServingStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CriterionSystemServingStatusEnum.CriterionSystemServingStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CriterionSystemServingStatusEnum.CriterionSystemServingStatus */ export enum CriterionSystemServingStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2317,7 +2362,7 @@ export namespace enums { /** * @name CriterionTypeEnum.CriterionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CriterionTypeEnum.CriterionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CriterionTypeEnum.CriterionType */ export enum CriterionType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2358,7 +2403,7 @@ export namespace enums { /** * @name CustomAudienceMemberTypeEnum.CustomAudienceMemberType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomAudienceMemberTypeEnum.CustomAudienceMemberType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomAudienceMemberTypeEnum.CustomAudienceMemberType */ export enum CustomAudienceMemberType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2371,7 +2416,7 @@ export namespace enums { /** * @name CustomAudienceStatusEnum.CustomAudienceStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomAudienceStatusEnum.CustomAudienceStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomAudienceStatusEnum.CustomAudienceStatus */ export enum CustomAudienceStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2382,7 +2427,7 @@ export namespace enums { /** * @name CustomAudienceTypeEnum.CustomAudienceType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomAudienceTypeEnum.CustomAudienceType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomAudienceTypeEnum.CustomAudienceType */ export enum CustomAudienceType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2395,7 +2440,7 @@ export namespace enums { /** * @name CustomInterestMemberTypeEnum.CustomInterestMemberType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomInterestMemberTypeEnum.CustomInterestMemberType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomInterestMemberTypeEnum.CustomInterestMemberType */ export enum CustomInterestMemberType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2406,7 +2451,7 @@ export namespace enums { /** * @name CustomInterestStatusEnum.CustomInterestStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomInterestStatusEnum.CustomInterestStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomInterestStatusEnum.CustomInterestStatus */ export enum CustomInterestStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2417,7 +2462,7 @@ export namespace enums { /** * @name CustomInterestTypeEnum.CustomInterestType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomInterestTypeEnum.CustomInterestType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomInterestTypeEnum.CustomInterestType */ export enum CustomInterestType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2428,7 +2473,7 @@ export namespace enums { /** * @name CustomPlaceholderFieldEnum.CustomPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomPlaceholderFieldEnum.CustomPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomPlaceholderFieldEnum.CustomPlaceholderField */ export enum CustomPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2457,7 +2502,7 @@ export namespace enums { /** * @name CustomerPayPerConversionEligibilityFailureReasonEnum.CustomerPayPerConversionEligibilityFailureReason - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerPayPerConversionEligibilityFailureReasonEnum.CustomerPayPerConversionEligibilityFailureReason + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerPayPerConversionEligibilityFailureReasonEnum.CustomerPayPerConversionEligibilityFailureReason */ export enum CustomerPayPerConversionEligibilityFailureReason { UNSPECIFIED = 0, // UNSPECIFIED @@ -2473,7 +2518,7 @@ export namespace enums { /** * @name DataDrivenModelStatusEnum.DataDrivenModelStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DataDrivenModelStatusEnum.DataDrivenModelStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DataDrivenModelStatusEnum.DataDrivenModelStatus */ export enum DataDrivenModelStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2486,7 +2531,7 @@ export namespace enums { /** * @name DistanceBucketEnum.DistanceBucket - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DistanceBucketEnum.DistanceBucket + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DistanceBucketEnum.DistanceBucket */ export enum DistanceBucket { UNSPECIFIED = 0, // UNSPECIFIED @@ -2522,7 +2567,7 @@ export namespace enums { /** * @name DsaPageFeedCriterionFieldEnum.DsaPageFeedCriterionField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DsaPageFeedCriterionFieldEnum.DsaPageFeedCriterionField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DsaPageFeedCriterionFieldEnum.DsaPageFeedCriterionField */ export enum DsaPageFeedCriterionField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2533,7 +2578,7 @@ export namespace enums { /** * @name EducationPlaceholderFieldEnum.EducationPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/EducationPlaceholderFieldEnum.EducationPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/EducationPlaceholderFieldEnum.EducationPlaceholderField */ export enum EducationPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2559,7 +2604,7 @@ export namespace enums { /** * @name ExtensionSettingDeviceEnum.ExtensionSettingDevice - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ExtensionSettingDeviceEnum.ExtensionSettingDevice + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ExtensionSettingDeviceEnum.ExtensionSettingDevice */ export enum ExtensionSettingDevice { UNSPECIFIED = 0, // UNSPECIFIED @@ -2570,7 +2615,7 @@ export namespace enums { /** * @name ExtensionTypeEnum.ExtensionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ExtensionTypeEnum.ExtensionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ExtensionTypeEnum.ExtensionType */ export enum ExtensionType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2592,7 +2637,7 @@ export namespace enums { /** * @name FeedAttributeTypeEnum.FeedAttributeType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedAttributeTypeEnum.FeedAttributeType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedAttributeTypeEnum.FeedAttributeType */ export enum FeedAttributeType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2614,7 +2659,7 @@ export namespace enums { /** * @name FeedItemQualityApprovalStatusEnum.FeedItemQualityApprovalStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemQualityApprovalStatusEnum.FeedItemQualityApprovalStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemQualityApprovalStatusEnum.FeedItemQualityApprovalStatus */ export enum FeedItemQualityApprovalStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2625,7 +2670,7 @@ export namespace enums { /** * @name FeedItemQualityDisapprovalReasonEnum.FeedItemQualityDisapprovalReason - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemQualityDisapprovalReasonEnum.FeedItemQualityDisapprovalReason + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemQualityDisapprovalReasonEnum.FeedItemQualityDisapprovalReason */ export enum FeedItemQualityDisapprovalReason { UNSPECIFIED = 0, // UNSPECIFIED @@ -2652,7 +2697,7 @@ export namespace enums { /** * @name FeedItemSetStatusEnum.FeedItemSetStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemSetStatusEnum.FeedItemSetStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemSetStatusEnum.FeedItemSetStatus */ export enum FeedItemSetStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2663,7 +2708,7 @@ export namespace enums { /** * @name FeedItemStatusEnum.FeedItemStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemStatusEnum.FeedItemStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemStatusEnum.FeedItemStatus */ export enum FeedItemStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2674,7 +2719,7 @@ export namespace enums { /** * @name FeedItemTargetDeviceEnum.FeedItemTargetDevice - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemTargetDeviceEnum.FeedItemTargetDevice + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemTargetDeviceEnum.FeedItemTargetDevice */ export enum FeedItemTargetDevice { UNSPECIFIED = 0, // UNSPECIFIED @@ -2684,7 +2729,7 @@ export namespace enums { /** * @name FeedItemTargetStatusEnum.FeedItemTargetStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemTargetStatusEnum.FeedItemTargetStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemTargetStatusEnum.FeedItemTargetStatus */ export enum FeedItemTargetStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2695,7 +2740,7 @@ export namespace enums { /** * @name FeedItemTargetTypeEnum.FeedItemTargetType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemTargetTypeEnum.FeedItemTargetType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemTargetTypeEnum.FeedItemTargetType */ export enum FeedItemTargetType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2707,7 +2752,7 @@ export namespace enums { /** * @name FeedItemValidationStatusEnum.FeedItemValidationStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemValidationStatusEnum.FeedItemValidationStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemValidationStatusEnum.FeedItemValidationStatus */ export enum FeedItemValidationStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2719,7 +2764,7 @@ export namespace enums { /** * @name FeedLinkStatusEnum.FeedLinkStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedLinkStatusEnum.FeedLinkStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedLinkStatusEnum.FeedLinkStatus */ export enum FeedLinkStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2730,7 +2775,7 @@ export namespace enums { /** * @name FeedMappingCriterionTypeEnum.FeedMappingCriterionType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedMappingCriterionTypeEnum.FeedMappingCriterionType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedMappingCriterionTypeEnum.FeedMappingCriterionType */ export enum FeedMappingCriterionType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2741,7 +2786,7 @@ export namespace enums { /** * @name FeedMappingStatusEnum.FeedMappingStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedMappingStatusEnum.FeedMappingStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedMappingStatusEnum.FeedMappingStatus */ export enum FeedMappingStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2752,7 +2797,7 @@ export namespace enums { /** * @name FeedOriginEnum.FeedOrigin - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedOriginEnum.FeedOrigin + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedOriginEnum.FeedOrigin */ export enum FeedOrigin { UNSPECIFIED = 0, // UNSPECIFIED @@ -2763,7 +2808,7 @@ export namespace enums { /** * @name FeedStatusEnum.FeedStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedStatusEnum.FeedStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedStatusEnum.FeedStatus */ export enum FeedStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2774,7 +2819,7 @@ export namespace enums { /** * @name FlightPlaceholderFieldEnum.FlightPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FlightPlaceholderFieldEnum.FlightPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FlightPlaceholderFieldEnum.FlightPlaceholderField */ export enum FlightPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2800,7 +2845,7 @@ export namespace enums { /** * @name GeoTargetConstantStatusEnum.GeoTargetConstantStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GeoTargetConstantStatusEnum.GeoTargetConstantStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GeoTargetConstantStatusEnum.GeoTargetConstantStatus */ export enum GeoTargetConstantStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2811,7 +2856,7 @@ export namespace enums { /** * @name GeoTargetingRestrictionEnum.GeoTargetingRestriction - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GeoTargetingRestrictionEnum.GeoTargetingRestriction + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GeoTargetingRestrictionEnum.GeoTargetingRestriction */ export enum GeoTargetingRestriction { UNSPECIFIED = 0, // UNSPECIFIED @@ -2821,7 +2866,7 @@ export namespace enums { /** * @name GeoTargetingTypeEnum.GeoTargetingType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GeoTargetingTypeEnum.GeoTargetingType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GeoTargetingTypeEnum.GeoTargetingType */ export enum GeoTargetingType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2832,7 +2877,7 @@ export namespace enums { /** * @name GoogleAdsFieldCategoryEnum.GoogleAdsFieldCategory - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GoogleAdsFieldCategoryEnum.GoogleAdsFieldCategory + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GoogleAdsFieldCategoryEnum.GoogleAdsFieldCategory */ export enum GoogleAdsFieldCategory { UNSPECIFIED = 0, // UNSPECIFIED @@ -2845,7 +2890,7 @@ export namespace enums { /** * @name GoogleAdsFieldDataTypeEnum.GoogleAdsFieldDataType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GoogleAdsFieldDataTypeEnum.GoogleAdsFieldDataType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GoogleAdsFieldDataTypeEnum.GoogleAdsFieldDataType */ export enum GoogleAdsFieldDataType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2865,7 +2910,7 @@ export namespace enums { /** * @name GoogleVoiceCallStatusEnum.GoogleVoiceCallStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GoogleVoiceCallStatusEnum.GoogleVoiceCallStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GoogleVoiceCallStatusEnum.GoogleVoiceCallStatus */ export enum GoogleVoiceCallStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2876,7 +2921,7 @@ export namespace enums { /** * @name HotelPlaceholderFieldEnum.HotelPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/HotelPlaceholderFieldEnum.HotelPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/HotelPlaceholderFieldEnum.HotelPlaceholderField */ export enum HotelPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2905,7 +2950,7 @@ export namespace enums { /** * @name ImagePlaceholderFieldEnum.ImagePlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ImagePlaceholderFieldEnum.ImagePlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ImagePlaceholderFieldEnum.ImagePlaceholderField */ export enum ImagePlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2915,7 +2960,7 @@ export namespace enums { /** * @name InvoiceTypeEnum.InvoiceType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/InvoiceTypeEnum.InvoiceType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/InvoiceTypeEnum.InvoiceType */ export enum InvoiceType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2926,7 +2971,7 @@ export namespace enums { /** * @name JobPlaceholderFieldEnum.JobPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/JobPlaceholderFieldEnum.JobPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/JobPlaceholderFieldEnum.JobPlaceholderField */ export enum JobPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -2952,7 +2997,7 @@ export namespace enums { /** * @name KeywordPlanForecastIntervalEnum.KeywordPlanForecastInterval - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanForecastIntervalEnum.KeywordPlanForecastInterval + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanForecastIntervalEnum.KeywordPlanForecastInterval */ export enum KeywordPlanForecastInterval { UNSPECIFIED = 0, // UNSPECIFIED @@ -2962,9 +3007,19 @@ export namespace enums { NEXT_QUARTER = 5, // NEXT_QUARTER } + /** + * @name KeywordPlanKeywordAnnotationEnum.KeywordPlanKeywordAnnotation + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanKeywordAnnotationEnum.KeywordPlanKeywordAnnotation + */ + export enum KeywordPlanKeywordAnnotation { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + KEYWORD_CONCEPT = 2, // KEYWORD_CONCEPT + } + /** * @name KeywordPlanNetworkEnum.KeywordPlanNetwork - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanNetworkEnum.KeywordPlanNetwork + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanNetworkEnum.KeywordPlanNetwork */ export enum KeywordPlanNetwork { UNSPECIFIED = 0, // UNSPECIFIED @@ -2975,7 +3030,7 @@ export namespace enums { /** * @name LabelStatusEnum.LabelStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LabelStatusEnum.LabelStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LabelStatusEnum.LabelStatus */ export enum LabelStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -2986,7 +3041,7 @@ export namespace enums { /** * @name LinkedAccountTypeEnum.LinkedAccountType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LinkedAccountTypeEnum.LinkedAccountType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LinkedAccountTypeEnum.LinkedAccountType */ export enum LinkedAccountType { UNSPECIFIED = 0, // UNSPECIFIED @@ -2998,7 +3053,7 @@ export namespace enums { /** * @name LocalPlaceholderFieldEnum.LocalPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LocalPlaceholderFieldEnum.LocalPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LocalPlaceholderFieldEnum.LocalPlaceholderField */ export enum LocalPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3026,7 +3081,7 @@ export namespace enums { /** * @name LocationExtensionTargetingCriterionFieldEnum.LocationExtensionTargetingCriterionField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LocationExtensionTargetingCriterionFieldEnum.LocationExtensionTargetingCriterionField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LocationExtensionTargetingCriterionFieldEnum.LocationExtensionTargetingCriterionField */ export enum LocationExtensionTargetingCriterionField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3041,7 +3096,7 @@ export namespace enums { /** * @name LocationPlaceholderFieldEnum.LocationPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LocationPlaceholderFieldEnum.LocationPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LocationPlaceholderFieldEnum.LocationPlaceholderField */ export enum LocationPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3058,7 +3113,7 @@ export namespace enums { /** * @name LocationSourceTypeEnum.LocationSourceType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LocationSourceTypeEnum.LocationSourceType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LocationSourceTypeEnum.LocationSourceType */ export enum LocationSourceType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3069,7 +3124,7 @@ export namespace enums { /** * @name ManagerLinkStatusEnum.ManagerLinkStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ManagerLinkStatusEnum.ManagerLinkStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ManagerLinkStatusEnum.ManagerLinkStatus */ export enum ManagerLinkStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -3083,7 +3138,7 @@ export namespace enums { /** * @name MediaTypeEnum.MediaType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MediaTypeEnum.MediaType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MediaTypeEnum.MediaType */ export enum MediaType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3098,7 +3153,7 @@ export namespace enums { /** * @name MerchantCenterLinkStatusEnum.MerchantCenterLinkStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MerchantCenterLinkStatusEnum.MerchantCenterLinkStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MerchantCenterLinkStatusEnum.MerchantCenterLinkStatus */ export enum MerchantCenterLinkStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -3109,7 +3164,7 @@ export namespace enums { /** * @name MessagePlaceholderFieldEnum.MessagePlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MessagePlaceholderFieldEnum.MessagePlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MessagePlaceholderFieldEnum.MessagePlaceholderField */ export enum MessagePlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3123,7 +3178,7 @@ export namespace enums { /** * @name MobileAppVendorEnum.MobileAppVendor - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MobileAppVendorEnum.MobileAppVendor + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MobileAppVendorEnum.MobileAppVendor */ export enum MobileAppVendor { UNSPECIFIED = 0, // UNSPECIFIED @@ -3134,7 +3189,7 @@ export namespace enums { /** * @name MobileDeviceTypeEnum.MobileDeviceType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MobileDeviceTypeEnum.MobileDeviceType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MobileDeviceTypeEnum.MobileDeviceType */ export enum MobileDeviceType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3145,7 +3200,7 @@ export namespace enums { /** * @name NegativeGeoTargetTypeEnum.NegativeGeoTargetType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/NegativeGeoTargetTypeEnum.NegativeGeoTargetType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/NegativeGeoTargetTypeEnum.NegativeGeoTargetType */ export enum NegativeGeoTargetType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3156,7 +3211,7 @@ export namespace enums { /** * @name OfflineUserDataJobFailureReasonEnum.OfflineUserDataJobFailureReason - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OfflineUserDataJobFailureReasonEnum.OfflineUserDataJobFailureReason + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OfflineUserDataJobFailureReasonEnum.OfflineUserDataJobFailureReason */ export enum OfflineUserDataJobFailureReason { UNSPECIFIED = 0, // UNSPECIFIED @@ -3167,7 +3222,7 @@ export namespace enums { /** * @name OfflineUserDataJobStatusEnum.OfflineUserDataJobStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OfflineUserDataJobStatusEnum.OfflineUserDataJobStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OfflineUserDataJobStatusEnum.OfflineUserDataJobStatus */ export enum OfflineUserDataJobStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -3180,7 +3235,7 @@ export namespace enums { /** * @name OfflineUserDataJobTypeEnum.OfflineUserDataJobType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OfflineUserDataJobTypeEnum.OfflineUserDataJobType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OfflineUserDataJobTypeEnum.OfflineUserDataJobType */ export enum OfflineUserDataJobType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3193,7 +3248,7 @@ export namespace enums { /** * @name OperatingSystemVersionOperatorTypeEnum.OperatingSystemVersionOperatorType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OperatingSystemVersionOperatorTypeEnum.OperatingSystemVersionOperatorType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OperatingSystemVersionOperatorTypeEnum.OperatingSystemVersionOperatorType */ export enum OperatingSystemVersionOperatorType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3204,7 +3259,7 @@ export namespace enums { /** * @name OptimizationGoalTypeEnum.OptimizationGoalType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OptimizationGoalTypeEnum.OptimizationGoalType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OptimizationGoalTypeEnum.OptimizationGoalType */ export enum OptimizationGoalType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3215,7 +3270,7 @@ export namespace enums { /** * @name PaymentModeEnum.PaymentMode - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PaymentModeEnum.PaymentMode + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PaymentModeEnum.PaymentMode */ export enum PaymentMode { UNSPECIFIED = 0, // UNSPECIFIED @@ -3228,7 +3283,7 @@ export namespace enums { /** * @name PlacementTypeEnum.PlacementType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PlacementTypeEnum.PlacementType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PlacementTypeEnum.PlacementType */ export enum PlacementType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3242,7 +3297,7 @@ export namespace enums { /** * @name PositiveGeoTargetTypeEnum.PositiveGeoTargetType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PositiveGeoTargetTypeEnum.PositiveGeoTargetType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PositiveGeoTargetTypeEnum.PositiveGeoTargetType */ export enum PositiveGeoTargetType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3254,7 +3309,7 @@ export namespace enums { /** * @name PricePlaceholderFieldEnum.PricePlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PricePlaceholderFieldEnum.PricePlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PricePlaceholderFieldEnum.PricePlaceholderField */ export enum PricePlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3316,7 +3371,7 @@ export namespace enums { /** * @name ProductBiddingCategoryStatusEnum.ProductBiddingCategoryStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductBiddingCategoryStatusEnum.ProductBiddingCategoryStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductBiddingCategoryStatusEnum.ProductBiddingCategoryStatus */ export enum ProductBiddingCategoryStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -3327,7 +3382,7 @@ export namespace enums { /** * @name PromotionPlaceholderFieldEnum.PromotionPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PromotionPlaceholderFieldEnum.PromotionPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PromotionPlaceholderFieldEnum.PromotionPlaceholderField */ export enum PromotionPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3350,7 +3405,7 @@ export namespace enums { /** * @name ReachPlanAdLengthEnum.ReachPlanAdLength - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ReachPlanAdLengthEnum.ReachPlanAdLength + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ReachPlanAdLengthEnum.ReachPlanAdLength */ export enum ReachPlanAdLength { UNSPECIFIED = 0, // UNSPECIFIED @@ -3362,7 +3417,7 @@ export namespace enums { /** * @name ReachPlanAgeRangeEnum.ReachPlanAgeRange - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ReachPlanAgeRangeEnum.ReachPlanAgeRange + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ReachPlanAgeRangeEnum.ReachPlanAgeRange */ export enum ReachPlanAgeRange { UNSPECIFIED = 0, // UNSPECIFIED @@ -3397,7 +3452,7 @@ export namespace enums { /** * @name ReachPlanNetworkEnum.ReachPlanNetwork - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ReachPlanNetworkEnum.ReachPlanNetwork + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ReachPlanNetworkEnum.ReachPlanNetwork */ export enum ReachPlanNetwork { UNSPECIFIED = 0, // UNSPECIFIED @@ -3409,7 +3464,7 @@ export namespace enums { /** * @name RealEstatePlaceholderFieldEnum.RealEstatePlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/RealEstatePlaceholderFieldEnum.RealEstatePlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/RealEstatePlaceholderFieldEnum.RealEstatePlaceholderField */ export enum RealEstatePlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3436,7 +3491,7 @@ export namespace enums { /** * @name RecommendationTypeEnum.RecommendationType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/RecommendationTypeEnum.RecommendationType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/RecommendationTypeEnum.RecommendationType */ export enum RecommendationType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3458,11 +3513,12 @@ export namespace enums { FORECASTING_CAMPAIGN_BUDGET = 16, // FORECASTING_CAMPAIGN_BUDGET TARGET_ROAS_OPT_IN = 17, // TARGET_ROAS_OPT_IN RESPONSIVE_SEARCH_AD = 18, // RESPONSIVE_SEARCH_AD + MARGINAL_ROI_CAMPAIGN_BUDGET = 19, // MARGINAL_ROI_CAMPAIGN_BUDGET } /** * @name ResourceChangeOperationEnum.ResourceChangeOperation - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ResourceChangeOperationEnum.ResourceChangeOperation + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ResourceChangeOperationEnum.ResourceChangeOperation */ export enum ResourceChangeOperation { UNSPECIFIED = 0, // UNSPECIFIED @@ -3472,9 +3528,105 @@ export namespace enums { REMOVE = 4, // REMOVE } + /** + * @name ResourceLimitTypeEnum.ResourceLimitType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ResourceLimitTypeEnum.ResourceLimitType + */ + export enum ResourceLimitType { + UNSPECIFIED = 0, // UNSPECIFIED + UNKNOWN = 1, // UNKNOWN + CAMPAIGNS_PER_CUSTOMER = 2, // CAMPAIGNS_PER_CUSTOMER + BASE_CAMPAIGNS_PER_CUSTOMER = 3, // BASE_CAMPAIGNS_PER_CUSTOMER + EXPERIMENT_CAMPAIGNS_PER_CUSTOMER = 105, // EXPERIMENT_CAMPAIGNS_PER_CUSTOMER + HOTEL_CAMPAIGNS_PER_CUSTOMER = 4, // HOTEL_CAMPAIGNS_PER_CUSTOMER + SMART_SHOPPING_CAMPAIGNS_PER_CUSTOMER = 5, // SMART_SHOPPING_CAMPAIGNS_PER_CUSTOMER + AD_GROUPS_PER_CAMPAIGN = 6, // AD_GROUPS_PER_CAMPAIGN + AD_GROUPS_PER_SHOPPING_CAMPAIGN = 8, // AD_GROUPS_PER_SHOPPING_CAMPAIGN + AD_GROUPS_PER_HOTEL_CAMPAIGN = 9, // AD_GROUPS_PER_HOTEL_CAMPAIGN + REPORTING_AD_GROUPS_PER_LOCAL_CAMPAIGN = 10, // REPORTING_AD_GROUPS_PER_LOCAL_CAMPAIGN + REPORTING_AD_GROUPS_PER_APP_CAMPAIGN = 11, // REPORTING_AD_GROUPS_PER_APP_CAMPAIGN + MANAGED_AD_GROUPS_PER_SMART_CAMPAIGN = 52, // MANAGED_AD_GROUPS_PER_SMART_CAMPAIGN + AD_GROUP_CRITERIA_PER_CUSTOMER = 12, // AD_GROUP_CRITERIA_PER_CUSTOMER + BASE_AD_GROUP_CRITERIA_PER_CUSTOMER = 13, // BASE_AD_GROUP_CRITERIA_PER_CUSTOMER + EXPERIMENT_AD_GROUP_CRITERIA_PER_CUSTOMER = 107, // EXPERIMENT_AD_GROUP_CRITERIA_PER_CUSTOMER + AD_GROUP_CRITERIA_PER_CAMPAIGN = 14, // AD_GROUP_CRITERIA_PER_CAMPAIGN + CAMPAIGN_CRITERIA_PER_CUSTOMER = 15, // CAMPAIGN_CRITERIA_PER_CUSTOMER + BASE_CAMPAIGN_CRITERIA_PER_CUSTOMER = 16, // BASE_CAMPAIGN_CRITERIA_PER_CUSTOMER + EXPERIMENT_CAMPAIGN_CRITERIA_PER_CUSTOMER = 108, // EXPERIMENT_CAMPAIGN_CRITERIA_PER_CUSTOMER + WEBPAGE_CRITERIA_PER_CUSTOMER = 17, // WEBPAGE_CRITERIA_PER_CUSTOMER + BASE_WEBPAGE_CRITERIA_PER_CUSTOMER = 18, // BASE_WEBPAGE_CRITERIA_PER_CUSTOMER + EXPERIMENT_WEBPAGE_CRITERIA_PER_CUSTOMER = 19, // EXPERIMENT_WEBPAGE_CRITERIA_PER_CUSTOMER + COMBINED_AUDIENCE_CRITERIA_PER_AD_GROUP = 20, // COMBINED_AUDIENCE_CRITERIA_PER_AD_GROUP + CUSTOMER_NEGATIVE_PLACEMENT_CRITERIA_PER_CUSTOMER = 21, // CUSTOMER_NEGATIVE_PLACEMENT_CRITERIA_PER_CUSTOMER + CUSTOMER_NEGATIVE_YOUTUBE_CHANNEL_CRITERIA_PER_CUSTOMER = 22, // CUSTOMER_NEGATIVE_YOUTUBE_CHANNEL_CRITERIA_PER_CUSTOMER + CRITERIA_PER_AD_GROUP = 23, // CRITERIA_PER_AD_GROUP + LISTING_GROUPS_PER_AD_GROUP = 24, // LISTING_GROUPS_PER_AD_GROUP + EXPLICITLY_SHARED_BUDGETS_PER_CUSTOMER = 25, // EXPLICITLY_SHARED_BUDGETS_PER_CUSTOMER + IMPLICITLY_SHARED_BUDGETS_PER_CUSTOMER = 26, // IMPLICITLY_SHARED_BUDGETS_PER_CUSTOMER + COMBINED_AUDIENCE_CRITERIA_PER_CAMPAIGN = 27, // COMBINED_AUDIENCE_CRITERIA_PER_CAMPAIGN + NEGATIVE_KEYWORDS_PER_CAMPAIGN = 28, // NEGATIVE_KEYWORDS_PER_CAMPAIGN + NEGATIVE_PLACEMENTS_PER_CAMPAIGN = 29, // NEGATIVE_PLACEMENTS_PER_CAMPAIGN + GEO_TARGETS_PER_CAMPAIGN = 30, // GEO_TARGETS_PER_CAMPAIGN + NEGATIVE_IP_BLOCKS_PER_CAMPAIGN = 32, // NEGATIVE_IP_BLOCKS_PER_CAMPAIGN + PROXIMITIES_PER_CAMPAIGN = 33, // PROXIMITIES_PER_CAMPAIGN + LISTING_SCOPES_PER_SHOPPING_CAMPAIGN = 34, // LISTING_SCOPES_PER_SHOPPING_CAMPAIGN + LISTING_SCOPES_PER_NON_SHOPPING_CAMPAIGN = 35, // LISTING_SCOPES_PER_NON_SHOPPING_CAMPAIGN + NEGATIVE_KEYWORDS_PER_SHARED_SET = 36, // NEGATIVE_KEYWORDS_PER_SHARED_SET + NEGATIVE_PLACEMENTS_PER_SHARED_SET = 37, // NEGATIVE_PLACEMENTS_PER_SHARED_SET + SHARED_SETS_PER_CUSTOMER_FOR_TYPE_DEFAULT = 40, // SHARED_SETS_PER_CUSTOMER_FOR_TYPE_DEFAULT + SHARED_SETS_PER_CUSTOMER_FOR_NEGATIVE_PLACEMENT_LIST_LOWER = 41, // SHARED_SETS_PER_CUSTOMER_FOR_NEGATIVE_PLACEMENT_LIST_LOWER + HOTEL_ADVANCE_BOOKING_WINDOW_BID_MODIFIERS_PER_AD_GROUP = 44, // HOTEL_ADVANCE_BOOKING_WINDOW_BID_MODIFIERS_PER_AD_GROUP + BIDDING_STRATEGIES_PER_CUSTOMER = 45, // BIDDING_STRATEGIES_PER_CUSTOMER + BASIC_USER_LISTS_PER_CUSTOMER = 47, // BASIC_USER_LISTS_PER_CUSTOMER + LOGICAL_USER_LISTS_PER_CUSTOMER = 48, // LOGICAL_USER_LISTS_PER_CUSTOMER + BASE_AD_GROUP_ADS_PER_CUSTOMER = 53, // BASE_AD_GROUP_ADS_PER_CUSTOMER + EXPERIMENT_AD_GROUP_ADS_PER_CUSTOMER = 54, // EXPERIMENT_AD_GROUP_ADS_PER_CUSTOMER + AD_GROUP_ADS_PER_CAMPAIGN = 55, // AD_GROUP_ADS_PER_CAMPAIGN + TEXT_AND_OTHER_ADS_PER_AD_GROUP = 56, // TEXT_AND_OTHER_ADS_PER_AD_GROUP + IMAGE_ADS_PER_AD_GROUP = 57, // IMAGE_ADS_PER_AD_GROUP + SHOPPING_SMART_ADS_PER_AD_GROUP = 58, // SHOPPING_SMART_ADS_PER_AD_GROUP + RESPONSIVE_SEARCH_ADS_PER_AD_GROUP = 59, // RESPONSIVE_SEARCH_ADS_PER_AD_GROUP + APP_ADS_PER_AD_GROUP = 60, // APP_ADS_PER_AD_GROUP + APP_ENGAGEMENT_ADS_PER_AD_GROUP = 61, // APP_ENGAGEMENT_ADS_PER_AD_GROUP + LOCAL_ADS_PER_AD_GROUP = 62, // LOCAL_ADS_PER_AD_GROUP + VIDEO_ADS_PER_AD_GROUP = 63, // VIDEO_ADS_PER_AD_GROUP + LEAD_FORM_ASSET_LINKS_PER_CAMPAIGN = 68, // LEAD_FORM_ASSET_LINKS_PER_CAMPAIGN + VERSIONS_PER_AD = 82, // VERSIONS_PER_AD + USER_FEEDS_PER_CUSTOMER = 90, // USER_FEEDS_PER_CUSTOMER + SYSTEM_FEEDS_PER_CUSTOMER = 91, // SYSTEM_FEEDS_PER_CUSTOMER + FEED_ATTRIBUTES_PER_FEED = 92, // FEED_ATTRIBUTES_PER_FEED + FEED_ITEMS_PER_CUSTOMER = 94, // FEED_ITEMS_PER_CUSTOMER + CAMPAIGN_FEEDS_PER_CUSTOMER = 95, // CAMPAIGN_FEEDS_PER_CUSTOMER + BASE_CAMPAIGN_FEEDS_PER_CUSTOMER = 96, // BASE_CAMPAIGN_FEEDS_PER_CUSTOMER + EXPERIMENT_CAMPAIGN_FEEDS_PER_CUSTOMER = 109, // EXPERIMENT_CAMPAIGN_FEEDS_PER_CUSTOMER + AD_GROUP_FEEDS_PER_CUSTOMER = 97, // AD_GROUP_FEEDS_PER_CUSTOMER + BASE_AD_GROUP_FEEDS_PER_CUSTOMER = 98, // BASE_AD_GROUP_FEEDS_PER_CUSTOMER + EXPERIMENT_AD_GROUP_FEEDS_PER_CUSTOMER = 110, // EXPERIMENT_AD_GROUP_FEEDS_PER_CUSTOMER + AD_GROUP_FEEDS_PER_CAMPAIGN = 99, // AD_GROUP_FEEDS_PER_CAMPAIGN + FEED_ITEM_SETS_PER_CUSTOMER = 100, // FEED_ITEM_SETS_PER_CUSTOMER + FEED_ITEMS_PER_FEED_ITEM_SET = 101, // FEED_ITEMS_PER_FEED_ITEM_SET + CAMPAIGN_EXPERIMENTS_PER_CUSTOMER = 112, // CAMPAIGN_EXPERIMENTS_PER_CUSTOMER + EXPERIMENT_ARMS_PER_VIDEO_EXPERIMENT = 113, // EXPERIMENT_ARMS_PER_VIDEO_EXPERIMENT + OWNED_LABELS_PER_CUSTOMER = 115, // OWNED_LABELS_PER_CUSTOMER + LABELS_PER_CAMPAIGN = 117, // LABELS_PER_CAMPAIGN + LABELS_PER_AD_GROUP = 118, // LABELS_PER_AD_GROUP + LABELS_PER_AD_GROUP_AD = 119, // LABELS_PER_AD_GROUP_AD + LABELS_PER_AD_GROUP_CRITERION = 120, // LABELS_PER_AD_GROUP_CRITERION + TARGET_CUSTOMERS_PER_LABEL = 121, // TARGET_CUSTOMERS_PER_LABEL + KEYWORD_PLANS_PER_USER_PER_CUSTOMER = 122, // KEYWORD_PLANS_PER_USER_PER_CUSTOMER + KEYWORD_PLAN_AD_GROUP_KEYWORDS_PER_KEYWORD_PLAN = 123, // KEYWORD_PLAN_AD_GROUP_KEYWORDS_PER_KEYWORD_PLAN + KEYWORD_PLAN_AD_GROUPS_PER_KEYWORD_PLAN = 124, // KEYWORD_PLAN_AD_GROUPS_PER_KEYWORD_PLAN + KEYWORD_PLAN_NEGATIVE_KEYWORDS_PER_KEYWORD_PLAN = 125, // KEYWORD_PLAN_NEGATIVE_KEYWORDS_PER_KEYWORD_PLAN + KEYWORD_PLAN_CAMPAIGNS_PER_KEYWORD_PLAN = 126, // KEYWORD_PLAN_CAMPAIGNS_PER_KEYWORD_PLAN + CONVERSION_ACTIONS_PER_CUSTOMER = 128, // CONVERSION_ACTIONS_PER_CUSTOMER + BATCH_JOB_OPERATIONS_PER_JOB = 130, // BATCH_JOB_OPERATIONS_PER_JOB + BATCH_JOBS_PER_CUSTOMER = 131, // BATCH_JOBS_PER_CUSTOMER + HOTEL_CHECK_IN_DATE_RANGE_BID_MODIFIERS_PER_AD_GROUP = 132, // HOTEL_CHECK_IN_DATE_RANGE_BID_MODIFIERS_PER_AD_GROUP + } + /** * @name ResponseContentTypeEnum.ResponseContentType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ResponseContentTypeEnum.ResponseContentType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ResponseContentTypeEnum.ResponseContentType */ export enum ResponseContentType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3484,7 +3636,7 @@ export namespace enums { /** * @name SearchTermTargetingStatusEnum.SearchTermTargetingStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SearchTermTargetingStatusEnum.SearchTermTargetingStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SearchTermTargetingStatusEnum.SearchTermTargetingStatus */ export enum SearchTermTargetingStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -3497,7 +3649,7 @@ export namespace enums { /** * @name SharedSetStatusEnum.SharedSetStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SharedSetStatusEnum.SharedSetStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SharedSetStatusEnum.SharedSetStatus */ export enum SharedSetStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -3508,7 +3660,7 @@ export namespace enums { /** * @name SharedSetTypeEnum.SharedSetType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SharedSetTypeEnum.SharedSetType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SharedSetTypeEnum.SharedSetType */ export enum SharedSetType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3519,18 +3671,19 @@ export namespace enums { /** * @name SimulationModificationMethodEnum.SimulationModificationMethod - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SimulationModificationMethodEnum.SimulationModificationMethod + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SimulationModificationMethodEnum.SimulationModificationMethod */ export enum SimulationModificationMethod { UNSPECIFIED = 0, // UNSPECIFIED UNKNOWN = 1, // UNKNOWN UNIFORM = 2, // UNIFORM DEFAULT = 3, // DEFAULT + SCALING = 4, // SCALING } /** * @name SimulationTypeEnum.SimulationType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SimulationTypeEnum.SimulationType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SimulationTypeEnum.SimulationType */ export enum SimulationType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3541,11 +3694,13 @@ export namespace enums { BID_MODIFIER = 5, // BID_MODIFIER TARGET_ROAS = 6, // TARGET_ROAS PERCENT_CPC_BID = 7, // PERCENT_CPC_BID + TARGET_IMPRESSION_SHARE = 8, // TARGET_IMPRESSION_SHARE + BUDGET = 9, // BUDGET } /** * @name SitelinkPlaceholderFieldEnum.SitelinkPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SitelinkPlaceholderFieldEnum.SitelinkPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SitelinkPlaceholderFieldEnum.SitelinkPlaceholderField */ export enum SitelinkPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3561,7 +3716,7 @@ export namespace enums { /** * @name SpendingLimitTypeEnum.SpendingLimitType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SpendingLimitTypeEnum.SpendingLimitType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SpendingLimitTypeEnum.SpendingLimitType */ export enum SpendingLimitType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3571,7 +3726,7 @@ export namespace enums { /** * @name StructuredSnippetPlaceholderFieldEnum.StructuredSnippetPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/StructuredSnippetPlaceholderFieldEnum.StructuredSnippetPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/StructuredSnippetPlaceholderFieldEnum.StructuredSnippetPlaceholderField */ export enum StructuredSnippetPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3582,7 +3737,7 @@ export namespace enums { /** * @name SummaryRowSettingEnum.SummaryRowSetting - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SummaryRowSettingEnum.SummaryRowSetting + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SummaryRowSettingEnum.SummaryRowSetting */ export enum SummaryRowSetting { UNSPECIFIED = 0, // UNSPECIFIED @@ -3594,7 +3749,7 @@ export namespace enums { /** * @name SystemManagedResourceSourceEnum.SystemManagedResourceSource - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SystemManagedResourceSourceEnum.SystemManagedResourceSource + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SystemManagedResourceSourceEnum.SystemManagedResourceSource */ export enum SystemManagedResourceSource { UNSPECIFIED = 0, // UNSPECIFIED @@ -3604,7 +3759,7 @@ export namespace enums { /** * @name TargetCpaOptInRecommendationGoalEnum.TargetCpaOptInRecommendationGoal - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TargetCpaOptInRecommendationGoalEnum.TargetCpaOptInRecommendationGoal + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TargetCpaOptInRecommendationGoalEnum.TargetCpaOptInRecommendationGoal */ export enum TargetCpaOptInRecommendationGoal { UNSPECIFIED = 0, // UNSPECIFIED @@ -3617,7 +3772,7 @@ export namespace enums { /** * @name TimeTypeEnum.TimeType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TimeTypeEnum.TimeType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TimeTypeEnum.TimeType */ export enum TimeType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3628,7 +3783,7 @@ export namespace enums { /** * @name TravelPlaceholderFieldEnum.TravelPlaceholderField - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TravelPlaceholderFieldEnum.TravelPlaceholderField + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TravelPlaceholderFieldEnum.TravelPlaceholderField */ export enum TravelPlaceholderField { UNSPECIFIED = 0, // UNSPECIFIED @@ -3657,7 +3812,7 @@ export namespace enums { /** * @name UserInterestTaxonomyTypeEnum.UserInterestTaxonomyType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserInterestTaxonomyTypeEnum.UserInterestTaxonomyType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserInterestTaxonomyTypeEnum.UserInterestTaxonomyType */ export enum UserInterestTaxonomyType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3671,7 +3826,7 @@ export namespace enums { /** * @name UserListAccessStatusEnum.UserListAccessStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListAccessStatusEnum.UserListAccessStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListAccessStatusEnum.UserListAccessStatus */ export enum UserListAccessStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -3682,7 +3837,7 @@ export namespace enums { /** * @name UserListClosingReasonEnum.UserListClosingReason - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListClosingReasonEnum.UserListClosingReason + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListClosingReasonEnum.UserListClosingReason */ export enum UserListClosingReason { UNSPECIFIED = 0, // UNSPECIFIED @@ -3692,7 +3847,7 @@ export namespace enums { /** * @name UserListMembershipStatusEnum.UserListMembershipStatus - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListMembershipStatusEnum.UserListMembershipStatus + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListMembershipStatusEnum.UserListMembershipStatus */ export enum UserListMembershipStatus { UNSPECIFIED = 0, // UNSPECIFIED @@ -3703,7 +3858,7 @@ export namespace enums { /** * @name UserListSizeRangeEnum.UserListSizeRange - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListSizeRangeEnum.UserListSizeRange + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListSizeRangeEnum.UserListSizeRange */ export enum UserListSizeRange { UNSPECIFIED = 0, // UNSPECIFIED @@ -3728,7 +3883,7 @@ export namespace enums { /** * @name UserListTypeEnum.UserListType - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListTypeEnum.UserListType + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListTypeEnum.UserListType */ export enum UserListType { UNSPECIFIED = 0, // UNSPECIFIED @@ -3743,7 +3898,7 @@ export namespace enums { /** * @name VanityPharmaDisplayUrlModeEnum.VanityPharmaDisplayUrlMode - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/VanityPharmaDisplayUrlModeEnum.VanityPharmaDisplayUrlMode + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/VanityPharmaDisplayUrlModeEnum.VanityPharmaDisplayUrlMode */ export enum VanityPharmaDisplayUrlMode { UNSPECIFIED = 0, // UNSPECIFIED @@ -3754,7 +3909,7 @@ export namespace enums { /** * @name VanityPharmaTextEnum.VanityPharmaText - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/VanityPharmaTextEnum.VanityPharmaText + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/VanityPharmaTextEnum.VanityPharmaText */ export enum VanityPharmaText { UNSPECIFIED = 0, // UNSPECIFIED diff --git a/src/protos/autogen/fields.ts b/src/protos/autogen/fields.ts index b229f83c..62cb04de 100644 --- a/src/protos/autogen/fields.ts +++ b/src/protos/autogen/fields.ts @@ -11,6 +11,7 @@ export namespace fields { | "ad_group_ad" | "ad_group_ad_asset_view" | "ad_group_ad_label" + | "ad_group_asset" | "ad_group_audience_view" | "ad_group_bid_modifier" | "ad_group_criterion" @@ -26,6 +27,7 @@ export namespace fields { | "asset" | "batch_job" | "bidding_strategy" + | "bidding_strategy_simulation" | "billing_setup" | "call_view" | "campaign" @@ -41,16 +43,19 @@ export namespace fields { | "campaign_feed" | "campaign_label" | "campaign_shared_set" + | "campaign_simulation" | "carrier_constant" | "change_event" | "change_status" | "click_view" | "combined_audience" | "conversion_action" + | "conversion_custom_variable" | "currency_constant" | "custom_audience" | "custom_interest" | "customer" + | "customer_asset" | "customer_client" | "customer_client_link" | "customer_extension_setting" @@ -90,6 +95,7 @@ export namespace fields { | "label" | "landing_page_view" | "language_constant" + | "life_event" | "location_view" | "managed_placement_view" | "media_file" @@ -113,7 +119,8 @@ export namespace fields { | "user_interest" | "user_list" | "user_location_view" - | "video"; + | "video" + | "webpage_view"; export type Resources = Array; @@ -192,6 +199,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -348,6 +356,7 @@ export namespace fields { | "ad_group_ad.ad.video_responsive_ad.videos" | "ad_group_ad.ad_group" | "ad_group_ad.ad_strength" + | "ad_group_ad.labels" | "ad_group_ad.policy_summary.approval_status" | "ad_group_ad.policy_summary.policy_topic_entries" | "ad_group_ad.policy_summary.review_status" @@ -363,6 +372,11 @@ export namespace fields { | "ad_group_ad_label.ad_group_ad" | "ad_group_ad_label.label" | "ad_group_ad_label.resource_name" + | "ad_group_asset.ad_group" + | "ad_group_asset.asset" + | "ad_group_asset.field_type" + | "ad_group_asset.resource_name" + | "ad_group_asset.status" | "ad_group_audience_view.resource_name" | "ad_group_bid_modifier.ad_group" | "ad_group_bid_modifier.base_ad_group" @@ -372,6 +386,8 @@ export namespace fields { | "ad_group_bid_modifier.device.type" | "ad_group_bid_modifier.hotel_advance_booking_window.max_days" | "ad_group_bid_modifier.hotel_advance_booking_window.min_days" + | "ad_group_bid_modifier.hotel_check_in_date_range.end_date" + | "ad_group_bid_modifier.hotel_check_in_date_range.start_date" | "ad_group_bid_modifier.hotel_check_in_day.day_of_week" | "ad_group_bid_modifier.hotel_date_selection_type.type" | "ad_group_bid_modifier.hotel_length_of_stay.max_nights" @@ -392,6 +408,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -407,6 +424,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -453,7 +471,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "ad_group_criterion_label.ad_group_criterion" @@ -502,6 +522,12 @@ export namespace fields { | "ad_schedule_view.resource_name" | "age_range_view.resource_name" | "asset.book_on_google_asset" + | "asset.callout_asset.ad_schedule_targets" + | "asset.callout_asset.callout_text" + | "asset.callout_asset.end_date" + | "asset.callout_asset.start_date" + | "asset.final_mobile_urls" + | "asset.final_url_suffix" | "asset.final_urls" | "asset.id" | "asset.image_asset.file_size" @@ -527,9 +553,34 @@ export namespace fields { | "asset.policy_summary.approval_status" | "asset.policy_summary.policy_topic_entries" | "asset.policy_summary.review_status" + | "asset.promotion_asset.ad_schedule_targets" + | "asset.promotion_asset.discount_modifier" + | "asset.promotion_asset.end_date" + | "asset.promotion_asset.language_code" + | "asset.promotion_asset.money_amount_off.amount_micros" + | "asset.promotion_asset.money_amount_off.currency_code" + | "asset.promotion_asset.occasion" + | "asset.promotion_asset.orders_over_amount.amount_micros" + | "asset.promotion_asset.orders_over_amount.currency_code" + | "asset.promotion_asset.percent_off" + | "asset.promotion_asset.promotion_code" + | "asset.promotion_asset.promotion_target" + | "asset.promotion_asset.redemption_end_date" + | "asset.promotion_asset.redemption_start_date" + | "asset.promotion_asset.start_date" | "asset.resource_name" + | "asset.sitelink_asset.ad_schedule_targets" + | "asset.sitelink_asset.description1" + | "asset.sitelink_asset.description2" + | "asset.sitelink_asset.end_date" + | "asset.sitelink_asset.link_text" + | "asset.sitelink_asset.start_date" + | "asset.structured_snippet_asset.header" + | "asset.structured_snippet_asset.values" | "asset.text_asset.text" + | "asset.tracking_url_template" | "asset.type" + | "asset.url_custom_parameters" | "asset.youtube_video_asset.youtube_video_id" | "asset.youtube_video_asset.youtube_video_title" | "batch_job.id" @@ -565,6 +616,14 @@ export namespace fields { | "bidding_strategy.target_spend.cpc_bid_ceiling_micros" | "bidding_strategy.target_spend.target_spend_micros" | "bidding_strategy.type" + | "bidding_strategy_simulation.bidding_strategy_id" + | "bidding_strategy_simulation.end_date" + | "bidding_strategy_simulation.modification_method" + | "bidding_strategy_simulation.resource_name" + | "bidding_strategy_simulation.start_date" + | "bidding_strategy_simulation.target_cpa_point_list.points" + | "bidding_strategy_simulation.target_roas_point_list.points" + | "bidding_strategy_simulation.type" | "billing_setup.end_date_time" | "billing_setup.end_time_type" | "billing_setup.id" @@ -602,6 +661,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -698,6 +758,7 @@ export namespace fields { | "campaign_criterion.custom_affinity.custom_affinity" | "campaign_criterion.custom_audience.custom_audience" | "campaign_criterion.device.type" + | "campaign_criterion.display_name" | "campaign_criterion.gender.type" | "campaign_criterion.income_range.type" | "campaign_criterion.ip_block.ip_address" @@ -734,7 +795,9 @@ export namespace fields { | "campaign_criterion.user_interest.user_interest_category" | "campaign_criterion.user_list.user_list" | "campaign_criterion.webpage.conditions" + | "campaign_criterion.webpage.coverage_percentage" | "campaign_criterion.webpage.criterion_name" + | "campaign_criterion.webpage.sample.sample_urls" | "campaign_criterion.youtube_channel.channel_id" | "campaign_criterion.youtube_video.video_id" | "campaign_criterion_simulation.bid_modifier_point_list.points" @@ -786,6 +849,17 @@ export namespace fields { | "campaign_shared_set.resource_name" | "campaign_shared_set.shared_set" | "campaign_shared_set.status" + | "campaign_simulation.budget_point_list.points" + | "campaign_simulation.campaign_id" + | "campaign_simulation.cpc_bid_point_list.points" + | "campaign_simulation.end_date" + | "campaign_simulation.modification_method" + | "campaign_simulation.resource_name" + | "campaign_simulation.start_date" + | "campaign_simulation.target_cpa_point_list.points" + | "campaign_simulation.target_impression_share_point_list.points" + | "campaign_simulation.target_roas_point_list.points" + | "campaign_simulation.type" | "carrier_constant.country_code" | "carrier_constant.id" | "carrier_constant.name" @@ -826,6 +900,9 @@ export namespace fields { | "click_view.area_of_interest.region" | "click_view.campaign_location_target" | "click_view.gclid" + | "click_view.keyword" + | "click_view.keyword_info.match_type" + | "click_view.keyword_info.text" | "click_view.location_of_presence.city" | "click_view.location_of_presence.country" | "click_view.location_of_presence.metro" @@ -863,6 +940,12 @@ export namespace fields { | "conversion_action.value_settings.default_currency_code" | "conversion_action.value_settings.default_value" | "conversion_action.view_through_lookback_window_days" + | "conversion_custom_variable.id" + | "conversion_custom_variable.name" + | "conversion_custom_variable.owner_customer" + | "conversion_custom_variable.resource_name" + | "conversion_custom_variable.status" + | "conversion_custom_variable.tag" | "currency_constant.billable_unit_micros" | "currency_constant.code" | "currency_constant.name" @@ -902,6 +985,10 @@ export namespace fields { | "customer.test_account" | "customer.time_zone" | "customer.tracking_url_template" + | "customer_asset.asset" + | "customer_asset.field_type" + | "customer_asset.resource_name" + | "customer_asset.status" | "customer_client.client_customer" | "customer_client.currency_code" | "customer_client.descriptive_name" @@ -1190,6 +1277,12 @@ export namespace fields { | "language_constant.name" | "language_constant.resource_name" | "language_constant.targetable" + | "life_event.availabilities" + | "life_event.id" + | "life_event.launched_to_all" + | "life_event.name" + | "life_event.parent" + | "life_event.resource_name" | "location_view.resource_name" | "managed_placement_view.resource_name" | "media_file.audio.ad_duration_millis" @@ -1261,6 +1354,7 @@ export namespace fields { | "recommendation.impact" | "recommendation.keyword_match_type_recommendation" | "recommendation.keyword_recommendation" + | "recommendation.marginal_roi_campaign_budget_recommendation" | "recommendation.maximize_clicks_opt_in_recommendation" | "recommendation.maximize_conversions_opt_in_recommendation" | "recommendation.move_unused_budget_recommendation" @@ -1359,7 +1453,8 @@ export namespace fields { | "video.duration_millis" | "video.id" | "video.resource_name" - | "video.title"; + | "video.title" + | "webpage_view.resource_name"; export type Attributes = Array; @@ -1468,6 +1563,7 @@ export namespace fields { | "metrics.search_rank_lost_impression_share" | "metrics.search_rank_lost_top_impression_share" | "metrics.search_top_impression_share" + | "metrics.sk_ad_network_conversions" | "metrics.speed_score" | "metrics.top_impression_percentage" | "metrics.valid_accelerated_mobile_pages_clicks_percentage" @@ -1567,6 +1663,7 @@ export namespace fields { | "segments.quarter" | "segments.search_engine_results_page_type" | "segments.search_term_match_type" + | "segments.sk_ad_network_conversion_value" | "segments.slot" | "segments.webpage" | "segments.week" @@ -1584,6 +1681,8 @@ export namespace fields { "ad_group_ad.resource_name", "ad_group_ad_asset_view.resource_name", "ad_group_ad_label.resource_name", + "ad_group_asset.resource_name", + "ad_group_audience_view.resource_name", "ad_group_bid_modifier.resource_name", "ad_group_criterion.resource_name", "ad_group_criterion_label.resource_name", @@ -1597,6 +1696,7 @@ export namespace fields { "asset.resource_name", "batch_job.resource_name", "bidding_strategy.resource_name", + "bidding_strategy_simulation.resource_name", "billing_setup.resource_name", "call_view.resource_name", "campaign.resource_name", @@ -1612,16 +1712,19 @@ export namespace fields { "campaign_feed.resource_name", "campaign_label.resource_name", "campaign_shared_set.resource_name", + "campaign_simulation.resource_name", "carrier_constant.resource_name", "change_event.resource_name", "change_status.resource_name", "click_view.resource_name", "combined_audience.resource_name", "conversion_action.resource_name", + "conversion_custom_variable.resource_name", "currency_constant.resource_name", "custom_audience.resource_name", "custom_interest.resource_name", "customer.resource_name", + "customer_asset.resource_name", "customer_client.resource_name", "customer_client_link.resource_name", "customer_extension_setting.resource_name", @@ -1659,7 +1762,8 @@ export namespace fields { "label.resource_name", "landing_page_view.resource_name", "language_constant.resource_name", - "location_view.resource_name", + "life_event.resource_name", + "managed_placement_view.resource_name", "media_file.resource_name", "mobile_app_category_constant.resource_name", "mobile_device_constant.resource_name", @@ -1680,6 +1784,7 @@ export namespace fields { "user_list.resource_name", "user_location_view.resource_name", "video.resource_name", + "webpage_view.resource_name", ]; /* -- ENUM FIELDS -- */ @@ -1707,6 +1812,7 @@ export namespace fields { "ad_group.display_custom_bid_dimension": "TargetingDimension", "ad_group.effective_target_cpa_source": "BiddingSource", "ad_group.effective_target_roas_source": "BiddingSource", + "ad_group.excluded_parent_asset_field_types": "AssetFieldType", "ad_group.status": "AdGroupStatus", "ad_group.type": "AdGroupType", "ad_group_ad.ad.call_only_ad.conversion_reporting_state": @@ -1728,6 +1834,8 @@ export namespace fields { "ad_group_ad.status": "AdGroupAdStatus", "ad_group_ad_asset_view.field_type": "AssetFieldType", "ad_group_ad_asset_view.performance_label": "AssetPerformanceLabel", + "ad_group_asset.field_type": "AssetFieldType", + "ad_group_asset.status": "AssetLinkStatus", "ad_group_bid_modifier.bid_modifier_source": "BidModifierSource", "ad_group_bid_modifier.device.type": "Device", "ad_group_bid_modifier.hotel_check_in_day.day_of_week": "DayOfWeek", @@ -1784,12 +1892,18 @@ export namespace fields { "LeadFormPostSubmitCallToActionType", "asset.policy_summary.approval_status": "PolicyApprovalStatus", "asset.policy_summary.review_status": "PolicyReviewStatus", + "asset.promotion_asset.discount_modifier": + "PromotionExtensionDiscountModifier", + "asset.promotion_asset.occasion": "PromotionExtensionOccasion", "asset.type": "AssetType", "batch_job.status": "BatchJobStatus", "bidding_strategy.status": "BiddingStrategyStatus", "bidding_strategy.target_impression_share.location": "TargetImpressionShareLocation", "bidding_strategy.type": "BiddingStrategyType", + "bidding_strategy_simulation.modification_method": + "SimulationModificationMethod", + "bidding_strategy_simulation.type": "SimulationType", "billing_setup.end_time_type": "TimeType", "billing_setup.status": "BillingSetupStatus", "call_view.call_status": "GoogleVoiceCallStatus", @@ -1802,6 +1916,7 @@ export namespace fields { "campaign.app_campaign_setting.bidding_strategy_goal_type": "AppCampaignBiddingStrategyGoalType", "campaign.bidding_strategy_type": "BiddingStrategyType", + "campaign.excluded_parent_asset_field_types": "AssetFieldType", "campaign.experiment_type": "CampaignExperimentType", "campaign.geo_target_type_setting.negative_geo_target_type": "NegativeGeoTargetType", @@ -1853,11 +1968,14 @@ export namespace fields { "campaign_feed.placeholder_types": "PlaceholderType", "campaign_feed.status": "FeedLinkStatus", "campaign_shared_set.status": "CampaignSharedSetStatus", + "campaign_simulation.modification_method": "SimulationModificationMethod", + "campaign_simulation.type": "SimulationType", "change_event.change_resource_type": "ChangeEventResourceType", "change_event.client_type": "ChangeClientType", "change_event.resource_change_operation": "ResourceChangeOperation", "change_status.resource_status": "ChangeStatusOperation", "change_status.resource_type": "ChangeStatusResourceType", + "click_view.keyword_info.match_type": "KeywordMatchType", "combined_audience.status": "CombinedAudienceStatus", "conversion_action.attribution_model_settings.attribution_model": "AttributionModel", @@ -1868,12 +1986,15 @@ export namespace fields { "conversion_action.mobile_app_vendor": "MobileAppVendor", "conversion_action.status": "ConversionActionStatus", "conversion_action.type": "ConversionActionType", + "conversion_custom_variable.status": "ConversionCustomVariableStatus", "custom_audience.status": "CustomAudienceStatus", "custom_audience.type": "CustomAudienceType", "custom_interest.status": "CustomInterestStatus", "custom_interest.type": "CustomInterestType", "customer.pay_per_conversion_eligibility_failure_reasons": "CustomerPayPerConversionEligibilityFailureReason", + "customer_asset.field_type": "AssetFieldType", + "customer_asset.status": "AssetLinkStatus", "customer_client_link.status": "ManagerLinkStatus", "customer_extension_setting.device": "ExtensionSettingDevice", "customer_extension_setting.extension_type": "ExtensionType", @@ -2178,6 +2299,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -2231,6 +2353,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -2422,6 +2545,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -2578,6 +2702,7 @@ export namespace fields { | "ad_group_ad.ad.video_responsive_ad.videos" | "ad_group_ad.ad_group" | "ad_group_ad.ad_strength" + | "ad_group_ad.labels" | "ad_group_ad.policy_summary.approval_status" | "ad_group_ad.policy_summary.policy_topic_entries" | "ad_group_ad.policy_summary.review_status" @@ -2599,6 +2724,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -2777,6 +2903,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -2933,6 +3060,7 @@ export namespace fields { | "ad_group_ad.ad.video_responsive_ad.videos" | "ad_group_ad.ad_group" | "ad_group_ad.ad_strength" + | "ad_group_ad.labels" | "ad_group_ad.policy_summary.approval_status" | "ad_group_ad.policy_summary.policy_topic_entries" | "ad_group_ad.policy_summary.review_status" @@ -2946,6 +3074,12 @@ export namespace fields { | "ad_group_ad_asset_view.policy_summary" | "ad_group_ad_asset_view.resource_name" | "asset.book_on_google_asset" + | "asset.callout_asset.ad_schedule_targets" + | "asset.callout_asset.callout_text" + | "asset.callout_asset.end_date" + | "asset.callout_asset.start_date" + | "asset.final_mobile_urls" + | "asset.final_url_suffix" | "asset.final_urls" | "asset.id" | "asset.image_asset.file_size" @@ -2971,9 +3105,34 @@ export namespace fields { | "asset.policy_summary.approval_status" | "asset.policy_summary.policy_topic_entries" | "asset.policy_summary.review_status" + | "asset.promotion_asset.ad_schedule_targets" + | "asset.promotion_asset.discount_modifier" + | "asset.promotion_asset.end_date" + | "asset.promotion_asset.language_code" + | "asset.promotion_asset.money_amount_off.amount_micros" + | "asset.promotion_asset.money_amount_off.currency_code" + | "asset.promotion_asset.occasion" + | "asset.promotion_asset.orders_over_amount.amount_micros" + | "asset.promotion_asset.orders_over_amount.currency_code" + | "asset.promotion_asset.percent_off" + | "asset.promotion_asset.promotion_code" + | "asset.promotion_asset.promotion_target" + | "asset.promotion_asset.redemption_end_date" + | "asset.promotion_asset.redemption_start_date" + | "asset.promotion_asset.start_date" | "asset.resource_name" + | "asset.sitelink_asset.ad_schedule_targets" + | "asset.sitelink_asset.description1" + | "asset.sitelink_asset.description2" + | "asset.sitelink_asset.end_date" + | "asset.sitelink_asset.link_text" + | "asset.sitelink_asset.start_date" + | "asset.structured_snippet_asset.header" + | "asset.structured_snippet_asset.values" | "asset.text_asset.text" + | "asset.tracking_url_template" | "asset.type" + | "asset.url_custom_parameters" | "asset.youtube_video_asset.youtube_video_id" | "asset.youtube_video_asset.youtube_video_title" | "campaign.ad_serving_optimization_status" @@ -2992,6 +3151,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -3114,6 +3274,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -3270,6 +3431,7 @@ export namespace fields { | "ad_group_ad.ad.video_responsive_ad.videos" | "ad_group_ad.ad_group" | "ad_group_ad.ad_strength" + | "ad_group_ad.labels" | "ad_group_ad.policy_summary.approval_status" | "ad_group_ad.policy_summary.policy_topic_entries" | "ad_group_ad.policy_summary.review_status" @@ -3294,6 +3456,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -3377,6 +3540,196 @@ export namespace fields { export type AdGroupAdLabelFields = Array; /* --- End of AdGroupAdLabel --- */ + /* --- Start of AdGroupAsset --- */ + export type AdGroupAssetField = + | "ad_group.ad_rotation_mode" + | "ad_group.base_ad_group" + | "ad_group.campaign" + | "ad_group.cpc_bid_micros" + | "ad_group.cpm_bid_micros" + | "ad_group.cpv_bid_micros" + | "ad_group.display_custom_bid_dimension" + | "ad_group.effective_target_cpa_micros" + | "ad_group.effective_target_cpa_source" + | "ad_group.effective_target_roas" + | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" + | "ad_group.explorer_auto_optimizer_setting.opt_in" + | "ad_group.final_url_suffix" + | "ad_group.id" + | "ad_group.labels" + | "ad_group.name" + | "ad_group.percent_cpc_bid_micros" + | "ad_group.resource_name" + | "ad_group.status" + | "ad_group.target_cpa_micros" + | "ad_group.target_cpm_micros" + | "ad_group.target_roas" + | "ad_group.targeting_setting.target_restrictions" + | "ad_group.tracking_url_template" + | "ad_group.type" + | "ad_group.url_custom_parameters" + | "ad_group_asset.ad_group" + | "ad_group_asset.asset" + | "ad_group_asset.field_type" + | "ad_group_asset.resource_name" + | "ad_group_asset.status" + | "asset.book_on_google_asset" + | "asset.callout_asset.ad_schedule_targets" + | "asset.callout_asset.callout_text" + | "asset.callout_asset.end_date" + | "asset.callout_asset.start_date" + | "asset.final_mobile_urls" + | "asset.final_url_suffix" + | "asset.final_urls" + | "asset.id" + | "asset.image_asset.file_size" + | "asset.image_asset.full_size.height_pixels" + | "asset.image_asset.full_size.url" + | "asset.image_asset.full_size.width_pixels" + | "asset.image_asset.mime_type" + | "asset.lead_form_asset.background_image_asset" + | "asset.lead_form_asset.business_name" + | "asset.lead_form_asset.call_to_action_description" + | "asset.lead_form_asset.call_to_action_type" + | "asset.lead_form_asset.custom_disclosure" + | "asset.lead_form_asset.delivery_methods" + | "asset.lead_form_asset.description" + | "asset.lead_form_asset.desired_intent" + | "asset.lead_form_asset.fields" + | "asset.lead_form_asset.headline" + | "asset.lead_form_asset.post_submit_call_to_action_type" + | "asset.lead_form_asset.post_submit_description" + | "asset.lead_form_asset.post_submit_headline" + | "asset.lead_form_asset.privacy_policy_url" + | "asset.name" + | "asset.policy_summary.approval_status" + | "asset.policy_summary.policy_topic_entries" + | "asset.policy_summary.review_status" + | "asset.promotion_asset.ad_schedule_targets" + | "asset.promotion_asset.discount_modifier" + | "asset.promotion_asset.end_date" + | "asset.promotion_asset.language_code" + | "asset.promotion_asset.money_amount_off.amount_micros" + | "asset.promotion_asset.money_amount_off.currency_code" + | "asset.promotion_asset.occasion" + | "asset.promotion_asset.orders_over_amount.amount_micros" + | "asset.promotion_asset.orders_over_amount.currency_code" + | "asset.promotion_asset.percent_off" + | "asset.promotion_asset.promotion_code" + | "asset.promotion_asset.promotion_target" + | "asset.promotion_asset.redemption_end_date" + | "asset.promotion_asset.redemption_start_date" + | "asset.promotion_asset.start_date" + | "asset.resource_name" + | "asset.sitelink_asset.ad_schedule_targets" + | "asset.sitelink_asset.description1" + | "asset.sitelink_asset.description2" + | "asset.sitelink_asset.end_date" + | "asset.sitelink_asset.link_text" + | "asset.sitelink_asset.start_date" + | "asset.structured_snippet_asset.header" + | "asset.structured_snippet_asset.values" + | "asset.text_asset.text" + | "asset.tracking_url_template" + | "asset.type" + | "asset.url_custom_parameters" + | "asset.youtube_video_asset.youtube_video_id" + | "asset.youtube_video_asset.youtube_video_title" + | "campaign.ad_serving_optimization_status" + | "campaign.advertising_channel_sub_type" + | "campaign.advertising_channel_type" + | "campaign.app_campaign_setting.app_id" + | "campaign.app_campaign_setting.app_store" + | "campaign.app_campaign_setting.bidding_strategy_goal_type" + | "campaign.base_campaign" + | "campaign.bidding_strategy" + | "campaign.bidding_strategy_type" + | "campaign.campaign_budget" + | "campaign.commission.commission_rate_micros" + | "campaign.dynamic_search_ads_setting.domain_name" + | "campaign.dynamic_search_ads_setting.feeds" + | "campaign.dynamic_search_ads_setting.language_code" + | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" + | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" + | "campaign.experiment_type" + | "campaign.final_url_suffix" + | "campaign.frequency_caps" + | "campaign.geo_target_type_setting.negative_geo_target_type" + | "campaign.geo_target_type_setting.positive_geo_target_type" + | "campaign.hotel_setting.hotel_center_id" + | "campaign.id" + | "campaign.labels" + | "campaign.local_campaign_setting.location_source_type" + | "campaign.manual_cpc.enhanced_cpc_enabled" + | "campaign.manual_cpm" + | "campaign.manual_cpv" + | "campaign.maximize_conversion_value.target_roas" + | "campaign.maximize_conversions.target_cpa" + | "campaign.name" + | "campaign.network_settings.target_content_network" + | "campaign.network_settings.target_google_search" + | "campaign.network_settings.target_partner_search_network" + | "campaign.network_settings.target_search_network" + | "campaign.optimization_goal_setting.optimization_goal_types" + | "campaign.optimization_score" + | "campaign.payment_mode" + | "campaign.percent_cpc.cpc_bid_ceiling_micros" + | "campaign.percent_cpc.enhanced_cpc_enabled" + | "campaign.real_time_bidding_setting.opt_in" + | "campaign.resource_name" + | "campaign.selective_optimization.conversion_actions" + | "campaign.serving_status" + | "campaign.shopping_setting.campaign_priority" + | "campaign.shopping_setting.enable_local" + | "campaign.shopping_setting.merchant_id" + | "campaign.shopping_setting.sales_country" + | "campaign.start_date" + | "campaign.status" + | "campaign.target_cpa.cpc_bid_ceiling_micros" + | "campaign.target_cpa.cpc_bid_floor_micros" + | "campaign.target_cpa.target_cpa_micros" + | "campaign.target_cpm" + | "campaign.target_impression_share.cpc_bid_ceiling_micros" + | "campaign.target_impression_share.location" + | "campaign.target_impression_share.location_fraction_micros" + | "campaign.target_roas.cpc_bid_ceiling_micros" + | "campaign.target_roas.cpc_bid_floor_micros" + | "campaign.target_roas.target_roas" + | "campaign.target_spend.cpc_bid_ceiling_micros" + | "campaign.target_spend.target_spend_micros" + | "campaign.targeting_setting.target_restrictions" + | "campaign.tracking_setting.tracking_url" + | "campaign.tracking_url_template" + | "campaign.url_custom_parameters" + | "campaign.vanity_pharma.vanity_pharma_display_url_mode" + | "campaign.vanity_pharma.vanity_pharma_text" + | "campaign.video_brand_safety_suitability" + | "customer.auto_tagging_enabled" + | "customer.call_reporting_setting.call_conversion_action" + | "customer.call_reporting_setting.call_conversion_reporting_enabled" + | "customer.call_reporting_setting.call_reporting_enabled" + | "customer.conversion_tracking_setting.conversion_tracking_id" + | "customer.conversion_tracking_setting.cross_account_conversion_tracking_id" + | "customer.currency_code" + | "customer.descriptive_name" + | "customer.final_url_suffix" + | "customer.has_partners_badge" + | "customer.id" + | "customer.manager" + | "customer.optimization_score" + | "customer.optimization_score_weight" + | "customer.pay_per_conversion_eligibility_failure_reasons" + | "customer.remarketing_setting.google_global_site_tag" + | "customer.resource_name" + | "customer.test_account" + | "customer.time_zone" + | "customer.tracking_url_template"; + + export type AdGroupAssetFields = Array; + /* --- End of AdGroupAsset --- */ + /* --- Start of AdGroupAudienceView --- */ export type AdGroupAudienceViewField = | "ad_group.ad_rotation_mode" @@ -3390,6 +3743,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -3420,6 +3774,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -3435,6 +3790,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -3481,7 +3837,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "bidding_strategy.campaign_count" @@ -3522,6 +3880,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -3725,6 +4084,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -3748,6 +4108,8 @@ export namespace fields { | "ad_group_bid_modifier.device.type" | "ad_group_bid_modifier.hotel_advance_booking_window.max_days" | "ad_group_bid_modifier.hotel_advance_booking_window.min_days" + | "ad_group_bid_modifier.hotel_check_in_date_range.end_date" + | "ad_group_bid_modifier.hotel_check_in_date_range.start_date" | "ad_group_bid_modifier.hotel_check_in_day.day_of_week" | "ad_group_bid_modifier.hotel_date_selection_type.type" | "ad_group_bid_modifier.hotel_length_of_stay.max_nights" @@ -3770,6 +4132,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -3860,6 +4223,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -3889,6 +4253,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -3904,6 +4269,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -3950,7 +4316,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "campaign.ad_serving_optimization_status" @@ -3969,6 +4337,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -4110,6 +4479,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -4139,6 +4509,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -4154,6 +4525,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -4200,7 +4572,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "ad_group_criterion_label.ad_group_criterion" @@ -4222,6 +4596,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -4318,6 +4693,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -4347,6 +4723,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -4362,6 +4739,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -4408,7 +4786,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "ad_group_criterion_simulation.ad_group_id" @@ -4436,6 +4816,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -4510,7 +4891,8 @@ export namespace fields { | "customer.time_zone" | "customer.tracking_url_template"; - export type AdGroupCriterionSimulationFields = Array; + export type AdGroupCriterionSimulationFields = + Array; /* --- End of AdGroupCriterionSimulation --- */ /* --- Start of AdGroupExtensionSetting --- */ @@ -4526,6 +4908,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -4562,6 +4945,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -4636,7 +5020,8 @@ export namespace fields { | "customer.time_zone" | "customer.tracking_url_template"; - export type AdGroupExtensionSettingFields = Array; + export type AdGroupExtensionSettingFields = + Array; /* --- End of AdGroupExtensionSetting --- */ /* --- Start of AdGroupFeed --- */ @@ -4652,6 +5037,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -4692,6 +5078,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -4794,6 +5181,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -4828,6 +5216,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -4924,6 +5313,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -4965,6 +5355,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -5055,6 +5446,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -5084,6 +5476,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -5099,6 +5492,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -5145,7 +5539,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "ad_parameter.ad_group_criterion" @@ -5168,6 +5564,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -5264,6 +5661,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -5332,6 +5730,7 @@ export namespace fields { | "campaign_criterion.custom_affinity.custom_affinity" | "campaign_criterion.custom_audience.custom_audience" | "campaign_criterion.device.type" + | "campaign_criterion.display_name" | "campaign_criterion.gender.type" | "campaign_criterion.income_range.type" | "campaign_criterion.ip_block.ip_address" @@ -5368,7 +5767,9 @@ export namespace fields { | "campaign_criterion.user_interest.user_interest_category" | "campaign_criterion.user_list.user_list" | "campaign_criterion.webpage.conditions" + | "campaign_criterion.webpage.coverage_percentage" | "campaign_criterion.webpage.criterion_name" + | "campaign_criterion.webpage.sample.sample_urls" | "campaign_criterion.youtube_channel.channel_id" | "campaign_criterion.youtube_video.video_id" | "customer.auto_tagging_enabled" @@ -5458,6 +5859,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -5487,6 +5889,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -5502,6 +5905,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -5548,7 +5952,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "age_range_view.resource_name" @@ -5590,6 +5996,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -5736,6 +6143,12 @@ export namespace fields { /* --- Start of Asset --- */ export type AssetField = | "asset.book_on_google_asset" + | "asset.callout_asset.ad_schedule_targets" + | "asset.callout_asset.callout_text" + | "asset.callout_asset.end_date" + | "asset.callout_asset.start_date" + | "asset.final_mobile_urls" + | "asset.final_url_suffix" | "asset.final_urls" | "asset.id" | "asset.image_asset.file_size" @@ -5761,9 +6174,34 @@ export namespace fields { | "asset.policy_summary.approval_status" | "asset.policy_summary.policy_topic_entries" | "asset.policy_summary.review_status" + | "asset.promotion_asset.ad_schedule_targets" + | "asset.promotion_asset.discount_modifier" + | "asset.promotion_asset.end_date" + | "asset.promotion_asset.language_code" + | "asset.promotion_asset.money_amount_off.amount_micros" + | "asset.promotion_asset.money_amount_off.currency_code" + | "asset.promotion_asset.occasion" + | "asset.promotion_asset.orders_over_amount.amount_micros" + | "asset.promotion_asset.orders_over_amount.currency_code" + | "asset.promotion_asset.percent_off" + | "asset.promotion_asset.promotion_code" + | "asset.promotion_asset.promotion_target" + | "asset.promotion_asset.redemption_end_date" + | "asset.promotion_asset.redemption_start_date" + | "asset.promotion_asset.start_date" | "asset.resource_name" + | "asset.sitelink_asset.ad_schedule_targets" + | "asset.sitelink_asset.description1" + | "asset.sitelink_asset.description2" + | "asset.sitelink_asset.end_date" + | "asset.sitelink_asset.link_text" + | "asset.sitelink_asset.start_date" + | "asset.structured_snippet_asset.header" + | "asset.structured_snippet_asset.values" | "asset.text_asset.text" + | "asset.tracking_url_template" | "asset.type" + | "asset.url_custom_parameters" | "asset.youtube_video_asset.youtube_video_id" | "asset.youtube_video_asset.youtube_video_title" | "customer.auto_tagging_enabled" @@ -5925,6 +6363,63 @@ export namespace fields { export type BiddingStrategySegments = Array; /* --- End of BiddingStrategy --- */ + /* --- Start of BiddingStrategySimulation --- */ + export type BiddingStrategySimulationField = + | "bidding_strategy.campaign_count" + | "bidding_strategy.effective_currency_code" + | "bidding_strategy.enhanced_cpc" + | "bidding_strategy.id" + | "bidding_strategy.maximize_conversion_value.target_roas" + | "bidding_strategy.maximize_conversions.target_cpa" + | "bidding_strategy.name" + | "bidding_strategy.non_removed_campaign_count" + | "bidding_strategy.resource_name" + | "bidding_strategy.status" + | "bidding_strategy.target_cpa.cpc_bid_ceiling_micros" + | "bidding_strategy.target_cpa.cpc_bid_floor_micros" + | "bidding_strategy.target_cpa.target_cpa_micros" + | "bidding_strategy.target_impression_share.cpc_bid_ceiling_micros" + | "bidding_strategy.target_impression_share.location" + | "bidding_strategy.target_impression_share.location_fraction_micros" + | "bidding_strategy.target_roas.cpc_bid_ceiling_micros" + | "bidding_strategy.target_roas.cpc_bid_floor_micros" + | "bidding_strategy.target_roas.target_roas" + | "bidding_strategy.target_spend.cpc_bid_ceiling_micros" + | "bidding_strategy.target_spend.target_spend_micros" + | "bidding_strategy.type" + | "bidding_strategy_simulation.bidding_strategy_id" + | "bidding_strategy_simulation.end_date" + | "bidding_strategy_simulation.modification_method" + | "bidding_strategy_simulation.resource_name" + | "bidding_strategy_simulation.start_date" + | "bidding_strategy_simulation.target_cpa_point_list.points" + | "bidding_strategy_simulation.target_roas_point_list.points" + | "bidding_strategy_simulation.type" + | "customer.auto_tagging_enabled" + | "customer.call_reporting_setting.call_conversion_action" + | "customer.call_reporting_setting.call_conversion_reporting_enabled" + | "customer.call_reporting_setting.call_reporting_enabled" + | "customer.conversion_tracking_setting.conversion_tracking_id" + | "customer.conversion_tracking_setting.cross_account_conversion_tracking_id" + | "customer.currency_code" + | "customer.descriptive_name" + | "customer.final_url_suffix" + | "customer.has_partners_badge" + | "customer.id" + | "customer.manager" + | "customer.optimization_score" + | "customer.optimization_score_weight" + | "customer.pay_per_conversion_eligibility_failure_reasons" + | "customer.remarketing_setting.google_global_site_tag" + | "customer.resource_name" + | "customer.test_account" + | "customer.time_zone" + | "customer.tracking_url_template"; + + export type BiddingStrategySimulationFields = + Array; + /* --- End of BiddingStrategySimulation --- */ + /* --- Start of BillingSetup --- */ export type BillingSetupField = | "billing_setup.end_date_time" @@ -5976,6 +6471,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -6016,6 +6512,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -6133,6 +6630,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -6295,6 +6793,7 @@ export namespace fields { | "metrics.search_rank_lost_impression_share" | "metrics.search_rank_lost_top_impression_share" | "metrics.search_top_impression_share" + | "metrics.sk_ad_network_conversions" | "metrics.top_impression_percentage" | "metrics.value_per_all_conversions" | "metrics.value_per_all_conversions_by_conversion_date" @@ -6330,6 +6829,7 @@ export namespace fields { | "segments.month" | "segments.month_of_year" | "segments.quarter" + | "segments.sk_ad_network_conversion_value" | "segments.slot" | "segments.week" | "segments.year"; @@ -6340,6 +6840,12 @@ export namespace fields { /* --- Start of CampaignAsset --- */ export type CampaignAssetField = | "asset.book_on_google_asset" + | "asset.callout_asset.ad_schedule_targets" + | "asset.callout_asset.callout_text" + | "asset.callout_asset.end_date" + | "asset.callout_asset.start_date" + | "asset.final_mobile_urls" + | "asset.final_url_suffix" | "asset.final_urls" | "asset.id" | "asset.image_asset.file_size" @@ -6365,9 +6871,34 @@ export namespace fields { | "asset.policy_summary.approval_status" | "asset.policy_summary.policy_topic_entries" | "asset.policy_summary.review_status" + | "asset.promotion_asset.ad_schedule_targets" + | "asset.promotion_asset.discount_modifier" + | "asset.promotion_asset.end_date" + | "asset.promotion_asset.language_code" + | "asset.promotion_asset.money_amount_off.amount_micros" + | "asset.promotion_asset.money_amount_off.currency_code" + | "asset.promotion_asset.occasion" + | "asset.promotion_asset.orders_over_amount.amount_micros" + | "asset.promotion_asset.orders_over_amount.currency_code" + | "asset.promotion_asset.percent_off" + | "asset.promotion_asset.promotion_code" + | "asset.promotion_asset.promotion_target" + | "asset.promotion_asset.redemption_end_date" + | "asset.promotion_asset.redemption_start_date" + | "asset.promotion_asset.start_date" | "asset.resource_name" + | "asset.sitelink_asset.ad_schedule_targets" + | "asset.sitelink_asset.description1" + | "asset.sitelink_asset.description2" + | "asset.sitelink_asset.end_date" + | "asset.sitelink_asset.link_text" + | "asset.sitelink_asset.start_date" + | "asset.structured_snippet_asset.header" + | "asset.structured_snippet_asset.values" | "asset.text_asset.text" + | "asset.tracking_url_template" | "asset.type" + | "asset.url_custom_parameters" | "asset.youtube_video_asset.youtube_video_id" | "asset.youtube_video_asset.youtube_video_title" | "campaign.ad_serving_optimization_status" @@ -6386,6 +6917,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -6508,6 +7040,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -6577,6 +7110,7 @@ export namespace fields { | "campaign_criterion.custom_affinity.custom_affinity" | "campaign_criterion.custom_audience.custom_audience" | "campaign_criterion.device.type" + | "campaign_criterion.display_name" | "campaign_criterion.gender.type" | "campaign_criterion.income_range.type" | "campaign_criterion.ip_block.ip_address" @@ -6613,7 +7147,9 @@ export namespace fields { | "campaign_criterion.user_interest.user_interest_category" | "campaign_criterion.user_list.user_list" | "campaign_criterion.webpage.conditions" + | "campaign_criterion.webpage.coverage_percentage" | "campaign_criterion.webpage.criterion_name" + | "campaign_criterion.webpage.sample.sample_urls" | "campaign_criterion.youtube_channel.channel_id" | "campaign_criterion.youtube_video.video_id" | "customer.auto_tagging_enabled" @@ -6732,11 +7268,13 @@ export namespace fields { export type CampaignAudienceViewSegment = | "bidding_strategy" + | "segments.ad_network_type" | "segments.click_type" | "segments.conversion_action" | "segments.conversion_action_category" | "segments.conversion_action_name" | "segments.date" + | "segments.day_of_week" | "segments.device" | "segments.external_conversion_source" | "segments.hotel_date_selection_type" @@ -6769,6 +7307,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -6873,6 +7412,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -7029,6 +7569,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -7097,6 +7638,7 @@ export namespace fields { | "campaign_criterion.custom_affinity.custom_affinity" | "campaign_criterion.custom_audience.custom_audience" | "campaign_criterion.device.type" + | "campaign_criterion.display_name" | "campaign_criterion.gender.type" | "campaign_criterion.income_range.type" | "campaign_criterion.ip_block.ip_address" @@ -7133,7 +7675,9 @@ export namespace fields { | "campaign_criterion.user_interest.user_interest_category" | "campaign_criterion.user_list.user_list" | "campaign_criterion.webpage.conditions" + | "campaign_criterion.webpage.coverage_percentage" | "campaign_criterion.webpage.criterion_name" + | "campaign_criterion.webpage.sample.sample_urls" | "campaign_criterion.youtube_channel.channel_id" | "campaign_criterion.youtube_video.video_id" | "carrier_constant.country_code" @@ -7262,6 +7806,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -7330,6 +7875,7 @@ export namespace fields { | "campaign_criterion.custom_affinity.custom_affinity" | "campaign_criterion.custom_audience.custom_audience" | "campaign_criterion.device.type" + | "campaign_criterion.display_name" | "campaign_criterion.gender.type" | "campaign_criterion.income_range.type" | "campaign_criterion.ip_block.ip_address" @@ -7366,7 +7912,9 @@ export namespace fields { | "campaign_criterion.user_interest.user_interest_category" | "campaign_criterion.user_list.user_list" | "campaign_criterion.webpage.conditions" + | "campaign_criterion.webpage.coverage_percentage" | "campaign_criterion.webpage.criterion_name" + | "campaign_criterion.webpage.sample.sample_urls" | "campaign_criterion.youtube_channel.channel_id" | "campaign_criterion.youtube_video.video_id" | "campaign_criterion_simulation.bid_modifier_point_list.points" @@ -7398,7 +7946,8 @@ export namespace fields { | "customer.time_zone" | "customer.tracking_url_template"; - export type CampaignCriterionSimulationFields = Array; + export type CampaignCriterionSimulationFields = + Array; /* --- End of CampaignCriterionSimulation --- */ /* --- Start of CampaignDraft --- */ @@ -7419,6 +7968,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -7522,6 +8072,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -7637,6 +8188,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -7716,7 +8268,8 @@ export namespace fields { | "customer.time_zone" | "customer.tracking_url_template"; - export type CampaignExtensionSettingFields = Array; + export type CampaignExtensionSettingFields = + Array; /* --- End of CampaignExtensionSetting --- */ /* --- Start of CampaignFeed --- */ @@ -7737,6 +8290,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -7853,6 +8407,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -7957,6 +8512,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -8045,44 +8601,8 @@ export namespace fields { export type CampaignSharedSetFields = Array; /* --- End of CampaignSharedSet --- */ - /* --- Start of CarrierConstant --- */ - export type CarrierConstantField = - | "carrier_constant.country_code" - | "carrier_constant.id" - | "carrier_constant.name" - | "carrier_constant.resource_name"; - - export type CarrierConstantFields = Array; - /* --- End of CarrierConstant --- */ - - /* --- Start of ChangeEvent --- */ - export type ChangeEventField = - | "ad_group.ad_rotation_mode" - | "ad_group.base_ad_group" - | "ad_group.campaign" - | "ad_group.cpc_bid_micros" - | "ad_group.cpm_bid_micros" - | "ad_group.cpv_bid_micros" - | "ad_group.display_custom_bid_dimension" - | "ad_group.effective_target_cpa_micros" - | "ad_group.effective_target_cpa_source" - | "ad_group.effective_target_roas" - | "ad_group.effective_target_roas_source" - | "ad_group.explorer_auto_optimizer_setting.opt_in" - | "ad_group.final_url_suffix" - | "ad_group.id" - | "ad_group.labels" - | "ad_group.name" - | "ad_group.percent_cpc_bid_micros" - | "ad_group.resource_name" - | "ad_group.status" - | "ad_group.target_cpa_micros" - | "ad_group.target_cpm_micros" - | "ad_group.target_roas" - | "ad_group.targeting_setting.target_restrictions" - | "ad_group.tracking_url_template" - | "ad_group.type" - | "ad_group.url_custom_parameters" + /* --- Start of CampaignSimulation --- */ + export type CampaignSimulationField = | "campaign.ad_serving_optimization_status" | "campaign.advertising_channel_sub_type" | "campaign.advertising_channel_type" @@ -8099,6 +8619,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -8152,20 +8673,17 @@ export namespace fields { | "campaign.vanity_pharma.vanity_pharma_display_url_mode" | "campaign.vanity_pharma.vanity_pharma_text" | "campaign.video_brand_safety_suitability" - | "change_event.ad_group" - | "change_event.campaign" - | "change_event.change_date_time" - | "change_event.change_resource_name" - | "change_event.change_resource_type" - | "change_event.changed_fields" - | "change_event.client_type" - | "change_event.feed" - | "change_event.feed_item" - | "change_event.new_resource" - | "change_event.old_resource" - | "change_event.resource_change_operation" - | "change_event.resource_name" - | "change_event.user_email" + | "campaign_simulation.budget_point_list.points" + | "campaign_simulation.campaign_id" + | "campaign_simulation.cpc_bid_point_list.points" + | "campaign_simulation.end_date" + | "campaign_simulation.modification_method" + | "campaign_simulation.resource_name" + | "campaign_simulation.start_date" + | "campaign_simulation.target_cpa_point_list.points" + | "campaign_simulation.target_impression_share_point_list.points" + | "campaign_simulation.target_roas_point_list.points" + | "campaign_simulation.type" | "customer.auto_tagging_enabled" | "customer.call_reporting_setting.call_conversion_action" | "customer.call_reporting_setting.call_conversion_reporting_enabled" @@ -8185,13 +8703,160 @@ export namespace fields { | "customer.resource_name" | "customer.test_account" | "customer.time_zone" - | "customer.tracking_url_template" - | "feed.affiliate_location_feed_data.chain_ids" - | "feed.affiliate_location_feed_data.relationship_type" - | "feed.attributes" - | "feed.id" - | "feed.name" - | "feed.origin" + | "customer.tracking_url_template"; + + export type CampaignSimulationFields = Array; + /* --- End of CampaignSimulation --- */ + + /* --- Start of CarrierConstant --- */ + export type CarrierConstantField = + | "carrier_constant.country_code" + | "carrier_constant.id" + | "carrier_constant.name" + | "carrier_constant.resource_name"; + + export type CarrierConstantFields = Array; + /* --- End of CarrierConstant --- */ + + /* --- Start of ChangeEvent --- */ + export type ChangeEventField = + | "ad_group.ad_rotation_mode" + | "ad_group.base_ad_group" + | "ad_group.campaign" + | "ad_group.cpc_bid_micros" + | "ad_group.cpm_bid_micros" + | "ad_group.cpv_bid_micros" + | "ad_group.display_custom_bid_dimension" + | "ad_group.effective_target_cpa_micros" + | "ad_group.effective_target_cpa_source" + | "ad_group.effective_target_roas" + | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" + | "ad_group.explorer_auto_optimizer_setting.opt_in" + | "ad_group.final_url_suffix" + | "ad_group.id" + | "ad_group.labels" + | "ad_group.name" + | "ad_group.percent_cpc_bid_micros" + | "ad_group.resource_name" + | "ad_group.status" + | "ad_group.target_cpa_micros" + | "ad_group.target_cpm_micros" + | "ad_group.target_roas" + | "ad_group.targeting_setting.target_restrictions" + | "ad_group.tracking_url_template" + | "ad_group.type" + | "ad_group.url_custom_parameters" + | "campaign.ad_serving_optimization_status" + | "campaign.advertising_channel_sub_type" + | "campaign.advertising_channel_type" + | "campaign.app_campaign_setting.app_id" + | "campaign.app_campaign_setting.app_store" + | "campaign.app_campaign_setting.bidding_strategy_goal_type" + | "campaign.base_campaign" + | "campaign.bidding_strategy" + | "campaign.bidding_strategy_type" + | "campaign.campaign_budget" + | "campaign.commission.commission_rate_micros" + | "campaign.dynamic_search_ads_setting.domain_name" + | "campaign.dynamic_search_ads_setting.feeds" + | "campaign.dynamic_search_ads_setting.language_code" + | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" + | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" + | "campaign.experiment_type" + | "campaign.final_url_suffix" + | "campaign.frequency_caps" + | "campaign.geo_target_type_setting.negative_geo_target_type" + | "campaign.geo_target_type_setting.positive_geo_target_type" + | "campaign.hotel_setting.hotel_center_id" + | "campaign.id" + | "campaign.labels" + | "campaign.local_campaign_setting.location_source_type" + | "campaign.manual_cpc.enhanced_cpc_enabled" + | "campaign.manual_cpm" + | "campaign.manual_cpv" + | "campaign.maximize_conversion_value.target_roas" + | "campaign.maximize_conversions.target_cpa" + | "campaign.name" + | "campaign.network_settings.target_content_network" + | "campaign.network_settings.target_google_search" + | "campaign.network_settings.target_partner_search_network" + | "campaign.network_settings.target_search_network" + | "campaign.optimization_goal_setting.optimization_goal_types" + | "campaign.optimization_score" + | "campaign.payment_mode" + | "campaign.percent_cpc.cpc_bid_ceiling_micros" + | "campaign.percent_cpc.enhanced_cpc_enabled" + | "campaign.real_time_bidding_setting.opt_in" + | "campaign.resource_name" + | "campaign.selective_optimization.conversion_actions" + | "campaign.serving_status" + | "campaign.shopping_setting.campaign_priority" + | "campaign.shopping_setting.enable_local" + | "campaign.shopping_setting.merchant_id" + | "campaign.shopping_setting.sales_country" + | "campaign.start_date" + | "campaign.status" + | "campaign.target_cpa.cpc_bid_ceiling_micros" + | "campaign.target_cpa.cpc_bid_floor_micros" + | "campaign.target_cpa.target_cpa_micros" + | "campaign.target_cpm" + | "campaign.target_impression_share.cpc_bid_ceiling_micros" + | "campaign.target_impression_share.location" + | "campaign.target_impression_share.location_fraction_micros" + | "campaign.target_roas.cpc_bid_ceiling_micros" + | "campaign.target_roas.cpc_bid_floor_micros" + | "campaign.target_roas.target_roas" + | "campaign.target_spend.cpc_bid_ceiling_micros" + | "campaign.target_spend.target_spend_micros" + | "campaign.targeting_setting.target_restrictions" + | "campaign.tracking_setting.tracking_url" + | "campaign.tracking_url_template" + | "campaign.url_custom_parameters" + | "campaign.vanity_pharma.vanity_pharma_display_url_mode" + | "campaign.vanity_pharma.vanity_pharma_text" + | "campaign.video_brand_safety_suitability" + | "change_event.ad_group" + | "change_event.campaign" + | "change_event.change_date_time" + | "change_event.change_resource_name" + | "change_event.change_resource_type" + | "change_event.changed_fields" + | "change_event.client_type" + | "change_event.feed" + | "change_event.feed_item" + | "change_event.new_resource" + | "change_event.old_resource" + | "change_event.resource_change_operation" + | "change_event.resource_name" + | "change_event.user_email" + | "customer.auto_tagging_enabled" + | "customer.call_reporting_setting.call_conversion_action" + | "customer.call_reporting_setting.call_conversion_reporting_enabled" + | "customer.call_reporting_setting.call_reporting_enabled" + | "customer.conversion_tracking_setting.conversion_tracking_id" + | "customer.conversion_tracking_setting.cross_account_conversion_tracking_id" + | "customer.currency_code" + | "customer.descriptive_name" + | "customer.final_url_suffix" + | "customer.has_partners_badge" + | "customer.id" + | "customer.manager" + | "customer.optimization_score" + | "customer.optimization_score_weight" + | "customer.pay_per_conversion_eligibility_failure_reasons" + | "customer.remarketing_setting.google_global_site_tag" + | "customer.resource_name" + | "customer.test_account" + | "customer.time_zone" + | "customer.tracking_url_template" + | "feed.affiliate_location_feed_data.chain_ids" + | "feed.affiliate_location_feed_data.relationship_type" + | "feed.attributes" + | "feed.id" + | "feed.name" + | "feed.origin" | "feed.places_location_feed_data.business_name_filter" | "feed.places_location_feed_data.category_filters" | "feed.places_location_feed_data.email_address" @@ -8225,6 +8890,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -8256,6 +8922,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -8382,6 +9049,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -8413,6 +9081,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -8474,6 +9143,9 @@ export namespace fields { | "click_view.area_of_interest.region" | "click_view.campaign_location_target" | "click_view.gclid" + | "click_view.keyword" + | "click_view.keyword_info.match_type" + | "click_view.keyword_info.text" | "click_view.location_of_presence.city" | "click_view.location_of_presence.country" | "click_view.location_of_presence.metro" @@ -8609,6 +9281,39 @@ export namespace fields { export type ConversionActionMetrics = Array; /* --- End of ConversionAction --- */ + /* --- Start of ConversionCustomVariable --- */ + export type ConversionCustomVariableField = + | "conversion_custom_variable.id" + | "conversion_custom_variable.name" + | "conversion_custom_variable.owner_customer" + | "conversion_custom_variable.resource_name" + | "conversion_custom_variable.status" + | "conversion_custom_variable.tag" + | "customer.auto_tagging_enabled" + | "customer.call_reporting_setting.call_conversion_action" + | "customer.call_reporting_setting.call_conversion_reporting_enabled" + | "customer.call_reporting_setting.call_reporting_enabled" + | "customer.conversion_tracking_setting.conversion_tracking_id" + | "customer.conversion_tracking_setting.cross_account_conversion_tracking_id" + | "customer.currency_code" + | "customer.descriptive_name" + | "customer.final_url_suffix" + | "customer.has_partners_badge" + | "customer.id" + | "customer.manager" + | "customer.optimization_score" + | "customer.optimization_score_weight" + | "customer.pay_per_conversion_eligibility_failure_reasons" + | "customer.remarketing_setting.google_global_site_tag" + | "customer.resource_name" + | "customer.test_account" + | "customer.time_zone" + | "customer.tracking_url_template"; + + export type ConversionCustomVariableFields = + Array; + /* --- End of ConversionCustomVariable --- */ + /* --- Start of CurrencyConstant --- */ export type CurrencyConstantField = | "currency_constant.billable_unit_micros" @@ -8755,6 +9460,7 @@ export namespace fields { | "metrics.search_exact_match_impression_share" | "metrics.search_impression_share" | "metrics.search_rank_lost_impression_share" + | "metrics.sk_ad_network_conversions" | "metrics.value_per_all_conversions" | "metrics.value_per_all_conversions_by_conversion_date" | "metrics.value_per_conversion" @@ -8782,6 +9488,7 @@ export namespace fields { | "segments.month" | "segments.month_of_year" | "segments.quarter" + | "segments.sk_ad_network_conversion_value" | "segments.slot" | "segments.week" | "segments.year"; @@ -8789,6 +9496,98 @@ export namespace fields { export type CustomerSegments = Array; /* --- End of Customer --- */ + /* --- Start of CustomerAsset --- */ + export type CustomerAssetField = + | "asset.book_on_google_asset" + | "asset.callout_asset.ad_schedule_targets" + | "asset.callout_asset.callout_text" + | "asset.callout_asset.end_date" + | "asset.callout_asset.start_date" + | "asset.final_mobile_urls" + | "asset.final_url_suffix" + | "asset.final_urls" + | "asset.id" + | "asset.image_asset.file_size" + | "asset.image_asset.full_size.height_pixels" + | "asset.image_asset.full_size.url" + | "asset.image_asset.full_size.width_pixels" + | "asset.image_asset.mime_type" + | "asset.lead_form_asset.background_image_asset" + | "asset.lead_form_asset.business_name" + | "asset.lead_form_asset.call_to_action_description" + | "asset.lead_form_asset.call_to_action_type" + | "asset.lead_form_asset.custom_disclosure" + | "asset.lead_form_asset.delivery_methods" + | "asset.lead_form_asset.description" + | "asset.lead_form_asset.desired_intent" + | "asset.lead_form_asset.fields" + | "asset.lead_form_asset.headline" + | "asset.lead_form_asset.post_submit_call_to_action_type" + | "asset.lead_form_asset.post_submit_description" + | "asset.lead_form_asset.post_submit_headline" + | "asset.lead_form_asset.privacy_policy_url" + | "asset.name" + | "asset.policy_summary.approval_status" + | "asset.policy_summary.policy_topic_entries" + | "asset.policy_summary.review_status" + | "asset.promotion_asset.ad_schedule_targets" + | "asset.promotion_asset.discount_modifier" + | "asset.promotion_asset.end_date" + | "asset.promotion_asset.language_code" + | "asset.promotion_asset.money_amount_off.amount_micros" + | "asset.promotion_asset.money_amount_off.currency_code" + | "asset.promotion_asset.occasion" + | "asset.promotion_asset.orders_over_amount.amount_micros" + | "asset.promotion_asset.orders_over_amount.currency_code" + | "asset.promotion_asset.percent_off" + | "asset.promotion_asset.promotion_code" + | "asset.promotion_asset.promotion_target" + | "asset.promotion_asset.redemption_end_date" + | "asset.promotion_asset.redemption_start_date" + | "asset.promotion_asset.start_date" + | "asset.resource_name" + | "asset.sitelink_asset.ad_schedule_targets" + | "asset.sitelink_asset.description1" + | "asset.sitelink_asset.description2" + | "asset.sitelink_asset.end_date" + | "asset.sitelink_asset.link_text" + | "asset.sitelink_asset.start_date" + | "asset.structured_snippet_asset.header" + | "asset.structured_snippet_asset.values" + | "asset.text_asset.text" + | "asset.tracking_url_template" + | "asset.type" + | "asset.url_custom_parameters" + | "asset.youtube_video_asset.youtube_video_id" + | "asset.youtube_video_asset.youtube_video_title" + | "customer.auto_tagging_enabled" + | "customer.call_reporting_setting.call_conversion_action" + | "customer.call_reporting_setting.call_conversion_reporting_enabled" + | "customer.call_reporting_setting.call_reporting_enabled" + | "customer.conversion_tracking_setting.conversion_tracking_id" + | "customer.conversion_tracking_setting.cross_account_conversion_tracking_id" + | "customer.currency_code" + | "customer.descriptive_name" + | "customer.final_url_suffix" + | "customer.has_partners_badge" + | "customer.id" + | "customer.manager" + | "customer.optimization_score" + | "customer.optimization_score_weight" + | "customer.pay_per_conversion_eligibility_failure_reasons" + | "customer.remarketing_setting.google_global_site_tag" + | "customer.resource_name" + | "customer.test_account" + | "customer.time_zone" + | "customer.tracking_url_template" + | "customer_asset.asset" + | "customer_asset.field_type" + | "customer_asset.resource_name" + | "customer_asset.status"; + + export type CustomerAssetFields = Array; + /* --- End of CustomerAsset --- */ + /* --- Start of CustomerClient --- */ export type CustomerClientField = | "customer.auto_tagging_enabled" @@ -8883,7 +9682,8 @@ export namespace fields { | "customer_extension_setting.extension_type" | "customer_extension_setting.resource_name"; - export type CustomerExtensionSettingFields = Array; + export type CustomerExtensionSettingFields = + Array; /* --- End of CustomerExtensionSetting --- */ /* --- Start of CustomerFeed --- */ @@ -9027,7 +9827,8 @@ export namespace fields { | "mobile_app_category_constant.name" | "mobile_app_category_constant.resource_name"; - export type CustomerNegativeCriterionFields = Array; + export type CustomerNegativeCriterionFields = + Array; /* --- End of CustomerNegativeCriterion --- */ /* --- Start of CustomerUserAccess --- */ @@ -9091,7 +9892,8 @@ export namespace fields { | "customer_user_access_invitation.invitation_status" | "customer_user_access_invitation.resource_name"; - export type CustomerUserAccessInvitationFields = Array; + export type CustomerUserAccessInvitationFields = + Array; /* --- End of CustomerUserAccessInvitation --- */ /* --- Start of DetailPlacementView --- */ @@ -9107,6 +9909,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -9138,6 +9941,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -9293,6 +10097,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -9322,6 +10127,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -9337,6 +10143,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -9383,7 +10190,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "bidding_strategy.campaign_count" @@ -9424,6 +10233,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -9587,6 +10397,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -9725,6 +10536,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -9824,6 +10636,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -9855,6 +10668,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -9937,7 +10751,8 @@ export namespace fields { | "dynamic_search_ads_search_term_view.resource_name" | "dynamic_search_ads_search_term_view.search_term"; - export type DynamicSearchAdsSearchTermViewFields = Array; + export type DynamicSearchAdsSearchTermViewFields = + Array; export type DynamicSearchAdsSearchTermViewMetric = | "metrics.all_conversions" @@ -9958,7 +10773,8 @@ export namespace fields { | "metrics.value_per_all_conversions" | "metrics.value_per_conversion"; - export type DynamicSearchAdsSearchTermViewMetrics = Array; + export type DynamicSearchAdsSearchTermViewMetrics = + Array; export type DynamicSearchAdsSearchTermViewSegment = | "segments.conversion_action" @@ -9974,7 +10790,8 @@ export namespace fields { | "segments.week" | "segments.year"; - export type DynamicSearchAdsSearchTermViewSegments = Array; + export type DynamicSearchAdsSearchTermViewSegments = + Array; /* --- End of DynamicSearchAdsSearchTermView --- */ /* --- Start of ExpandedLandingPageView --- */ @@ -9990,6 +10807,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -10021,6 +10839,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -10099,7 +10918,8 @@ export namespace fields { | "landing_page_view.resource_name" | "landing_page_view.unexpanded_final_url"; - export type ExpandedLandingPageViewFields = Array; + export type ExpandedLandingPageViewFields = + Array; export type ExpandedLandingPageViewMetric = | "metrics.active_view_cpm" @@ -10144,7 +10964,8 @@ export namespace fields { | "metrics.video_view_rate" | "metrics.video_views"; - export type ExpandedLandingPageViewMetrics = Array; + export type ExpandedLandingPageViewMetrics = + Array; export type ExpandedLandingPageViewSegment = | "ad_group" @@ -10166,7 +10987,8 @@ export namespace fields { | "segments.week" | "segments.year"; - export type ExpandedLandingPageViewSegments = Array; + export type ExpandedLandingPageViewSegments = + Array; /* --- End of ExpandedLandingPageView --- */ /* --- Start of ExtensionFeedItem --- */ @@ -10182,6 +11004,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -10213,6 +11036,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -10486,6 +11310,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -10642,6 +11467,7 @@ export namespace fields { | "ad_group_ad.ad.video_responsive_ad.videos" | "ad_group_ad.ad_group" | "ad_group_ad.ad_strength" + | "ad_group_ad.labels" | "ad_group_ad.policy_summary.approval_status" | "ad_group_ad.policy_summary.policy_topic_entries" | "ad_group_ad.policy_summary.review_status" @@ -10663,6 +11489,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -10939,6 +11766,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -10970,6 +11798,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -11139,6 +11968,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -11295,6 +12125,7 @@ export namespace fields { | "ad_group_ad.ad.video_responsive_ad.videos" | "ad_group_ad.ad_group" | "ad_group_ad.ad_strength" + | "ad_group_ad.labels" | "ad_group_ad.policy_summary.approval_status" | "ad_group_ad.policy_summary.policy_topic_entries" | "ad_group_ad.policy_summary.review_status" @@ -11316,6 +12147,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -11462,6 +12294,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -11491,6 +12324,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -11506,6 +12340,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -11552,7 +12387,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "bidding_strategy.campaign_count" @@ -11593,6 +12430,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -11765,6 +12603,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -11796,6 +12635,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -11948,6 +12788,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -11979,6 +12820,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -12132,6 +12974,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -12161,6 +13004,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -12176,6 +13020,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -12222,7 +13067,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "campaign.ad_serving_optimization_status" @@ -12241,6 +13088,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -12380,6 +13228,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -12411,6 +13260,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -12551,6 +13401,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -12580,6 +13431,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -12595,6 +13447,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -12641,7 +13494,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "campaign.ad_serving_optimization_status" @@ -12660,6 +13515,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -12924,7 +13780,8 @@ export namespace fields { | "keyword_plan_campaign.name" | "keyword_plan_campaign.resource_name"; - export type KeywordPlanAdGroupKeywordFields = Array; + export type KeywordPlanAdGroupKeywordFields = + Array; /* --- End of KeywordPlanAdGroupKeyword --- */ /* --- Start of KeywordPlanCampaign --- */ @@ -13006,7 +13863,8 @@ export namespace fields { | "keyword_plan_campaign_keyword.resource_name" | "keyword_plan_campaign_keyword.text"; - export type KeywordPlanCampaignKeywordFields = Array; + export type KeywordPlanCampaignKeywordFields = + Array; /* --- End of KeywordPlanCampaignKeyword --- */ /* --- Start of KeywordView --- */ @@ -13022,6 +13880,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -13051,6 +13910,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -13066,6 +13926,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -13112,7 +13973,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "bidding_strategy.campaign_count" @@ -13153,6 +14016,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -13377,6 +14241,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -13408,6 +14273,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -13567,6 +14433,18 @@ export namespace fields { export type LanguageConstantFields = Array; /* --- End of LanguageConstant --- */ + /* --- Start of LifeEvent --- */ + export type LifeEventField = + | "life_event.availabilities" + | "life_event.id" + | "life_event.launched_to_all" + | "life_event.name" + | "life_event.parent" + | "life_event.resource_name"; + + export type LifeEventFields = Array; + /* --- End of LifeEvent --- */ + /* --- Start of LocationView --- */ export type LocationViewField = | "campaign.ad_serving_optimization_status" @@ -13585,6 +14463,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -13653,6 +14532,7 @@ export namespace fields { | "campaign_criterion.custom_affinity.custom_affinity" | "campaign_criterion.custom_audience.custom_audience" | "campaign_criterion.device.type" + | "campaign_criterion.display_name" | "campaign_criterion.gender.type" | "campaign_criterion.income_range.type" | "campaign_criterion.ip_block.ip_address" @@ -13689,7 +14569,9 @@ export namespace fields { | "campaign_criterion.user_interest.user_interest_category" | "campaign_criterion.user_list.user_list" | "campaign_criterion.webpage.conditions" + | "campaign_criterion.webpage.coverage_percentage" | "campaign_criterion.webpage.criterion_name" + | "campaign_criterion.webpage.sample.sample_urls" | "campaign_criterion.youtube_channel.channel_id" | "campaign_criterion.youtube_video.video_id" | "customer.auto_tagging_enabled" @@ -13776,6 +14658,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -13805,6 +14688,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -13820,6 +14704,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -13866,7 +14751,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "bidding_strategy.campaign_count" @@ -13907,6 +14794,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -14099,7 +14987,8 @@ export namespace fields { | "mobile_app_category_constant.name" | "mobile_app_category_constant.resource_name"; - export type MobileAppCategoryConstantFields = Array; + export type MobileAppCategoryConstantFields = + Array; /* --- End of MobileAppCategoryConstant --- */ /* --- Start of MobileDeviceConstant --- */ @@ -14201,7 +15090,8 @@ export namespace fields { | "operating_system_version_constant.os_minor_version" | "operating_system_version_constant.resource_name"; - export type OperatingSystemVersionConstantFields = Array; + export type OperatingSystemVersionConstantFields = + Array; /* --- End of OperatingSystemVersionConstant --- */ /* --- Start of PaidOrganicSearchTermView --- */ @@ -14217,6 +15107,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -14248,6 +15139,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -14324,7 +15216,8 @@ export namespace fields { | "paid_organic_search_term_view.resource_name" | "paid_organic_search_term_view.search_term"; - export type PaidOrganicSearchTermViewFields = Array; + export type PaidOrganicSearchTermViewFields = + Array; export type PaidOrganicSearchTermViewMetric = | "metrics.average_cpc" @@ -14340,7 +15233,8 @@ export namespace fields { | "metrics.organic_impressions_per_query" | "metrics.organic_queries"; - export type PaidOrganicSearchTermViewMetrics = Array; + export type PaidOrganicSearchTermViewMetrics = + Array; export type PaidOrganicSearchTermViewSegment = | "segments.date" @@ -14356,7 +15250,8 @@ export namespace fields { | "segments.week" | "segments.year"; - export type PaidOrganicSearchTermViewSegments = Array; + export type PaidOrganicSearchTermViewSegments = + Array; /* --- End of PaidOrganicSearchTermView --- */ /* --- Start of ParentalStatusView --- */ @@ -14372,6 +15267,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -14401,6 +15297,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -14416,6 +15313,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -14462,7 +15360,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "bidding_strategy.campaign_count" @@ -14503,6 +15403,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -14658,7 +15559,8 @@ export namespace fields { | "product_bidding_category_constant.resource_name" | "product_bidding_category_constant.status"; - export type ProductBiddingCategoryConstantFields = Array; + export type ProductBiddingCategoryConstantFields = + Array; /* --- End of ProductBiddingCategoryConstant --- */ /* --- Start of ProductGroupView --- */ @@ -14674,6 +15576,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -14703,6 +15606,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -14718,6 +15622,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -14764,7 +15669,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "campaign.ad_serving_optimization_status" @@ -14783,6 +15690,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -14919,6 +15827,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -14950,6 +15859,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -15052,6 +15962,7 @@ export namespace fields { | "recommendation.impact" | "recommendation.keyword_match_type_recommendation" | "recommendation.keyword_recommendation" + | "recommendation.marginal_roi_campaign_budget_recommendation" | "recommendation.maximize_clicks_opt_in_recommendation" | "recommendation.maximize_conversions_opt_in_recommendation" | "recommendation.move_unused_budget_recommendation" @@ -15111,6 +16022,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -15267,6 +16179,7 @@ export namespace fields { | "ad_group_ad.ad.video_responsive_ad.videos" | "ad_group_ad.ad_group" | "ad_group_ad.ad_strength" + | "ad_group_ad.labels" | "ad_group_ad.policy_summary.approval_status" | "ad_group_ad.policy_summary.policy_topic_entries" | "ad_group_ad.policy_summary.review_status" @@ -15288,6 +16201,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -15499,6 +16413,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -15604,6 +16519,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -15635,6 +16551,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -15710,7 +16627,8 @@ export namespace fields { | "customer.tracking_url_template" | "shopping_performance_view.resource_name"; - export type ShoppingPerformanceViewFields = Array; + export type ShoppingPerformanceViewFields = + Array; export type ShoppingPerformanceViewMetric = | "metrics.all_conversions" @@ -15733,7 +16651,8 @@ export namespace fields { | "metrics.value_per_all_conversions" | "metrics.value_per_conversion"; - export type ShoppingPerformanceViewMetrics = Array; + export type ShoppingPerformanceViewMetrics = + Array; export type ShoppingPerformanceViewSegment = | "ad_group" @@ -15778,7 +16697,8 @@ export namespace fields { | "segments.week" | "segments.year"; - export type ShoppingPerformanceViewSegments = Array; + export type ShoppingPerformanceViewSegments = + Array; /* --- End of ShoppingPerformanceView --- */ /* --- Start of ThirdPartyAppAnalyticsLink --- */ @@ -15815,7 +16735,8 @@ export namespace fields { | "third_party_app_analytics_link.resource_name" | "third_party_app_analytics_link.shareable_link_id"; - export type ThirdPartyAppAnalyticsLinkFields = Array; + export type ThirdPartyAppAnalyticsLinkFields = + Array; /* --- End of ThirdPartyAppAnalyticsLink --- */ /* --- Start of TopicConstant --- */ @@ -15841,6 +16762,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -15870,6 +16792,7 @@ export namespace fields { | "ad_group_criterion.custom_audience.custom_audience" | "ad_group_criterion.custom_intent.custom_intent" | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" | "ad_group_criterion.effective_cpc_bid_micros" | "ad_group_criterion.effective_cpc_bid_source" | "ad_group_criterion.effective_cpm_bid_micros" @@ -15885,6 +16808,7 @@ export namespace fields { | "ad_group_criterion.income_range.type" | "ad_group_criterion.keyword.match_type" | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" | "ad_group_criterion.listing_group.case_value.hotel_class.value" | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" @@ -15931,7 +16855,9 @@ export namespace fields { | "ad_group_criterion.user_interest.user_interest_category" | "ad_group_criterion.user_list.user_list" | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" | "ad_group_criterion.youtube_channel.channel_id" | "ad_group_criterion.youtube_video.video_id" | "bidding_strategy.campaign_count" @@ -15972,6 +16898,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -16206,6 +17133,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -16237,6 +17165,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -16389,6 +17318,7 @@ export namespace fields { | "ad_group.effective_target_cpa_source" | "ad_group.effective_target_roas" | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" | "ad_group.explorer_auto_optimizer_setting.opt_in" | "ad_group.final_url_suffix" | "ad_group.id" @@ -16545,6 +17475,7 @@ export namespace fields { | "ad_group_ad.ad.video_responsive_ad.videos" | "ad_group_ad.ad_group" | "ad_group_ad.ad_strength" + | "ad_group_ad.labels" | "ad_group_ad.policy_summary.approval_status" | "ad_group_ad.policy_summary.policy_topic_entries" | "ad_group_ad.policy_summary.review_status" @@ -16566,6 +17497,7 @@ export namespace fields { | "campaign.dynamic_search_ads_setting.language_code" | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" | "campaign.experiment_type" | "campaign.final_url_suffix" | "campaign.frequency_caps" @@ -16702,4 +17634,274 @@ export namespace fields { export type VideoSegments = Array; /* --- End of Video --- */ + + /* --- Start of WebpageView --- */ + export type WebpageViewField = + | "ad_group.ad_rotation_mode" + | "ad_group.base_ad_group" + | "ad_group.campaign" + | "ad_group.cpc_bid_micros" + | "ad_group.cpm_bid_micros" + | "ad_group.cpv_bid_micros" + | "ad_group.display_custom_bid_dimension" + | "ad_group.effective_target_cpa_micros" + | "ad_group.effective_target_cpa_source" + | "ad_group.effective_target_roas" + | "ad_group.effective_target_roas_source" + | "ad_group.excluded_parent_asset_field_types" + | "ad_group.explorer_auto_optimizer_setting.opt_in" + | "ad_group.final_url_suffix" + | "ad_group.id" + | "ad_group.labels" + | "ad_group.name" + | "ad_group.percent_cpc_bid_micros" + | "ad_group.resource_name" + | "ad_group.status" + | "ad_group.target_cpa_micros" + | "ad_group.target_cpm_micros" + | "ad_group.target_roas" + | "ad_group.targeting_setting.target_restrictions" + | "ad_group.tracking_url_template" + | "ad_group.type" + | "ad_group.url_custom_parameters" + | "ad_group_criterion.ad_group" + | "ad_group_criterion.age_range.type" + | "ad_group_criterion.app_payment_model.type" + | "ad_group_criterion.approval_status" + | "ad_group_criterion.bid_modifier" + | "ad_group_criterion.combined_audience.combined_audience" + | "ad_group_criterion.cpc_bid_micros" + | "ad_group_criterion.cpm_bid_micros" + | "ad_group_criterion.cpv_bid_micros" + | "ad_group_criterion.criterion_id" + | "ad_group_criterion.custom_affinity.custom_affinity" + | "ad_group_criterion.custom_audience.custom_audience" + | "ad_group_criterion.custom_intent.custom_intent" + | "ad_group_criterion.disapproval_reasons" + | "ad_group_criterion.display_name" + | "ad_group_criterion.effective_cpc_bid_micros" + | "ad_group_criterion.effective_cpc_bid_source" + | "ad_group_criterion.effective_cpm_bid_micros" + | "ad_group_criterion.effective_cpm_bid_source" + | "ad_group_criterion.effective_cpv_bid_micros" + | "ad_group_criterion.effective_cpv_bid_source" + | "ad_group_criterion.effective_percent_cpc_bid_micros" + | "ad_group_criterion.effective_percent_cpc_bid_source" + | "ad_group_criterion.final_mobile_urls" + | "ad_group_criterion.final_url_suffix" + | "ad_group_criterion.final_urls" + | "ad_group_criterion.gender.type" + | "ad_group_criterion.income_range.type" + | "ad_group_criterion.keyword.match_type" + | "ad_group_criterion.keyword.text" + | "ad_group_criterion.labels" + | "ad_group_criterion.listing_group.case_value.hotel_city.city_criterion" + | "ad_group_criterion.listing_group.case_value.hotel_class.value" + | "ad_group_criterion.listing_group.case_value.hotel_country_region.country_region_criterion" + | "ad_group_criterion.listing_group.case_value.hotel_id.value" + | "ad_group_criterion.listing_group.case_value.hotel_state.state_criterion" + | "ad_group_criterion.listing_group.case_value.product_bidding_category.country_code" + | "ad_group_criterion.listing_group.case_value.product_bidding_category.id" + | "ad_group_criterion.listing_group.case_value.product_bidding_category.level" + | "ad_group_criterion.listing_group.case_value.product_brand.value" + | "ad_group_criterion.listing_group.case_value.product_channel.channel" + | "ad_group_criterion.listing_group.case_value.product_channel_exclusivity.channel_exclusivity" + | "ad_group_criterion.listing_group.case_value.product_condition.condition" + | "ad_group_criterion.listing_group.case_value.product_custom_attribute.index" + | "ad_group_criterion.listing_group.case_value.product_custom_attribute.value" + | "ad_group_criterion.listing_group.case_value.product_item_id.value" + | "ad_group_criterion.listing_group.case_value.product_type.level" + | "ad_group_criterion.listing_group.case_value.product_type.value" + | "ad_group_criterion.listing_group.parent_ad_group_criterion" + | "ad_group_criterion.listing_group.type" + | "ad_group_criterion.mobile_app_category.mobile_app_category_constant" + | "ad_group_criterion.mobile_application.app_id" + | "ad_group_criterion.mobile_application.name" + | "ad_group_criterion.negative" + | "ad_group_criterion.parental_status.type" + | "ad_group_criterion.percent_cpc_bid_micros" + | "ad_group_criterion.placement.url" + | "ad_group_criterion.position_estimates.estimated_add_clicks_at_first_position_cpc" + | "ad_group_criterion.position_estimates.estimated_add_cost_at_first_position_cpc" + | "ad_group_criterion.position_estimates.first_page_cpc_micros" + | "ad_group_criterion.position_estimates.first_position_cpc_micros" + | "ad_group_criterion.position_estimates.top_of_page_cpc_micros" + | "ad_group_criterion.quality_info.creative_quality_score" + | "ad_group_criterion.quality_info.post_click_quality_score" + | "ad_group_criterion.quality_info.quality_score" + | "ad_group_criterion.quality_info.search_predicted_ctr" + | "ad_group_criterion.resource_name" + | "ad_group_criterion.status" + | "ad_group_criterion.system_serving_status" + | "ad_group_criterion.topic.path" + | "ad_group_criterion.topic.topic_constant" + | "ad_group_criterion.tracking_url_template" + | "ad_group_criterion.type" + | "ad_group_criterion.url_custom_parameters" + | "ad_group_criterion.user_interest.user_interest_category" + | "ad_group_criterion.user_list.user_list" + | "ad_group_criterion.webpage.conditions" + | "ad_group_criterion.webpage.coverage_percentage" + | "ad_group_criterion.webpage.criterion_name" + | "ad_group_criterion.webpage.sample.sample_urls" + | "ad_group_criterion.youtube_channel.channel_id" + | "ad_group_criterion.youtube_video.video_id" + | "campaign.ad_serving_optimization_status" + | "campaign.advertising_channel_sub_type" + | "campaign.advertising_channel_type" + | "campaign.app_campaign_setting.app_id" + | "campaign.app_campaign_setting.app_store" + | "campaign.app_campaign_setting.bidding_strategy_goal_type" + | "campaign.base_campaign" + | "campaign.bidding_strategy" + | "campaign.bidding_strategy_type" + | "campaign.campaign_budget" + | "campaign.commission.commission_rate_micros" + | "campaign.dynamic_search_ads_setting.domain_name" + | "campaign.dynamic_search_ads_setting.feeds" + | "campaign.dynamic_search_ads_setting.language_code" + | "campaign.dynamic_search_ads_setting.use_supplied_urls_only" + | "campaign.end_date" + | "campaign.excluded_parent_asset_field_types" + | "campaign.experiment_type" + | "campaign.final_url_suffix" + | "campaign.frequency_caps" + | "campaign.geo_target_type_setting.negative_geo_target_type" + | "campaign.geo_target_type_setting.positive_geo_target_type" + | "campaign.hotel_setting.hotel_center_id" + | "campaign.id" + | "campaign.labels" + | "campaign.local_campaign_setting.location_source_type" + | "campaign.manual_cpc.enhanced_cpc_enabled" + | "campaign.manual_cpm" + | "campaign.manual_cpv" + | "campaign.maximize_conversion_value.target_roas" + | "campaign.maximize_conversions.target_cpa" + | "campaign.name" + | "campaign.network_settings.target_content_network" + | "campaign.network_settings.target_google_search" + | "campaign.network_settings.target_partner_search_network" + | "campaign.network_settings.target_search_network" + | "campaign.optimization_goal_setting.optimization_goal_types" + | "campaign.optimization_score" + | "campaign.payment_mode" + | "campaign.percent_cpc.cpc_bid_ceiling_micros" + | "campaign.percent_cpc.enhanced_cpc_enabled" + | "campaign.real_time_bidding_setting.opt_in" + | "campaign.resource_name" + | "campaign.selective_optimization.conversion_actions" + | "campaign.serving_status" + | "campaign.shopping_setting.campaign_priority" + | "campaign.shopping_setting.enable_local" + | "campaign.shopping_setting.merchant_id" + | "campaign.shopping_setting.sales_country" + | "campaign.start_date" + | "campaign.status" + | "campaign.target_cpa.cpc_bid_ceiling_micros" + | "campaign.target_cpa.cpc_bid_floor_micros" + | "campaign.target_cpa.target_cpa_micros" + | "campaign.target_cpm" + | "campaign.target_impression_share.cpc_bid_ceiling_micros" + | "campaign.target_impression_share.location" + | "campaign.target_impression_share.location_fraction_micros" + | "campaign.target_roas.cpc_bid_ceiling_micros" + | "campaign.target_roas.cpc_bid_floor_micros" + | "campaign.target_roas.target_roas" + | "campaign.target_spend.cpc_bid_ceiling_micros" + | "campaign.target_spend.target_spend_micros" + | "campaign.targeting_setting.target_restrictions" + | "campaign.tracking_setting.tracking_url" + | "campaign.tracking_url_template" + | "campaign.url_custom_parameters" + | "campaign.vanity_pharma.vanity_pharma_display_url_mode" + | "campaign.vanity_pharma.vanity_pharma_text" + | "campaign.video_brand_safety_suitability" + | "customer.auto_tagging_enabled" + | "customer.call_reporting_setting.call_conversion_action" + | "customer.call_reporting_setting.call_conversion_reporting_enabled" + | "customer.call_reporting_setting.call_reporting_enabled" + | "customer.conversion_tracking_setting.conversion_tracking_id" + | "customer.conversion_tracking_setting.cross_account_conversion_tracking_id" + | "customer.currency_code" + | "customer.descriptive_name" + | "customer.final_url_suffix" + | "customer.has_partners_badge" + | "customer.id" + | "customer.manager" + | "customer.optimization_score" + | "customer.optimization_score_weight" + | "customer.pay_per_conversion_eligibility_failure_reasons" + | "customer.remarketing_setting.google_global_site_tag" + | "customer.resource_name" + | "customer.test_account" + | "customer.time_zone" + | "customer.tracking_url_template" + | "webpage_view.resource_name"; + + export type WebpageViewFields = Array; + + export type WebpageViewMetric = + | "metrics.absolute_top_impression_percentage" + | "metrics.active_view_cpm" + | "metrics.active_view_ctr" + | "metrics.active_view_impressions" + | "metrics.active_view_measurability" + | "metrics.active_view_measurable_cost_micros" + | "metrics.active_view_measurable_impressions" + | "metrics.active_view_viewability" + | "metrics.all_conversions" + | "metrics.all_conversions_from_interactions_rate" + | "metrics.all_conversions_value" + | "metrics.average_cost" + | "metrics.average_cpc" + | "metrics.average_cpe" + | "metrics.average_cpm" + | "metrics.average_cpv" + | "metrics.clicks" + | "metrics.conversions" + | "metrics.conversions_from_interactions_rate" + | "metrics.conversions_value" + | "metrics.cost_micros" + | "metrics.cost_per_all_conversions" + | "metrics.cost_per_conversion" + | "metrics.cost_per_current_model_attributed_conversion" + | "metrics.cross_device_conversions" + | "metrics.ctr" + | "metrics.current_model_attributed_conversions" + | "metrics.current_model_attributed_conversions_value" + | "metrics.engagement_rate" + | "metrics.engagements" + | "metrics.impressions" + | "metrics.interaction_event_types" + | "metrics.interaction_rate" + | "metrics.interactions" + | "metrics.top_impression_percentage" + | "metrics.value_per_all_conversions" + | "metrics.value_per_conversion" + | "metrics.value_per_current_model_attributed_conversion" + | "metrics.view_through_conversions"; + + export type WebpageViewMetrics = Array; + + export type WebpageViewSegment = + | "segments.ad_network_type" + | "segments.click_type" + | "segments.conversion_action" + | "segments.conversion_action_category" + | "segments.conversion_action_name" + | "segments.conversion_lag_bucket" + | "segments.conversion_or_adjustment_lag_bucket" + | "segments.date" + | "segments.day_of_week" + | "segments.device" + | "segments.external_conversion_source" + | "segments.month" + | "segments.month_of_year" + | "segments.quarter" + | "segments.slot" + | "segments.week" + | "segments.year"; + + export type WebpageViewSegments = Array; + /* --- End of WebpageView --- */ } diff --git a/src/protos/autogen/resourceNames.ts b/src/protos/autogen/resourceNames.ts index 901c68ae..8bf692f8 100644 --- a/src/protos/autogen/resourceNames.ts +++ b/src/protos/autogen/resourceNames.ts @@ -3,7 +3,8 @@ type StrNum = string | number; /* AccountBudget */ -export type AccountBudgetResourceName = `customers/${StrNum}/accountBudgets/${StrNum}`; +export type AccountBudgetResourceName = + `customers/${StrNum}/accountBudgets/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} accountBudgetId @@ -18,7 +19,8 @@ export function accountBudget( } /* AccountBudgetProposal */ -export type AccountBudgetProposalResourceName = `customers/${StrNum}/accountBudgetProposals/${StrNum}`; +export type AccountBudgetProposalResourceName = + `customers/${StrNum}/accountBudgetProposals/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} accountBudgetProposalId @@ -33,7 +35,8 @@ export function accountBudgetProposal( } /* AccountLink */ -export type AccountLinkResourceName = `customers/${StrNum}/accountLinks/${StrNum}`; +export type AccountLinkResourceName = + `customers/${StrNum}/accountLinks/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} accountLinkId @@ -78,7 +81,8 @@ export function adGroup( } /* AdGroupAd */ -export type AdGroupAdResourceName = `customers/${StrNum}/adGroupAds/${StrNum}~${StrNum}`; +export type AdGroupAdResourceName = + `customers/${StrNum}/adGroupAds/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -95,7 +99,8 @@ export function adGroupAd( } /* AdGroupAdAssetView */ -export type AdGroupAdAssetViewResourceName = `customers/${StrNum}/adGroupAdAssetViews/${StrNum}~${StrNum}~${StrNum}~${StrNum}`; +export type AdGroupAdAssetViewResourceName = + `customers/${StrNum}/adGroupAdAssetViews/${StrNum}~${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -116,7 +121,8 @@ export function adGroupAdAssetView( } /* AdGroupAdLabel */ -export type AdGroupAdLabelResourceName = `customers/${StrNum}/adGroupAdLabels/${StrNum}~${StrNum}~${StrNum}`; +export type AdGroupAdLabelResourceName = + `customers/${StrNum}/adGroupAdLabels/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -134,8 +140,29 @@ export function adGroupAdLabel( return `customers/${customerId}/adGroupAdLabels/${adGroupId}~${adId}~${labelId}` as const; } +/* AdGroupAsset */ +export type AdGroupAssetResourceName = + `customers/${StrNum}/adGroupAssets/${StrNum}~${StrNum}~${StrNum}`; +/** + * @param {string | number} customerId + * @param {string | number} adGroupId + * @param {string | number} assetId + * @param {string | number} fieldType + * @returns `AdGroupAssetResourceName` + * @example const adGroupAsset: ResourceNames.AdGroupAssetResourceName = ResourceNames.adGroupAsset(10987417, 21974834, 43949668, 87899336) + */ +export function adGroupAsset( + customerId: string | number, + adGroupId: string | number, + assetId: string | number, + fieldType: string | number +): AdGroupAssetResourceName { + return `customers/${customerId}/adGroupAssets/${adGroupId}~${assetId}~${fieldType}` as const; +} + /* AdGroupAudienceView */ -export type AdGroupAudienceViewResourceName = `customers/${StrNum}/adGroupAudienceViews/${StrNum}~${StrNum}`; +export type AdGroupAudienceViewResourceName = + `customers/${StrNum}/adGroupAudienceViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -152,7 +179,8 @@ export function adGroupAudienceView( } /* AdGroupBidModifier */ -export type AdGroupBidModifierResourceName = `customers/${StrNum}/adGroupBidModifiers/${StrNum}~${StrNum}`; +export type AdGroupBidModifierResourceName = + `customers/${StrNum}/adGroupBidModifiers/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -169,7 +197,8 @@ export function adGroupBidModifier( } /* AdGroupCriterion */ -export type AdGroupCriterionResourceName = `customers/${StrNum}/adGroupCriteria/${StrNum}~${StrNum}`; +export type AdGroupCriterionResourceName = + `customers/${StrNum}/adGroupCriteria/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -186,7 +215,8 @@ export function adGroupCriterion( } /* AdGroupCriterionLabel */ -export type AdGroupCriterionLabelResourceName = `customers/${StrNum}/adGroupCriterionLabels/${StrNum}~${StrNum}~${StrNum}`; +export type AdGroupCriterionLabelResourceName = + `customers/${StrNum}/adGroupCriterionLabels/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -205,7 +235,8 @@ export function adGroupCriterionLabel( } /* AdGroupCriterionSimulation */ -export type AdGroupCriterionSimulationResourceName = `customers/${StrNum}/adGroupCriterionSimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; +export type AdGroupCriterionSimulationResourceName = + `customers/${StrNum}/adGroupCriterionSimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -230,7 +261,8 @@ export function adGroupCriterionSimulation( } /* AdGroupExtensionSetting */ -export type AdGroupExtensionSettingResourceName = `customers/${StrNum}/adGroupExtensionSettings/${StrNum}~${StrNum}`; +export type AdGroupExtensionSettingResourceName = + `customers/${StrNum}/adGroupExtensionSettings/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -247,7 +279,8 @@ export function adGroupExtensionSetting( } /* AdGroupFeed */ -export type AdGroupFeedResourceName = `customers/${StrNum}/adGroupFeeds/${StrNum}~${StrNum}`; +export type AdGroupFeedResourceName = + `customers/${StrNum}/adGroupFeeds/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -264,7 +297,8 @@ export function adGroupFeed( } /* AdGroupLabel */ -export type AdGroupLabelResourceName = `customers/${StrNum}/adGroupLabels/${StrNum}~${StrNum}`; +export type AdGroupLabelResourceName = + `customers/${StrNum}/adGroupLabels/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -281,7 +315,8 @@ export function adGroupLabel( } /* AdGroupSimulation */ -export type AdGroupSimulationResourceName = `customers/${StrNum}/adGroupSimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; +export type AdGroupSimulationResourceName = + `customers/${StrNum}/adGroupSimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -304,7 +339,8 @@ export function adGroupSimulation( } /* AdParameter */ -export type AdParameterResourceName = `customers/${StrNum}/adParameters/${StrNum}~${StrNum}~${StrNum}`; +export type AdParameterResourceName = + `customers/${StrNum}/adParameters/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -323,7 +359,8 @@ export function adParameter( } /* AdScheduleView */ -export type AdScheduleViewResourceName = `customers/${StrNum}/adScheduleViews/${StrNum}~${StrNum}`; +export type AdScheduleViewResourceName = + `customers/${StrNum}/adScheduleViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -340,7 +377,8 @@ export function adScheduleView( } /* AgeRangeView */ -export type AgeRangeViewResourceName = `customers/${StrNum}/ageRangeViews/${StrNum}~${StrNum}`; +export type AgeRangeViewResourceName = + `customers/${StrNum}/ageRangeViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -387,7 +425,8 @@ export function batchJob( } /* BiddingStrategy */ -export type BiddingStrategyResourceName = `customers/${StrNum}/biddingStrategies/${StrNum}`; +export type BiddingStrategyResourceName = + `customers/${StrNum}/biddingStrategies/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} biddingStrategyId @@ -401,8 +440,33 @@ export function biddingStrategy( return `customers/${customerId}/biddingStrategies/${biddingStrategyId}` as const; } +/* BiddingStrategySimulation */ +export type BiddingStrategySimulationResourceName = + `customers/${StrNum}/biddingStrategySimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; +/** + * @param {string | number} customerId + * @param {string | number} biddingStrategyId + * @param {string | number} type + * @param {string | number} modificationMethod + * @param {string | number} startDate + * @param {string | number} endDate + * @returns `BiddingStrategySimulationResourceName` + * @example const biddingStrategySimulation: ResourceNames.BiddingStrategySimulationResourceName = ResourceNames.biddingStrategySimulation(10987417, 21974834, 43949668, 87899336, 175798672, 351597344) + */ +export function biddingStrategySimulation( + customerId: string | number, + biddingStrategyId: string | number, + type: string | number, + modificationMethod: string | number, + startDate: string | number, + endDate: string | number +): BiddingStrategySimulationResourceName { + return `customers/${customerId}/biddingStrategySimulations/${biddingStrategyId}~${type}~${modificationMethod}~${startDate}~${endDate}` as const; +} + /* BillingSetup */ -export type BillingSetupResourceName = `customers/${StrNum}/billingSetups/${StrNum}`; +export type BillingSetupResourceName = + `customers/${StrNum}/billingSetups/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} billingSetupId @@ -447,7 +511,8 @@ export function campaign( } /* CampaignAsset */ -export type CampaignAssetResourceName = `customers/${StrNum}/campaignAssets/${StrNum}~${StrNum}~${StrNum}`; +export type CampaignAssetResourceName = + `customers/${StrNum}/campaignAssets/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -466,7 +531,8 @@ export function campaignAsset( } /* CampaignAudienceView */ -export type CampaignAudienceViewResourceName = `customers/${StrNum}/campaignAudienceViews/${StrNum}~${StrNum}`; +export type CampaignAudienceViewResourceName = + `customers/${StrNum}/campaignAudienceViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -483,7 +549,8 @@ export function campaignAudienceView( } /* CampaignBidModifier */ -export type CampaignBidModifierResourceName = `customers/${StrNum}/campaignBidModifiers/${StrNum}~${StrNum}`; +export type CampaignBidModifierResourceName = + `customers/${StrNum}/campaignBidModifiers/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -500,7 +567,8 @@ export function campaignBidModifier( } /* CampaignBudget */ -export type CampaignBudgetResourceName = `customers/${StrNum}/campaignBudgets/${StrNum}`; +export type CampaignBudgetResourceName = + `customers/${StrNum}/campaignBudgets/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignBudgetId @@ -515,7 +583,8 @@ export function campaignBudget( } /* CampaignCriterion */ -export type CampaignCriterionResourceName = `customers/${StrNum}/campaignCriteria/${StrNum}~${StrNum}`; +export type CampaignCriterionResourceName = + `customers/${StrNum}/campaignCriteria/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -532,7 +601,8 @@ export function campaignCriterion( } /* CampaignCriterionSimulation */ -export type CampaignCriterionSimulationResourceName = `customers/${StrNum}/campaignCriterionSimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; +export type CampaignCriterionSimulationResourceName = + `customers/${StrNum}/campaignCriterionSimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -557,7 +627,8 @@ export function campaignCriterionSimulation( } /* CampaignDraft */ -export type CampaignDraftResourceName = `customers/${StrNum}/campaignDrafts/${StrNum}~${StrNum}`; +export type CampaignDraftResourceName = + `customers/${StrNum}/campaignDrafts/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} baseCampaignId @@ -574,7 +645,8 @@ export function campaignDraft( } /* CampaignExperiment */ -export type CampaignExperimentResourceName = `customers/${StrNum}/campaignExperiments/${StrNum}`; +export type CampaignExperimentResourceName = + `customers/${StrNum}/campaignExperiments/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignExperimentId @@ -589,7 +661,8 @@ export function campaignExperiment( } /* CampaignExtensionSetting */ -export type CampaignExtensionSettingResourceName = `customers/${StrNum}/campaignExtensionSettings/${StrNum}~${StrNum}`; +export type CampaignExtensionSettingResourceName = + `customers/${StrNum}/campaignExtensionSettings/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -606,7 +679,8 @@ export function campaignExtensionSetting( } /* CampaignFeed */ -export type CampaignFeedResourceName = `customers/${StrNum}/campaignFeeds/${StrNum}~${StrNum}`; +export type CampaignFeedResourceName = + `customers/${StrNum}/campaignFeeds/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -623,7 +697,8 @@ export function campaignFeed( } /* CampaignLabel */ -export type CampaignLabelResourceName = `customers/${StrNum}/campaignLabels/${StrNum}~${StrNum}`; +export type CampaignLabelResourceName = + `customers/${StrNum}/campaignLabels/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -640,7 +715,8 @@ export function campaignLabel( } /* CampaignSharedSet */ -export type CampaignSharedSetResourceName = `customers/${StrNum}/campaignSharedSets/${StrNum}~${StrNum}`; +export type CampaignSharedSetResourceName = + `customers/${StrNum}/campaignSharedSets/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -656,6 +732,30 @@ export function campaignSharedSet( return `customers/${customerId}/campaignSharedSets/${campaignId}~${sharedSetId}` as const; } +/* CampaignSimulation */ +export type CampaignSimulationResourceName = + `customers/${StrNum}/campaignSimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; +/** + * @param {string | number} customerId + * @param {string | number} campaignId + * @param {string | number} type + * @param {string | number} modificationMethod + * @param {string | number} startDate + * @param {string | number} endDate + * @returns `CampaignSimulationResourceName` + * @example const campaignSimulation: ResourceNames.CampaignSimulationResourceName = ResourceNames.campaignSimulation(10987417, 21974834, 43949668, 87899336, 175798672, 351597344) + */ +export function campaignSimulation( + customerId: string | number, + campaignId: string | number, + type: string | number, + modificationMethod: string | number, + startDate: string | number, + endDate: string | number +): CampaignSimulationResourceName { + return `customers/${customerId}/campaignSimulations/${campaignId}~${type}~${modificationMethod}~${startDate}~${endDate}` as const; +} + /* CarrierConstant */ export type CarrierConstantResourceName = `carrierConstants/${StrNum}`; /** @@ -670,7 +770,8 @@ export function carrierConstant( } /* ChangeEvent */ -export type ChangeEventResourceName = `customers/${StrNum}/changeEvents/${StrNum}~${StrNum}~${StrNum}`; +export type ChangeEventResourceName = + `customers/${StrNum}/changeEvents/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} timestampMicros @@ -689,7 +790,8 @@ export function changeEvent( } /* ChangeStatus */ -export type ChangeStatusResourceName = `customers/${StrNum}/changeStatus/${StrNum}`; +export type ChangeStatusResourceName = + `customers/${StrNum}/changeStatus/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} changeStatusId @@ -704,7 +806,8 @@ export function changeStatus( } /* ClickView */ -export type ClickViewResourceName = `customers/${StrNum}/clickViews/${StrNum}~${StrNum}`; +export type ClickViewResourceName = + `customers/${StrNum}/clickViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} date @@ -721,7 +824,8 @@ export function clickView( } /* CombinedAudience */ -export type CombinedAudienceResourceName = `customers/${StrNum}/combinedAudiences/${StrNum}`; +export type CombinedAudienceResourceName = + `customers/${StrNum}/combinedAudiences/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} combinedAudienceId @@ -736,7 +840,8 @@ export function combinedAudience( } /* ConversionAction */ -export type ConversionActionResourceName = `customers/${StrNum}/conversionActions/${StrNum}`; +export type ConversionActionResourceName = + `customers/${StrNum}/conversionActions/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} conversionActionId @@ -750,6 +855,22 @@ export function conversionAction( return `customers/${customerId}/conversionActions/${conversionActionId}` as const; } +/* ConversionCustomVariable */ +export type ConversionCustomVariableResourceName = + `customers/${StrNum}/conversionCustomVariables/${StrNum}`; +/** + * @param {string | number} customerId + * @param {string | number} conversionCustomVariableId + * @returns `ConversionCustomVariableResourceName` + * @example const conversionCustomVariable: ResourceNames.ConversionCustomVariableResourceName = ResourceNames.conversionCustomVariable(10987417, 21974834) + */ +export function conversionCustomVariable( + customerId: string | number, + conversionCustomVariableId: string | number +): ConversionCustomVariableResourceName { + return `customers/${customerId}/conversionCustomVariables/${conversionCustomVariableId}` as const; +} + /* CurrencyConstant */ export type CurrencyConstantResourceName = `currencyConstants/${StrNum}`; /** @@ -764,7 +885,8 @@ export function currencyConstant( } /* CustomAudience */ -export type CustomAudienceResourceName = `customers/${StrNum}/customAudiences/${StrNum}`; +export type CustomAudienceResourceName = + `customers/${StrNum}/customAudiences/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} customAudienceId @@ -779,7 +901,8 @@ export function customAudience( } /* CustomInterest */ -export type CustomInterestResourceName = `customers/${StrNum}/customInterests/${StrNum}`; +export type CustomInterestResourceName = + `customers/${StrNum}/customInterests/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} customInterestId @@ -804,8 +927,27 @@ export function customer(customerId: string | number): CustomerResourceName { return `customers/${customerId}` as const; } +/* CustomerAsset */ +export type CustomerAssetResourceName = + `customers/${StrNum}/customerAssets/${StrNum}~${StrNum}`; +/** + * @param {string | number} customerId + * @param {string | number} assetId + * @param {string | number} fieldType + * @returns `CustomerAssetResourceName` + * @example const customerAsset: ResourceNames.CustomerAssetResourceName = ResourceNames.customerAsset(10987417, 21974834, 43949668) + */ +export function customerAsset( + customerId: string | number, + assetId: string | number, + fieldType: string | number +): CustomerAssetResourceName { + return `customers/${customerId}/customerAssets/${assetId}~${fieldType}` as const; +} + /* CustomerClient */ -export type CustomerClientResourceName = `customers/${StrNum}/customerClients/${StrNum}`; +export type CustomerClientResourceName = + `customers/${StrNum}/customerClients/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} clientCustomerId @@ -820,7 +962,8 @@ export function customerClient( } /* CustomerClientLink */ -export type CustomerClientLinkResourceName = `customers/${StrNum}/customerClientLinks/${StrNum}~${StrNum}`; +export type CustomerClientLinkResourceName = + `customers/${StrNum}/customerClientLinks/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} clientCustomerId @@ -837,7 +980,8 @@ export function customerClientLink( } /* CustomerExtensionSetting */ -export type CustomerExtensionSettingResourceName = `customers/${StrNum}/customerExtensionSettings/${StrNum}`; +export type CustomerExtensionSettingResourceName = + `customers/${StrNum}/customerExtensionSettings/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} extensionType @@ -852,7 +996,8 @@ export function customerExtensionSetting( } /* CustomerFeed */ -export type CustomerFeedResourceName = `customers/${StrNum}/customerFeeds/${StrNum}`; +export type CustomerFeedResourceName = + `customers/${StrNum}/customerFeeds/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} feedId @@ -867,7 +1012,8 @@ export function customerFeed( } /* CustomerLabel */ -export type CustomerLabelResourceName = `customers/${StrNum}/customerLabels/${StrNum}`; +export type CustomerLabelResourceName = + `customers/${StrNum}/customerLabels/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} labelId @@ -882,7 +1028,8 @@ export function customerLabel( } /* CustomerManagerLink */ -export type CustomerManagerLinkResourceName = `customers/${StrNum}/customerManagerLinks/${StrNum}~${StrNum}`; +export type CustomerManagerLinkResourceName = + `customers/${StrNum}/customerManagerLinks/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} managerCustomerId @@ -899,7 +1046,8 @@ export function customerManagerLink( } /* CustomerNegativeCriterion */ -export type CustomerNegativeCriterionResourceName = `customers/${StrNum}/customerNegativeCriteria/${StrNum}`; +export type CustomerNegativeCriterionResourceName = + `customers/${StrNum}/customerNegativeCriteria/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} criterionId @@ -914,7 +1062,8 @@ export function customerNegativeCriterion( } /* CustomerUserAccess */ -export type CustomerUserAccessResourceName = `customers/${StrNum}/customerUserAccesses/${StrNum}`; +export type CustomerUserAccessResourceName = + `customers/${StrNum}/customerUserAccesses/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} userId @@ -929,7 +1078,8 @@ export function customerUserAccess( } /* CustomerUserAccessInvitation */ -export type CustomerUserAccessInvitationResourceName = `customers/${StrNum}/customerUserAccessInvitations/${StrNum}`; +export type CustomerUserAccessInvitationResourceName = + `customers/${StrNum}/customerUserAccessInvitations/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} invitationId @@ -944,7 +1094,8 @@ export function customerUserAccessInvitation( } /* DetailPlacementView */ -export type DetailPlacementViewResourceName = `customers/${StrNum}/detailPlacementViews/${StrNum}~${StrNum}`; +export type DetailPlacementViewResourceName = + `customers/${StrNum}/detailPlacementViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -961,7 +1112,8 @@ export function detailPlacementView( } /* DisplayKeywordView */ -export type DisplayKeywordViewResourceName = `customers/${StrNum}/displayKeywordViews/${StrNum}~${StrNum}`; +export type DisplayKeywordViewResourceName = + `customers/${StrNum}/displayKeywordViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -978,7 +1130,8 @@ export function displayKeywordView( } /* DistanceView */ -export type DistanceViewResourceName = `customers/${StrNum}/distanceViews/${StrNum}~${StrNum}`; +export type DistanceViewResourceName = + `customers/${StrNum}/distanceViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} placeholderChainId @@ -995,7 +1148,8 @@ export function distanceView( } /* DomainCategory */ -export type DomainCategoryResourceName = `customers/${StrNum}/domainCategories/${StrNum}~${StrNum}~${StrNum}`; +export type DomainCategoryResourceName = + `customers/${StrNum}/domainCategories/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -1014,7 +1168,8 @@ export function domainCategory( } /* DynamicSearchAdsSearchTermView */ -export type DynamicSearchAdsSearchTermViewResourceName = `customers/${StrNum}/dynamicSearchAdsSearchTermViews/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; +export type DynamicSearchAdsSearchTermViewResourceName = + `customers/${StrNum}/dynamicSearchAdsSearchTermViews/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1037,7 +1192,8 @@ export function dynamicSearchAdsSearchTermView( } /* ExpandedLandingPageView */ -export type ExpandedLandingPageViewResourceName = `customers/${StrNum}/expandedLandingPageViews/${StrNum}`; +export type ExpandedLandingPageViewResourceName = + `customers/${StrNum}/expandedLandingPageViews/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} expandedFinalUrlFingerprint @@ -1052,7 +1208,8 @@ export function expandedLandingPageView( } /* ExtensionFeedItem */ -export type ExtensionFeedItemResourceName = `customers/${StrNum}/extensionFeedItems/${StrNum}`; +export type ExtensionFeedItemResourceName = + `customers/${StrNum}/extensionFeedItems/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} feedItemId @@ -1082,7 +1239,8 @@ export function feed( } /* FeedItem */ -export type FeedItemResourceName = `customers/${StrNum}/feedItems/${StrNum}~${StrNum}`; +export type FeedItemResourceName = + `customers/${StrNum}/feedItems/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} feedId @@ -1099,7 +1257,8 @@ export function feedItem( } /* FeedItemSet */ -export type FeedItemSetResourceName = `customers/${StrNum}/feedItemSets/${StrNum}~${StrNum}`; +export type FeedItemSetResourceName = + `customers/${StrNum}/feedItemSets/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} feedId @@ -1116,7 +1275,8 @@ export function feedItemSet( } /* FeedItemSetLink */ -export type FeedItemSetLinkResourceName = `customers/${StrNum}/feedItemSetLinks/${StrNum}~${StrNum}~${StrNum}`; +export type FeedItemSetLinkResourceName = + `customers/${StrNum}/feedItemSetLinks/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} feedId @@ -1135,7 +1295,8 @@ export function feedItemSetLink( } /* FeedItemTarget */ -export type FeedItemTargetResourceName = `customers/${StrNum}/feedItemTargets/${StrNum}~${StrNum}~${StrNum}~${StrNum}`; +export type FeedItemTargetResourceName = + `customers/${StrNum}/feedItemTargets/${StrNum}~${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} feedId @@ -1156,7 +1317,8 @@ export function feedItemTarget( } /* FeedMapping */ -export type FeedMappingResourceName = `customers/${StrNum}/feedMappings/${StrNum}~${StrNum}`; +export type FeedMappingResourceName = + `customers/${StrNum}/feedMappings/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} feedId @@ -1173,7 +1335,8 @@ export function feedMapping( } /* FeedPlaceholderView */ -export type FeedPlaceholderViewResourceName = `customers/${StrNum}/feedPlaceholderViews/${StrNum}`; +export type FeedPlaceholderViewResourceName = + `customers/${StrNum}/feedPlaceholderViews/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} placeholderType @@ -1188,7 +1351,8 @@ export function feedPlaceholderView( } /* GenderView */ -export type GenderViewResourceName = `customers/${StrNum}/genderViews/${StrNum}~${StrNum}`; +export type GenderViewResourceName = + `customers/${StrNum}/genderViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1218,7 +1382,8 @@ export function geoTargetConstant( } /* GeographicView */ -export type GeographicViewResourceName = `customers/${StrNum}/geographicViews/${StrNum}~${StrNum}`; +export type GeographicViewResourceName = + `customers/${StrNum}/geographicViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} countryCriterionId @@ -1248,7 +1413,8 @@ export function googleAdsField( } /* GroupPlacementView */ -export type GroupPlacementViewResourceName = `customers/${StrNum}/groupPlacementViews/${StrNum}~${StrNum}`; +export type GroupPlacementViewResourceName = + `customers/${StrNum}/groupPlacementViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1265,7 +1431,8 @@ export function groupPlacementView( } /* HotelGroupView */ -export type HotelGroupViewResourceName = `customers/${StrNum}/hotelGroupViews/${StrNum}~${StrNum}`; +export type HotelGroupViewResourceName = + `customers/${StrNum}/hotelGroupViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1282,7 +1449,8 @@ export function hotelGroupView( } /* HotelPerformanceView */ -export type HotelPerformanceViewResourceName = `customers/${StrNum}/hotelPerformanceView`; +export type HotelPerformanceViewResourceName = + `customers/${StrNum}/hotelPerformanceView`; /** * @param {string | number} customerId * @returns `HotelPerformanceViewResourceName` @@ -1295,7 +1463,8 @@ export function hotelPerformanceView( } /* IncomeRangeView */ -export type IncomeRangeViewResourceName = `customers/${StrNum}/incomeRangeViews/${StrNum}~${StrNum}`; +export type IncomeRangeViewResourceName = + `customers/${StrNum}/incomeRangeViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1327,7 +1496,8 @@ export function invoice( } /* KeywordPlan */ -export type KeywordPlanResourceName = `customers/${StrNum}/keywordPlans/${StrNum}`; +export type KeywordPlanResourceName = + `customers/${StrNum}/keywordPlans/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} keywordPlanId @@ -1342,7 +1512,8 @@ export function keywordPlan( } /* KeywordPlanAdGroup */ -export type KeywordPlanAdGroupResourceName = `customers/${StrNum}/keywordPlanAdGroups/${StrNum}`; +export type KeywordPlanAdGroupResourceName = + `customers/${StrNum}/keywordPlanAdGroups/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} keywordPlanAdGroupId @@ -1357,7 +1528,8 @@ export function keywordPlanAdGroup( } /* KeywordPlanAdGroupKeyword */ -export type KeywordPlanAdGroupKeywordResourceName = `customers/${StrNum}/keywordPlanAdGroupKeywords/${StrNum}`; +export type KeywordPlanAdGroupKeywordResourceName = + `customers/${StrNum}/keywordPlanAdGroupKeywords/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} keywordPlanAdGroupKeywordId @@ -1372,7 +1544,8 @@ export function keywordPlanAdGroupKeyword( } /* KeywordPlanCampaign */ -export type KeywordPlanCampaignResourceName = `customers/${StrNum}/keywordPlanCampaigns/${StrNum}`; +export type KeywordPlanCampaignResourceName = + `customers/${StrNum}/keywordPlanCampaigns/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} keywordPlanCampaignId @@ -1387,7 +1560,8 @@ export function keywordPlanCampaign( } /* KeywordPlanCampaignKeyword */ -export type KeywordPlanCampaignKeywordResourceName = `customers/${StrNum}/keywordPlanCampaignKeywords/${StrNum}`; +export type KeywordPlanCampaignKeywordResourceName = + `customers/${StrNum}/keywordPlanCampaignKeywords/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} keywordPlanCampaignKeywordId @@ -1402,7 +1576,8 @@ export function keywordPlanCampaignKeyword( } /* KeywordView */ -export type KeywordViewResourceName = `customers/${StrNum}/keywordViews/${StrNum}~${StrNum}`; +export type KeywordViewResourceName = + `customers/${StrNum}/keywordViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1434,7 +1609,8 @@ export function label( } /* LandingPageView */ -export type LandingPageViewResourceName = `customers/${StrNum}/landingPageViews/${StrNum}`; +export type LandingPageViewResourceName = + `customers/${StrNum}/landingPageViews/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} unexpandedFinalUrlFingerprint @@ -1461,8 +1637,24 @@ export function languageConstant( return `languageConstants/${criterionId}` as const; } +/* LifeEvent */ +export type LifeEventResourceName = `customers/${StrNum}/lifeEvents/${StrNum}`; +/** + * @param {string | number} customerId + * @param {string | number} lifeEventId + * @returns `LifeEventResourceName` + * @example const lifeEvent: ResourceNames.LifeEventResourceName = ResourceNames.lifeEvent(10987417, 21974834) + */ +export function lifeEvent( + customerId: string | number, + lifeEventId: string | number +): LifeEventResourceName { + return `customers/${customerId}/lifeEvents/${lifeEventId}` as const; +} + /* LocationView */ -export type LocationViewResourceName = `customers/${StrNum}/locationViews/${StrNum}~${StrNum}`; +export type LocationViewResourceName = + `customers/${StrNum}/locationViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -1479,7 +1671,8 @@ export function locationView( } /* ManagedPlacementView */ -export type ManagedPlacementViewResourceName = `customers/${StrNum}/managedPlacementViews/${StrNum}~${StrNum}`; +export type ManagedPlacementViewResourceName = + `customers/${StrNum}/managedPlacementViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1511,7 +1704,8 @@ export function mediaFile( } /* MerchantCenterLink */ -export type MerchantCenterLinkResourceName = `customers/${StrNum}/merchantCenterLinks/${StrNum}`; +export type MerchantCenterLinkResourceName = + `customers/${StrNum}/merchantCenterLinks/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} merchantCenterId @@ -1526,7 +1720,8 @@ export function merchantCenterLink( } /* MobileAppCategoryConstant */ -export type MobileAppCategoryConstantResourceName = `mobileAppCategoryConstants/${StrNum}`; +export type MobileAppCategoryConstantResourceName = + `mobileAppCategoryConstants/${StrNum}`; /** * @param {string | number} mobileAppCategoryId * @returns `MobileAppCategoryConstantResourceName` @@ -1539,7 +1734,8 @@ export function mobileAppCategoryConstant( } /* MobileDeviceConstant */ -export type MobileDeviceConstantResourceName = `mobileDeviceConstants/${StrNum}`; +export type MobileDeviceConstantResourceName = + `mobileDeviceConstants/${StrNum}`; /** * @param {string | number} criterionId * @returns `MobileDeviceConstantResourceName` @@ -1552,7 +1748,8 @@ export function mobileDeviceConstant( } /* OfflineUserDataJob */ -export type OfflineUserDataJobResourceName = `customers/${StrNum}/offlineUserDataJobs/${StrNum}`; +export type OfflineUserDataJobResourceName = + `customers/${StrNum}/offlineUserDataJobs/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} offlineUserDataUpdateId @@ -1567,7 +1764,8 @@ export function offlineUserDataJob( } /* OperatingSystemVersionConstant */ -export type OperatingSystemVersionConstantResourceName = `operatingSystemVersionConstants/${StrNum}`; +export type OperatingSystemVersionConstantResourceName = + `operatingSystemVersionConstants/${StrNum}`; /** * @param {string | number} criterionId * @returns `OperatingSystemVersionConstantResourceName` @@ -1580,7 +1778,8 @@ export function operatingSystemVersionConstant( } /* PaidOrganicSearchTermView */ -export type PaidOrganicSearchTermViewResourceName = `customers/${StrNum}/paidOrganicSearchTermViews/${StrNum}~${StrNum}~${StrNum}`; +export type PaidOrganicSearchTermViewResourceName = + `customers/${StrNum}/paidOrganicSearchTermViews/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -1599,7 +1798,8 @@ export function paidOrganicSearchTermView( } /* ParentalStatusView */ -export type ParentalStatusViewResourceName = `customers/${StrNum}/parentalStatusViews/${StrNum}~${StrNum}`; +export type ParentalStatusViewResourceName = + `customers/${StrNum}/parentalStatusViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1616,7 +1816,8 @@ export function parentalStatusView( } /* PaymentsAccount */ -export type PaymentsAccountResourceName = `customers/${StrNum}/paymentsAccounts/${StrNum}`; +export type PaymentsAccountResourceName = + `customers/${StrNum}/paymentsAccounts/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} paymentsAccountId @@ -1631,7 +1832,8 @@ export function paymentsAccount( } /* ProductBiddingCategoryConstant */ -export type ProductBiddingCategoryConstantResourceName = `productBiddingCategoryConstants/${StrNum}~${StrNum}~${StrNum}`; +export type ProductBiddingCategoryConstantResourceName = + `productBiddingCategoryConstants/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} countryCode * @param {string | number} level @@ -1648,7 +1850,8 @@ export function productBiddingCategoryConstant( } /* ProductGroupView */ -export type ProductGroupViewResourceName = `customers/${StrNum}/productGroupViews/${StrNum}~${StrNum}`; +export type ProductGroupViewResourceName = + `customers/${StrNum}/productGroupViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adgroupId @@ -1665,7 +1868,8 @@ export function productGroupView( } /* Recommendation */ -export type RecommendationResourceName = `customers/${StrNum}/recommendations/${StrNum}`; +export type RecommendationResourceName = + `customers/${StrNum}/recommendations/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} recommendationId @@ -1680,7 +1884,8 @@ export function recommendation( } /* RemarketingAction */ -export type RemarketingActionResourceName = `customers/${StrNum}/remarketingActions/${StrNum}`; +export type RemarketingActionResourceName = + `customers/${StrNum}/remarketingActions/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} remarketingActionId @@ -1695,7 +1900,8 @@ export function remarketingAction( } /* SearchTermView */ -export type SearchTermViewResourceName = `customers/${StrNum}/searchTermViews/${StrNum}~${StrNum}~${StrNum}`; +export type SearchTermViewResourceName = + `customers/${StrNum}/searchTermViews/${StrNum}~${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} campaignId @@ -1714,7 +1920,8 @@ export function searchTermView( } /* SharedCriterion */ -export type SharedCriterionResourceName = `customers/${StrNum}/sharedCriteria/${StrNum}~${StrNum}`; +export type SharedCriterionResourceName = + `customers/${StrNum}/sharedCriteria/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} sharedSetId @@ -1746,7 +1953,8 @@ export function sharedSet( } /* ShoppingPerformanceView */ -export type ShoppingPerformanceViewResourceName = `customers/${StrNum}/shoppingPerformanceView`; +export type ShoppingPerformanceViewResourceName = + `customers/${StrNum}/shoppingPerformanceView`; /** * @param {string | number} customerId * @returns `ShoppingPerformanceViewResourceName` @@ -1759,7 +1967,8 @@ export function shoppingPerformanceView( } /* ThirdPartyAppAnalyticsLink */ -export type ThirdPartyAppAnalyticsLinkResourceName = `customers/${StrNum}/thirdPartyAppAnalyticsLinks/${StrNum}`; +export type ThirdPartyAppAnalyticsLinkResourceName = + `customers/${StrNum}/thirdPartyAppAnalyticsLinks/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} customerLinkId @@ -1787,7 +1996,8 @@ export function topicConstant( } /* TopicView */ -export type TopicViewResourceName = `customers/${StrNum}/topicViews/${StrNum}~${StrNum}`; +export type TopicViewResourceName = + `customers/${StrNum}/topicViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} adGroupId @@ -1804,7 +2014,8 @@ export function topicView( } /* UserInterest */ -export type UserInterestResourceName = `customers/${StrNum}/userInterests/${StrNum}`; +export type UserInterestResourceName = + `customers/${StrNum}/userInterests/${StrNum}`; /** * @param {string | number} customerId * @param {string | number} userInterestId @@ -1834,7 +2045,8 @@ export function userList( } /* UserLocationView */ -export type UserLocationViewResourceName = `customers/${StrNum}/userLocationViews/${StrNum}~${StrNum}`; +export type UserLocationViewResourceName = + `customers/${StrNum}/userLocationViews/${StrNum}~${StrNum}`; /** * @param {string | number} customerId * @param {string | number} countryCriterionId @@ -1864,3 +2076,21 @@ export function video( ): VideoResourceName { return `customers/${customerId}/videos/${videoId}` as const; } + +/* WebpageView */ +export type WebpageViewResourceName = + `customers/${StrNum}/webpageViews/${StrNum}~${StrNum}`; +/** + * @param {string | number} customerId + * @param {string | number} adGroupId + * @param {string | number} criterionId + * @returns `WebpageViewResourceName` + * @example const webpageView: ResourceNames.WebpageViewResourceName = ResourceNames.webpageView(10987417, 21974834, 43949668) + */ +export function webpageView( + customerId: string | number, + adGroupId: string | number, + criterionId: string | number +): WebpageViewResourceName { + return `customers/${customerId}/webpageViews/${adGroupId}~${criterionId}` as const; +} diff --git a/src/protos/autogen/serviceFactory.ts b/src/protos/autogen/serviceFactory.ts index 93d3f113..88b0212c 100644 --- a/src/protos/autogen/serviceFactory.ts +++ b/src/protos/autogen/serviceFactory.ts @@ -1,3 +1,4 @@ + /* Autogenerated File! Do Not Edit */ import { ClientOptions } from "../../client"; @@ -15,16500 +16,17459 @@ export default class ServiceFactory extends Service { constructor( clientOptions: ClientOptions, customerOptions: CustomerOptions, - hooks?: Hooks, - timeout = 3600000 // 1 hour + hooks?: Hooks ) { - super(clientOptions, customerOptions, hooks ?? {}, timeout); + super(clientOptions, customerOptions, hooks ?? {}); } - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccountBudgetProposalService - */ - public get accountBudgetProposals() { - const service = this.loadService( - "AccountBudgetProposalServiceClient" - ); - type MutateOptions = Partial< - Pick - >; - return { - /** - * @description Retrieve a resources.AccountBudgetProposal in full detail - * @warning Don't use get in production! - * @returns resources.AccountBudgetProposal - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAccountBudgetProposalRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAccountBudgetProposal(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccountBudgetProposalService + */ + public get accountBudgetProposals() { + const service = this.loadService("AccountBudgetProposalServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AccountBudgetProposal in full detail + * @warning Don't use get in production! + * @returns resources.AccountBudgetProposal + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAccountBudgetProposalRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAccountBudgetProposal(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAccountBudgetProposal + * @returns services.MutateAccountBudgetProposalResponse + */ + create: async ( + accountBudgetProposals: (resources.IAccountBudgetProposal | resources.AccountBudgetProposal)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AccountBudgetProposalOperation, + resources.IAccountBudgetProposal + >( + "create", + accountBudgetProposals + + + ); + const request = this.buildRequest< + services.AccountBudgetProposalOperation, + services.IMutateAccountBudgetProposalRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AccountBudgetProposalService.mutateAccountBudgetProposal", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAccountBudgetProposal - * @returns services.MutateAccountBudgetProposalResponse - */ - create: async ( - accountBudgetProposals: ( - | resources.IAccountBudgetProposal - | resources.AccountBudgetProposal - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AccountBudgetProposalOperation, - resources.IAccountBudgetProposal - >("create", accountBudgetProposals); - const request = this.buildRequest< - services.AccountBudgetProposalOperation, - services.IMutateAccountBudgetProposalRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AccountBudgetProposalService.mutateAccountBudgetProposal", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAccountBudgetProposal( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAccountBudgetProposal(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAccountBudgetProposalResponse + */ + remove: async ( + accountBudgetProposals: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AccountBudgetProposalOperation, + string + >( + "remove", + accountBudgetProposals + + + ); + const request = this.buildRequest< + services.AccountBudgetProposalOperation, + services.IMutateAccountBudgetProposalRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AccountBudgetProposalService.mutateAccountBudgetProposal", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAccountBudgetProposalResponse - */ - remove: async ( - accountBudgetProposals: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AccountBudgetProposalOperation, - string - >("remove", accountBudgetProposals); - const request = this.buildRequest< - services.AccountBudgetProposalOperation, - services.IMutateAccountBudgetProposalRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AccountBudgetProposalService.mutateAccountBudgetProposal", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAccountBudgetProposal( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccountBudgetService - */ - public get accountBudgets() { - const service = this.loadService( - "AccountBudgetServiceClient" - ); - - return { - /** - * @description Retrieve a resources.AccountBudget in full detail - * @warning Don't use get in production! - * @returns resources.AccountBudget - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAccountBudgetRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAccountBudget(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAccountBudgetProposal(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccountLinkService - */ - public get accountLinks() { - const service = this.loadService( - "AccountLinkServiceClient" - ); - type MutateOptions = Partial< - Pick< + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccountBudgetService + */ + public get accountBudgets() { + const service = this.loadService("AccountBudgetServiceClient") + + return { + + /** + * @description Retrieve a resources.AccountBudget in full detail + * @warning Don't use get in production! + * @returns resources.AccountBudget + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAccountBudgetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAccountBudget(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccountLinkService + */ + public get accountLinks() { + const service = this.loadService("AccountLinkServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AccountLink in full detail + * @warning Don't use get in production! + * @returns resources.AccountLink + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAccountLinkRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAccountLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AccountLinkService#createaccountlink + */ + createAccountLink: async (request: services.CreateAccountLinkRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.createAccountLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description update resources of type resources.IAccountLink + * @returns services.MutateAccountLinkResponse + */ + update: async ( + accountLinks: (resources.IAccountLink | resources.AccountLink)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AccountLinkOperation, + resources.IAccountLink + >( + "update", + accountLinks + // @ts-expect-error Static class type here is fine + , resources.AccountLink + ); + const request = this.buildRequest< + services.AccountLinkOperation, services.IMutateAccountLinkRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.AccountLink in full detail - * @warning Don't use get in production! - * @returns resources.AccountLink - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAccountLinkRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAccountLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AccountLinkService.mutateAccountLink", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AccountLinkService#createaccountlink - */ - createAccountLink: async ( - request: services.CreateAccountLinkRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.createAccountLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAccountLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAccountLinkResponse + */ + remove: async ( + accountLinks: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AccountLinkOperation, + string + >( + "remove", + accountLinks + + + ); + const request = this.buildRequest< + services.AccountLinkOperation, + services.IMutateAccountLinkRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AccountLinkService.mutateAccountLink", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IAccountLink - * @returns services.MutateAccountLinkResponse - */ - update: async ( - accountLinks: (resources.IAccountLink | resources.AccountLink)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AccountLinkOperation, - resources.IAccountLink - >( - "update", - accountLinks, - // @ts-expect-error Static class type here is fine - resources.AccountLink - ); - const request = this.buildRequest< - services.AccountLinkOperation, - services.IMutateAccountLinkRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AccountLinkService.mutateAccountLink", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAccountLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAccountLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupAdAssetViewService + */ + public get adGroupAdAssetViews() { + const service = this.loadService("AdGroupAdAssetViewServiceClient") + + return { + + /** + * @description Retrieve a resources.AdGroupAdAssetView in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupAdAssetView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupAdAssetViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupAdAssetView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupAdLabelService + */ + public get adGroupAdLabels() { + const service = this.loadService("AdGroupAdLabelServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupAdLabel in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupAdLabel + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupAdLabelRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupAdLabel(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupAdLabel + * @returns services.MutateAdGroupAdLabelsResponse + */ + create: async ( + adGroupAdLabels: (resources.IAdGroupAdLabel | resources.AdGroupAdLabel)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupAdLabelOperation, + resources.IAdGroupAdLabel + >( + "create", + adGroupAdLabels + + + ); + const request = this.buildRequest< + services.AdGroupAdLabelOperation, + services.IMutateAdGroupAdLabelsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupAdLabelService.mutateAdGroupAdLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAccountLinkResponse - */ - remove: async ( - accountLinks: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - accountLinks - ); - const request = this.buildRequest< - services.AccountLinkOperation, - services.IMutateAccountLinkRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AccountLinkService.mutateAccountLink", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAccountLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupAdAssetViewService - */ - public get adGroupAdAssetViews() { - const service = this.loadService( - "AdGroupAdAssetViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.AdGroupAdAssetView in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupAdAssetView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAdGroupAdAssetViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupAdAssetView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupAdLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupAdLabelService - */ - public get adGroupAdLabels() { - const service = this.loadService( - "AdGroupAdLabelServiceClient" - ); - type MutateOptions = Partial< - Pick< + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupAdLabelsResponse + */ + remove: async ( + adGroupAdLabels: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupAdLabelOperation, + string + >( + "remove", + adGroupAdLabels + + + ); + const request = this.buildRequest< + services.AdGroupAdLabelOperation, services.IMutateAdGroupAdLabelsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.AdGroupAdLabel in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupAdLabel - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAdGroupAdLabelRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupAdLabel(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupAdLabelService.mutateAdGroupAdLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroupAdLabel - * @returns services.MutateAdGroupAdLabelsResponse - */ - create: async ( - adGroupAdLabels: ( - | resources.IAdGroupAdLabel - | resources.AdGroupAdLabel - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupAdLabelOperation, - resources.IAdGroupAdLabel - >("create", adGroupAdLabels); - const request = this.buildRequest< - services.AdGroupAdLabelOperation, - services.IMutateAdGroupAdLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupAdLabelService.mutateAdGroupAdLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupAdLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupAdLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupAdService + */ + public get adGroupAds() { + const service = this.loadService("AdGroupAdServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupAd in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupAd + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupAdRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupAd(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupAd + * @returns services.MutateAdGroupAdsResponse + */ + create: async ( + adGroupAds: (resources.IAdGroupAd | resources.AdGroupAd)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupAdOperation, + resources.IAdGroupAd + >( + "create", + adGroupAds + + + ); + const request = this.buildRequest< + services.AdGroupAdOperation, + services.IMutateAdGroupAdsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupAdService.mutateAdGroupAds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupAdLabelsResponse - */ - remove: async ( - adGroupAdLabels: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupAdLabelOperation, - string - >("remove", adGroupAdLabels); - const request = this.buildRequest< - services.AdGroupAdLabelOperation, - services.IMutateAdGroupAdLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupAdLabelService.mutateAdGroupAdLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupAdLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupAdService - */ - public get adGroupAds() { - const service = this.loadService( - "AdGroupAdServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupAds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAdGroupAd + * @returns services.MutateAdGroupAdsResponse + */ + update: async ( + adGroupAds: (resources.IAdGroupAd | resources.AdGroupAd)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupAdOperation, + resources.IAdGroupAd + >( + "update", + adGroupAds + // @ts-expect-error Static class type here is fine + , resources.AdGroupAd + ); + const request = this.buildRequest< + services.AdGroupAdOperation, services.IMutateAdGroupAdsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.AdGroupAd in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupAd - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAdGroupAdRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupAd(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupAdService.mutateAdGroupAds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroupAd - * @returns services.MutateAdGroupAdsResponse - */ - create: async ( - adGroupAds: (resources.IAdGroupAd | resources.AdGroupAd)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupAdOperation, - resources.IAdGroupAd - >("create", adGroupAds); - const request = this.buildRequest< - services.AdGroupAdOperation, - services.IMutateAdGroupAdsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupAdService.mutateAdGroupAds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupAds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupAds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupAdsResponse + */ + remove: async ( + adGroupAds: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupAdOperation, + string + >( + "remove", + adGroupAds + + + ); + const request = this.buildRequest< + services.AdGroupAdOperation, + services.IMutateAdGroupAdsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupAdService.mutateAdGroupAds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IAdGroupAd - * @returns services.MutateAdGroupAdsResponse - */ - update: async ( - adGroupAds: (resources.IAdGroupAd | resources.AdGroupAd)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupAdOperation, - resources.IAdGroupAd - >( - "update", - adGroupAds, - // @ts-expect-error Static class type here is fine - resources.AdGroupAd - ); - const request = this.buildRequest< - services.AdGroupAdOperation, - services.IMutateAdGroupAdsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupAdService.mutateAdGroupAds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupAds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupAds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupAssetService + */ + public get adGroupAssets() { + const service = this.loadService("AdGroupAssetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupAsset in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupAsset + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupAssetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupAsset(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupAsset + * @returns services.MutateAdGroupAssetsResponse + */ + create: async ( + adGroupAssets: (resources.IAdGroupAsset | resources.AdGroupAsset)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupAssetOperation, + resources.IAdGroupAsset + >( + "create", + adGroupAssets + + + ); + const request = this.buildRequest< + services.AdGroupAssetOperation, + services.IMutateAdGroupAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupAssetService.mutateAdGroupAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupAdsResponse - */ - remove: async ( - adGroupAds: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - adGroupAds - ); - const request = this.buildRequest< - services.AdGroupAdOperation, - services.IMutateAdGroupAdsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupAdService.mutateAdGroupAds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupAds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupAudienceViewService - */ - public get adGroupAudienceViews() { - const service = this.loadService( - "AdGroupAudienceViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.AdGroupAudienceView in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupAudienceView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAdGroupAudienceViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupAudienceView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupBidModifierService - */ - public get adGroupBidModifiers() { - const service = this.loadService( - "AdGroupBidModifierServiceClient" - ); - type MutateOptions = Partial< - Pick< + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAdGroupAsset + * @returns services.MutateAdGroupAssetsResponse + */ + update: async ( + adGroupAssets: (resources.IAdGroupAsset | resources.AdGroupAsset)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupAssetOperation, + resources.IAdGroupAsset + >( + "update", + adGroupAssets + // @ts-expect-error Static class type here is fine + , resources.AdGroupAsset + ); + const request = this.buildRequest< + services.AdGroupAssetOperation, + services.IMutateAdGroupAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupAssetService.mutateAdGroupAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupAssetsResponse + */ + remove: async ( + adGroupAssets: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupAssetOperation, + string + >( + "remove", + adGroupAssets + + + ); + const request = this.buildRequest< + services.AdGroupAssetOperation, + services.IMutateAdGroupAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupAssetService.mutateAdGroupAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupAudienceViewService + */ + public get adGroupAudienceViews() { + const service = this.loadService("AdGroupAudienceViewServiceClient") + + return { + + /** + * @description Retrieve a resources.AdGroupAudienceView in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupAudienceView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupAudienceViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupAudienceView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupBidModifierService + */ + public get adGroupBidModifiers() { + const service = this.loadService("AdGroupBidModifierServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupBidModifier in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupBidModifier + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupBidModifierRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupBidModifier(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupBidModifier + * @returns services.MutateAdGroupBidModifiersResponse + */ + create: async ( + adGroupBidModifiers: (resources.IAdGroupBidModifier | resources.AdGroupBidModifier)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupBidModifierOperation, + resources.IAdGroupBidModifier + >( + "create", + adGroupBidModifiers + + + ); + const request = this.buildRequest< + services.AdGroupBidModifierOperation, services.IMutateAdGroupBidModifiersRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.AdGroupBidModifier in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupBidModifier - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAdGroupBidModifierRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupBidModifier(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupBidModifierService.mutateAdGroupBidModifiers", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroupBidModifier - * @returns services.MutateAdGroupBidModifiersResponse - */ - create: async ( - adGroupBidModifiers: ( - | resources.IAdGroupBidModifier - | resources.AdGroupBidModifier - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupBidModifierOperation, - resources.IAdGroupBidModifier - >("create", adGroupBidModifiers); - const request = this.buildRequest< - services.AdGroupBidModifierOperation, - services.IMutateAdGroupBidModifiersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupBidModifierService.mutateAdGroupBidModifiers", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupBidModifiers(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupBidModifiers(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAdGroupBidModifier + * @returns services.MutateAdGroupBidModifiersResponse + */ + update: async ( + adGroupBidModifiers: (resources.IAdGroupBidModifier | resources.AdGroupBidModifier)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupBidModifierOperation, + resources.IAdGroupBidModifier + >( + "update", + adGroupBidModifiers + // @ts-expect-error Static class type here is fine + , resources.AdGroupBidModifier + ); + const request = this.buildRequest< + services.AdGroupBidModifierOperation, + services.IMutateAdGroupBidModifiersRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupBidModifierService.mutateAdGroupBidModifiers", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IAdGroupBidModifier - * @returns services.MutateAdGroupBidModifiersResponse - */ - update: async ( - adGroupBidModifiers: ( - | resources.IAdGroupBidModifier - | resources.AdGroupBidModifier - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupBidModifierOperation, - resources.IAdGroupBidModifier - >( - "update", - adGroupBidModifiers, - // @ts-expect-error Static class type here is fine - resources.AdGroupBidModifier - ); - const request = this.buildRequest< - services.AdGroupBidModifierOperation, - services.IMutateAdGroupBidModifiersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupBidModifierService.mutateAdGroupBidModifiers", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupBidModifiers(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupBidModifiers(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupBidModifiersResponse + */ + remove: async ( + adGroupBidModifiers: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupBidModifierOperation, + string + >( + "remove", + adGroupBidModifiers + + + ); + const request = this.buildRequest< + services.AdGroupBidModifierOperation, + services.IMutateAdGroupBidModifiersRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupBidModifierService.mutateAdGroupBidModifiers", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupBidModifiersResponse - */ - remove: async ( - adGroupBidModifiers: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupBidModifierOperation, - string - >("remove", adGroupBidModifiers); - const request = this.buildRequest< - services.AdGroupBidModifierOperation, - services.IMutateAdGroupBidModifiersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupBidModifierService.mutateAdGroupBidModifiers", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupBidModifiers(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupCriterionLabelService - */ - public get adGroupCriterionLabels() { - const service = this.loadService( - "AdGroupCriterionLabelServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupBidModifiers(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupCriterionLabelService + */ + public get adGroupCriterionLabels() { + const service = this.loadService("AdGroupCriterionLabelServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupCriterionLabel in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupCriterionLabel + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupCriterionLabelRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupCriterionLabel(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupCriterionLabel + * @returns services.MutateAdGroupCriterionLabelsResponse + */ + create: async ( + adGroupCriterionLabels: (resources.IAdGroupCriterionLabel | resources.AdGroupCriterionLabel)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupCriterionLabelOperation, + resources.IAdGroupCriterionLabel + >( + "create", + adGroupCriterionLabels + + + ); + const request = this.buildRequest< + services.AdGroupCriterionLabelOperation, services.IMutateAdGroupCriterionLabelsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.AdGroupCriterionLabel in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupCriterionLabel - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAdGroupCriterionLabelRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupCriterionLabel(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupCriterionLabelService.mutateAdGroupCriterionLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroupCriterionLabel - * @returns services.MutateAdGroupCriterionLabelsResponse - */ - create: async ( - adGroupCriterionLabels: ( - | resources.IAdGroupCriterionLabel - | resources.AdGroupCriterionLabel - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupCriterionLabelOperation, - resources.IAdGroupCriterionLabel - >("create", adGroupCriterionLabels); - const request = this.buildRequest< - services.AdGroupCriterionLabelOperation, - services.IMutateAdGroupCriterionLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupCriterionLabelService.mutateAdGroupCriterionLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupCriterionLabels( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupCriterionLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupCriterionLabelsResponse + */ + remove: async ( + adGroupCriterionLabels: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupCriterionLabelOperation, + string + >( + "remove", + adGroupCriterionLabels + + + ); + const request = this.buildRequest< + services.AdGroupCriterionLabelOperation, + services.IMutateAdGroupCriterionLabelsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupCriterionLabelService.mutateAdGroupCriterionLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupCriterionLabelsResponse - */ - remove: async ( - adGroupCriterionLabels: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupCriterionLabelOperation, - string - >("remove", adGroupCriterionLabels); - const request = this.buildRequest< - services.AdGroupCriterionLabelOperation, - services.IMutateAdGroupCriterionLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupCriterionLabelService.mutateAdGroupCriterionLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupCriterionLabels( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupCriterionService - */ - public get adGroupCriteria() { - const service = this.loadService( - "AdGroupCriterionServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupCriterionLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupCriterionService + */ + public get adGroupCriteria() { + const service = this.loadService("AdGroupCriterionServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupCriterion in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupCriterion + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupCriterionRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupCriterion(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupCriterion + * @returns services.MutateAdGroupCriteriaResponse + */ + create: async ( + adGroupCriteria: (resources.IAdGroupCriterion | resources.AdGroupCriterion)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupCriterionOperation, + resources.IAdGroupCriterion + >( + "create", + adGroupCriteria + + + ); + const request = this.buildRequest< + services.AdGroupCriterionOperation, services.IMutateAdGroupCriteriaRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.AdGroupCriterion in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupCriterion - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAdGroupCriterionRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupCriterion(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupCriterionService.mutateAdGroupCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroupCriterion - * @returns services.MutateAdGroupCriteriaResponse - */ - create: async ( - adGroupCriteria: ( - | resources.IAdGroupCriterion - | resources.AdGroupCriterion - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupCriterionOperation, - resources.IAdGroupCriterion - >("create", adGroupCriteria); - const request = this.buildRequest< - services.AdGroupCriterionOperation, - services.IMutateAdGroupCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupCriterionService.mutateAdGroupCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupCriteria(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAdGroupCriterion + * @returns services.MutateAdGroupCriteriaResponse + */ + update: async ( + adGroupCriteria: (resources.IAdGroupCriterion | resources.AdGroupCriterion)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupCriterionOperation, + resources.IAdGroupCriterion + >( + "update", + adGroupCriteria + // @ts-expect-error Static class type here is fine + , resources.AdGroupCriterion + ); + const request = this.buildRequest< + services.AdGroupCriterionOperation, + services.IMutateAdGroupCriteriaRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupCriterionService.mutateAdGroupCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IAdGroupCriterion - * @returns services.MutateAdGroupCriteriaResponse - */ - update: async ( - adGroupCriteria: ( - | resources.IAdGroupCriterion - | resources.AdGroupCriterion - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupCriterionOperation, - resources.IAdGroupCriterion - >( - "update", - adGroupCriteria, - // @ts-expect-error Static class type here is fine - resources.AdGroupCriterion - ); - const request = this.buildRequest< - services.AdGroupCriterionOperation, - services.IMutateAdGroupCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupCriterionService.mutateAdGroupCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupCriteria(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupCriteriaResponse + */ + remove: async ( + adGroupCriteria: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupCriterionOperation, + string + >( + "remove", + adGroupCriteria + + + ); + const request = this.buildRequest< + services.AdGroupCriterionOperation, + services.IMutateAdGroupCriteriaRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupCriterionService.mutateAdGroupCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupCriteriaResponse - */ - remove: async ( - adGroupCriteria: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupCriterionOperation, - string - >("remove", adGroupCriteria); - const request = this.buildRequest< - services.AdGroupCriterionOperation, - services.IMutateAdGroupCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupCriterionService.mutateAdGroupCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupCriteria(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupCriterionSimulationService - */ - public get adGroupCriterionSimulations() { - const service = this.loadService( - "AdGroupCriterionSimulationServiceClient" - ); - - return { - /** - * @description Retrieve a resources.AdGroupCriterionSimulation in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupCriterionSimulation - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAdGroupCriterionSimulationRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupCriterionSimulation( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupExtensionSettingService - */ - public get adGroupExtensionSettings() { - const service = this.loadService( - "AdGroupExtensionSettingServiceClient" - ); - type MutateOptions = Partial< - Pick< + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupCriterionSimulationService + */ + public get adGroupCriterionSimulations() { + const service = this.loadService("AdGroupCriterionSimulationServiceClient") + + return { + + /** + * @description Retrieve a resources.AdGroupCriterionSimulation in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupCriterionSimulation + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupCriterionSimulationRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupCriterionSimulation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupExtensionSettingService + */ + public get adGroupExtensionSettings() { + const service = this.loadService("AdGroupExtensionSettingServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupExtensionSetting in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupExtensionSetting + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupExtensionSettingRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupExtensionSetting(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupExtensionSetting + * @returns services.MutateAdGroupExtensionSettingsResponse + */ + create: async ( + adGroupExtensionSettings: (resources.IAdGroupExtensionSetting | resources.AdGroupExtensionSetting)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupExtensionSettingOperation, + resources.IAdGroupExtensionSetting + >( + "create", + adGroupExtensionSettings + + + ); + const request = this.buildRequest< + services.AdGroupExtensionSettingOperation, services.IMutateAdGroupExtensionSettingsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.AdGroupExtensionSetting in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupExtensionSetting - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAdGroupExtensionSettingRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupExtensionSetting(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupExtensionSettingService.mutateAdGroupExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroupExtensionSetting - * @returns services.MutateAdGroupExtensionSettingsResponse - */ - create: async ( - adGroupExtensionSettings: ( - | resources.IAdGroupExtensionSetting - | resources.AdGroupExtensionSetting - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupExtensionSettingOperation, - resources.IAdGroupExtensionSetting - >("create", adGroupExtensionSettings); - const request = this.buildRequest< - services.AdGroupExtensionSettingOperation, - services.IMutateAdGroupExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "AdGroupExtensionSettingService.mutateAdGroupExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAdGroupExtensionSetting + * @returns services.MutateAdGroupExtensionSettingsResponse + */ + update: async ( + adGroupExtensionSettings: (resources.IAdGroupExtensionSetting | resources.AdGroupExtensionSetting)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupExtensionSettingOperation, + resources.IAdGroupExtensionSetting + >( + "update", + adGroupExtensionSettings + // @ts-expect-error Static class type here is fine + , resources.AdGroupExtensionSetting + ); + const request = this.buildRequest< + services.AdGroupExtensionSettingOperation, + services.IMutateAdGroupExtensionSettingsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupExtensionSettingService.mutateAdGroupExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IAdGroupExtensionSetting - * @returns services.MutateAdGroupExtensionSettingsResponse - */ - update: async ( - adGroupExtensionSettings: ( - | resources.IAdGroupExtensionSetting - | resources.AdGroupExtensionSetting - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupExtensionSettingOperation, - resources.IAdGroupExtensionSetting - >( - "update", - adGroupExtensionSettings, - // @ts-expect-error Static class type here is fine - resources.AdGroupExtensionSetting - ); - const request = this.buildRequest< - services.AdGroupExtensionSettingOperation, - services.IMutateAdGroupExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "AdGroupExtensionSettingService.mutateAdGroupExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupExtensionSettingsResponse + */ + remove: async ( + adGroupExtensionSettings: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupExtensionSettingOperation, + string + >( + "remove", + adGroupExtensionSettings + + + ); + const request = this.buildRequest< + services.AdGroupExtensionSettingOperation, + services.IMutateAdGroupExtensionSettingsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupExtensionSettingService.mutateAdGroupExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupExtensionSettingsResponse - */ - remove: async ( - adGroupExtensionSettings: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupExtensionSettingOperation, - string - >("remove", adGroupExtensionSettings); - const request = this.buildRequest< - services.AdGroupExtensionSettingOperation, - services.IMutateAdGroupExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "AdGroupExtensionSettingService.mutateAdGroupExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupFeedService - */ - public get adGroupFeeds() { - const service = this.loadService( - "AdGroupFeedServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupFeedService + */ + public get adGroupFeeds() { + const service = this.loadService("AdGroupFeedServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupFeed in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupFeed + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupFeedRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupFeed(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupFeed + * @returns services.MutateAdGroupFeedsResponse + */ + create: async ( + adGroupFeeds: (resources.IAdGroupFeed | resources.AdGroupFeed)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupFeedOperation, + resources.IAdGroupFeed + >( + "create", + adGroupFeeds + + + ); + const request = this.buildRequest< + services.AdGroupFeedOperation, services.IMutateAdGroupFeedsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.AdGroupFeed in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupFeed - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAdGroupFeedRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupFeed(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupFeedService.mutateAdGroupFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroupFeed - * @returns services.MutateAdGroupFeedsResponse - */ - create: async ( - adGroupFeeds: (resources.IAdGroupFeed | resources.AdGroupFeed)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupFeedOperation, - resources.IAdGroupFeed - >("create", adGroupFeeds); - const request = this.buildRequest< - services.AdGroupFeedOperation, - services.IMutateAdGroupFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupFeedService.mutateAdGroupFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAdGroupFeed + * @returns services.MutateAdGroupFeedsResponse + */ + update: async ( + adGroupFeeds: (resources.IAdGroupFeed | resources.AdGroupFeed)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupFeedOperation, + resources.IAdGroupFeed + >( + "update", + adGroupFeeds + // @ts-expect-error Static class type here is fine + , resources.AdGroupFeed + ); + const request = this.buildRequest< + services.AdGroupFeedOperation, + services.IMutateAdGroupFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupFeedService.mutateAdGroupFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IAdGroupFeed - * @returns services.MutateAdGroupFeedsResponse - */ - update: async ( - adGroupFeeds: (resources.IAdGroupFeed | resources.AdGroupFeed)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupFeedOperation, - resources.IAdGroupFeed - >( - "update", - adGroupFeeds, - // @ts-expect-error Static class type here is fine - resources.AdGroupFeed - ); - const request = this.buildRequest< - services.AdGroupFeedOperation, - services.IMutateAdGroupFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupFeedService.mutateAdGroupFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupFeedsResponse + */ + remove: async ( + adGroupFeeds: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupFeedOperation, + string + >( + "remove", + adGroupFeeds + + + ); + const request = this.buildRequest< + services.AdGroupFeedOperation, + services.IMutateAdGroupFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupFeedService.mutateAdGroupFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupFeedsResponse - */ - remove: async ( - adGroupFeeds: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - adGroupFeeds - ); - const request = this.buildRequest< - services.AdGroupFeedOperation, - services.IMutateAdGroupFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupFeedService.mutateAdGroupFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupLabelService - */ - public get adGroupLabels() { - const service = this.loadService( - "AdGroupLabelServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupLabelService + */ + public get adGroupLabels() { + const service = this.loadService("AdGroupLabelServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroupLabel in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupLabel + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupLabelRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupLabel(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroupLabel + * @returns services.MutateAdGroupLabelsResponse + */ + create: async ( + adGroupLabels: (resources.IAdGroupLabel | resources.AdGroupLabel)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupLabelOperation, + resources.IAdGroupLabel + >( + "create", + adGroupLabels + + + ); + const request = this.buildRequest< + services.AdGroupLabelOperation, services.IMutateAdGroupLabelsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.AdGroupLabel in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupLabel - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAdGroupLabelRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupLabel(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupLabelService.mutateAdGroupLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroupLabel - * @returns services.MutateAdGroupLabelsResponse - */ - create: async ( - adGroupLabels: (resources.IAdGroupLabel | resources.AdGroupLabel)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupLabelOperation, - resources.IAdGroupLabel - >("create", adGroupLabels); - const request = this.buildRequest< - services.AdGroupLabelOperation, - services.IMutateAdGroupLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupLabelService.mutateAdGroupLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupLabelsResponse + */ + remove: async ( + adGroupLabels: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupLabelOperation, + string + >( + "remove", + adGroupLabels + + + ); + const request = this.buildRequest< + services.AdGroupLabelOperation, + services.IMutateAdGroupLabelsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupLabelService.mutateAdGroupLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupLabelsResponse - */ - remove: async ( - adGroupLabels: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupLabelOperation, - string - >("remove", adGroupLabels); - const request = this.buildRequest< - services.AdGroupLabelOperation, - services.IMutateAdGroupLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupLabelService.mutateAdGroupLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroupLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupService - */ - public get adGroups() { - const service = this.loadService( - "AdGroupServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroupLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupService + */ + public get adGroups() { + const service = this.loadService("AdGroupServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdGroup in full detail + * @warning Don't use get in production! + * @returns resources.AdGroup + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroup(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdGroup + * @returns services.MutateAdGroupsResponse + */ + create: async ( + adGroups: (resources.IAdGroup | resources.AdGroup)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupOperation, + resources.IAdGroup + >( + "create", + adGroups + + + ); + const request = this.buildRequest< + services.AdGroupOperation, services.IMutateAdGroupsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.AdGroup in full detail - * @warning Don't use get in production! - * @returns resources.AdGroup - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAdGroupRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroup(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupService.mutateAdGroups", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IAdGroup - * @returns services.MutateAdGroupsResponse - */ - create: async ( - adGroups: (resources.IAdGroup | resources.AdGroup)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupOperation, - resources.IAdGroup - >("create", adGroups); - const request = this.buildRequest< - services.AdGroupOperation, - services.IMutateAdGroupsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupService.mutateAdGroups", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroups(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroups(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAdGroup + * @returns services.MutateAdGroupsResponse + */ + update: async ( + adGroups: (resources.IAdGroup | resources.AdGroup)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupOperation, + resources.IAdGroup + >( + "update", + adGroups + // @ts-expect-error Static class type here is fine + , resources.AdGroup + ); + const request = this.buildRequest< + services.AdGroupOperation, + services.IMutateAdGroupsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupService.mutateAdGroups", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IAdGroup - * @returns services.MutateAdGroupsResponse - */ - update: async ( - adGroups: (resources.IAdGroup | resources.AdGroup)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdGroupOperation, - resources.IAdGroup - >( - "update", - adGroups, - // @ts-expect-error Static class type here is fine - resources.AdGroup - ); - const request = this.buildRequest< - services.AdGroupOperation, - services.IMutateAdGroupsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupService.mutateAdGroups", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroups(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroups(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdGroupsResponse + */ + remove: async ( + adGroups: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdGroupOperation, + string + >( + "remove", + adGroups + + + ); + const request = this.buildRequest< + services.AdGroupOperation, + services.IMutateAdGroupsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdGroupService.mutateAdGroups", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdGroupsResponse - */ - remove: async ( - adGroups: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - adGroups - ); - const request = this.buildRequest< - services.AdGroupOperation, - services.IMutateAdGroupsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdGroupService.mutateAdGroups", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdGroups(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdGroupSimulationService - */ - public get adGroupSimulations() { - const service = this.loadService( - "AdGroupSimulationServiceClient" - ); - - return { - /** - * @description Retrieve a resources.AdGroupSimulation in full detail - * @warning Don't use get in production! - * @returns resources.AdGroupSimulation - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetAdGroupSimulationRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdGroupSimulation(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdGroups(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdParameterService - */ - public get adParameters() { - const service = this.loadService( - "AdParameterServiceClient" - ); - type MutateOptions = Partial< - Pick< + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdGroupSimulationService + */ + public get adGroupSimulations() { + const service = this.loadService("AdGroupSimulationServiceClient") + + return { + + /** + * @description Retrieve a resources.AdGroupSimulation in full detail + * @warning Don't use get in production! + * @returns resources.AdGroupSimulation + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdGroupSimulationRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdGroupSimulation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdParameterService + */ + public get adParameters() { + const service = this.loadService("AdParameterServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.AdParameter in full detail + * @warning Don't use get in production! + * @returns resources.AdParameter + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdParameterRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdParameter(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAdParameter + * @returns services.MutateAdParametersResponse + */ + create: async ( + adParameters: (resources.IAdParameter | resources.AdParameter)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdParameterOperation, + resources.IAdParameter + >( + "create", + adParameters + + + ); + const request = this.buildRequest< + services.AdParameterOperation, services.IMutateAdParametersRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.AdParameter in full detail - * @warning Don't use get in production! - * @returns resources.AdParameter - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAdParameterRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdParameter(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.IAdParameter - * @returns services.MutateAdParametersResponse - */ - create: async ( - adParameters: (resources.IAdParameter | resources.AdParameter)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdParameterOperation, - resources.IAdParameter - >("create", adParameters); - const request = this.buildRequest< - services.AdParameterOperation, - services.IMutateAdParametersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdParameterService.mutateAdParameters", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdParameters(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description update resources of type resources.IAdParameter - * @returns services.MutateAdParametersResponse - */ - update: async ( - adParameters: (resources.IAdParameter | resources.AdParameter)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AdParameterOperation, - resources.IAdParameter - >( - "update", - adParameters, - // @ts-expect-error Static class type here is fine - resources.AdParameter - ); - const request = this.buildRequest< - services.AdParameterOperation, - services.IMutateAdParametersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdParameterService.mutateAdParameters", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdParameters(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdParameterService.mutateAdParameters", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateAdParametersResponse - */ - remove: async ( - adParameters: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - adParameters - ); - const request = this.buildRequest< - services.AdParameterOperation, - services.IMutateAdParametersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdParameterService.mutateAdParameters", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAdParameters(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdScheduleViewService - */ - public get adScheduleViews() { - const service = this.loadService( - "AdScheduleViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.AdScheduleView in full detail - * @warning Don't use get in production! - * @returns resources.AdScheduleView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAdScheduleViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAdScheduleView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdParameters(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AdService - */ - public get ads() { - const service = this.loadService("AdServiceClient"); - type MutateOptions = Partial< - Pick - >; - return { - /** - * @description Retrieve a resources.Ad in full detail - * @warning Don't use get in production! - * @returns resources.Ad - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAdRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAd(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAdParameter + * @returns services.MutateAdParametersResponse + */ + update: async ( + adParameters: (resources.IAdParameter | resources.AdParameter)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdParameterOperation, + resources.IAdParameter + >( + "update", + adParameters + // @ts-expect-error Static class type here is fine + , resources.AdParameter + ); + const request = this.buildRequest< + services.AdParameterOperation, + services.IMutateAdParametersRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdParameterService.mutateAdParameters", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IAd - * @returns services.MutateAdsResponse - */ - update: async ( - ads: (resources.IAd | resources.Ad)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "update", - ads, - // @ts-expect-error Static class type here is fine - resources.Ad - ); - const request = this.buildRequest< - services.AdOperation, - services.IMutateAdsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AdService.mutateAds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AgeRangeViewService - */ - public get ageRangeViews() { - const service = this.loadService( - "AgeRangeViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.AgeRangeView in full detail - * @warning Don't use get in production! - * @returns resources.AgeRangeView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAgeRangeViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAgeRangeView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdParameters(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/AssetService - */ - public get assets() { - const service = this.loadService( - "AssetServiceClient" - ); - type MutateOptions = Partial< - Pick - >; - return { - /** - * @description Retrieve a resources.Asset in full detail - * @warning Don't use get in production! - * @returns resources.Asset - */ - get: async (resourceName: string): Promise => { - const request = new services.GetAssetRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getAsset(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.IAsset - * @returns services.MutateAssetsResponse - */ - create: async ( - assets: (resources.IAsset | resources.Asset)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AssetOperation, - resources.IAsset - >("create", assets); - const request = this.buildRequest< - services.AssetOperation, - services.IMutateAssetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AssetService.mutateAssets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAssets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description update resources of type resources.IAsset - * @returns services.MutateAssetsResponse - */ - update: async ( - assets: (resources.IAsset | resources.Asset)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.AssetOperation, - resources.IAsset - >( - "update", - assets, - // @ts-expect-error Static class type here is fine - resources.Asset - ); - const request = this.buildRequest< - services.AssetOperation, - services.IMutateAssetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "AssetService.mutateAssets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateAssets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BatchJobService - */ - public get batchJobs() { - const service = this.loadService( - "BatchJobServiceClient" - ); - type MutateOptions = never; - return { - /** - * @description create resources of type resources.IBatchJob - * @returns services.MutateBatchJobResponse - */ - create: async ( - batchJobs: (resources.IBatchJob | resources.BatchJob)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.BatchJobOperation, - resources.IBatchJob - >("create", batchJobs); - const request = this.buildRequest< - services.BatchJobOperation, - services.IMutateBatchJobRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "BatchJobService.mutateBatchJob", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateBatchJob(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description Retrieve a resources.BatchJob in full detail - * @warning Don't use get in production! - * @returns resources.BatchJob - */ - get: async (resourceName: string): Promise => { - const request = new services.GetBatchJobRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getBatchJob(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BatchJobService#listbatchjobresults - */ - listBatchJobResults: async ( - request: services.ListBatchJobResultsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listBatchJobResults(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateAdParametersResponse + */ + remove: async ( + adParameters: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdParameterOperation, + string + >( + "remove", + adParameters + + + ); + const request = this.buildRequest< + services.AdParameterOperation, + services.IMutateAdParametersRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdParameterService.mutateAdParameters", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BatchJobService#runbatchjob - */ - runBatchJob: async ( - request: services.RunBatchJobRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.runBatchJob(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAdParameters(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdScheduleViewService + */ + public get adScheduleViews() { + const service = this.loadService("AdScheduleViewServiceClient") + + return { + + /** + * @description Retrieve a resources.AdScheduleView in full detail + * @warning Don't use get in production! + * @returns resources.AdScheduleView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdScheduleViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAdScheduleView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AdService + */ + public get ads() { + const service = this.loadService("AdServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.Ad in full detail + * @warning Don't use get in production! + * @returns resources.Ad + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAdRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAd(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description update resources of type resources.IAd + * @returns services.MutateAdsResponse + */ + update: async ( + ads: (resources.IAd | resources.Ad)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AdOperation, + resources.IAd + >( + "update", + ads + // @ts-expect-error Static class type here is fine + , resources.Ad + ); + const request = this.buildRequest< + services.AdOperation, + services.IMutateAdsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AdService.mutateAds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BatchJobService#addbatchjoboperations - */ - addBatchJobOperations: async ( - request: services.AddBatchJobOperationsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.addBatchJobOperations(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BiddingStrategyService - */ - public get biddingStrategies() { - const service = this.loadService( - "BiddingStrategyServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AgeRangeViewService + */ + public get ageRangeViews() { + const service = this.loadService("AgeRangeViewServiceClient") + + return { + + /** + * @description Retrieve a resources.AgeRangeView in full detail + * @warning Don't use get in production! + * @returns resources.AgeRangeView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAgeRangeViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAgeRangeView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/AssetService + */ + public get assets() { + const service = this.loadService("AssetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.Asset in full detail + * @warning Don't use get in production! + * @returns resources.Asset + */ + get: async (resourceName: string): Promise => { + const request = new services.GetAssetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getAsset(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IAsset + * @returns services.MutateAssetsResponse + */ + create: async ( + assets: (resources.IAsset | resources.Asset)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AssetOperation, + resources.IAsset + >( + "create", + assets + + + ); + const request = this.buildRequest< + services.AssetOperation, + services.IMutateAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AssetService.mutateAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IAsset + * @returns services.MutateAssetsResponse + */ + update: async ( + assets: (resources.IAsset | resources.Asset)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.AssetOperation, + resources.IAsset + >( + "update", + assets + // @ts-expect-error Static class type here is fine + , resources.Asset + ); + const request = this.buildRequest< + services.AssetOperation, + services.IMutateAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "AssetService.mutateAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BatchJobService + */ + public get batchJobs() { + const service = this.loadService("BatchJobServiceClient") + type MutateOptions = never + return { + + /** + * @description create resources of type resources.IBatchJob + * @returns services.MutateBatchJobResponse + */ + create: async ( + batchJobs: (resources.IBatchJob | resources.BatchJob)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.BatchJobOperation, + resources.IBatchJob + >( + "create", + batchJobs + + + ); + const request = this.buildRequest< + services.BatchJobOperation, + services.IMutateBatchJobRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "BatchJobService.mutateBatchJob", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateBatchJob(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description Retrieve a resources.BatchJob in full detail + * @warning Don't use get in production! + * @returns resources.BatchJob + */ + get: async (resourceName: string): Promise => { + const request = new services.GetBatchJobRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getBatchJob(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BatchJobService#listbatchjobresults + */ + listBatchJobResults: async (request: services.ListBatchJobResultsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listBatchJobResults(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BatchJobService#runbatchjob + */ + runBatchJob: async (request: services.RunBatchJobRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.runBatchJob(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BatchJobService#addbatchjoboperations + */ + addBatchJobOperations: async (request: services.AddBatchJobOperationsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.addBatchJobOperations(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BiddingStrategyService + */ + public get biddingStrategies() { + const service = this.loadService("BiddingStrategyServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.BiddingStrategy in full detail + * @warning Don't use get in production! + * @returns resources.BiddingStrategy + */ + get: async (resourceName: string): Promise => { + const request = new services.GetBiddingStrategyRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getBiddingStrategy(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IBiddingStrategy + * @returns services.MutateBiddingStrategiesResponse + */ + create: async ( + biddingStrategies: (resources.IBiddingStrategy | resources.BiddingStrategy)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.BiddingStrategyOperation, + resources.IBiddingStrategy + >( + "create", + biddingStrategies + + + ); + const request = this.buildRequest< + services.BiddingStrategyOperation, services.IMutateBiddingStrategiesRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.BiddingStrategy in full detail - * @warning Don't use get in production! - * @returns resources.BiddingStrategy - */ - get: async (resourceName: string): Promise => { - const request = new services.GetBiddingStrategyRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getBiddingStrategy(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "BiddingStrategyService.mutateBiddingStrategies", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IBiddingStrategy - * @returns services.MutateBiddingStrategiesResponse - */ - create: async ( - biddingStrategies: ( - | resources.IBiddingStrategy - | resources.BiddingStrategy - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.BiddingStrategyOperation, - resources.IBiddingStrategy - >("create", biddingStrategies); - const request = this.buildRequest< - services.BiddingStrategyOperation, - services.IMutateBiddingStrategiesRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "BiddingStrategyService.mutateBiddingStrategies", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateBiddingStrategies(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateBiddingStrategies(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IBiddingStrategy + * @returns services.MutateBiddingStrategiesResponse + */ + update: async ( + biddingStrategies: (resources.IBiddingStrategy | resources.BiddingStrategy)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.BiddingStrategyOperation, + resources.IBiddingStrategy + >( + "update", + biddingStrategies + // @ts-expect-error Static class type here is fine + , resources.BiddingStrategy + ); + const request = this.buildRequest< + services.BiddingStrategyOperation, + services.IMutateBiddingStrategiesRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "BiddingStrategyService.mutateBiddingStrategies", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IBiddingStrategy - * @returns services.MutateBiddingStrategiesResponse - */ - update: async ( - biddingStrategies: ( - | resources.IBiddingStrategy - | resources.BiddingStrategy - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.BiddingStrategyOperation, - resources.IBiddingStrategy - >( - "update", - biddingStrategies, - // @ts-expect-error Static class type here is fine - resources.BiddingStrategy - ); - const request = this.buildRequest< - services.BiddingStrategyOperation, - services.IMutateBiddingStrategiesRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "BiddingStrategyService.mutateBiddingStrategies", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateBiddingStrategies(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateBiddingStrategies(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateBiddingStrategiesResponse + */ + remove: async ( + biddingStrategies: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.BiddingStrategyOperation, + string + >( + "remove", + biddingStrategies + + + ); + const request = this.buildRequest< + services.BiddingStrategyOperation, + services.IMutateBiddingStrategiesRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "BiddingStrategyService.mutateBiddingStrategies", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateBiddingStrategiesResponse - */ - remove: async ( - biddingStrategies: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.BiddingStrategyOperation, - string - >("remove", biddingStrategies); - const request = this.buildRequest< - services.BiddingStrategyOperation, - services.IMutateBiddingStrategiesRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "BiddingStrategyService.mutateBiddingStrategies", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateBiddingStrategies(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignAssetService - */ - public get campaignAssets() { - const service = this.loadService( - "CampaignAssetServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateBiddingStrategies(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignAssetService + */ + public get campaignAssets() { + const service = this.loadService("CampaignAssetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignAsset in full detail + * @warning Don't use get in production! + * @returns resources.CampaignAsset + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignAssetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignAsset(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignAsset + * @returns services.MutateCampaignAssetsResponse + */ + create: async ( + campaignAssets: (resources.ICampaignAsset | resources.CampaignAsset)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignAssetOperation, + resources.ICampaignAsset + >( + "create", + campaignAssets + + + ); + const request = this.buildRequest< + services.CampaignAssetOperation, services.IMutateCampaignAssetsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.CampaignAsset in full detail - * @warning Don't use get in production! - * @returns resources.CampaignAsset - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCampaignAssetRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignAsset(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignAssetService.mutateCampaignAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaignAsset - * @returns services.MutateCampaignAssetsResponse - */ - create: async ( - campaignAssets: (resources.ICampaignAsset | resources.CampaignAsset)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignAssetOperation, - resources.ICampaignAsset - >("create", campaignAssets); - const request = this.buildRequest< - services.CampaignAssetOperation, - services.IMutateCampaignAssetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignAssetService.mutateCampaignAssets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignAssets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICampaignAsset + * @returns services.MutateCampaignAssetsResponse + */ + update: async ( + campaignAssets: (resources.ICampaignAsset | resources.CampaignAsset)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignAssetOperation, + resources.ICampaignAsset + >( + "update", + campaignAssets + // @ts-expect-error Static class type here is fine + , resources.CampaignAsset + ); + const request = this.buildRequest< + services.CampaignAssetOperation, + services.IMutateCampaignAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignAssetService.mutateCampaignAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignAssetsResponse - */ - remove: async ( - campaignAssets: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignAssetOperation, - string - >("remove", campaignAssets); - const request = this.buildRequest< - services.CampaignAssetOperation, - services.IMutateCampaignAssetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignAssetService.mutateCampaignAssets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignAssets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignBidModifierService - */ - public get campaignBidModifiers() { - const service = this.loadService( - "CampaignBidModifierServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignAssetsResponse + */ + remove: async ( + campaignAssets: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignAssetOperation, + string + >( + "remove", + campaignAssets + + + ); + const request = this.buildRequest< + services.CampaignAssetOperation, + services.IMutateCampaignAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignAssetService.mutateCampaignAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignBidModifierService + */ + public get campaignBidModifiers() { + const service = this.loadService("CampaignBidModifierServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignBidModifier in full detail + * @warning Don't use get in production! + * @returns resources.CampaignBidModifier + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignBidModifierRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignBidModifier(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignBidModifier + * @returns services.MutateCampaignBidModifiersResponse + */ + create: async ( + campaignBidModifiers: (resources.ICampaignBidModifier | resources.CampaignBidModifier)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignBidModifierOperation, + resources.ICampaignBidModifier + >( + "create", + campaignBidModifiers + + + ); + const request = this.buildRequest< + services.CampaignBidModifierOperation, services.IMutateCampaignBidModifiersRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CampaignBidModifier in full detail - * @warning Don't use get in production! - * @returns resources.CampaignBidModifier - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCampaignBidModifierRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignBidModifier(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignBidModifierService.mutateCampaignBidModifiers", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaignBidModifier - * @returns services.MutateCampaignBidModifiersResponse - */ - create: async ( - campaignBidModifiers: ( - | resources.ICampaignBidModifier - | resources.CampaignBidModifier - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignBidModifierOperation, - resources.ICampaignBidModifier - >("create", campaignBidModifiers); - const request = this.buildRequest< - services.CampaignBidModifierOperation, - services.IMutateCampaignBidModifiersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignBidModifierService.mutateCampaignBidModifiers", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignBidModifiers(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignBidModifiers(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICampaignBidModifier + * @returns services.MutateCampaignBidModifiersResponse + */ + update: async ( + campaignBidModifiers: (resources.ICampaignBidModifier | resources.CampaignBidModifier)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignBidModifierOperation, + resources.ICampaignBidModifier + >( + "update", + campaignBidModifiers + // @ts-expect-error Static class type here is fine + , resources.CampaignBidModifier + ); + const request = this.buildRequest< + services.CampaignBidModifierOperation, + services.IMutateCampaignBidModifiersRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignBidModifierService.mutateCampaignBidModifiers", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICampaignBidModifier - * @returns services.MutateCampaignBidModifiersResponse - */ - update: async ( - campaignBidModifiers: ( - | resources.ICampaignBidModifier - | resources.CampaignBidModifier - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignBidModifierOperation, - resources.ICampaignBidModifier - >( - "update", - campaignBidModifiers, - // @ts-expect-error Static class type here is fine - resources.CampaignBidModifier - ); - const request = this.buildRequest< - services.CampaignBidModifierOperation, - services.IMutateCampaignBidModifiersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignBidModifierService.mutateCampaignBidModifiers", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignBidModifiers(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignBidModifiers(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignBidModifiersResponse + */ + remove: async ( + campaignBidModifiers: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignBidModifierOperation, + string + >( + "remove", + campaignBidModifiers + + + ); + const request = this.buildRequest< + services.CampaignBidModifierOperation, + services.IMutateCampaignBidModifiersRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignBidModifierService.mutateCampaignBidModifiers", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignBidModifiersResponse - */ - remove: async ( - campaignBidModifiers: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignBidModifierOperation, - string - >("remove", campaignBidModifiers); - const request = this.buildRequest< - services.CampaignBidModifierOperation, - services.IMutateCampaignBidModifiersRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignBidModifierService.mutateCampaignBidModifiers", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignBidModifiers(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignBudgetService - */ - public get campaignBudgets() { - const service = this.loadService( - "CampaignBudgetServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignBidModifiers(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignBudgetService + */ + public get campaignBudgets() { + const service = this.loadService("CampaignBudgetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignBudget in full detail + * @warning Don't use get in production! + * @returns resources.CampaignBudget + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignBudgetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignBudget(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignBudget + * @returns services.MutateCampaignBudgetsResponse + */ + create: async ( + campaignBudgets: (resources.ICampaignBudget | resources.CampaignBudget)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignBudgetOperation, + resources.ICampaignBudget + >( + "create", + campaignBudgets + + + ); + const request = this.buildRequest< + services.CampaignBudgetOperation, services.IMutateCampaignBudgetsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CampaignBudget in full detail - * @warning Don't use get in production! - * @returns resources.CampaignBudget - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCampaignBudgetRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignBudget(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignBudgetService.mutateCampaignBudgets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaignBudget - * @returns services.MutateCampaignBudgetsResponse - */ - create: async ( - campaignBudgets: ( - | resources.ICampaignBudget - | resources.CampaignBudget - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignBudgetOperation, - resources.ICampaignBudget - >("create", campaignBudgets); - const request = this.buildRequest< - services.CampaignBudgetOperation, - services.IMutateCampaignBudgetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignBudgetService.mutateCampaignBudgets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignBudgets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignBudgets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICampaignBudget + * @returns services.MutateCampaignBudgetsResponse + */ + update: async ( + campaignBudgets: (resources.ICampaignBudget | resources.CampaignBudget)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignBudgetOperation, + resources.ICampaignBudget + >( + "update", + campaignBudgets + // @ts-expect-error Static class type here is fine + , resources.CampaignBudget + ); + const request = this.buildRequest< + services.CampaignBudgetOperation, + services.IMutateCampaignBudgetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignBudgetService.mutateCampaignBudgets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICampaignBudget - * @returns services.MutateCampaignBudgetsResponse - */ - update: async ( - campaignBudgets: ( - | resources.ICampaignBudget - | resources.CampaignBudget - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignBudgetOperation, - resources.ICampaignBudget - >( - "update", - campaignBudgets, - // @ts-expect-error Static class type here is fine - resources.CampaignBudget - ); - const request = this.buildRequest< - services.CampaignBudgetOperation, - services.IMutateCampaignBudgetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignBudgetService.mutateCampaignBudgets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignBudgets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignBudgets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignBudgetsResponse + */ + remove: async ( + campaignBudgets: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignBudgetOperation, + string + >( + "remove", + campaignBudgets + + + ); + const request = this.buildRequest< + services.CampaignBudgetOperation, + services.IMutateCampaignBudgetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignBudgetService.mutateCampaignBudgets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignBudgetsResponse - */ - remove: async ( - campaignBudgets: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignBudgetOperation, - string - >("remove", campaignBudgets); - const request = this.buildRequest< - services.CampaignBudgetOperation, - services.IMutateCampaignBudgetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignBudgetService.mutateCampaignBudgets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignBudgets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignCriterionService - */ - public get campaignCriteria() { - const service = this.loadService( - "CampaignCriterionServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignBudgets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignCriterionService + */ + public get campaignCriteria() { + const service = this.loadService("CampaignCriterionServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignCriterion in full detail + * @warning Don't use get in production! + * @returns resources.CampaignCriterion + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignCriterionRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignCriterion(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignCriterion + * @returns services.MutateCampaignCriteriaResponse + */ + create: async ( + campaignCriteria: (resources.ICampaignCriterion | resources.CampaignCriterion)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignCriterionOperation, + resources.ICampaignCriterion + >( + "create", + campaignCriteria + + + ); + const request = this.buildRequest< + services.CampaignCriterionOperation, services.IMutateCampaignCriteriaRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CampaignCriterion in full detail - * @warning Don't use get in production! - * @returns resources.CampaignCriterion - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCampaignCriterionRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignCriterion(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignCriterionService.mutateCampaignCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaignCriterion - * @returns services.MutateCampaignCriteriaResponse - */ - create: async ( - campaignCriteria: ( - | resources.ICampaignCriterion - | resources.CampaignCriterion - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignCriterionOperation, - resources.ICampaignCriterion - >("create", campaignCriteria); - const request = this.buildRequest< - services.CampaignCriterionOperation, - services.IMutateCampaignCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignCriterionService.mutateCampaignCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignCriteria(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICampaignCriterion + * @returns services.MutateCampaignCriteriaResponse + */ + update: async ( + campaignCriteria: (resources.ICampaignCriterion | resources.CampaignCriterion)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignCriterionOperation, + resources.ICampaignCriterion + >( + "update", + campaignCriteria + // @ts-expect-error Static class type here is fine + , resources.CampaignCriterion + ); + const request = this.buildRequest< + services.CampaignCriterionOperation, + services.IMutateCampaignCriteriaRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignCriterionService.mutateCampaignCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICampaignCriterion - * @returns services.MutateCampaignCriteriaResponse - */ - update: async ( - campaignCriteria: ( - | resources.ICampaignCriterion - | resources.CampaignCriterion - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignCriterionOperation, - resources.ICampaignCriterion - >( - "update", - campaignCriteria, - // @ts-expect-error Static class type here is fine - resources.CampaignCriterion - ); - const request = this.buildRequest< - services.CampaignCriterionOperation, - services.IMutateCampaignCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignCriterionService.mutateCampaignCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignCriteria(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignCriteriaResponse + */ + remove: async ( + campaignCriteria: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignCriterionOperation, + string + >( + "remove", + campaignCriteria + + + ); + const request = this.buildRequest< + services.CampaignCriterionOperation, + services.IMutateCampaignCriteriaRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignCriterionService.mutateCampaignCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignCriteriaResponse - */ - remove: async ( - campaignCriteria: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignCriterionOperation, - string - >("remove", campaignCriteria); - const request = this.buildRequest< - services.CampaignCriterionOperation, - services.IMutateCampaignCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignCriterionService.mutateCampaignCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignCriteria(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignDraftService - */ - public get campaignDrafts() { - const service = this.loadService( - "CampaignDraftServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignDraftService + */ + public get campaignDrafts() { + const service = this.loadService("CampaignDraftServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignDraft in full detail + * @warning Don't use get in production! + * @returns resources.CampaignDraft + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignDraftRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignDraft(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignDraft + * @returns services.MutateCampaignDraftsResponse + */ + create: async ( + campaignDrafts: (resources.ICampaignDraft | resources.CampaignDraft)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignDraftOperation, + resources.ICampaignDraft + >( + "create", + campaignDrafts + + + ); + const request = this.buildRequest< + services.CampaignDraftOperation, services.IMutateCampaignDraftsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CampaignDraft in full detail - * @warning Don't use get in production! - * @returns resources.CampaignDraft - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCampaignDraftRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignDraft(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.ICampaignDraft - * @returns services.MutateCampaignDraftsResponse - */ - create: async ( - campaignDrafts: (resources.ICampaignDraft | resources.CampaignDraft)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignDraftOperation, - resources.ICampaignDraft - >("create", campaignDrafts); - const request = this.buildRequest< - services.CampaignDraftOperation, - services.IMutateCampaignDraftsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignDraftService.mutateCampaignDrafts", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignDrafts(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description update resources of type resources.ICampaignDraft - * @returns services.MutateCampaignDraftsResponse - */ - update: async ( - campaignDrafts: (resources.ICampaignDraft | resources.CampaignDraft)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignDraftOperation, - resources.ICampaignDraft - >( - "update", - campaignDrafts, - // @ts-expect-error Static class type here is fine - resources.CampaignDraft - ); - const request = this.buildRequest< - services.CampaignDraftOperation, - services.IMutateCampaignDraftsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignDraftService.mutateCampaignDrafts", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignDrafts(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignDraftService.mutateCampaignDrafts", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignDraftsResponse - */ - remove: async ( - campaignDrafts: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignDraftOperation, - string - >("remove", campaignDrafts); - const request = this.buildRequest< - services.CampaignDraftOperation, - services.IMutateCampaignDraftsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignDraftService.mutateCampaignDrafts", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignDrafts(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignDrafts(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICampaignDraft + * @returns services.MutateCampaignDraftsResponse + */ + update: async ( + campaignDrafts: (resources.ICampaignDraft | resources.CampaignDraft)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignDraftOperation, + resources.ICampaignDraft + >( + "update", + campaignDrafts + // @ts-expect-error Static class type here is fine + , resources.CampaignDraft + ); + const request = this.buildRequest< + services.CampaignDraftOperation, + services.IMutateCampaignDraftsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignDraftService.mutateCampaignDrafts", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignDraftService#promotecampaigndraft - */ - promoteCampaignDraft: async ( - request: services.PromoteCampaignDraftRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.promoteCampaignDraft(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignDrafts(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignDraftsResponse + */ + remove: async ( + campaignDrafts: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignDraftOperation, + string + >( + "remove", + campaignDrafts + + + ); + const request = this.buildRequest< + services.CampaignDraftOperation, + services.IMutateCampaignDraftsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignDraftService.mutateCampaignDrafts", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignDraftService#listcampaigndraftasyncerrors - */ - listCampaignDraftAsyncErrors: async ( - request: services.ListCampaignDraftAsyncErrorsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listCampaignDraftAsyncErrors( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentService - */ - public get campaignExperiments() { - const service = this.loadService( - "CampaignExperimentServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignDrafts(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignDraftService#promotecampaigndraft + */ + promoteCampaignDraft: async (request: services.PromoteCampaignDraftRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.promoteCampaignDraft(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignDraftService#listcampaigndraftasyncerrors + */ + listCampaignDraftAsyncErrors: async (request: services.ListCampaignDraftAsyncErrorsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listCampaignDraftAsyncErrors(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentService + */ + public get campaignExperiments() { + const service = this.loadService("CampaignExperimentServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignExperiment in full detail + * @warning Don't use get in production! + * @returns resources.CampaignExperiment + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignExperimentRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignExperiment(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentService#createcampaignexperiment + */ + createCampaignExperiment: async (request: services.CreateCampaignExperimentRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.createCampaignExperiment(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description update resources of type resources.ICampaignExperiment + * @returns services.MutateCampaignExperimentsResponse + */ + update: async ( + campaignExperiments: (resources.ICampaignExperiment | resources.CampaignExperiment)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignExperimentOperation, + resources.ICampaignExperiment + >( + "update", + campaignExperiments + // @ts-expect-error Static class type here is fine + , resources.CampaignExperiment + ); + const request = this.buildRequest< + services.CampaignExperimentOperation, services.IMutateCampaignExperimentsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CampaignExperiment in full detail - * @warning Don't use get in production! - * @returns resources.CampaignExperiment - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCampaignExperimentRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignExperiment(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignExperimentService.mutateCampaignExperiments", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentService#createcampaignexperiment - */ - createCampaignExperiment: async ( - request: services.CreateCampaignExperimentRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.createCampaignExperiment(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignExperiments(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignExperimentsResponse + */ + remove: async ( + campaignExperiments: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignExperimentOperation, + string + >( + "remove", + campaignExperiments + + + ); + const request = this.buildRequest< + services.CampaignExperimentOperation, + services.IMutateCampaignExperimentsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignExperimentService.mutateCampaignExperiments", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICampaignExperiment - * @returns services.MutateCampaignExperimentsResponse - */ - update: async ( - campaignExperiments: ( - | resources.ICampaignExperiment - | resources.CampaignExperiment - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignExperimentOperation, - resources.ICampaignExperiment - >( - "update", - campaignExperiments, - // @ts-expect-error Static class type here is fine - resources.CampaignExperiment - ); - const request = this.buildRequest< - services.CampaignExperimentOperation, - services.IMutateCampaignExperimentsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignExperimentService.mutateCampaignExperiments", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignExperiments(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignExperiments(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentService#graduatecampaignexperiment + */ + graduateCampaignExperiment: async (request: services.GraduateCampaignExperimentRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.graduateCampaignExperiment(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentService#promotecampaignexperiment + */ + promoteCampaignExperiment: async (request: services.PromoteCampaignExperimentRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.promoteCampaignExperiment(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentService#endcampaignexperiment + */ + endCampaignExperiment: async (request: services.EndCampaignExperimentRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.endCampaignExperiment(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExperimentService#listcampaignexperimentasyncerrors + */ + listCampaignExperimentAsyncErrors: async (request: services.ListCampaignExperimentAsyncErrorsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listCampaignExperimentAsyncErrors(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignExtensionSettingService + */ + public get campaignExtensionSettings() { + const service = this.loadService("CampaignExtensionSettingServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignExtensionSetting in full detail + * @warning Don't use get in production! + * @returns resources.CampaignExtensionSetting + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignExtensionSettingRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignExtensionSetting(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignExtensionSetting + * @returns services.MutateCampaignExtensionSettingsResponse + */ + create: async ( + campaignExtensionSettings: (resources.ICampaignExtensionSetting | resources.CampaignExtensionSetting)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignExtensionSettingOperation, + resources.ICampaignExtensionSetting + >( + "create", + campaignExtensionSettings + + + ); + const request = this.buildRequest< + services.CampaignExtensionSettingOperation, + services.IMutateCampaignExtensionSettingsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignExtensionSettingService.mutateCampaignExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignExperimentsResponse - */ - remove: async ( - campaignExperiments: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignExperimentOperation, - string - >("remove", campaignExperiments); - const request = this.buildRequest< - services.CampaignExperimentOperation, - services.IMutateCampaignExperimentsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignExperimentService.mutateCampaignExperiments", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignExperiments(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICampaignExtensionSetting + * @returns services.MutateCampaignExtensionSettingsResponse + */ + update: async ( + campaignExtensionSettings: (resources.ICampaignExtensionSetting | resources.CampaignExtensionSetting)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignExtensionSettingOperation, + resources.ICampaignExtensionSetting + >( + "update", + campaignExtensionSettings + // @ts-expect-error Static class type here is fine + , resources.CampaignExtensionSetting + ); + const request = this.buildRequest< + services.CampaignExtensionSettingOperation, + services.IMutateCampaignExtensionSettingsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignExtensionSettingService.mutateCampaignExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentService#graduatecampaignexperiment - */ - graduateCampaignExperiment: async ( - request: services.GraduateCampaignExperimentRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.graduateCampaignExperiment(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignExtensionSettingsResponse + */ + remove: async ( + campaignExtensionSettings: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignExtensionSettingOperation, + string + >( + "remove", + campaignExtensionSettings + + + ); + const request = this.buildRequest< + services.CampaignExtensionSettingOperation, + services.IMutateCampaignExtensionSettingsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignExtensionSettingService.mutateCampaignExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentService#promotecampaignexperiment - */ - promoteCampaignExperiment: async ( - request: services.PromoteCampaignExperimentRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.promoteCampaignExperiment(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignFeedService + */ + public get campaignFeeds() { + const service = this.loadService("CampaignFeedServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignFeed in full detail + * @warning Don't use get in production! + * @returns resources.CampaignFeed + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignFeedRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignFeed(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignFeed + * @returns services.MutateCampaignFeedsResponse + */ + create: async ( + campaignFeeds: (resources.ICampaignFeed | resources.CampaignFeed)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignFeedOperation, + resources.ICampaignFeed + >( + "create", + campaignFeeds + + + ); + const request = this.buildRequest< + services.CampaignFeedOperation, + services.IMutateCampaignFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignFeedService.mutateCampaignFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentService#endcampaignexperiment - */ - endCampaignExperiment: async ( - request: services.EndCampaignExperimentRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.endCampaignExperiment(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICampaignFeed + * @returns services.MutateCampaignFeedsResponse + */ + update: async ( + campaignFeeds: (resources.ICampaignFeed | resources.CampaignFeed)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignFeedOperation, + resources.ICampaignFeed + >( + "update", + campaignFeeds + // @ts-expect-error Static class type here is fine + , resources.CampaignFeed + ); + const request = this.buildRequest< + services.CampaignFeedOperation, + services.IMutateCampaignFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignFeedService.mutateCampaignFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExperimentService#listcampaignexperimentasyncerrors - */ - listCampaignExperimentAsyncErrors: async ( - request: services.ListCampaignExperimentAsyncErrorsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listCampaignExperimentAsyncErrors( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignExtensionSettingService - */ - public get campaignExtensionSettings() { - const service = this.loadService( - "CampaignExtensionSettingServiceClient" - ); - type MutateOptions = Partial< - Pick< - services.IMutateCampaignExtensionSettingsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.CampaignExtensionSetting in full detail - * @warning Don't use get in production! - * @returns resources.CampaignExtensionSetting - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCampaignExtensionSettingRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignExtensionSetting( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignFeedsResponse + */ + remove: async ( + campaignFeeds: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignFeedOperation, + string + >( + "remove", + campaignFeeds + + + ); + const request = this.buildRequest< + services.CampaignFeedOperation, + services.IMutateCampaignFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignFeedService.mutateCampaignFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaignExtensionSetting - * @returns services.MutateCampaignExtensionSettingsResponse - */ - create: async ( - campaignExtensionSettings: ( - | resources.ICampaignExtensionSetting - | resources.CampaignExtensionSetting - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignExtensionSettingOperation, - resources.ICampaignExtensionSetting - >("create", campaignExtensionSettings); - const request = this.buildRequest< - services.CampaignExtensionSettingOperation, - services.IMutateCampaignExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CampaignExtensionSettingService.mutateCampaignExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignLabelService + */ + public get campaignLabels() { + const service = this.loadService("CampaignLabelServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignLabel in full detail + * @warning Don't use get in production! + * @returns resources.CampaignLabel + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignLabelRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignLabel(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignLabel + * @returns services.MutateCampaignLabelsResponse + */ + create: async ( + campaignLabels: (resources.ICampaignLabel | resources.CampaignLabel)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignLabelOperation, + resources.ICampaignLabel + >( + "create", + campaignLabels + + + ); + const request = this.buildRequest< + services.CampaignLabelOperation, + services.IMutateCampaignLabelsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignLabelService.mutateCampaignLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICampaignExtensionSetting - * @returns services.MutateCampaignExtensionSettingsResponse - */ - update: async ( - campaignExtensionSettings: ( - | resources.ICampaignExtensionSetting - | resources.CampaignExtensionSetting - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignExtensionSettingOperation, - resources.ICampaignExtensionSetting - >( - "update", - campaignExtensionSettings, - // @ts-expect-error Static class type here is fine - resources.CampaignExtensionSetting - ); - const request = this.buildRequest< - services.CampaignExtensionSettingOperation, - services.IMutateCampaignExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CampaignExtensionSettingService.mutateCampaignExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignLabelsResponse + */ + remove: async ( + campaignLabels: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignLabelOperation, + string + >( + "remove", + campaignLabels + + + ); + const request = this.buildRequest< + services.CampaignLabelOperation, + services.IMutateCampaignLabelsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignLabelService.mutateCampaignLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignExtensionSettingsResponse - */ - remove: async ( - campaignExtensionSettings: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignExtensionSettingOperation, - string - >("remove", campaignExtensionSettings); - const request = this.buildRequest< - services.CampaignExtensionSettingOperation, - services.IMutateCampaignExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CampaignExtensionSettingService.mutateCampaignExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignFeedService - */ - public get campaignFeeds() { - const service = this.loadService( - "CampaignFeedServiceClient" - ); - type MutateOptions = Partial< - Pick< - services.IMutateCampaignFeedsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CampaignFeed in full detail - * @warning Don't use get in production! - * @returns resources.CampaignFeed - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCampaignFeedRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignFeed(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignService + */ + public get campaigns() { + const service = this.loadService("CampaignServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.Campaign in full detail + * @warning Don't use get in production! + * @returns resources.Campaign + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaign(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaign + * @returns services.MutateCampaignsResponse + */ + create: async ( + campaigns: (resources.ICampaign | resources.Campaign)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignOperation, + resources.ICampaign + >( + "create", + campaigns + + + ); + const request = this.buildRequest< + services.CampaignOperation, + services.IMutateCampaignsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignService.mutateCampaigns", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaignFeed - * @returns services.MutateCampaignFeedsResponse - */ - create: async ( - campaignFeeds: (resources.ICampaignFeed | resources.CampaignFeed)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignFeedOperation, - resources.ICampaignFeed - >("create", campaignFeeds); - const request = this.buildRequest< - services.CampaignFeedOperation, - services.IMutateCampaignFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignFeedService.mutateCampaignFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaigns(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICampaign + * @returns services.MutateCampaignsResponse + */ + update: async ( + campaigns: (resources.ICampaign | resources.Campaign)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignOperation, + resources.ICampaign + >( + "update", + campaigns + // @ts-expect-error Static class type here is fine + , resources.Campaign + ); + const request = this.buildRequest< + services.CampaignOperation, + services.IMutateCampaignsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignService.mutateCampaigns", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICampaignFeed - * @returns services.MutateCampaignFeedsResponse - */ - update: async ( - campaignFeeds: (resources.ICampaignFeed | resources.CampaignFeed)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignFeedOperation, - resources.ICampaignFeed - >( - "update", - campaignFeeds, - // @ts-expect-error Static class type here is fine - resources.CampaignFeed - ); - const request = this.buildRequest< - services.CampaignFeedOperation, - services.IMutateCampaignFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignFeedService.mutateCampaignFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaigns(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignsResponse + */ + remove: async ( + campaigns: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignOperation, + string + >( + "remove", + campaigns + + + ); + const request = this.buildRequest< + services.CampaignOperation, + services.IMutateCampaignsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignService.mutateCampaigns", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignFeedsResponse - */ - remove: async ( - campaignFeeds: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignFeedOperation, - string - >("remove", campaignFeeds); - const request = this.buildRequest< - services.CampaignFeedOperation, - services.IMutateCampaignFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignFeedService.mutateCampaignFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignLabelService - */ - public get campaignLabels() { - const service = this.loadService( - "CampaignLabelServiceClient" - ); - type MutateOptions = Partial< - Pick< - services.IMutateCampaignLabelsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.CampaignLabel in full detail - * @warning Don't use get in production! - * @returns resources.CampaignLabel - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCampaignLabelRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignLabel(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaigns(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignSharedSetService + */ + public get campaignSharedSets() { + const service = this.loadService("CampaignSharedSetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CampaignSharedSet in full detail + * @warning Don't use get in production! + * @returns resources.CampaignSharedSet + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignSharedSetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignSharedSet(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICampaignSharedSet + * @returns services.MutateCampaignSharedSetsResponse + */ + create: async ( + campaignSharedSets: (resources.ICampaignSharedSet | resources.CampaignSharedSet)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignSharedSetOperation, + resources.ICampaignSharedSet + >( + "create", + campaignSharedSets + + + ); + const request = this.buildRequest< + services.CampaignSharedSetOperation, + services.IMutateCampaignSharedSetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignSharedSetService.mutateCampaignSharedSets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaignLabel - * @returns services.MutateCampaignLabelsResponse - */ - create: async ( - campaignLabels: (resources.ICampaignLabel | resources.CampaignLabel)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignLabelOperation, - resources.ICampaignLabel - >("create", campaignLabels); - const request = this.buildRequest< - services.CampaignLabelOperation, - services.IMutateCampaignLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignLabelService.mutateCampaignLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignSharedSets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCampaignSharedSetsResponse + */ + remove: async ( + campaignSharedSets: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CampaignSharedSetOperation, + string + >( + "remove", + campaignSharedSets + + + ); + const request = this.buildRequest< + services.CampaignSharedSetOperation, + services.IMutateCampaignSharedSetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CampaignSharedSetService.mutateCampaignSharedSets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignLabelsResponse - */ - remove: async ( - campaignLabels: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignLabelOperation, - string - >("remove", campaignLabels); - const request = this.buildRequest< - services.CampaignLabelOperation, - services.IMutateCampaignLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignLabelService.mutateCampaignLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignService - */ - public get campaigns() { - const service = this.loadService( - "CampaignServiceClient" - ); - type MutateOptions = Partial< - Pick< - services.IMutateCampaignsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.Campaign in full detail - * @warning Don't use get in production! - * @returns resources.Campaign - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCampaignRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaign(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCampaignSharedSets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionActionService + */ + public get conversionActions() { + const service = this.loadService("ConversionActionServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.ConversionAction in full detail + * @warning Don't use get in production! + * @returns resources.ConversionAction + */ + get: async (resourceName: string): Promise => { + const request = new services.GetConversionActionRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getConversionAction(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IConversionAction + * @returns services.MutateConversionActionsResponse + */ + create: async ( + conversionActions: (resources.IConversionAction | resources.ConversionAction)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.ConversionActionOperation, + resources.IConversionAction + >( + "create", + conversionActions + + + ); + const request = this.buildRequest< + services.ConversionActionOperation, + services.IMutateConversionActionsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "ConversionActionService.mutateConversionActions", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaign - * @returns services.MutateCampaignsResponse - */ - create: async ( - campaigns: (resources.ICampaign | resources.Campaign)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignOperation, - resources.ICampaign - >("create", campaigns); - const request = this.buildRequest< - services.CampaignOperation, - services.IMutateCampaignsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignService.mutateCampaigns", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaigns(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateConversionActions(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IConversionAction + * @returns services.MutateConversionActionsResponse + */ + update: async ( + conversionActions: (resources.IConversionAction | resources.ConversionAction)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.ConversionActionOperation, + resources.IConversionAction + >( + "update", + conversionActions + // @ts-expect-error Static class type here is fine + , resources.ConversionAction + ); + const request = this.buildRequest< + services.ConversionActionOperation, + services.IMutateConversionActionsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "ConversionActionService.mutateConversionActions", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICampaign - * @returns services.MutateCampaignsResponse - */ - update: async ( - campaigns: (resources.ICampaign | resources.Campaign)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignOperation, - resources.ICampaign - >( - "update", - campaigns, - // @ts-expect-error Static class type here is fine - resources.Campaign - ); - const request = this.buildRequest< - services.CampaignOperation, - services.IMutateCampaignsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignService.mutateCampaigns", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaigns(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateConversionActions(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateConversionActionsResponse + */ + remove: async ( + conversionActions: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.ConversionActionOperation, + string + >( + "remove", + conversionActions + + + ); + const request = this.buildRequest< + services.ConversionActionOperation, + services.IMutateConversionActionsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "ConversionActionService.mutateConversionActions", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignsResponse - */ - remove: async ( - campaigns: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - campaigns - ); - const request = this.buildRequest< - services.CampaignOperation, - services.IMutateCampaignsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignService.mutateCampaigns", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaigns(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignSharedSetService - */ - public get campaignSharedSets() { - const service = this.loadService( - "CampaignSharedSetServiceClient" - ); - type MutateOptions = Partial< - Pick< - services.IMutateCampaignSharedSetsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CampaignSharedSet in full detail - * @warning Don't use get in production! - * @returns resources.CampaignSharedSet - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCampaignSharedSetRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignSharedSet(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateConversionActions(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionCustomVariableService + */ + public get conversionCustomVariables() { + const service = this.loadService("ConversionCustomVariableServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.ConversionCustomVariable in full detail + * @warning Don't use get in production! + * @returns resources.ConversionCustomVariable + */ + get: async (resourceName: string): Promise => { + const request = new services.GetConversionCustomVariableRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getConversionCustomVariable(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IConversionCustomVariable + * @returns services.MutateConversionCustomVariablesResponse + */ + create: async ( + conversionCustomVariables: (resources.IConversionCustomVariable | resources.ConversionCustomVariable)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.ConversionCustomVariableOperation, + resources.IConversionCustomVariable + >( + "create", + conversionCustomVariables + + + ); + const request = this.buildRequest< + services.ConversionCustomVariableOperation, + services.IMutateConversionCustomVariablesRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "ConversionCustomVariableService.mutateConversionCustomVariables", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICampaignSharedSet - * @returns services.MutateCampaignSharedSetsResponse - */ - create: async ( - campaignSharedSets: ( - | resources.ICampaignSharedSet - | resources.CampaignSharedSet - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignSharedSetOperation, - resources.ICampaignSharedSet - >("create", campaignSharedSets); - const request = this.buildRequest< - services.CampaignSharedSetOperation, - services.IMutateCampaignSharedSetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignSharedSetService.mutateCampaignSharedSets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignSharedSets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateConversionCustomVariables(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IConversionCustomVariable + * @returns services.MutateConversionCustomVariablesResponse + */ + update: async ( + conversionCustomVariables: (resources.IConversionCustomVariable | resources.ConversionCustomVariable)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.ConversionCustomVariableOperation, + resources.IConversionCustomVariable + >( + "update", + conversionCustomVariables + // @ts-expect-error Static class type here is fine + , resources.ConversionCustomVariable + ); + const request = this.buildRequest< + services.ConversionCustomVariableOperation, + services.IMutateConversionCustomVariablesRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "ConversionCustomVariableService.mutateConversionCustomVariables", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCampaignSharedSetsResponse - */ - remove: async ( - campaignSharedSets: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CampaignSharedSetOperation, - string - >("remove", campaignSharedSets); - const request = this.buildRequest< - services.CampaignSharedSetOperation, - services.IMutateCampaignSharedSetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CampaignSharedSetService.mutateCampaignSharedSets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCampaignSharedSets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionActionService - */ - public get conversionActions() { - const service = this.loadService( - "ConversionActionServiceClient" - ); - type MutateOptions = Partial< - Pick< - services.IMutateConversionActionsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.ConversionAction in full detail - * @warning Don't use get in production! - * @returns resources.ConversionAction - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetConversionActionRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getConversionAction(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateConversionCustomVariables(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerAssetService + */ + public get customerAssets() { + const service = this.loadService("CustomerAssetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomerAsset in full detail + * @warning Don't use get in production! + * @returns resources.CustomerAsset + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerAssetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerAsset(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomerAsset + * @returns services.MutateCustomerAssetsResponse + */ + create: async ( + customerAssets: (resources.ICustomerAsset | resources.CustomerAsset)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerAssetOperation, + resources.ICustomerAsset + >( + "create", + customerAssets + + + ); + const request = this.buildRequest< + services.CustomerAssetOperation, + services.IMutateCustomerAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerAssetService.mutateCustomerAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IConversionAction - * @returns services.MutateConversionActionsResponse - */ - create: async ( - conversionActions: ( - | resources.IConversionAction - | resources.ConversionAction - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.ConversionActionOperation, - resources.IConversionAction - >("create", conversionActions); - const request = this.buildRequest< - services.ConversionActionOperation, - services.IMutateConversionActionsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "ConversionActionService.mutateConversionActions", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateConversionActions(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICustomerAsset + * @returns services.MutateCustomerAssetsResponse + */ + update: async ( + customerAssets: (resources.ICustomerAsset | resources.CustomerAsset)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerAssetOperation, + resources.ICustomerAsset + >( + "update", + customerAssets + // @ts-expect-error Static class type here is fine + , resources.CustomerAsset + ); + const request = this.buildRequest< + services.CustomerAssetOperation, + services.IMutateCustomerAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerAssetService.mutateCustomerAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IConversionAction - * @returns services.MutateConversionActionsResponse - */ - update: async ( - conversionActions: ( - | resources.IConversionAction - | resources.ConversionAction - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.ConversionActionOperation, - resources.IConversionAction - >( - "update", - conversionActions, - // @ts-expect-error Static class type here is fine - resources.ConversionAction - ); - const request = this.buildRequest< - services.ConversionActionOperation, - services.IMutateConversionActionsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "ConversionActionService.mutateConversionActions", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateConversionActions(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCustomerAssetsResponse + */ + remove: async ( + customerAssets: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerAssetOperation, + string + >( + "remove", + customerAssets + + + ); + const request = this.buildRequest< + services.CustomerAssetOperation, + services.IMutateCustomerAssetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerAssetService.mutateCustomerAssets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateConversionActionsResponse - */ - remove: async ( - conversionActions: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.ConversionActionOperation, - string - >("remove", conversionActions); - const request = this.buildRequest< - services.ConversionActionOperation, - services.IMutateConversionActionsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "ConversionActionService.mutateConversionActions", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateConversionActions(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerExtensionSettingService - */ - public get customerExtensionSettings() { - const service = this.loadService( - "CustomerExtensionSettingServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerAssets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerExtensionSettingService + */ + public get customerExtensionSettings() { + const service = this.loadService("CustomerExtensionSettingServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomerExtensionSetting in full detail + * @warning Don't use get in production! + * @returns resources.CustomerExtensionSetting + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerExtensionSettingRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerExtensionSetting(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomerExtensionSetting + * @returns services.MutateCustomerExtensionSettingsResponse + */ + create: async ( + customerExtensionSettings: (resources.ICustomerExtensionSetting | resources.CustomerExtensionSetting)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerExtensionSettingOperation, + resources.ICustomerExtensionSetting + >( + "create", + customerExtensionSettings + + + ); + const request = this.buildRequest< + services.CustomerExtensionSettingOperation, services.IMutateCustomerExtensionSettingsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.CustomerExtensionSetting in full detail - * @warning Don't use get in production! - * @returns resources.CustomerExtensionSetting - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCustomerExtensionSettingRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerExtensionSetting( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerExtensionSettingService.mutateCustomerExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICustomerExtensionSetting - * @returns services.MutateCustomerExtensionSettingsResponse - */ - create: async ( - customerExtensionSettings: ( - | resources.ICustomerExtensionSetting - | resources.CustomerExtensionSetting - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerExtensionSettingOperation, - resources.ICustomerExtensionSetting - >("create", customerExtensionSettings); - const request = this.buildRequest< - services.CustomerExtensionSettingOperation, - services.IMutateCustomerExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CustomerExtensionSettingService.mutateCustomerExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICustomerExtensionSetting + * @returns services.MutateCustomerExtensionSettingsResponse + */ + update: async ( + customerExtensionSettings: (resources.ICustomerExtensionSetting | resources.CustomerExtensionSetting)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerExtensionSettingOperation, + resources.ICustomerExtensionSetting + >( + "update", + customerExtensionSettings + // @ts-expect-error Static class type here is fine + , resources.CustomerExtensionSetting + ); + const request = this.buildRequest< + services.CustomerExtensionSettingOperation, + services.IMutateCustomerExtensionSettingsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerExtensionSettingService.mutateCustomerExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICustomerExtensionSetting - * @returns services.MutateCustomerExtensionSettingsResponse - */ - update: async ( - customerExtensionSettings: ( - | resources.ICustomerExtensionSetting - | resources.CustomerExtensionSetting - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerExtensionSettingOperation, - resources.ICustomerExtensionSetting - >( - "update", - customerExtensionSettings, - // @ts-expect-error Static class type here is fine - resources.CustomerExtensionSetting - ); - const request = this.buildRequest< - services.CustomerExtensionSettingOperation, - services.IMutateCustomerExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CustomerExtensionSettingService.mutateCustomerExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCustomerExtensionSettingsResponse + */ + remove: async ( + customerExtensionSettings: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerExtensionSettingOperation, + string + >( + "remove", + customerExtensionSettings + + + ); + const request = this.buildRequest< + services.CustomerExtensionSettingOperation, + services.IMutateCustomerExtensionSettingsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerExtensionSettingService.mutateCustomerExtensionSettings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCustomerExtensionSettingsResponse - */ - remove: async ( - customerExtensionSettings: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerExtensionSettingOperation, - string - >("remove", customerExtensionSettings); - const request = this.buildRequest< - services.CustomerExtensionSettingOperation, - services.IMutateCustomerExtensionSettingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CustomerExtensionSettingService.mutateCustomerExtensionSettings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerExtensionSettings( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerFeedService - */ - public get customerFeeds() { - const service = this.loadService( - "CustomerFeedServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerExtensionSettings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerFeedService + */ + public get customerFeeds() { + const service = this.loadService("CustomerFeedServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomerFeed in full detail + * @warning Don't use get in production! + * @returns resources.CustomerFeed + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerFeedRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerFeed(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomerFeed + * @returns services.MutateCustomerFeedsResponse + */ + create: async ( + customerFeeds: (resources.ICustomerFeed | resources.CustomerFeed)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerFeedOperation, + resources.ICustomerFeed + >( + "create", + customerFeeds + + + ); + const request = this.buildRequest< + services.CustomerFeedOperation, services.IMutateCustomerFeedsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CustomerFeed in full detail - * @warning Don't use get in production! - * @returns resources.CustomerFeed - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCustomerFeedRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerFeed(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerFeedService.mutateCustomerFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICustomerFeed - * @returns services.MutateCustomerFeedsResponse - */ - create: async ( - customerFeeds: (resources.ICustomerFeed | resources.CustomerFeed)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerFeedOperation, - resources.ICustomerFeed - >("create", customerFeeds); - const request = this.buildRequest< - services.CustomerFeedOperation, - services.IMutateCustomerFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerFeedService.mutateCustomerFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICustomerFeed + * @returns services.MutateCustomerFeedsResponse + */ + update: async ( + customerFeeds: (resources.ICustomerFeed | resources.CustomerFeed)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerFeedOperation, + resources.ICustomerFeed + >( + "update", + customerFeeds + // @ts-expect-error Static class type here is fine + , resources.CustomerFeed + ); + const request = this.buildRequest< + services.CustomerFeedOperation, + services.IMutateCustomerFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerFeedService.mutateCustomerFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICustomerFeed - * @returns services.MutateCustomerFeedsResponse - */ - update: async ( - customerFeeds: (resources.ICustomerFeed | resources.CustomerFeed)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerFeedOperation, - resources.ICustomerFeed - >( - "update", - customerFeeds, - // @ts-expect-error Static class type here is fine - resources.CustomerFeed - ); - const request = this.buildRequest< - services.CustomerFeedOperation, - services.IMutateCustomerFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerFeedService.mutateCustomerFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCustomerFeedsResponse + */ + remove: async ( + customerFeeds: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerFeedOperation, + string + >( + "remove", + customerFeeds + + + ); + const request = this.buildRequest< + services.CustomerFeedOperation, + services.IMutateCustomerFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerFeedService.mutateCustomerFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCustomerFeedsResponse - */ - remove: async ( - customerFeeds: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerFeedOperation, - string - >("remove", customerFeeds); - const request = this.buildRequest< - services.CustomerFeedOperation, - services.IMutateCustomerFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerFeedService.mutateCustomerFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerLabelService - */ - public get customerLabels() { - const service = this.loadService( - "CustomerLabelServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerLabelService + */ + public get customerLabels() { + const service = this.loadService("CustomerLabelServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomerLabel in full detail + * @warning Don't use get in production! + * @returns resources.CustomerLabel + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerLabelRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerLabel(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomerLabel + * @returns services.MutateCustomerLabelsResponse + */ + create: async ( + customerLabels: (resources.ICustomerLabel | resources.CustomerLabel)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerLabelOperation, + resources.ICustomerLabel + >( + "create", + customerLabels + + + ); + const request = this.buildRequest< + services.CustomerLabelOperation, services.IMutateCustomerLabelsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.CustomerLabel in full detail - * @warning Don't use get in production! - * @returns resources.CustomerLabel - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCustomerLabelRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerLabel(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerLabelService.mutateCustomerLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICustomerLabel - * @returns services.MutateCustomerLabelsResponse - */ - create: async ( - customerLabels: (resources.ICustomerLabel | resources.CustomerLabel)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerLabelOperation, - resources.ICustomerLabel - >("create", customerLabels); - const request = this.buildRequest< - services.CustomerLabelOperation, - services.IMutateCustomerLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerLabelService.mutateCustomerLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCustomerLabelsResponse + */ + remove: async ( + customerLabels: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerLabelOperation, + string + >( + "remove", + customerLabels + + + ); + const request = this.buildRequest< + services.CustomerLabelOperation, + services.IMutateCustomerLabelsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerLabelService.mutateCustomerLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCustomerLabelsResponse - */ - remove: async ( - customerLabels: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerLabelOperation, - string - >("remove", customerLabels); - const request = this.buildRequest< - services.CustomerLabelOperation, - services.IMutateCustomerLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerLabelService.mutateCustomerLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerNegativeCriterionService - */ - public get customerNegativeCriteria() { - const service = this.loadService( - "CustomerNegativeCriterionServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerNegativeCriterionService + */ + public get customerNegativeCriteria() { + const service = this.loadService("CustomerNegativeCriterionServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomerNegativeCriterion in full detail + * @warning Don't use get in production! + * @returns resources.CustomerNegativeCriterion + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerNegativeCriterionRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerNegativeCriterion(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomerNegativeCriterion + * @returns services.MutateCustomerNegativeCriteriaResponse + */ + create: async ( + customerNegativeCriteria: (resources.ICustomerNegativeCriterion | resources.CustomerNegativeCriterion)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerNegativeCriterionOperation, + resources.ICustomerNegativeCriterion + >( + "create", + customerNegativeCriteria + + + ); + const request = this.buildRequest< + services.CustomerNegativeCriterionOperation, services.IMutateCustomerNegativeCriteriaRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.CustomerNegativeCriterion in full detail - * @warning Don't use get in production! - * @returns resources.CustomerNegativeCriterion - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCustomerNegativeCriterionRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerNegativeCriterion( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerNegativeCriterionService.mutateCustomerNegativeCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ICustomerNegativeCriterion - * @returns services.MutateCustomerNegativeCriteriaResponse - */ - create: async ( - customerNegativeCriteria: ( - | resources.ICustomerNegativeCriterion - | resources.CustomerNegativeCriterion - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerNegativeCriterionOperation, - resources.ICustomerNegativeCriterion - >("create", customerNegativeCriteria); - const request = this.buildRequest< - services.CustomerNegativeCriterionOperation, - services.IMutateCustomerNegativeCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CustomerNegativeCriterionService.mutateCustomerNegativeCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerNegativeCriteria( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerNegativeCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCustomerNegativeCriteriaResponse + */ + remove: async ( + customerNegativeCriteria: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerNegativeCriterionOperation, + string + >( + "remove", + customerNegativeCriteria + + + ); + const request = this.buildRequest< + services.CustomerNegativeCriterionOperation, + services.IMutateCustomerNegativeCriteriaRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerNegativeCriterionService.mutateCustomerNegativeCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCustomerNegativeCriteriaResponse - */ - remove: async ( - customerNegativeCriteria: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerNegativeCriterionOperation, - string - >("remove", customerNegativeCriteria); - const request = this.buildRequest< - services.CustomerNegativeCriterionOperation, - services.IMutateCustomerNegativeCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CustomerNegativeCriterionService.mutateCustomerNegativeCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerNegativeCriteria( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerService - */ - public get customers() { - const service = this.loadService( - "CustomerServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerNegativeCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerService + */ + public get customers() { + const service = this.loadService("CustomerServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.Customer in full detail + * @warning Don't use get in production! + * @returns resources.Customer + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomer(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description update resources of type resources.ICustomer + * @returns services.MutateCustomerResponse + */ + update: async ( + customers: (resources.ICustomer | resources.Customer)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerOperation, + resources.ICustomer + >( + "update", + customers + // @ts-expect-error Static class type here is fine + , resources.Customer + ); + const request = this.buildRequest< + services.CustomerOperation, services.IMutateCustomerRequest, - "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.Customer in full detail - * @warning Don't use get in production! - * @returns resources.Customer - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCustomerRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomer(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description update resources of type resources.ICustomer - * @returns services.MutateCustomerResponse - */ - update: async ( - customers: (resources.ICustomer | resources.Customer)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerOperation, - resources.ICustomer - >( - "update", - customers, - // @ts-expect-error Static class type here is fine - resources.Customer - ); - const request = this.buildRequest< - services.CustomerOperation, - services.IMutateCustomerRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerService.mutateCustomer", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomer(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerService#listaccessiblecustomers - */ - listAccessibleCustomers: async ( - request: services.ListAccessibleCustomersRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listAccessibleCustomers(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerService.mutateCustomer", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerService#createcustomerclient - */ - createCustomerClient: async ( - request: services.CreateCustomerClientRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.createCustomerClient(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ExtensionFeedItemService - */ - public get extensionFeedItems() { - const service = this.loadService( - "ExtensionFeedItemServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomer(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerService#listaccessiblecustomers + */ + listAccessibleCustomers: async (request: services.ListAccessibleCustomersRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listAccessibleCustomers(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerService#createcustomerclient + */ + createCustomerClient: async (request: services.CreateCustomerClientRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.createCustomerClient(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ExtensionFeedItemService + */ + public get extensionFeedItems() { + const service = this.loadService("ExtensionFeedItemServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.ExtensionFeedItem in full detail + * @warning Don't use get in production! + * @returns resources.ExtensionFeedItem + */ + get: async (resourceName: string): Promise => { + const request = new services.GetExtensionFeedItemRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getExtensionFeedItem(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IExtensionFeedItem + * @returns services.MutateExtensionFeedItemsResponse + */ + create: async ( + extensionFeedItems: (resources.IExtensionFeedItem | resources.ExtensionFeedItem)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.ExtensionFeedItemOperation, + resources.IExtensionFeedItem + >( + "create", + extensionFeedItems + + + ); + const request = this.buildRequest< + services.ExtensionFeedItemOperation, services.IMutateExtensionFeedItemsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.ExtensionFeedItem in full detail - * @warning Don't use get in production! - * @returns resources.ExtensionFeedItem - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetExtensionFeedItemRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getExtensionFeedItem(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "ExtensionFeedItemService.mutateExtensionFeedItems", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IExtensionFeedItem - * @returns services.MutateExtensionFeedItemsResponse - */ - create: async ( - extensionFeedItems: ( - | resources.IExtensionFeedItem - | resources.ExtensionFeedItem - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.ExtensionFeedItemOperation, - resources.IExtensionFeedItem - >("create", extensionFeedItems); - const request = this.buildRequest< - services.ExtensionFeedItemOperation, - services.IMutateExtensionFeedItemsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "ExtensionFeedItemService.mutateExtensionFeedItems", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateExtensionFeedItems(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateExtensionFeedItems(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IExtensionFeedItem + * @returns services.MutateExtensionFeedItemsResponse + */ + update: async ( + extensionFeedItems: (resources.IExtensionFeedItem | resources.ExtensionFeedItem)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.ExtensionFeedItemOperation, + resources.IExtensionFeedItem + >( + "update", + extensionFeedItems + // @ts-expect-error Static class type here is fine + , resources.ExtensionFeedItem + ); + const request = this.buildRequest< + services.ExtensionFeedItemOperation, + services.IMutateExtensionFeedItemsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "ExtensionFeedItemService.mutateExtensionFeedItems", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IExtensionFeedItem - * @returns services.MutateExtensionFeedItemsResponse - */ - update: async ( - extensionFeedItems: ( - | resources.IExtensionFeedItem - | resources.ExtensionFeedItem - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.ExtensionFeedItemOperation, - resources.IExtensionFeedItem - >( - "update", - extensionFeedItems, - // @ts-expect-error Static class type here is fine - resources.ExtensionFeedItem - ); - const request = this.buildRequest< - services.ExtensionFeedItemOperation, - services.IMutateExtensionFeedItemsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "ExtensionFeedItemService.mutateExtensionFeedItems", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateExtensionFeedItems(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateExtensionFeedItems(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateExtensionFeedItemsResponse + */ + remove: async ( + extensionFeedItems: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.ExtensionFeedItemOperation, + string + >( + "remove", + extensionFeedItems + + + ); + const request = this.buildRequest< + services.ExtensionFeedItemOperation, + services.IMutateExtensionFeedItemsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "ExtensionFeedItemService.mutateExtensionFeedItems", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateExtensionFeedItemsResponse - */ - remove: async ( - extensionFeedItems: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.ExtensionFeedItemOperation, - string - >("remove", extensionFeedItems); - const request = this.buildRequest< - services.ExtensionFeedItemOperation, - services.IMutateExtensionFeedItemsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "ExtensionFeedItemService.mutateExtensionFeedItems", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateExtensionFeedItems(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemService - */ - public get feedItems() { - const service = this.loadService( - "FeedItemServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateExtensionFeedItems(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemService + */ + public get feedItems() { + const service = this.loadService("FeedItemServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.FeedItem in full detail + * @warning Don't use get in production! + * @returns resources.FeedItem + */ + get: async (resourceName: string): Promise => { + const request = new services.GetFeedItemRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getFeedItem(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IFeedItem + * @returns services.MutateFeedItemsResponse + */ + create: async ( + feedItems: (resources.IFeedItem | resources.FeedItem)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemOperation, + resources.IFeedItem + >( + "create", + feedItems + + + ); + const request = this.buildRequest< + services.FeedItemOperation, services.IMutateFeedItemsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.FeedItem in full detail - * @warning Don't use get in production! - * @returns resources.FeedItem - */ - get: async (resourceName: string): Promise => { - const request = new services.GetFeedItemRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getFeedItem(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemService.mutateFeedItems", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IFeedItem - * @returns services.MutateFeedItemsResponse - */ - create: async ( - feedItems: (resources.IFeedItem | resources.FeedItem)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedItemOperation, - resources.IFeedItem - >("create", feedItems); - const request = this.buildRequest< - services.FeedItemOperation, - services.IMutateFeedItemsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemService.mutateFeedItems", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItems(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItems(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IFeedItem + * @returns services.MutateFeedItemsResponse + */ + update: async ( + feedItems: (resources.IFeedItem | resources.FeedItem)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemOperation, + resources.IFeedItem + >( + "update", + feedItems + // @ts-expect-error Static class type here is fine + , resources.FeedItem + ); + const request = this.buildRequest< + services.FeedItemOperation, + services.IMutateFeedItemsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemService.mutateFeedItems", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IFeedItem - * @returns services.MutateFeedItemsResponse - */ - update: async ( - feedItems: (resources.IFeedItem | resources.FeedItem)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedItemOperation, - resources.IFeedItem - >( - "update", - feedItems, - // @ts-expect-error Static class type here is fine - resources.FeedItem - ); - const request = this.buildRequest< - services.FeedItemOperation, - services.IMutateFeedItemsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemService.mutateFeedItems", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItems(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItems(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateFeedItemsResponse + */ + remove: async ( + feedItems: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemOperation, + string + >( + "remove", + feedItems + + + ); + const request = this.buildRequest< + services.FeedItemOperation, + services.IMutateFeedItemsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemService.mutateFeedItems", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateFeedItemsResponse - */ - remove: async ( - feedItems: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - feedItems - ); - const request = this.buildRequest< - services.FeedItemOperation, - services.IMutateFeedItemsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemService.mutateFeedItems", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItems(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemSetLinkService - */ - public get feedItemSetLinks() { - const service = this.loadService( - "FeedItemSetLinkServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItems(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemSetLinkService + */ + public get feedItemSetLinks() { + const service = this.loadService("FeedItemSetLinkServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.FeedItemSetLink in full detail + * @warning Don't use get in production! + * @returns resources.FeedItemSetLink + */ + get: async (resourceName: string): Promise => { + const request = new services.GetFeedItemSetLinkRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getFeedItemSetLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IFeedItemSetLink + * @returns services.MutateFeedItemSetLinksResponse + */ + create: async ( + feedItemSetLinks: (resources.IFeedItemSetLink | resources.FeedItemSetLink)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemSetLinkOperation, + resources.IFeedItemSetLink + >( + "create", + feedItemSetLinks + + + ); + const request = this.buildRequest< + services.FeedItemSetLinkOperation, services.IMutateFeedItemSetLinksRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.FeedItemSetLink in full detail - * @warning Don't use get in production! - * @returns resources.FeedItemSetLink - */ - get: async (resourceName: string): Promise => { - const request = new services.GetFeedItemSetLinkRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getFeedItemSetLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemSetLinkService.mutateFeedItemSetLinks", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IFeedItemSetLink - * @returns services.MutateFeedItemSetLinksResponse - */ - create: async ( - feedItemSetLinks: ( - | resources.IFeedItemSetLink - | resources.FeedItemSetLink - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedItemSetLinkOperation, - resources.IFeedItemSetLink - >("create", feedItemSetLinks); - const request = this.buildRequest< - services.FeedItemSetLinkOperation, - services.IMutateFeedItemSetLinksRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemSetLinkService.mutateFeedItemSetLinks", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItemSetLinks(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItemSetLinks(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateFeedItemSetLinksResponse + */ + remove: async ( + feedItemSetLinks: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemSetLinkOperation, + string + >( + "remove", + feedItemSetLinks + + + ); + const request = this.buildRequest< + services.FeedItemSetLinkOperation, + services.IMutateFeedItemSetLinksRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemSetLinkService.mutateFeedItemSetLinks", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateFeedItemSetLinksResponse - */ - remove: async ( - feedItemSetLinks: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedItemSetLinkOperation, - string - >("remove", feedItemSetLinks); - const request = this.buildRequest< - services.FeedItemSetLinkOperation, - services.IMutateFeedItemSetLinksRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemSetLinkService.mutateFeedItemSetLinks", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItemSetLinks(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemSetService - */ - public get feedItemSets() { - const service = this.loadService( - "FeedItemSetServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItemSetLinks(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemSetService + */ + public get feedItemSets() { + const service = this.loadService("FeedItemSetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.FeedItemSet in full detail + * @warning Don't use get in production! + * @returns resources.FeedItemSet + */ + get: async (resourceName: string): Promise => { + const request = new services.GetFeedItemSetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getFeedItemSet(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IFeedItemSet + * @returns services.MutateFeedItemSetsResponse + */ + create: async ( + feedItemSets: (resources.IFeedItemSet | resources.FeedItemSet)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemSetOperation, + resources.IFeedItemSet + >( + "create", + feedItemSets + + + ); + const request = this.buildRequest< + services.FeedItemSetOperation, services.IMutateFeedItemSetsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.FeedItemSet in full detail - * @warning Don't use get in production! - * @returns resources.FeedItemSet - */ - get: async (resourceName: string): Promise => { - const request = new services.GetFeedItemSetRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getFeedItemSet(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemSetService.mutateFeedItemSets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IFeedItemSet - * @returns services.MutateFeedItemSetsResponse - */ - create: async ( - feedItemSets: (resources.IFeedItemSet | resources.FeedItemSet)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedItemSetOperation, - resources.IFeedItemSet - >("create", feedItemSets); - const request = this.buildRequest< - services.FeedItemSetOperation, - services.IMutateFeedItemSetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemSetService.mutateFeedItemSets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItemSets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItemSets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IFeedItemSet + * @returns services.MutateFeedItemSetsResponse + */ + update: async ( + feedItemSets: (resources.IFeedItemSet | resources.FeedItemSet)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemSetOperation, + resources.IFeedItemSet + >( + "update", + feedItemSets + // @ts-expect-error Static class type here is fine + , resources.FeedItemSet + ); + const request = this.buildRequest< + services.FeedItemSetOperation, + services.IMutateFeedItemSetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemSetService.mutateFeedItemSets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IFeedItemSet - * @returns services.MutateFeedItemSetsResponse - */ - update: async ( - feedItemSets: (resources.IFeedItemSet | resources.FeedItemSet)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedItemSetOperation, - resources.IFeedItemSet - >( - "update", - feedItemSets, - // @ts-expect-error Static class type here is fine - resources.FeedItemSet - ); - const request = this.buildRequest< - services.FeedItemSetOperation, - services.IMutateFeedItemSetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemSetService.mutateFeedItemSets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItemSets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItemSets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateFeedItemSetsResponse + */ + remove: async ( + feedItemSets: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemSetOperation, + string + >( + "remove", + feedItemSets + + + ); + const request = this.buildRequest< + services.FeedItemSetOperation, + services.IMutateFeedItemSetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemSetService.mutateFeedItemSets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateFeedItemSetsResponse - */ - remove: async ( - feedItemSets: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - feedItemSets - ); - const request = this.buildRequest< - services.FeedItemSetOperation, - services.IMutateFeedItemSetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemSetService.mutateFeedItemSets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItemSets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedItemTargetService - */ - public get feedItemTargets() { - const service = this.loadService( - "FeedItemTargetServiceClient" - ); - type MutateOptions = Partial< - Pick - >; - return { - /** - * @description Retrieve a resources.FeedItemTarget in full detail - * @warning Don't use get in production! - * @returns resources.FeedItemTarget - */ - get: async (resourceName: string): Promise => { - const request = new services.GetFeedItemTargetRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getFeedItemTarget(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItemSets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedItemTargetService + */ + public get feedItemTargets() { + const service = this.loadService("FeedItemTargetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.FeedItemTarget in full detail + * @warning Don't use get in production! + * @returns resources.FeedItemTarget + */ + get: async (resourceName: string): Promise => { + const request = new services.GetFeedItemTargetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getFeedItemTarget(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IFeedItemTarget + * @returns services.MutateFeedItemTargetsResponse + */ + create: async ( + feedItemTargets: (resources.IFeedItemTarget | resources.FeedItemTarget)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemTargetOperation, + resources.IFeedItemTarget + >( + "create", + feedItemTargets + + + ); + const request = this.buildRequest< + services.FeedItemTargetOperation, + services.IMutateFeedItemTargetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemTargetService.mutateFeedItemTargets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IFeedItemTarget - * @returns services.MutateFeedItemTargetsResponse - */ - create: async ( - feedItemTargets: ( - | resources.IFeedItemTarget - | resources.FeedItemTarget - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedItemTargetOperation, - resources.IFeedItemTarget - >("create", feedItemTargets); - const request = this.buildRequest< - services.FeedItemTargetOperation, - services.IMutateFeedItemTargetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemTargetService.mutateFeedItemTargets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItemTargets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItemTargets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateFeedItemTargetsResponse + */ + remove: async ( + feedItemTargets: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedItemTargetOperation, + string + >( + "remove", + feedItemTargets + + + ); + const request = this.buildRequest< + services.FeedItemTargetOperation, + services.IMutateFeedItemTargetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedItemTargetService.mutateFeedItemTargets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateFeedItemTargetsResponse - */ - remove: async ( - feedItemTargets: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedItemTargetOperation, - string - >("remove", feedItemTargets); - const request = this.buildRequest< - services.FeedItemTargetOperation, - services.IMutateFeedItemTargetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedItemTargetService.mutateFeedItemTargets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedItemTargets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedMappingService - */ - public get feedMappings() { - const service = this.loadService( - "FeedMappingServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedItemTargets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedMappingService + */ + public get feedMappings() { + const service = this.loadService("FeedMappingServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.FeedMapping in full detail + * @warning Don't use get in production! + * @returns resources.FeedMapping + */ + get: async (resourceName: string): Promise => { + const request = new services.GetFeedMappingRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getFeedMapping(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IFeedMapping + * @returns services.MutateFeedMappingsResponse + */ + create: async ( + feedMappings: (resources.IFeedMapping | resources.FeedMapping)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedMappingOperation, + resources.IFeedMapping + >( + "create", + feedMappings + + + ); + const request = this.buildRequest< + services.FeedMappingOperation, services.IMutateFeedMappingsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.FeedMapping in full detail - * @warning Don't use get in production! - * @returns resources.FeedMapping - */ - get: async (resourceName: string): Promise => { - const request = new services.GetFeedMappingRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getFeedMapping(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedMappingService.mutateFeedMappings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IFeedMapping - * @returns services.MutateFeedMappingsResponse - */ - create: async ( - feedMappings: (resources.IFeedMapping | resources.FeedMapping)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedMappingOperation, - resources.IFeedMapping - >("create", feedMappings); - const request = this.buildRequest< - services.FeedMappingOperation, - services.IMutateFeedMappingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedMappingService.mutateFeedMappings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedMappings(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedMappings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateFeedMappingsResponse + */ + remove: async ( + feedMappings: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedMappingOperation, + string + >( + "remove", + feedMappings + + + ); + const request = this.buildRequest< + services.FeedMappingOperation, + services.IMutateFeedMappingsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedMappingService.mutateFeedMappings", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateFeedMappingsResponse - */ - remove: async ( - feedMappings: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - feedMappings - ); - const request = this.buildRequest< - services.FeedMappingOperation, - services.IMutateFeedMappingsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedMappingService.mutateFeedMappings", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeedMappings(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeedMappings(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedService - */ - public get feeds() { - const service = this.loadService("FeedServiceClient"); - type MutateOptions = Partial< - Pick< + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedService + */ + public get feeds() { + const service = this.loadService("FeedServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.Feed in full detail + * @warning Don't use get in production! + * @returns resources.Feed + */ + get: async (resourceName: string): Promise => { + const request = new services.GetFeedRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getFeed(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IFeed + * @returns services.MutateFeedsResponse + */ + create: async ( + feeds: (resources.IFeed | resources.Feed)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedOperation, + resources.IFeed + >( + "create", + feeds + + + ); + const request = this.buildRequest< + services.FeedOperation, services.IMutateFeedsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.Feed in full detail - * @warning Don't use get in production! - * @returns resources.Feed - */ - get: async (resourceName: string): Promise => { - const request = new services.GetFeedRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getFeed(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedService.mutateFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IFeed - * @returns services.MutateFeedsResponse - */ - create: async ( - feeds: (resources.IFeed | resources.Feed)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedOperation, - resources.IFeed - >("create", feeds); - const request = this.buildRequest< - services.FeedOperation, - services.IMutateFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedService.mutateFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IFeed + * @returns services.MutateFeedsResponse + */ + update: async ( + feeds: (resources.IFeed | resources.Feed)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedOperation, + resources.IFeed + >( + "update", + feeds + // @ts-expect-error Static class type here is fine + , resources.Feed + ); + const request = this.buildRequest< + services.FeedOperation, + services.IMutateFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedService.mutateFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IFeed - * @returns services.MutateFeedsResponse - */ - update: async ( - feeds: (resources.IFeed | resources.Feed)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.FeedOperation, - resources.IFeed - >( - "update", - feeds, - // @ts-expect-error Static class type here is fine - resources.Feed - ); - const request = this.buildRequest< - services.FeedOperation, - services.IMutateFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedService.mutateFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateFeedsResponse + */ + remove: async ( + feeds: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.FeedOperation, + string + >( + "remove", + feeds + + + ); + const request = this.buildRequest< + services.FeedOperation, + services.IMutateFeedsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "FeedService.mutateFeeds", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateFeedsResponse - */ - remove: async ( - feeds: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - feeds - ); - const request = this.buildRequest< - services.FeedOperation, - services.IMutateFeedsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "FeedService.mutateFeeds", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateFeeds(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanAdGroupKeywordService - */ - public get keywordPlanAdGroupKeywords() { - const service = this.loadService( - "KeywordPlanAdGroupKeywordServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateFeeds(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanAdGroupKeywordService + */ + public get keywordPlanAdGroupKeywords() { + const service = this.loadService("KeywordPlanAdGroupKeywordServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.KeywordPlanAdGroupKeyword in full detail + * @warning Don't use get in production! + * @returns resources.KeywordPlanAdGroupKeyword + */ + get: async (resourceName: string): Promise => { + const request = new services.GetKeywordPlanAdGroupKeywordRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getKeywordPlanAdGroupKeyword(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IKeywordPlanAdGroupKeyword + * @returns services.MutateKeywordPlanAdGroupKeywordsResponse + */ + create: async ( + keywordPlanAdGroupKeywords: (resources.IKeywordPlanAdGroupKeyword | resources.KeywordPlanAdGroupKeyword)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanAdGroupKeywordOperation, + resources.IKeywordPlanAdGroupKeyword + >( + "create", + keywordPlanAdGroupKeywords + + + ); + const request = this.buildRequest< + services.KeywordPlanAdGroupKeywordOperation, services.IMutateKeywordPlanAdGroupKeywordsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.KeywordPlanAdGroupKeyword in full detail - * @warning Don't use get in production! - * @returns resources.KeywordPlanAdGroupKeyword - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetKeywordPlanAdGroupKeywordRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getKeywordPlanAdGroupKeyword( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanAdGroupKeywordService.mutateKeywordPlanAdGroupKeywords", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IKeywordPlanAdGroupKeyword - * @returns services.MutateKeywordPlanAdGroupKeywordsResponse - */ - create: async ( - keywordPlanAdGroupKeywords: ( - | resources.IKeywordPlanAdGroupKeyword - | resources.KeywordPlanAdGroupKeyword - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanAdGroupKeywordOperation, - resources.IKeywordPlanAdGroupKeyword - >("create", keywordPlanAdGroupKeywords); - const request = this.buildRequest< - services.KeywordPlanAdGroupKeywordOperation, - services.IMutateKeywordPlanAdGroupKeywordsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "KeywordPlanAdGroupKeywordService.mutateKeywordPlanAdGroupKeywords", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanAdGroupKeywords( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanAdGroupKeywords(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IKeywordPlanAdGroupKeyword + * @returns services.MutateKeywordPlanAdGroupKeywordsResponse + */ + update: async ( + keywordPlanAdGroupKeywords: (resources.IKeywordPlanAdGroupKeyword | resources.KeywordPlanAdGroupKeyword)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanAdGroupKeywordOperation, + resources.IKeywordPlanAdGroupKeyword + >( + "update", + keywordPlanAdGroupKeywords + // @ts-expect-error Static class type here is fine + , resources.KeywordPlanAdGroupKeyword + ); + const request = this.buildRequest< + services.KeywordPlanAdGroupKeywordOperation, + services.IMutateKeywordPlanAdGroupKeywordsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanAdGroupKeywordService.mutateKeywordPlanAdGroupKeywords", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IKeywordPlanAdGroupKeyword - * @returns services.MutateKeywordPlanAdGroupKeywordsResponse - */ - update: async ( - keywordPlanAdGroupKeywords: ( - | resources.IKeywordPlanAdGroupKeyword - | resources.KeywordPlanAdGroupKeyword - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanAdGroupKeywordOperation, - resources.IKeywordPlanAdGroupKeyword - >( - "update", - keywordPlanAdGroupKeywords, - // @ts-expect-error Static class type here is fine - resources.KeywordPlanAdGroupKeyword - ); - const request = this.buildRequest< - services.KeywordPlanAdGroupKeywordOperation, - services.IMutateKeywordPlanAdGroupKeywordsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "KeywordPlanAdGroupKeywordService.mutateKeywordPlanAdGroupKeywords", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanAdGroupKeywords( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanAdGroupKeywords(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateKeywordPlanAdGroupKeywordsResponse + */ + remove: async ( + keywordPlanAdGroupKeywords: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanAdGroupKeywordOperation, + string + >( + "remove", + keywordPlanAdGroupKeywords + + + ); + const request = this.buildRequest< + services.KeywordPlanAdGroupKeywordOperation, + services.IMutateKeywordPlanAdGroupKeywordsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanAdGroupKeywordService.mutateKeywordPlanAdGroupKeywords", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateKeywordPlanAdGroupKeywordsResponse - */ - remove: async ( - keywordPlanAdGroupKeywords: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanAdGroupKeywordOperation, - string - >("remove", keywordPlanAdGroupKeywords); - const request = this.buildRequest< - services.KeywordPlanAdGroupKeywordOperation, - services.IMutateKeywordPlanAdGroupKeywordsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "KeywordPlanAdGroupKeywordService.mutateKeywordPlanAdGroupKeywords", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanAdGroupKeywords( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanAdGroupService - */ - public get keywordPlanAdGroups() { - const service = this.loadService( - "KeywordPlanAdGroupServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanAdGroupKeywords(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanAdGroupService + */ + public get keywordPlanAdGroups() { + const service = this.loadService("KeywordPlanAdGroupServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.KeywordPlanAdGroup in full detail + * @warning Don't use get in production! + * @returns resources.KeywordPlanAdGroup + */ + get: async (resourceName: string): Promise => { + const request = new services.GetKeywordPlanAdGroupRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getKeywordPlanAdGroup(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IKeywordPlanAdGroup + * @returns services.MutateKeywordPlanAdGroupsResponse + */ + create: async ( + keywordPlanAdGroups: (resources.IKeywordPlanAdGroup | resources.KeywordPlanAdGroup)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanAdGroupOperation, + resources.IKeywordPlanAdGroup + >( + "create", + keywordPlanAdGroups + + + ); + const request = this.buildRequest< + services.KeywordPlanAdGroupOperation, services.IMutateKeywordPlanAdGroupsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.KeywordPlanAdGroup in full detail - * @warning Don't use get in production! - * @returns resources.KeywordPlanAdGroup - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetKeywordPlanAdGroupRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getKeywordPlanAdGroup(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanAdGroupService.mutateKeywordPlanAdGroups", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IKeywordPlanAdGroup - * @returns services.MutateKeywordPlanAdGroupsResponse - */ - create: async ( - keywordPlanAdGroups: ( - | resources.IKeywordPlanAdGroup - | resources.KeywordPlanAdGroup - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanAdGroupOperation, - resources.IKeywordPlanAdGroup - >("create", keywordPlanAdGroups); - const request = this.buildRequest< - services.KeywordPlanAdGroupOperation, - services.IMutateKeywordPlanAdGroupsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanAdGroupService.mutateKeywordPlanAdGroups", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanAdGroups(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanAdGroups(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IKeywordPlanAdGroup + * @returns services.MutateKeywordPlanAdGroupsResponse + */ + update: async ( + keywordPlanAdGroups: (resources.IKeywordPlanAdGroup | resources.KeywordPlanAdGroup)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanAdGroupOperation, + resources.IKeywordPlanAdGroup + >( + "update", + keywordPlanAdGroups + // @ts-expect-error Static class type here is fine + , resources.KeywordPlanAdGroup + ); + const request = this.buildRequest< + services.KeywordPlanAdGroupOperation, + services.IMutateKeywordPlanAdGroupsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanAdGroupService.mutateKeywordPlanAdGroups", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IKeywordPlanAdGroup - * @returns services.MutateKeywordPlanAdGroupsResponse - */ - update: async ( - keywordPlanAdGroups: ( - | resources.IKeywordPlanAdGroup - | resources.KeywordPlanAdGroup - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanAdGroupOperation, - resources.IKeywordPlanAdGroup - >( - "update", - keywordPlanAdGroups, - // @ts-expect-error Static class type here is fine - resources.KeywordPlanAdGroup - ); - const request = this.buildRequest< - services.KeywordPlanAdGroupOperation, - services.IMutateKeywordPlanAdGroupsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanAdGroupService.mutateKeywordPlanAdGroups", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanAdGroups(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanAdGroups(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateKeywordPlanAdGroupsResponse + */ + remove: async ( + keywordPlanAdGroups: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanAdGroupOperation, + string + >( + "remove", + keywordPlanAdGroups + + + ); + const request = this.buildRequest< + services.KeywordPlanAdGroupOperation, + services.IMutateKeywordPlanAdGroupsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanAdGroupService.mutateKeywordPlanAdGroups", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateKeywordPlanAdGroupsResponse - */ - remove: async ( - keywordPlanAdGroups: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanAdGroupOperation, - string - >("remove", keywordPlanAdGroups); - const request = this.buildRequest< - services.KeywordPlanAdGroupOperation, - services.IMutateKeywordPlanAdGroupsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanAdGroupService.mutateKeywordPlanAdGroups", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanAdGroups(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanCampaignKeywordService - */ - public get keywordPlanCampaignKeywords() { - const service = this.loadService( - "KeywordPlanCampaignKeywordServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanAdGroups(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanCampaignKeywordService + */ + public get keywordPlanCampaignKeywords() { + const service = this.loadService("KeywordPlanCampaignKeywordServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.KeywordPlanCampaignKeyword in full detail + * @warning Don't use get in production! + * @returns resources.KeywordPlanCampaignKeyword + */ + get: async (resourceName: string): Promise => { + const request = new services.GetKeywordPlanCampaignKeywordRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getKeywordPlanCampaignKeyword(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IKeywordPlanCampaignKeyword + * @returns services.MutateKeywordPlanCampaignKeywordsResponse + */ + create: async ( + keywordPlanCampaignKeywords: (resources.IKeywordPlanCampaignKeyword | resources.KeywordPlanCampaignKeyword)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanCampaignKeywordOperation, + resources.IKeywordPlanCampaignKeyword + >( + "create", + keywordPlanCampaignKeywords + + + ); + const request = this.buildRequest< + services.KeywordPlanCampaignKeywordOperation, services.IMutateKeywordPlanCampaignKeywordsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.KeywordPlanCampaignKeyword in full detail - * @warning Don't use get in production! - * @returns resources.KeywordPlanCampaignKeyword - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetKeywordPlanCampaignKeywordRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getKeywordPlanCampaignKeyword( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanCampaignKeywordService.mutateKeywordPlanCampaignKeywords", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IKeywordPlanCampaignKeyword - * @returns services.MutateKeywordPlanCampaignKeywordsResponse - */ - create: async ( - keywordPlanCampaignKeywords: ( - | resources.IKeywordPlanCampaignKeyword - | resources.KeywordPlanCampaignKeyword - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanCampaignKeywordOperation, - resources.IKeywordPlanCampaignKeyword - >("create", keywordPlanCampaignKeywords); - const request = this.buildRequest< - services.KeywordPlanCampaignKeywordOperation, - services.IMutateKeywordPlanCampaignKeywordsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "KeywordPlanCampaignKeywordService.mutateKeywordPlanCampaignKeywords", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanCampaignKeywords( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanCampaignKeywords(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IKeywordPlanCampaignKeyword + * @returns services.MutateKeywordPlanCampaignKeywordsResponse + */ + update: async ( + keywordPlanCampaignKeywords: (resources.IKeywordPlanCampaignKeyword | resources.KeywordPlanCampaignKeyword)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanCampaignKeywordOperation, + resources.IKeywordPlanCampaignKeyword + >( + "update", + keywordPlanCampaignKeywords + // @ts-expect-error Static class type here is fine + , resources.KeywordPlanCampaignKeyword + ); + const request = this.buildRequest< + services.KeywordPlanCampaignKeywordOperation, + services.IMutateKeywordPlanCampaignKeywordsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanCampaignKeywordService.mutateKeywordPlanCampaignKeywords", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IKeywordPlanCampaignKeyword - * @returns services.MutateKeywordPlanCampaignKeywordsResponse - */ - update: async ( - keywordPlanCampaignKeywords: ( - | resources.IKeywordPlanCampaignKeyword - | resources.KeywordPlanCampaignKeyword - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanCampaignKeywordOperation, - resources.IKeywordPlanCampaignKeyword - >( - "update", - keywordPlanCampaignKeywords, - // @ts-expect-error Static class type here is fine - resources.KeywordPlanCampaignKeyword - ); - const request = this.buildRequest< - services.KeywordPlanCampaignKeywordOperation, - services.IMutateKeywordPlanCampaignKeywordsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "KeywordPlanCampaignKeywordService.mutateKeywordPlanCampaignKeywords", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanCampaignKeywords( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanCampaignKeywords(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateKeywordPlanCampaignKeywordsResponse + */ + remove: async ( + keywordPlanCampaignKeywords: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanCampaignKeywordOperation, + string + >( + "remove", + keywordPlanCampaignKeywords + + + ); + const request = this.buildRequest< + services.KeywordPlanCampaignKeywordOperation, + services.IMutateKeywordPlanCampaignKeywordsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanCampaignKeywordService.mutateKeywordPlanCampaignKeywords", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateKeywordPlanCampaignKeywordsResponse - */ - remove: async ( - keywordPlanCampaignKeywords: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanCampaignKeywordOperation, - string - >("remove", keywordPlanCampaignKeywords); - const request = this.buildRequest< - services.KeywordPlanCampaignKeywordOperation, - services.IMutateKeywordPlanCampaignKeywordsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "KeywordPlanCampaignKeywordService.mutateKeywordPlanCampaignKeywords", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanCampaignKeywords( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanCampaignService - */ - public get keywordPlanCampaigns() { - const service = this.loadService( - "KeywordPlanCampaignServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanCampaignKeywords(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanCampaignService + */ + public get keywordPlanCampaigns() { + const service = this.loadService("KeywordPlanCampaignServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.KeywordPlanCampaign in full detail + * @warning Don't use get in production! + * @returns resources.KeywordPlanCampaign + */ + get: async (resourceName: string): Promise => { + const request = new services.GetKeywordPlanCampaignRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getKeywordPlanCampaign(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IKeywordPlanCampaign + * @returns services.MutateKeywordPlanCampaignsResponse + */ + create: async ( + keywordPlanCampaigns: (resources.IKeywordPlanCampaign | resources.KeywordPlanCampaign)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanCampaignOperation, + resources.IKeywordPlanCampaign + >( + "create", + keywordPlanCampaigns + + + ); + const request = this.buildRequest< + services.KeywordPlanCampaignOperation, services.IMutateKeywordPlanCampaignsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.KeywordPlanCampaign in full detail - * @warning Don't use get in production! - * @returns resources.KeywordPlanCampaign - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetKeywordPlanCampaignRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getKeywordPlanCampaign(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanCampaignService.mutateKeywordPlanCampaigns", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IKeywordPlanCampaign - * @returns services.MutateKeywordPlanCampaignsResponse - */ - create: async ( - keywordPlanCampaigns: ( - | resources.IKeywordPlanCampaign - | resources.KeywordPlanCampaign - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanCampaignOperation, - resources.IKeywordPlanCampaign - >("create", keywordPlanCampaigns); - const request = this.buildRequest< - services.KeywordPlanCampaignOperation, - services.IMutateKeywordPlanCampaignsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanCampaignService.mutateKeywordPlanCampaigns", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanCampaigns(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanCampaigns(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IKeywordPlanCampaign + * @returns services.MutateKeywordPlanCampaignsResponse + */ + update: async ( + keywordPlanCampaigns: (resources.IKeywordPlanCampaign | resources.KeywordPlanCampaign)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanCampaignOperation, + resources.IKeywordPlanCampaign + >( + "update", + keywordPlanCampaigns + // @ts-expect-error Static class type here is fine + , resources.KeywordPlanCampaign + ); + const request = this.buildRequest< + services.KeywordPlanCampaignOperation, + services.IMutateKeywordPlanCampaignsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanCampaignService.mutateKeywordPlanCampaigns", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IKeywordPlanCampaign - * @returns services.MutateKeywordPlanCampaignsResponse - */ - update: async ( - keywordPlanCampaigns: ( - | resources.IKeywordPlanCampaign - | resources.KeywordPlanCampaign - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanCampaignOperation, - resources.IKeywordPlanCampaign - >( - "update", - keywordPlanCampaigns, - // @ts-expect-error Static class type here is fine - resources.KeywordPlanCampaign - ); - const request = this.buildRequest< - services.KeywordPlanCampaignOperation, - services.IMutateKeywordPlanCampaignsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanCampaignService.mutateKeywordPlanCampaigns", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanCampaigns(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanCampaigns(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateKeywordPlanCampaignsResponse + */ + remove: async ( + keywordPlanCampaigns: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanCampaignOperation, + string + >( + "remove", + keywordPlanCampaigns + + + ); + const request = this.buildRequest< + services.KeywordPlanCampaignOperation, + services.IMutateKeywordPlanCampaignsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanCampaignService.mutateKeywordPlanCampaigns", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateKeywordPlanCampaignsResponse - */ - remove: async ( - keywordPlanCampaigns: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanCampaignOperation, - string - >("remove", keywordPlanCampaigns); - const request = this.buildRequest< - services.KeywordPlanCampaignOperation, - services.IMutateKeywordPlanCampaignsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanCampaignService.mutateKeywordPlanCampaigns", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlanCampaigns(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanService - */ - public get keywordPlans() { - const service = this.loadService( - "KeywordPlanServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlanCampaigns(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanService + */ + public get keywordPlans() { + const service = this.loadService("KeywordPlanServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.KeywordPlan in full detail + * @warning Don't use get in production! + * @returns resources.KeywordPlan + */ + get: async (resourceName: string): Promise => { + const request = new services.GetKeywordPlanRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getKeywordPlan(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IKeywordPlan + * @returns services.MutateKeywordPlansResponse + */ + create: async ( + keywordPlans: (resources.IKeywordPlan | resources.KeywordPlan)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanOperation, + resources.IKeywordPlan + >( + "create", + keywordPlans + + + ); + const request = this.buildRequest< + services.KeywordPlanOperation, services.IMutateKeywordPlansRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.KeywordPlan in full detail - * @warning Don't use get in production! - * @returns resources.KeywordPlan - */ - get: async (resourceName: string): Promise => { - const request = new services.GetKeywordPlanRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getKeywordPlan(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.IKeywordPlan - * @returns services.MutateKeywordPlansResponse - */ - create: async ( - keywordPlans: (resources.IKeywordPlan | resources.KeywordPlan)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanOperation, - resources.IKeywordPlan - >("create", keywordPlans); - const request = this.buildRequest< - services.KeywordPlanOperation, - services.IMutateKeywordPlansRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanService.mutateKeywordPlans", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlans(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description update resources of type resources.IKeywordPlan - * @returns services.MutateKeywordPlansResponse - */ - update: async ( - keywordPlans: (resources.IKeywordPlan | resources.KeywordPlan)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.KeywordPlanOperation, - resources.IKeywordPlan - >( - "update", - keywordPlans, - // @ts-expect-error Static class type here is fine - resources.KeywordPlan - ); - const request = this.buildRequest< - services.KeywordPlanOperation, - services.IMutateKeywordPlansRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanService.mutateKeywordPlans", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlans(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description remove resources of type string - * @returns services.MutateKeywordPlansResponse - */ - remove: async ( - keywordPlans: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - keywordPlans - ); - const request = this.buildRequest< - services.KeywordPlanOperation, - services.IMutateKeywordPlansRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "KeywordPlanService.mutateKeywordPlans", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateKeywordPlans(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanService#generateforecastcurve - */ - generateForecastCurve: async ( - request: services.GenerateForecastCurveRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.generateForecastCurve(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanService.mutateKeywordPlans", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanService#generateforecasttimeseries - */ - generateForecastTimeSeries: async ( - request: services.GenerateForecastTimeSeriesRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.generateForecastTimeSeries(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlans(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IKeywordPlan + * @returns services.MutateKeywordPlansResponse + */ + update: async ( + keywordPlans: (resources.IKeywordPlan | resources.KeywordPlan)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanOperation, + resources.IKeywordPlan + >( + "update", + keywordPlans + // @ts-expect-error Static class type here is fine + , resources.KeywordPlan + ); + const request = this.buildRequest< + services.KeywordPlanOperation, + services.IMutateKeywordPlansRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanService.mutateKeywordPlans", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanService#generateforecastmetrics - */ - generateForecastMetrics: async ( - request: services.GenerateForecastMetricsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.generateForecastMetrics(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlans(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateKeywordPlansResponse + */ + remove: async ( + keywordPlans: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.KeywordPlanOperation, + string + >( + "remove", + keywordPlans + + + ); + const request = this.buildRequest< + services.KeywordPlanOperation, + services.IMutateKeywordPlansRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "KeywordPlanService.mutateKeywordPlans", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanService#generatehistoricalmetrics - */ - generateHistoricalMetrics: async ( - request: services.GenerateHistoricalMetricsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.generateHistoricalMetrics(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LabelService - */ - public get labels() { - const service = this.loadService( - "LabelServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateKeywordPlans(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanService#generateforecastcurve + */ + generateForecastCurve: async (request: services.GenerateForecastCurveRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.generateForecastCurve(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanService#generateforecasttimeseries + */ + generateForecastTimeSeries: async (request: services.GenerateForecastTimeSeriesRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.generateForecastTimeSeries(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanService#generateforecastmetrics + */ + generateForecastMetrics: async (request: services.GenerateForecastMetricsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.generateForecastMetrics(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanService#generatehistoricalmetrics + */ + generateHistoricalMetrics: async (request: services.GenerateHistoricalMetricsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.generateHistoricalMetrics(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LabelService + */ + public get labels() { + const service = this.loadService("LabelServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.Label in full detail + * @warning Don't use get in production! + * @returns resources.Label + */ + get: async (resourceName: string): Promise => { + const request = new services.GetLabelRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getLabel(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ILabel + * @returns services.MutateLabelsResponse + */ + create: async ( + labels: (resources.ILabel | resources.Label)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.LabelOperation, + resources.ILabel + >( + "create", + labels + + + ); + const request = this.buildRequest< + services.LabelOperation, services.IMutateLabelsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.Label in full detail - * @warning Don't use get in production! - * @returns resources.Label - */ - get: async (resourceName: string): Promise => { - const request = new services.GetLabelRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getLabel(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "LabelService.mutateLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.ILabel - * @returns services.MutateLabelsResponse - */ - create: async ( - labels: (resources.ILabel | resources.Label)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.LabelOperation, - resources.ILabel - >("create", labels); - const request = this.buildRequest< - services.LabelOperation, - services.IMutateLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "LabelService.mutateLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ILabel + * @returns services.MutateLabelsResponse + */ + update: async ( + labels: (resources.ILabel | resources.Label)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.LabelOperation, + resources.ILabel + >( + "update", + labels + // @ts-expect-error Static class type here is fine + , resources.Label + ); + const request = this.buildRequest< + services.LabelOperation, + services.IMutateLabelsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "LabelService.mutateLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ILabel - * @returns services.MutateLabelsResponse - */ - update: async ( - labels: (resources.ILabel | resources.Label)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.LabelOperation, - resources.ILabel - >( - "update", - labels, - // @ts-expect-error Static class type here is fine - resources.Label - ); - const request = this.buildRequest< - services.LabelOperation, - services.IMutateLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "LabelService.mutateLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateLabelsResponse + */ + remove: async ( + labels: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.LabelOperation, + string + >( + "remove", + labels + + + ); + const request = this.buildRequest< + services.LabelOperation, + services.IMutateLabelsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "LabelService.mutateLabels", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateLabelsResponse - */ - remove: async ( - labels: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - labels - ); - const request = this.buildRequest< - services.LabelOperation, - services.IMutateLabelsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "LabelService.mutateLabels", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateLabels(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MediaFileService - */ - public get mediaFiles() { - const service = this.loadService( - "MediaFileServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateLabels(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MediaFileService + */ + public get mediaFiles() { + const service = this.loadService("MediaFileServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.MediaFile in full detail + * @warning Don't use get in production! + * @returns resources.MediaFile + */ + get: async (resourceName: string): Promise => { + const request = new services.GetMediaFileRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getMediaFile(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IMediaFile + * @returns services.MutateMediaFilesResponse + */ + create: async ( + mediaFiles: (resources.IMediaFile | resources.MediaFile)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.MediaFileOperation, + resources.IMediaFile + >( + "create", + mediaFiles + + + ); + const request = this.buildRequest< + services.MediaFileOperation, services.IMutateMediaFilesRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.MediaFile in full detail - * @warning Don't use get in production! - * @returns resources.MediaFile - */ - get: async (resourceName: string): Promise => { - const request = new services.GetMediaFileRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getMediaFile(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "MediaFileService.mutateMediaFiles", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IMediaFile - * @returns services.MutateMediaFilesResponse - */ - create: async ( - mediaFiles: (resources.IMediaFile | resources.MediaFile)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.MediaFileOperation, - resources.IMediaFile - >("create", mediaFiles); - const request = this.buildRequest< - services.MediaFileOperation, - services.IMutateMediaFilesRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "MediaFileService.mutateMediaFiles", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateMediaFiles(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/RemarketingActionService - */ - public get remarketingActions() { - const service = this.loadService( - "RemarketingActionServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateMediaFiles(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/RemarketingActionService + */ + public get remarketingActions() { + const service = this.loadService("RemarketingActionServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.RemarketingAction in full detail + * @warning Don't use get in production! + * @returns resources.RemarketingAction + */ + get: async (resourceName: string): Promise => { + const request = new services.GetRemarketingActionRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getRemarketingAction(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IRemarketingAction + * @returns services.MutateRemarketingActionsResponse + */ + create: async ( + remarketingActions: (resources.IRemarketingAction | resources.RemarketingAction)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.RemarketingActionOperation, + resources.IRemarketingAction + >( + "create", + remarketingActions + + + ); + const request = this.buildRequest< + services.RemarketingActionOperation, services.IMutateRemarketingActionsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.RemarketingAction in full detail - * @warning Don't use get in production! - * @returns resources.RemarketingAction - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetRemarketingActionRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getRemarketingAction(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "RemarketingActionService.mutateRemarketingActions", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description create resources of type resources.IRemarketingAction - * @returns services.MutateRemarketingActionsResponse - */ - create: async ( - remarketingActions: ( - | resources.IRemarketingAction - | resources.RemarketingAction - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.RemarketingActionOperation, - resources.IRemarketingAction - >("create", remarketingActions); - const request = this.buildRequest< - services.RemarketingActionOperation, - services.IMutateRemarketingActionsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "RemarketingActionService.mutateRemarketingActions", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateRemarketingActions(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateRemarketingActions(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IRemarketingAction + * @returns services.MutateRemarketingActionsResponse + */ + update: async ( + remarketingActions: (resources.IRemarketingAction | resources.RemarketingAction)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.RemarketingActionOperation, + resources.IRemarketingAction + >( + "update", + remarketingActions + // @ts-expect-error Static class type here is fine + , resources.RemarketingAction + ); + const request = this.buildRequest< + services.RemarketingActionOperation, + services.IMutateRemarketingActionsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "RemarketingActionService.mutateRemarketingActions", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.IRemarketingAction - * @returns services.MutateRemarketingActionsResponse - */ - update: async ( - remarketingActions: ( - | resources.IRemarketingAction - | resources.RemarketingAction - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.RemarketingActionOperation, - resources.IRemarketingAction - >( - "update", - remarketingActions, - // @ts-expect-error Static class type here is fine - resources.RemarketingAction - ); - const request = this.buildRequest< - services.RemarketingActionOperation, - services.IMutateRemarketingActionsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "RemarketingActionService.mutateRemarketingActions", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateRemarketingActions(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SharedCriterionService - */ - public get sharedCriteria() { - const service = this.loadService( - "SharedCriterionServiceClient" - ); - type MutateOptions = Partial< - Pick< + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateRemarketingActions(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SharedCriterionService + */ + public get sharedCriteria() { + const service = this.loadService("SharedCriterionServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.SharedCriterion in full detail + * @warning Don't use get in production! + * @returns resources.SharedCriterion + */ + get: async (resourceName: string): Promise => { + const request = new services.GetSharedCriterionRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getSharedCriterion(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ISharedCriterion + * @returns services.MutateSharedCriteriaResponse + */ + create: async ( + sharedCriteria: (resources.ISharedCriterion | resources.SharedCriterion)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.SharedCriterionOperation, + resources.ISharedCriterion + >( + "create", + sharedCriteria + + + ); + const request = this.buildRequest< + services.SharedCriterionOperation, services.IMutateSharedCriteriaRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.SharedCriterion in full detail - * @warning Don't use get in production! - * @returns resources.SharedCriterion - */ - get: async (resourceName: string): Promise => { - const request = new services.GetSharedCriterionRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getSharedCriterion(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.ISharedCriterion - * @returns services.MutateSharedCriteriaResponse - */ - create: async ( - sharedCriteria: ( - | resources.ISharedCriterion - | resources.SharedCriterion - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.SharedCriterionOperation, - resources.ISharedCriterion - >("create", sharedCriteria); - const request = this.buildRequest< - services.SharedCriterionOperation, - services.IMutateSharedCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "SharedCriterionService.mutateSharedCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateSharedCriteria(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "SharedCriterionService.mutateSharedCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateSharedCriteriaResponse - */ - remove: async ( - sharedCriteria: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.SharedCriterionOperation, - string - >("remove", sharedCriteria); - const request = this.buildRequest< - services.SharedCriterionOperation, - services.IMutateSharedCriteriaRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "SharedCriterionService.mutateSharedCriteria", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateSharedCriteria(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SharedSetService - */ - public get sharedSets() { - const service = this.loadService( - "SharedSetServiceClient" - ); - type MutateOptions = Partial< - Pick< - services.IMutateSharedSetsRequest, - "partial_failure" | "validate_only" | "response_content_type" - > - >; - return { - /** - * @description Retrieve a resources.SharedSet in full detail - * @warning Don't use get in production! - * @returns resources.SharedSet - */ - get: async (resourceName: string): Promise => { - const request = new services.GetSharedSetRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getSharedSet(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.ISharedSet - * @returns services.MutateSharedSetsResponse - */ - create: async ( - sharedSets: (resources.ISharedSet | resources.SharedSet)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.SharedSetOperation, - resources.ISharedSet - >("create", sharedSets); - const request = this.buildRequest< - services.SharedSetOperation, - services.IMutateSharedSetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "SharedSetService.mutateSharedSets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateSharedSets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description update resources of type resources.ISharedSet - * @returns services.MutateSharedSetsResponse - */ - update: async ( - sharedSets: (resources.ISharedSet | resources.SharedSet)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.SharedSetOperation, - resources.ISharedSet - >( - "update", - sharedSets, - // @ts-expect-error Static class type here is fine - resources.SharedSet - ); - const request = this.buildRequest< - services.SharedSetOperation, - services.IMutateSharedSetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "SharedSetService.mutateSharedSets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateSharedSets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description remove resources of type string - * @returns services.MutateSharedSetsResponse - */ - remove: async ( - sharedSets: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - sharedSets - ); - const request = this.buildRequest< - services.SharedSetOperation, - services.IMutateSharedSetsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "SharedSetService.mutateSharedSets", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateSharedSets(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateSharedCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserListService - */ - public get userLists() { - const service = this.loadService( - "UserListServiceClient" - ); - type MutateOptions = Partial< - Pick< - services.IMutateUserListsRequest, - "partial_failure" | "validate_only" - > - >; - return { - /** - * @description Retrieve a resources.UserList in full detail - * @warning Don't use get in production! - * @returns resources.UserList - */ - get: async (resourceName: string): Promise => { - const request = new services.GetUserListRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getUserList(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.IUserList - * @returns services.MutateUserListsResponse - */ - create: async ( - userLists: (resources.IUserList | resources.UserList)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.UserListOperation, - resources.IUserList - >("create", userLists); - const request = this.buildRequest< - services.UserListOperation, - services.IMutateUserListsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "UserListService.mutateUserLists", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateUserLists(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description update resources of type resources.IUserList - * @returns services.MutateUserListsResponse - */ - update: async ( - userLists: (resources.IUserList | resources.UserList)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.UserListOperation, - resources.IUserList - >( - "update", - userLists, - // @ts-expect-error Static class type here is fine - resources.UserList - ); - const request = this.buildRequest< - services.UserListOperation, - services.IMutateUserListsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "UserListService.mutateUserLists", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateUserLists(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description remove resources of type string - * @returns services.MutateUserListsResponse - */ - remove: async ( - userLists: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations( - "remove", - userLists - ); - const request = this.buildRequest< - services.UserListOperation, - services.IMutateUserListsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "UserListService.mutateUserLists", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateUserLists(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response: this.decodePartialFailureError(response), - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return this.decodePartialFailureError(response); - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/BillingSetupService - */ - public get billingSetups() { - const service = this.loadService( - "BillingSetupServiceClient" - ); - type MutateOptions = never; - return { - /** - * @description Retrieve a resources.BillingSetup in full detail - * @warning Don't use get in production! - * @returns resources.BillingSetup - */ - get: async (resourceName: string): Promise => { - const request = new services.GetBillingSetupRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getBillingSetup(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.IBillingSetup - * @returns services.MutateBillingSetupResponse - */ - create: async ( - billingSetups: (resources.IBillingSetup | resources.BillingSetup)[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.BillingSetupOperation, - resources.IBillingSetup - >("create", billingSetups); - const request = this.buildRequest< - services.BillingSetupOperation, - services.IMutateBillingSetupRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "BillingSetupService.mutateBillingSetup", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateBillingSetup(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateSharedCriteriaResponse + */ + remove: async ( + sharedCriteria: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.SharedCriterionOperation, + string + >( + "remove", + sharedCriteria + + + ); + const request = this.buildRequest< + services.SharedCriterionOperation, + services.IMutateSharedCriteriaRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "SharedCriterionService.mutateSharedCriteria", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateBillingSetupResponse - */ - remove: async ( - billingSetups: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.BillingSetupOperation, - string - >("remove", billingSetups); - const request = this.buildRequest< - services.BillingSetupOperation, - services.IMutateBillingSetupRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "BillingSetupService.mutateBillingSetup", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateBillingSetup(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignAudienceViewService - */ - public get campaignAudienceViews() { - const service = this.loadService( - "CampaignAudienceViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.CampaignAudienceView in full detail - * @warning Don't use get in production! - * @returns resources.CampaignAudienceView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCampaignAudienceViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignAudienceView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateSharedCriteria(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CampaignCriterionSimulationService - */ - public get campaignCriterionSimulations() { - const service = this.loadService( - "CampaignCriterionSimulationServiceClient" - ); - - return { - /** - * @description Retrieve a resources.CampaignCriterionSimulation in full detail - * @warning Don't use get in production! - * @returns resources.CampaignCriterionSimulation - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCampaignCriterionSimulationRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCampaignCriterionSimulation( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CarrierConstantService - */ - public get carrierConstants() { - const service = this.loadService( - "CarrierConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.CarrierConstant in full detail - * @warning Don't use get in production! - * @returns resources.CarrierConstant - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCarrierConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCarrierConstant(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SharedSetService + */ + public get sharedSets() { + const service = this.loadService("SharedSetServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.SharedSet in full detail + * @warning Don't use get in production! + * @returns resources.SharedSet + */ + get: async (resourceName: string): Promise => { + const request = new services.GetSharedSetRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getSharedSet(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ISharedSet + * @returns services.MutateSharedSetsResponse + */ + create: async ( + sharedSets: (resources.ISharedSet | resources.SharedSet)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.SharedSetOperation, + resources.ISharedSet + >( + "create", + sharedSets + + + ); + const request = this.buildRequest< + services.SharedSetOperation, + services.IMutateSharedSetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "SharedSetService.mutateSharedSets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ChangeStatusService - */ - public get changeStatuses() { - const service = this.loadService( - "ChangeStatusServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ChangeStatus in full detail - * @warning Don't use get in production! - * @returns resources.ChangeStatus - */ - get: async (resourceName: string): Promise => { - const request = new services.GetChangeStatusRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getChangeStatus(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateSharedSets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ClickViewService - */ - public get clickViews() { - const service = this.loadService( - "ClickViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ClickView in full detail - * @warning Don't use get in production! - * @returns resources.ClickView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetClickViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getClickView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CombinedAudienceService - */ - public get combinedAudiences() { - const service = this.loadService( - "CombinedAudienceServiceClient" - ); - - return { - /** - * @description Retrieve a resources.CombinedAudience in full detail - * @warning Don't use get in production! - * @returns resources.CombinedAudience - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCombinedAudienceRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCombinedAudience(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ISharedSet + * @returns services.MutateSharedSetsResponse + */ + update: async ( + sharedSets: (resources.ISharedSet | resources.SharedSet)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.SharedSetOperation, + resources.ISharedSet + >( + "update", + sharedSets + // @ts-expect-error Static class type here is fine + , resources.SharedSet + ); + const request = this.buildRequest< + services.SharedSetOperation, + services.IMutateSharedSetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "SharedSetService.mutateSharedSets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionAdjustmentUploadService - */ - public get conversionAdjustmentUploads() { - const service = this.loadService( - "ConversionAdjustmentUploadServiceClient" - ); - - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionAdjustmentUploadService#uploadconversionadjustments - */ - uploadConversionAdjustments: async ( - request: services.UploadConversionAdjustmentsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.uploadConversionAdjustments( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateSharedSets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionUploadService - */ - public get conversionUploads() { - const service = this.loadService( - "ConversionUploadServiceClient" - ); - - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionUploadService#uploadclickconversions - */ - uploadClickConversions: async ( - request: services.UploadClickConversionsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.uploadClickConversions(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateSharedSetsResponse + */ + remove: async ( + sharedSets: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.SharedSetOperation, + string + >( + "remove", + sharedSets + + + ); + const request = this.buildRequest< + services.SharedSetOperation, + services.IMutateSharedSetsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "SharedSetService.mutateSharedSets", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ConversionUploadService#uploadcallconversions - */ - uploadCallConversions: async ( - request: services.UploadCallConversionsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.uploadCallConversions(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CurrencyConstantService - */ - public get currencyConstants() { - const service = this.loadService( - "CurrencyConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.CurrencyConstant in full detail - * @warning Don't use get in production! - * @returns resources.CurrencyConstant - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCurrencyConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCurrencyConstant(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateSharedSets(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomAudienceService - */ - public get customAudiences() { - const service = this.loadService( - "CustomAudienceServiceClient" - ); - type MutateOptions = Partial< - Pick - >; - return { - /** - * @description Retrieve a resources.CustomAudience in full detail - * @warning Don't use get in production! - * @returns resources.CustomAudience - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCustomAudienceRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomAudience(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.ICustomAudience - * @returns services.MutateCustomAudiencesResponse - */ - create: async ( - customAudiences: ( - | resources.ICustomAudience - | resources.CustomAudience - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomAudienceOperation, - resources.ICustomAudience - >("create", customAudiences); - const request = this.buildRequest< - services.CustomAudienceOperation, - services.IMutateCustomAudiencesRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomAudienceService.mutateCustomAudiences", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomAudiences(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserListService + */ + public get userLists() { + const service = this.loadService("UserListServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.UserList in full detail + * @warning Don't use get in production! + * @returns resources.UserList + */ + get: async (resourceName: string): Promise => { + const request = new services.GetUserListRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getUserList(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IUserList + * @returns services.MutateUserListsResponse + */ + create: async ( + userLists: (resources.IUserList | resources.UserList)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.UserListOperation, + resources.IUserList + >( + "create", + userLists + + + ); + const request = this.buildRequest< + services.UserListOperation, + services.IMutateUserListsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "UserListService.mutateUserLists", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICustomAudience - * @returns services.MutateCustomAudiencesResponse - */ - update: async ( - customAudiences: ( - | resources.ICustomAudience - | resources.CustomAudience - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomAudienceOperation, - resources.ICustomAudience - >( - "update", - customAudiences, - // @ts-expect-error Static class type here is fine - resources.CustomAudience - ); - const request = this.buildRequest< - services.CustomAudienceOperation, - services.IMutateCustomAudiencesRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomAudienceService.mutateCustomAudiences", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomAudiences(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateUserLists(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.IUserList + * @returns services.MutateUserListsResponse + */ + update: async ( + userLists: (resources.IUserList | resources.UserList)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.UserListOperation, + resources.IUserList + >( + "update", + userLists + // @ts-expect-error Static class type here is fine + , resources.UserList + ); + const request = this.buildRequest< + services.UserListOperation, + services.IMutateUserListsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "UserListService.mutateUserLists", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCustomAudiencesResponse - */ - remove: async ( - customAudiences: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomAudienceOperation, - string - >("remove", customAudiences); - const request = this.buildRequest< - services.CustomAudienceOperation, - services.IMutateCustomAudiencesRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomAudienceService.mutateCustomAudiences", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomAudiences(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomInterestService - */ - public get customInterests() { - const service = this.loadService( - "CustomInterestServiceClient" - ); - type MutateOptions = Partial< - Pick - >; - return { - /** - * @description Retrieve a resources.CustomInterest in full detail - * @warning Don't use get in production! - * @returns resources.CustomInterest - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCustomInterestRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomInterest(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.ICustomInterest - * @returns services.MutateCustomInterestsResponse - */ - create: async ( - customInterests: ( - | resources.ICustomInterest - | resources.CustomInterest - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomInterestOperation, - resources.ICustomInterest - >("create", customInterests); - const request = this.buildRequest< - services.CustomInterestOperation, - services.IMutateCustomInterestsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomInterestService.mutateCustomInterests", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomInterests(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @description update resources of type resources.ICustomInterest - * @returns services.MutateCustomInterestsResponse - */ - update: async ( - customInterests: ( - | resources.ICustomInterest - | resources.CustomInterest - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomInterestOperation, - resources.ICustomInterest - >( - "update", - customInterests, - // @ts-expect-error Static class type here is fine - resources.CustomInterest - ); - const request = this.buildRequest< - services.CustomInterestOperation, - services.IMutateCustomInterestsRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomInterestService.mutateCustomInterests", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomInterests(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateUserLists(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerClientLinkService - */ - public get customerClientLinks() { - const service = this.loadService( - "CustomerClientLinkServiceClient" - ); - type MutateOptions = never; - return { - /** - * @description Retrieve a resources.CustomerClientLink in full detail - * @warning Don't use get in production! - * @returns resources.CustomerClientLink - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCustomerClientLinkRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerClientLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.ICustomerClientLink - * @returns services.MutateCustomerClientLinkResponse - */ - create: async ( - customerClientLinks: ( - | resources.ICustomerClientLink - | resources.CustomerClientLink - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerClientLinkOperation, - resources.ICustomerClientLink - >("create", customerClientLinks); - const request = this.buildRequest< - services.CustomerClientLinkOperation, - services.IMutateCustomerClientLinkRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerClientLinkService.mutateCustomerClientLink", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerClientLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateUserListsResponse + */ + remove: async ( + userLists: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.UserListOperation, + string + >( + "remove", + userLists + + + ); + const request = this.buildRequest< + services.UserListOperation, + services.IMutateUserListsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "UserListService.mutateUserLists", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description update resources of type resources.ICustomerClientLink - * @returns services.MutateCustomerClientLinkResponse - */ - update: async ( - customerClientLinks: ( - | resources.ICustomerClientLink - | resources.CustomerClientLink - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerClientLinkOperation, - resources.ICustomerClientLink - >( - "update", - customerClientLinks, - // @ts-expect-error Static class type here is fine - resources.CustomerClientLink - ); - const request = this.buildRequest< - services.CustomerClientLinkOperation, - services.IMutateCustomerClientLinkRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerClientLinkService.mutateCustomerClientLink", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerClientLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerClientService - */ - public get customerClients() { - const service = this.loadService( - "CustomerClientServiceClient" - ); - - return { - /** - * @description Retrieve a resources.CustomerClient in full detail - * @warning Don't use get in production! - * @returns resources.CustomerClient - */ - get: async (resourceName: string): Promise => { - const request = new services.GetCustomerClientRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerClient(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateUserLists(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response: this.decodePartialFailureError(response), + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerManagerLinkService - */ - public get customerManagerLinks() { - const service = this.loadService( - "CustomerManagerLinkServiceClient" - ); - type MutateOptions = never; - return { - /** - * @description Retrieve a resources.CustomerManagerLink in full detail - * @warning Don't use get in production! - * @returns resources.CustomerManagerLink - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCustomerManagerLinkRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerManagerLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description update resources of type resources.ICustomerManagerLink - * @returns services.MutateCustomerManagerLinkResponse - */ - update: async ( - customerManagerLinks: ( - | resources.ICustomerManagerLink - | resources.CustomerManagerLink - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerManagerLinkOperation, - resources.ICustomerManagerLink - >( - "update", - customerManagerLinks, - // @ts-expect-error Static class type here is fine - resources.CustomerManagerLink - ); - const request = this.buildRequest< - services.CustomerManagerLinkOperation, - services.IMutateCustomerManagerLinkRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerManagerLinkService.mutateCustomerManagerLink", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerManagerLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerManagerLinkService#movemanagerlink - */ - moveManagerLink: async ( - request: services.MoveManagerLinkRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.moveManagerLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return this.decodePartialFailureError(response); + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerUserAccessInvitationService - */ - public get customerUserAccessInvitations() { - const service = this.loadService( - "CustomerUserAccessInvitationServiceClient" - ); - type MutateOptions = never; - return { - /** - * @description Retrieve a resources.CustomerUserAccessInvitation in full detail - * @warning Don't use get in production! - * @returns resources.CustomerUserAccessInvitation - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCustomerUserAccessInvitationRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerUserAccessInvitation( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description create resources of type resources.ICustomerUserAccessInvitation - * @returns services.MutateCustomerUserAccessInvitationResponse - */ - create: async ( - customerUserAccessInvitations: ( - | resources.ICustomerUserAccessInvitation - | resources.CustomerUserAccessInvitation - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerUserAccessInvitationOperation, - resources.ICustomerUserAccessInvitation - >("create", customerUserAccessInvitations); - const request = this.buildRequest< - services.CustomerUserAccessInvitationOperation, - services.IMutateCustomerUserAccessInvitationRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CustomerUserAccessInvitationService.mutateCustomerUserAccessInvitation", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerUserAccessInvitation( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BiddingStrategySimulationService + */ + public get biddingStrategySimulations() { + const service = this.loadService("BiddingStrategySimulationServiceClient") + + return { + + /** + * @description Retrieve a resources.BiddingStrategySimulation in full detail + * @warning Don't use get in production! + * @returns resources.BiddingStrategySimulation + */ + get: async (resourceName: string): Promise => { + const request = new services.GetBiddingStrategySimulationRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getBiddingStrategySimulation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/BillingSetupService + */ + public get billingSetups() { + const service = this.loadService("BillingSetupServiceClient") + type MutateOptions = never + return { + + /** + * @description Retrieve a resources.BillingSetup in full detail + * @warning Don't use get in production! + * @returns resources.BillingSetup + */ + get: async (resourceName: string): Promise => { + const request = new services.GetBillingSetupRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getBillingSetup(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.IBillingSetup + * @returns services.MutateBillingSetupResponse + */ + create: async ( + billingSetups: (resources.IBillingSetup | resources.BillingSetup)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.BillingSetupOperation, + resources.IBillingSetup + >( + "create", + billingSetups + + + ); + const request = this.buildRequest< + services.BillingSetupOperation, + services.IMutateBillingSetupRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "BillingSetupService.mutateBillingSetup", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCustomerUserAccessInvitationResponse - */ - remove: async ( - customerUserAccessInvitations: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerUserAccessInvitationOperation, - string - >("remove", customerUserAccessInvitations); - const request = this.buildRequest< - services.CustomerUserAccessInvitationOperation, - services.IMutateCustomerUserAccessInvitationRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: - "CustomerUserAccessInvitationService.mutateCustomerUserAccessInvitation", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerUserAccessInvitation( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/CustomerUserAccessService - */ - public get customerUserAccesses() { - const service = this.loadService( - "CustomerUserAccessServiceClient" - ); - type MutateOptions = never; - return { - /** - * @description Retrieve a resources.CustomerUserAccess in full detail - * @warning Don't use get in production! - * @returns resources.CustomerUserAccess - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetCustomerUserAccessRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getCustomerUserAccess(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description update resources of type resources.ICustomerUserAccess - * @returns services.MutateCustomerUserAccessResponse - */ - update: async ( - customerUserAccesses: ( - | resources.ICustomerUserAccess - | resources.CustomerUserAccess - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerUserAccessOperation, - resources.ICustomerUserAccess - >( - "update", - customerUserAccesses, - // @ts-expect-error Static class type here is fine - resources.CustomerUserAccess - ); - const request = this.buildRequest< - services.CustomerUserAccessOperation, - services.IMutateCustomerUserAccessRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerUserAccessService.mutateCustomerUserAccess", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerUserAccess(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateBillingSetup(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateBillingSetupResponse + */ + remove: async ( + billingSetups: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.BillingSetupOperation, + string + >( + "remove", + billingSetups + + + ); + const request = this.buildRequest< + services.BillingSetupOperation, + services.IMutateBillingSetupRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "BillingSetupService.mutateBillingSetup", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateCustomerUserAccessResponse - */ - remove: async ( - customerUserAccesses: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.CustomerUserAccessOperation, - string - >("remove", customerUserAccesses); - const request = this.buildRequest< - services.CustomerUserAccessOperation, - services.IMutateCustomerUserAccessRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "CustomerUserAccessService.mutateCustomerUserAccess", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateCustomerUserAccess(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DetailPlacementViewService - */ - public get detailPlacementViews() { - const service = this.loadService( - "DetailPlacementViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.DetailPlacementView in full detail - * @warning Don't use get in production! - * @returns resources.DetailPlacementView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetDetailPlacementViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getDetailPlacementView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateBillingSetup(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DisplayKeywordViewService - */ - public get displayKeywordViews() { - const service = this.loadService( - "DisplayKeywordViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.DisplayKeywordView in full detail - * @warning Don't use get in production! - * @returns resources.DisplayKeywordView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetDisplayKeywordViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getDisplayKeywordView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DistanceViewService - */ - public get distanceViews() { - const service = this.loadService( - "DistanceViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.DistanceView in full detail - * @warning Don't use get in production! - * @returns resources.DistanceView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetDistanceViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getDistanceView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignAudienceViewService + */ + public get campaignAudienceViews() { + const service = this.loadService("CampaignAudienceViewServiceClient") + + return { + + /** + * @description Retrieve a resources.CampaignAudienceView in full detail + * @warning Don't use get in production! + * @returns resources.CampaignAudienceView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignAudienceViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignAudienceView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignCriterionSimulationService + */ + public get campaignCriterionSimulations() { + const service = this.loadService("CampaignCriterionSimulationServiceClient") + + return { + + /** + * @description Retrieve a resources.CampaignCriterionSimulation in full detail + * @warning Don't use get in production! + * @returns resources.CampaignCriterionSimulation + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignCriterionSimulationRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignCriterionSimulation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CampaignSimulationService + */ + public get campaignSimulations() { + const service = this.loadService("CampaignSimulationServiceClient") + + return { + + /** + * @description Retrieve a resources.CampaignSimulation in full detail + * @warning Don't use get in production! + * @returns resources.CampaignSimulation + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCampaignSimulationRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCampaignSimulation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CarrierConstantService + */ + public get carrierConstants() { + const service = this.loadService("CarrierConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.CarrierConstant in full detail + * @warning Don't use get in production! + * @returns resources.CarrierConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCarrierConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCarrierConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ChangeStatusService + */ + public get changeStatuses() { + const service = this.loadService("ChangeStatusServiceClient") + + return { + + /** + * @description Retrieve a resources.ChangeStatus in full detail + * @warning Don't use get in production! + * @returns resources.ChangeStatus + */ + get: async (resourceName: string): Promise => { + const request = new services.GetChangeStatusRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getChangeStatus(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ClickViewService + */ + public get clickViews() { + const service = this.loadService("ClickViewServiceClient") + + return { + + /** + * @description Retrieve a resources.ClickView in full detail + * @warning Don't use get in production! + * @returns resources.ClickView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetClickViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getClickView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CombinedAudienceService + */ + public get combinedAudiences() { + const service = this.loadService("CombinedAudienceServiceClient") + + return { + + /** + * @description Retrieve a resources.CombinedAudience in full detail + * @warning Don't use get in production! + * @returns resources.CombinedAudience + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCombinedAudienceRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCombinedAudience(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionAdjustmentUploadService + */ + public get conversionAdjustmentUploads() { + const service = this.loadService("ConversionAdjustmentUploadServiceClient") + + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionAdjustmentUploadService#uploadconversionadjustments + */ + uploadConversionAdjustments: async (request: services.UploadConversionAdjustmentsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.uploadConversionAdjustments(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionUploadService + */ + public get conversionUploads() { + const service = this.loadService("ConversionUploadServiceClient") + + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionUploadService#uploadclickconversions + */ + uploadClickConversions: async (request: services.UploadClickConversionsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.uploadClickConversions(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ConversionUploadService#uploadcallconversions + */ + uploadCallConversions: async (request: services.UploadCallConversionsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.uploadCallConversions(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CurrencyConstantService + */ + public get currencyConstants() { + const service = this.loadService("CurrencyConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.CurrencyConstant in full detail + * @warning Don't use get in production! + * @returns resources.CurrencyConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCurrencyConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCurrencyConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomAudienceService + */ + public get customAudiences() { + const service = this.loadService("CustomAudienceServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomAudience in full detail + * @warning Don't use get in production! + * @returns resources.CustomAudience + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomAudienceRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomAudience(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomAudience + * @returns services.MutateCustomAudiencesResponse + */ + create: async ( + customAudiences: (resources.ICustomAudience | resources.CustomAudience)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomAudienceOperation, + resources.ICustomAudience + >( + "create", + customAudiences + + + ); + const request = this.buildRequest< + services.CustomAudienceOperation, + services.IMutateCustomAudiencesRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomAudienceService.mutateCustomAudiences", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DomainCategoryService - */ - public get domainCategories() { - const service = this.loadService( - "DomainCategoryServiceClient" - ); - - return { - /** - * @description Retrieve a resources.DomainCategory in full detail - * @warning Don't use get in production! - * @returns resources.DomainCategory - */ - get: async (resourceName: string): Promise => { - const request = new services.GetDomainCategoryRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getDomainCategory(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomAudiences(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/DynamicSearchAdsSearchTermViewService - */ - public get dynamicSearchAdsSearchTermViews() { - const service = this.loadService( - "DynamicSearchAdsSearchTermViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.DynamicSearchAdsSearchTermView in full detail - * @warning Don't use get in production! - * @returns resources.DynamicSearchAdsSearchTermView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetDynamicSearchAdsSearchTermViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getDynamicSearchAdsSearchTermView( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ExpandedLandingPageViewService - */ - public get expandedLandingPageViews() { - const service = this.loadService( - "ExpandedLandingPageViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ExpandedLandingPageView in full detail - * @warning Don't use get in production! - * @returns resources.ExpandedLandingPageView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetExpandedLandingPageViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getExpandedLandingPageView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICustomAudience + * @returns services.MutateCustomAudiencesResponse + */ + update: async ( + customAudiences: (resources.ICustomAudience | resources.CustomAudience)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomAudienceOperation, + resources.ICustomAudience + >( + "update", + customAudiences + // @ts-expect-error Static class type here is fine + , resources.CustomAudience + ); + const request = this.buildRequest< + services.CustomAudienceOperation, + services.IMutateCustomAudiencesRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomAudienceService.mutateCustomAudiences", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/FeedPlaceholderViewService - */ - public get feedPlaceholderViews() { - const service = this.loadService( - "FeedPlaceholderViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.FeedPlaceholderView in full detail - * @warning Don't use get in production! - * @returns resources.FeedPlaceholderView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetFeedPlaceholderViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getFeedPlaceholderView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomAudiences(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GenderViewService - */ - public get genderViews() { - const service = this.loadService( - "GenderViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.GenderView in full detail - * @warning Don't use get in production! - * @returns resources.GenderView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetGenderViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getGenderView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GeoTargetConstantService - */ - public get geoTargetConstants() { - const service = this.loadService( - "GeoTargetConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.GeoTargetConstant in full detail - * @warning Don't use get in production! - * @returns resources.GeoTargetConstant - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetGeoTargetConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getGeoTargetConstant(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCustomAudiencesResponse + */ + remove: async ( + customAudiences: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomAudienceOperation, + string + >( + "remove", + customAudiences + + + ); + const request = this.buildRequest< + services.CustomAudienceOperation, + services.IMutateCustomAudiencesRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomAudienceService.mutateCustomAudiences", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GeoTargetConstantService#suggestgeotargetconstants - */ - suggestGeoTargetConstants: async ( - request: services.SuggestGeoTargetConstantsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.suggestGeoTargetConstants(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GeographicViewService - */ - public get geographicViews() { - const service = this.loadService( - "GeographicViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.GeographicView in full detail - * @warning Don't use get in production! - * @returns resources.GeographicView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetGeographicViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getGeographicView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; - } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/GroupPlacementViewService - */ - public get groupPlacementViews() { - const service = this.loadService( - "GroupPlacementViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.GroupPlacementView in full detail - * @warning Don't use get in production! - * @returns resources.GroupPlacementView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetGroupPlacementViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getGroupPlacementView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomAudiences(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/HotelGroupViewService - */ - public get hotelGroupViews() { - const service = this.loadService( - "HotelGroupViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.HotelGroupView in full detail - * @warning Don't use get in production! - * @returns resources.HotelGroupView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetHotelGroupViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getHotelGroupView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/HotelPerformanceViewService - */ - public get hotelPerformanceViews() { - const service = this.loadService( - "HotelPerformanceViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.HotelPerformanceView in full detail - * @warning Don't use get in production! - * @returns resources.HotelPerformanceView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetHotelPerformanceViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getHotelPerformanceView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomInterestService + */ + public get customInterests() { + const service = this.loadService("CustomInterestServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomInterest in full detail + * @warning Don't use get in production! + * @returns resources.CustomInterest + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomInterestRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomInterest(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomInterest + * @returns services.MutateCustomInterestsResponse + */ + create: async ( + customInterests: (resources.ICustomInterest | resources.CustomInterest)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomInterestOperation, + resources.ICustomInterest + >( + "create", + customInterests + + + ); + const request = this.buildRequest< + services.CustomInterestOperation, + services.IMutateCustomInterestsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomInterestService.mutateCustomInterests", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/IncomeRangeViewService - */ - public get incomeRangeViews() { - const service = this.loadService( - "IncomeRangeViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.IncomeRangeView in full detail - * @warning Don't use get in production! - * @returns resources.IncomeRangeView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetIncomeRangeViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getIncomeRangeView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomInterests(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/InvoiceService - */ - public get invoices() { - const service = this.loadService( - "InvoiceServiceClient" - ); - - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/InvoiceService#listinvoices - */ - listInvoices: async ( - request: services.ListInvoicesRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listInvoices(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanIdeaService - */ - public get keywordPlanIdeas() { - const service = this.loadService( - "KeywordPlanIdeaServiceClient" - ); - - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordPlanIdeaService#generatekeywordideas - */ - generateKeywordIdeas: async ( - request: services.GenerateKeywordIdeasRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.generateKeywordIdeas(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICustomInterest + * @returns services.MutateCustomInterestsResponse + */ + update: async ( + customInterests: (resources.ICustomInterest | resources.CustomInterest)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomInterestOperation, + resources.ICustomInterest + >( + "update", + customInterests + // @ts-expect-error Static class type here is fine + , resources.CustomInterest + ); + const request = this.buildRequest< + services.CustomInterestOperation, + services.IMutateCustomInterestsRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomInterestService.mutateCustomInterests", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/KeywordViewService - */ - public get keywordViews() { - const service = this.loadService( - "KeywordViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.KeywordView in full detail - * @warning Don't use get in production! - * @returns resources.KeywordView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetKeywordViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getKeywordView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomInterests(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LandingPageViewService - */ - public get landingPageViews() { - const service = this.loadService( - "LandingPageViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.LandingPageView in full detail - * @warning Don't use get in production! - * @returns resources.LandingPageView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetLandingPageViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getLandingPageView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LanguageConstantService - */ - public get languageConstants() { - const service = this.loadService( - "LanguageConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.LanguageConstant in full detail - * @warning Don't use get in production! - * @returns resources.LanguageConstant - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetLanguageConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getLanguageConstant(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerClientLinkService + */ + public get customerClientLinks() { + const service = this.loadService("CustomerClientLinkServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomerClientLink in full detail + * @warning Don't use get in production! + * @returns resources.CustomerClientLink + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerClientLinkRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerClientLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomerClientLink + * @returns services.MutateCustomerClientLinkResponse + */ + create: async ( + customerClientLinks: (resources.ICustomerClientLink | resources.CustomerClientLink)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerClientLinkOperation, + resources.ICustomerClientLink + >( + "create", + customerClientLinks + + + ); + const request = this.buildRequest< + services.CustomerClientLinkOperation, + services.IMutateCustomerClientLinkRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerClientLinkService.mutateCustomerClientLink", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/LocationViewService - */ - public get locationViews() { - const service = this.loadService( - "LocationViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.LocationView in full detail - * @warning Don't use get in production! - * @returns resources.LocationView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetLocationViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getLocationView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerClientLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ManagedPlacementViewService - */ - public get managedPlacementViews() { - const service = this.loadService( - "ManagedPlacementViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ManagedPlacementView in full detail - * @warning Don't use get in production! - * @returns resources.ManagedPlacementView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetManagedPlacementViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getManagedPlacementView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MerchantCenterLinkService - */ - public get merchantCenterLinks() { - const service = this.loadService( - "MerchantCenterLinkServiceClient" - ); - type MutateOptions = never; - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MerchantCenterLinkService#listmerchantcenterlinks - */ - listMerchantCenterLinks: async ( - request: services.ListMerchantCenterLinksRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listMerchantCenterLinks(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description Retrieve a resources.MerchantCenterLink in full detail - * @warning Don't use get in production! - * @returns resources.MerchantCenterLink - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetMerchantCenterLinkRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getMerchantCenterLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description update resources of type resources.IMerchantCenterLink - * @returns services.MutateMerchantCenterLinkResponse - */ - update: async ( - merchantCenterLinks: ( - | resources.IMerchantCenterLink - | resources.MerchantCenterLink - )[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.MerchantCenterLinkOperation, - resources.IMerchantCenterLink - >( - "update", - merchantCenterLinks, - // @ts-expect-error Static class type here is fine - resources.MerchantCenterLink - ); - const request = this.buildRequest< - services.MerchantCenterLinkOperation, - services.IMutateMerchantCenterLinkRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "MerchantCenterLinkService.mutateMerchantCenterLink", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateMerchantCenterLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } + throw googleAdsError; + } + } + +, + /** + * @description update resources of type resources.ICustomerClientLink + * @returns services.MutateCustomerClientLinkResponse + */ + update: async ( + customerClientLinks: (resources.ICustomerClientLink | resources.CustomerClientLink)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerClientLinkOperation, + resources.ICustomerClientLink + >( + "update", + customerClientLinks + // @ts-expect-error Static class type here is fine + , resources.CustomerClientLink + ); + const request = this.buildRequest< + services.CustomerClientLinkOperation, + services.IMutateCustomerClientLinkRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerClientLinkService.mutateCustomerClientLink", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @description remove resources of type string - * @returns services.MutateMerchantCenterLinkResponse - */ - remove: async ( - merchantCenterLinks: string[], - options?: MutateOptions - ): Promise => { - const ops = this.buildOperations< - services.MerchantCenterLinkOperation, - string - >("remove", merchantCenterLinks); - const request = this.buildRequest< - services.MerchantCenterLinkOperation, - services.IMutateMerchantCenterLinkRequest, - MutateOptions - >(ops, options); - const baseHookArguments: BaseMutationHookArgs = { - credentials: this.credentials, - method: "MerchantCenterLinkService.mutateMerchantCenterLink", - mutation: request, - isServiceCall: true, - }; - if (this.hooks.onMutationStart) { - const mutationCancellation: HookedCancellation = { cancelled: false }; - await this.hooks.onMutationStart({ - ...baseHookArguments, - cancel: (res) => { - mutationCancellation.cancelled = true; - mutationCancellation.res = res; - }, - editOptions: (options) => { - Object.entries(options).forEach(([key, val]) => { - // @ts-expect-error Index with key type is fine - request[key] = val; - }); - }, - }); - if (mutationCancellation.cancelled) { - return mutationCancellation.res; - } - } - try { - // @ts-expect-error Response is an array type - const [response] = await service.mutateMerchantCenterLink(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - if (this.hooks.onMutationEnd) { - const mutationResolution: HookedResolution = { resolved: false }; - await this.hooks.onMutationEnd({ - ...baseHookArguments, - response, - resolve: (res) => { - mutationResolution.resolved = true; - mutationResolution.res = res; - }, - }); - if (mutationResolution.resolved) { - return mutationResolution.res; - } - } - return response; - } catch (err) { - const googleAdsError = this.getGoogleAdsError(err); - if (this.hooks.onMutationError) { - await this.hooks.onMutationError({ - ...baseHookArguments, - error: googleAdsError, - }); - } - throw googleAdsError; - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MobileAppCategoryConstantService - */ - public get mobileAppCategoryConstants() { - const service = this.loadService( - "MobileAppCategoryConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.MobileAppCategoryConstant in full detail - * @warning Don't use get in production! - * @returns resources.MobileAppCategoryConstant - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetMobileAppCategoryConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getMobileAppCategoryConstant( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerClientLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/MobileDeviceConstantService - */ - public get mobileDeviceConstants() { - const service = this.loadService( - "MobileDeviceConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.MobileDeviceConstant in full detail - * @warning Don't use get in production! - * @returns resources.MobileDeviceConstant - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetMobileDeviceConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getMobileDeviceConstant(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OfflineUserDataJobService - */ - public get offlineUserDataJobs() { - const service = this.loadService( - "OfflineUserDataJobServiceClient" - ); - - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OfflineUserDataJobService#createofflineuserdatajob - */ - createOfflineUserDataJob: async ( - request: services.CreateOfflineUserDataJobRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.createOfflineUserDataJob(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @description Retrieve a resources.OfflineUserDataJob in full detail - * @warning Don't use get in production! - * @returns resources.OfflineUserDataJob - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetOfflineUserDataJobRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getOfflineUserDataJob(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OfflineUserDataJobService#addofflineuserdatajoboperations - */ - addOfflineUserDataJobOperations: async ( - request: services.AddOfflineUserDataJobOperationsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.addOfflineUserDataJobOperations( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerClientService + */ + public get customerClients() { + const service = this.loadService("CustomerClientServiceClient") + + return { + + /** + * @description Retrieve a resources.CustomerClient in full detail + * @warning Don't use get in production! + * @returns resources.CustomerClient + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerClientRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerClient(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerManagerLinkService + */ + public get customerManagerLinks() { + const service = this.loadService("CustomerManagerLinkServiceClient") + type MutateOptions = Partial> + return { + + /** + * @description Retrieve a resources.CustomerManagerLink in full detail + * @warning Don't use get in production! + * @returns resources.CustomerManagerLink + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerManagerLinkRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerManagerLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description update resources of type resources.ICustomerManagerLink + * @returns services.MutateCustomerManagerLinkResponse + */ + update: async ( + customerManagerLinks: (resources.ICustomerManagerLink | resources.CustomerManagerLink)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerManagerLinkOperation, + resources.ICustomerManagerLink + >( + "update", + customerManagerLinks + // @ts-expect-error Static class type here is fine + , resources.CustomerManagerLink + ); + const request = this.buildRequest< + services.CustomerManagerLinkOperation, + services.IMutateCustomerManagerLinkRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerManagerLinkService.mutateCustomerManagerLink", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OfflineUserDataJobService#runofflineuserdatajob - */ - runOfflineUserDataJob: async ( - request: services.RunOfflineUserDataJobRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.runOfflineUserDataJob(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; - } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/OperatingSystemVersionConstantService - */ - public get operatingSystemVersionConstants() { - const service = this.loadService( - "OperatingSystemVersionConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.OperatingSystemVersionConstant in full detail - * @warning Don't use get in production! - * @returns resources.OperatingSystemVersionConstant - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetOperatingSystemVersionConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getOperatingSystemVersionConstant( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PaidOrganicSearchTermViewService - */ - public get paidOrganicSearchTermViews() { - const service = this.loadService( - "PaidOrganicSearchTermViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.PaidOrganicSearchTermView in full detail - * @warning Don't use get in production! - * @returns resources.PaidOrganicSearchTermView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetPaidOrganicSearchTermViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getPaidOrganicSearchTermView( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerManagerLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ParentalStatusViewService - */ - public get parentalStatusViews() { - const service = this.loadService( - "ParentalStatusViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ParentalStatusView in full detail - * @warning Don't use get in production! - * @returns resources.ParentalStatusView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetParentalStatusViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getParentalStatusView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PaymentsAccountService - */ - public get paymentsAccounts() { - const service = this.loadService( - "PaymentsAccountServiceClient" - ); - - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/PaymentsAccountService#listpaymentsaccounts - */ - listPaymentsAccounts: async ( - request: services.ListPaymentsAccountsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listPaymentsAccounts(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerManagerLinkService#movemanagerlink + */ + moveManagerLink: async (request: services.MoveManagerLinkRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.moveManagerLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerUserAccessInvitationService + */ + public get customerUserAccessInvitations() { + const service = this.loadService("CustomerUserAccessInvitationServiceClient") + type MutateOptions = never + return { + + /** + * @description Retrieve a resources.CustomerUserAccessInvitation in full detail + * @warning Don't use get in production! + * @returns resources.CustomerUserAccessInvitation + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerUserAccessInvitationRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerUserAccessInvitation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description create resources of type resources.ICustomerUserAccessInvitation + * @returns services.MutateCustomerUserAccessInvitationResponse + */ + create: async ( + customerUserAccessInvitations: (resources.ICustomerUserAccessInvitation | resources.CustomerUserAccessInvitation)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerUserAccessInvitationOperation, + resources.ICustomerUserAccessInvitation + >( + "create", + customerUserAccessInvitations + + + ); + const request = this.buildRequest< + services.CustomerUserAccessInvitationOperation, + services.IMutateCustomerUserAccessInvitationRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerUserAccessInvitationService.mutateCustomerUserAccessInvitation", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductBiddingCategoryConstantService - */ - public get productBiddingCategoryConstants() { - const service = this.loadService( - "ProductBiddingCategoryConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ProductBiddingCategoryConstant in full detail - * @warning Don't use get in production! - * @returns resources.ProductBiddingCategoryConstant - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetProductBiddingCategoryConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getProductBiddingCategoryConstant( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerUserAccessInvitation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ProductGroupViewService - */ - public get productGroupViews() { - const service = this.loadService( - "ProductGroupViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ProductGroupView in full detail - * @warning Don't use get in production! - * @returns resources.ProductGroupView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetProductGroupViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getProductGroupView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ReachPlanService - */ - public get reachPlans() { - const service = this.loadService( - "ReachPlanServiceClient" - ); - - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ReachPlanService#listplannablelocations - */ - listPlannableLocations: async ( - request: services.ListPlannableLocationsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listPlannableLocations(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ReachPlanService#listplannableproducts - */ - listPlannableProducts: async ( - request: services.ListPlannableProductsRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.listPlannableProducts(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ReachPlanService#generateproductmixideas - */ - generateProductMixIdeas: async ( - request: services.GenerateProductMixIdeasRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.generateProductMixIdeas(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCustomerUserAccessInvitationResponse + */ + remove: async ( + customerUserAccessInvitations: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerUserAccessInvitationOperation, + string + >( + "remove", + customerUserAccessInvitations + + + ); + const request = this.buildRequest< + services.CustomerUserAccessInvitationOperation, + services.IMutateCustomerUserAccessInvitationRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerUserAccessInvitationService.mutateCustomerUserAccessInvitation", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ReachPlanService#generatereachforecast - */ - generateReachForecast: async ( - request: services.GenerateReachForecastRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.generateReachForecast(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/RecommendationService - */ - public get recommendations() { - const service = this.loadService( - "RecommendationServiceClient" - ); - - return { - /** - * @description Retrieve a resources.Recommendation in full detail - * @warning Don't use get in production! - * @returns resources.Recommendation - */ - get: async (resourceName: string): Promise => { - const request = new services.GetRecommendationRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getRecommendation(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerUserAccessInvitation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/CustomerUserAccessService + */ + public get customerUserAccesses() { + const service = this.loadService("CustomerUserAccessServiceClient") + type MutateOptions = never + return { + + /** + * @description Retrieve a resources.CustomerUserAccess in full detail + * @warning Don't use get in production! + * @returns resources.CustomerUserAccess + */ + get: async (resourceName: string): Promise => { + const request = new services.GetCustomerUserAccessRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getCustomerUserAccess(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description update resources of type resources.ICustomerUserAccess + * @returns services.MutateCustomerUserAccessResponse + */ + update: async ( + customerUserAccesses: (resources.ICustomerUserAccess | resources.CustomerUserAccess)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerUserAccessOperation, + resources.ICustomerUserAccess + >( + "update", + customerUserAccesses + // @ts-expect-error Static class type here is fine + , resources.CustomerUserAccess + ); + const request = this.buildRequest< + services.CustomerUserAccessOperation, + services.IMutateCustomerUserAccessRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerUserAccessService.mutateCustomerUserAccess", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/RecommendationService#applyrecommendation - */ - applyRecommendation: async ( - request: services.ApplyRecommendationRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.applyRecommendation(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } + } + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerUserAccess(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } + } + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); + } + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateCustomerUserAccessResponse + */ + remove: async ( + customerUserAccesses: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.CustomerUserAccessOperation, + string + >( + "remove", + customerUserAccesses + + + ); + const request = this.buildRequest< + services.CustomerUserAccessOperation, + services.IMutateCustomerUserAccessRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "CustomerUserAccessService.mutateCustomerUserAccess", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/RecommendationService#dismissrecommendation - */ - dismissRecommendation: async ( - request: services.DismissRecommendationRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.dismissRecommendation(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/SearchTermViewService - */ - public get searchTermViews() { - const service = this.loadService( - "SearchTermViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.SearchTermView in full detail - * @warning Don't use get in production! - * @returns resources.SearchTermView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetSearchTermViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getSearchTermView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateCustomerUserAccess(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ShoppingPerformanceViewService - */ - public get shoppingPerformanceViews() { - const service = this.loadService( - "ShoppingPerformanceViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ShoppingPerformanceView in full detail - * @warning Don't use get in production! - * @returns resources.ShoppingPerformanceView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetShoppingPerformanceViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getShoppingPerformanceView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ThirdPartyAppAnalyticsLinkService - */ - public get thirdPartyAppAnalyticsLinks() { - const service = this.loadService( - "ThirdPartyAppAnalyticsLinkServiceClient" - ); - - return { - /** - * @description Retrieve a resources.ThirdPartyAppAnalyticsLink in full detail - * @warning Don't use get in production! - * @returns resources.ThirdPartyAppAnalyticsLink - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetThirdPartyAppAnalyticsLinkRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getThirdPartyAppAnalyticsLink( - request, - { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - } - ); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DetailPlacementViewService + */ + public get detailPlacementViews() { + const service = this.loadService("DetailPlacementViewServiceClient") + + return { + + /** + * @description Retrieve a resources.DetailPlacementView in full detail + * @warning Don't use get in production! + * @returns resources.DetailPlacementView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetDetailPlacementViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getDetailPlacementView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DisplayKeywordViewService + */ + public get displayKeywordViews() { + const service = this.loadService("DisplayKeywordViewServiceClient") + + return { + + /** + * @description Retrieve a resources.DisplayKeywordView in full detail + * @warning Don't use get in production! + * @returns resources.DisplayKeywordView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetDisplayKeywordViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getDisplayKeywordView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DistanceViewService + */ + public get distanceViews() { + const service = this.loadService("DistanceViewServiceClient") + + return { + + /** + * @description Retrieve a resources.DistanceView in full detail + * @warning Don't use get in production! + * @returns resources.DistanceView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetDistanceViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getDistanceView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DomainCategoryService + */ + public get domainCategories() { + const service = this.loadService("DomainCategoryServiceClient") + + return { + + /** + * @description Retrieve a resources.DomainCategory in full detail + * @warning Don't use get in production! + * @returns resources.DomainCategory + */ + get: async (resourceName: string): Promise => { + const request = new services.GetDomainCategoryRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getDomainCategory(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/DynamicSearchAdsSearchTermViewService + */ + public get dynamicSearchAdsSearchTermViews() { + const service = this.loadService("DynamicSearchAdsSearchTermViewServiceClient") + + return { + + /** + * @description Retrieve a resources.DynamicSearchAdsSearchTermView in full detail + * @warning Don't use get in production! + * @returns resources.DynamicSearchAdsSearchTermView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetDynamicSearchAdsSearchTermViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getDynamicSearchAdsSearchTermView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ExpandedLandingPageViewService + */ + public get expandedLandingPageViews() { + const service = this.loadService("ExpandedLandingPageViewServiceClient") + + return { + + /** + * @description Retrieve a resources.ExpandedLandingPageView in full detail + * @warning Don't use get in production! + * @returns resources.ExpandedLandingPageView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetExpandedLandingPageViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getExpandedLandingPageView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/FeedPlaceholderViewService + */ + public get feedPlaceholderViews() { + const service = this.loadService("FeedPlaceholderViewServiceClient") + + return { + + /** + * @description Retrieve a resources.FeedPlaceholderView in full detail + * @warning Don't use get in production! + * @returns resources.FeedPlaceholderView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetFeedPlaceholderViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getFeedPlaceholderView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GenderViewService + */ + public get genderViews() { + const service = this.loadService("GenderViewServiceClient") + + return { + + /** + * @description Retrieve a resources.GenderView in full detail + * @warning Don't use get in production! + * @returns resources.GenderView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetGenderViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getGenderView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GeoTargetConstantService + */ + public get geoTargetConstants() { + const service = this.loadService("GeoTargetConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.GeoTargetConstant in full detail + * @warning Don't use get in production! + * @returns resources.GeoTargetConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetGeoTargetConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getGeoTargetConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GeoTargetConstantService#suggestgeotargetconstants + */ + suggestGeoTargetConstants: async (request: services.SuggestGeoTargetConstantsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.suggestGeoTargetConstants(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GeographicViewService + */ + public get geographicViews() { + const service = this.loadService("GeographicViewServiceClient") + + return { + + /** + * @description Retrieve a resources.GeographicView in full detail + * @warning Don't use get in production! + * @returns resources.GeographicView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetGeographicViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getGeographicView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/GroupPlacementViewService + */ + public get groupPlacementViews() { + const service = this.loadService("GroupPlacementViewServiceClient") + + return { + + /** + * @description Retrieve a resources.GroupPlacementView in full detail + * @warning Don't use get in production! + * @returns resources.GroupPlacementView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetGroupPlacementViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getGroupPlacementView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/HotelGroupViewService + */ + public get hotelGroupViews() { + const service = this.loadService("HotelGroupViewServiceClient") + + return { + + /** + * @description Retrieve a resources.HotelGroupView in full detail + * @warning Don't use get in production! + * @returns resources.HotelGroupView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetHotelGroupViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getHotelGroupView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/HotelPerformanceViewService + */ + public get hotelPerformanceViews() { + const service = this.loadService("HotelPerformanceViewServiceClient") + + return { + + /** + * @description Retrieve a resources.HotelPerformanceView in full detail + * @warning Don't use get in production! + * @returns resources.HotelPerformanceView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetHotelPerformanceViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getHotelPerformanceView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/IncomeRangeViewService + */ + public get incomeRangeViews() { + const service = this.loadService("IncomeRangeViewServiceClient") + + return { + + /** + * @description Retrieve a resources.IncomeRangeView in full detail + * @warning Don't use get in production! + * @returns resources.IncomeRangeView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetIncomeRangeViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getIncomeRangeView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/InvoiceService + */ + public get invoices() { + const service = this.loadService("InvoiceServiceClient") + + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/InvoiceService#listinvoices + */ + listInvoices: async (request: services.ListInvoicesRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listInvoices(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanIdeaService + */ + public get keywordPlanIdeas() { + const service = this.loadService("KeywordPlanIdeaServiceClient") + + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordPlanIdeaService#generatekeywordideas + */ + generateKeywordIdeas: async (request: services.GenerateKeywordIdeasRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.generateKeywordIdeas(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/KeywordViewService + */ + public get keywordViews() { + const service = this.loadService("KeywordViewServiceClient") + + return { + + /** + * @description Retrieve a resources.KeywordView in full detail + * @warning Don't use get in production! + * @returns resources.KeywordView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetKeywordViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getKeywordView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LandingPageViewService + */ + public get landingPageViews() { + const service = this.loadService("LandingPageViewServiceClient") + + return { + + /** + * @description Retrieve a resources.LandingPageView in full detail + * @warning Don't use get in production! + * @returns resources.LandingPageView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetLandingPageViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getLandingPageView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LanguageConstantService + */ + public get languageConstants() { + const service = this.loadService("LanguageConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.LanguageConstant in full detail + * @warning Don't use get in production! + * @returns resources.LanguageConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetLanguageConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getLanguageConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LifeEventService + */ + public get lifeEvents() { + const service = this.loadService("LifeEventServiceClient") + + return { + + /** + * @description Retrieve a resources.LifeEvent in full detail + * @warning Don't use get in production! + * @returns resources.LifeEvent + */ + get: async (resourceName: string): Promise => { + const request = new services.GetLifeEventRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getLifeEvent(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/LocationViewService + */ + public get locationViews() { + const service = this.loadService("LocationViewServiceClient") + + return { + + /** + * @description Retrieve a resources.LocationView in full detail + * @warning Don't use get in production! + * @returns resources.LocationView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetLocationViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getLocationView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ManagedPlacementViewService + */ + public get managedPlacementViews() { + const service = this.loadService("ManagedPlacementViewServiceClient") + + return { + + /** + * @description Retrieve a resources.ManagedPlacementView in full detail + * @warning Don't use get in production! + * @returns resources.ManagedPlacementView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetManagedPlacementViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getManagedPlacementView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MerchantCenterLinkService + */ + public get merchantCenterLinks() { + const service = this.loadService("MerchantCenterLinkServiceClient") + type MutateOptions = Partial> + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MerchantCenterLinkService#listmerchantcenterlinks + */ + listMerchantCenterLinks: async (request: services.ListMerchantCenterLinksRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listMerchantCenterLinks(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description Retrieve a resources.MerchantCenterLink in full detail + * @warning Don't use get in production! + * @returns resources.MerchantCenterLink + */ + get: async (resourceName: string): Promise => { + const request = new services.GetMerchantCenterLinkRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getMerchantCenterLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description update resources of type resources.IMerchantCenterLink + * @returns services.MutateMerchantCenterLinkResponse + */ + update: async ( + merchantCenterLinks: (resources.IMerchantCenterLink | resources.MerchantCenterLink)[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.MerchantCenterLinkOperation, + resources.IMerchantCenterLink + >( + "update", + merchantCenterLinks + // @ts-expect-error Static class type here is fine + , resources.MerchantCenterLink + ); + const request = this.buildRequest< + services.MerchantCenterLinkOperation, + services.IMutateMerchantCenterLinkRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "MerchantCenterLinkService.mutateMerchantCenterLink", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); }, - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/ThirdPartyAppAnalyticsLinkService#regenerateshareablelinkid - */ - regenerateShareableLinkId: async ( - request: services.RegenerateShareableLinkIdRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.regenerateShareableLinkId(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TopicConstantService - */ - public get topicConstants() { - const service = this.loadService( - "TopicConstantServiceClient" - ); - - return { - /** - * @description Retrieve a resources.TopicConstant in full detail - * @warning Don't use get in production! - * @returns resources.TopicConstant - */ - get: async (resourceName: string): Promise => { - const request = new services.GetTopicConstantRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getTopicConstant(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateMerchantCenterLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/TopicViewService - */ - public get topicViews() { - const service = this.loadService( - "TopicViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.TopicView in full detail - * @warning Don't use get in production! - * @returns resources.TopicView - */ - get: async (resourceName: string): Promise => { - const request = new services.GetTopicViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getTopicView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserDataService - */ - public get userData() { - const service = this.loadService( - "UserDataServiceClient" - ); - - return { - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserDataService#uploaduserdata - */ - uploadUserData: async ( - request: services.UploadUserDataRequest - ): Promise => { - try { - // @ts-expect-error Response is an array type - const [response] = await service.uploadUserData(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + throw googleAdsError; + } + } + +, + /** + * @description remove resources of type string + * @returns services.MutateMerchantCenterLinkResponse + */ + remove: async ( + merchantCenterLinks: string[] , + options?: MutateOptions + ): Promise => { + const ops = this.buildOperations< + services.MerchantCenterLinkOperation, + string + >( + "remove", + merchantCenterLinks + + + ); + const request = this.buildRequest< + services.MerchantCenterLinkOperation, + services.IMutateMerchantCenterLinkRequest, + MutateOptions + >(ops, options); + const baseHookArguments: BaseMutationHookArgs = { + credentials: this.credentials, + method: "MerchantCenterLinkService.mutateMerchantCenterLink", + mutation: request, + isServiceCall: true, + }; + if (this.hooks.onMutationStart) { + const mutationCancellation: HookedCancellation = { cancelled: false }; + await this.hooks.onMutationStart({ + ...baseHookArguments, + cancel: (res) => { + mutationCancellation.cancelled = true; + mutationCancellation.res = res; + }, + editOptions: (options) => { + Object.entries(options).forEach(([key, val]) => { + // @ts-expect-error Index with key type is fine + request[key] = val; + }); + }, + }); + if (mutationCancellation.cancelled) { + return mutationCancellation.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserInterestService - */ - public get userInterests() { - const service = this.loadService( - "UserInterestServiceClient" - ); - - return { - /** - * @description Retrieve a resources.UserInterest in full detail - * @warning Don't use get in production! - * @returns resources.UserInterest - */ - get: async (resourceName: string): Promise => { - const request = new services.GetUserInterestRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getUserInterest(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + try { + // @ts-expect-error Response is an array type + const [response] = await service.mutateMerchantCenterLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + if (this.hooks.onMutationEnd) { + const mutationResolution: HookedResolution = { resolved: false }; + await this.hooks.onMutationEnd({ + ...baseHookArguments, + response, + resolve: (res) => { + mutationResolution.resolved = true; + mutationResolution.res = res; + }, + }); + if (mutationResolution.resolved) { + return mutationResolution.res; + } } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/UserLocationViewService - */ - public get userLocationViews() { - const service = this.loadService( - "UserLocationViewServiceClient" - ); - - return { - /** - * @description Retrieve a resources.UserLocationView in full detail - * @warning Don't use get in production! - * @returns resources.UserLocationView - */ - get: async ( - resourceName: string - ): Promise => { - const request = new services.GetUserLocationViewRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getUserLocationView(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; + return response; + } catch (err) { + const googleAdsError = this.getGoogleAdsError(err); + if (this.hooks.onMutationError) { + await this.hooks.onMutationError({ + ...baseHookArguments, + error: googleAdsError, + }); } - - /** - * @link https://developers.google.com/google-ads/api/reference/rpc/v6/VideoService - */ - public get videos() { - const service = this.loadService( - "VideoServiceClient" - ); - - return { - /** - * @description Retrieve a resources.Video in full detail - * @warning Don't use get in production! - * @returns resources.Video - */ - get: async (resourceName: string): Promise => { - const request = new services.GetVideoRequest({ - resource_name: resourceName, - }); - try { - // @ts-expect-error Response is an array type - const [response] = await service.getVideo(request, { - // @ts-expect-error This arg doesn't exist in the type definitions - otherArgs: { - headers: this.callHeaders, - }, - }); - return response; - } catch (err) { - throw this.getGoogleAdsError(err); - } - }, - }; - } -} + throw googleAdsError; + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MobileAppCategoryConstantService + */ + public get mobileAppCategoryConstants() { + const service = this.loadService("MobileAppCategoryConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.MobileAppCategoryConstant in full detail + * @warning Don't use get in production! + * @returns resources.MobileAppCategoryConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetMobileAppCategoryConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getMobileAppCategoryConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/MobileDeviceConstantService + */ + public get mobileDeviceConstants() { + const service = this.loadService("MobileDeviceConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.MobileDeviceConstant in full detail + * @warning Don't use get in production! + * @returns resources.MobileDeviceConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetMobileDeviceConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getMobileDeviceConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OfflineUserDataJobService + */ + public get offlineUserDataJobs() { + const service = this.loadService("OfflineUserDataJobServiceClient") + + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OfflineUserDataJobService#createofflineuserdatajob + */ + createOfflineUserDataJob: async (request: services.CreateOfflineUserDataJobRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.createOfflineUserDataJob(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @description Retrieve a resources.OfflineUserDataJob in full detail + * @warning Don't use get in production! + * @returns resources.OfflineUserDataJob + */ + get: async (resourceName: string): Promise => { + const request = new services.GetOfflineUserDataJobRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getOfflineUserDataJob(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OfflineUserDataJobService#addofflineuserdatajoboperations + */ + addOfflineUserDataJobOperations: async (request: services.AddOfflineUserDataJobOperationsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.addOfflineUserDataJobOperations(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OfflineUserDataJobService#runofflineuserdatajob + */ + runOfflineUserDataJob: async (request: services.RunOfflineUserDataJobRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.runOfflineUserDataJob(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/OperatingSystemVersionConstantService + */ + public get operatingSystemVersionConstants() { + const service = this.loadService("OperatingSystemVersionConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.OperatingSystemVersionConstant in full detail + * @warning Don't use get in production! + * @returns resources.OperatingSystemVersionConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetOperatingSystemVersionConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getOperatingSystemVersionConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PaidOrganicSearchTermViewService + */ + public get paidOrganicSearchTermViews() { + const service = this.loadService("PaidOrganicSearchTermViewServiceClient") + + return { + + /** + * @description Retrieve a resources.PaidOrganicSearchTermView in full detail + * @warning Don't use get in production! + * @returns resources.PaidOrganicSearchTermView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetPaidOrganicSearchTermViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getPaidOrganicSearchTermView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ParentalStatusViewService + */ + public get parentalStatusViews() { + const service = this.loadService("ParentalStatusViewServiceClient") + + return { + + /** + * @description Retrieve a resources.ParentalStatusView in full detail + * @warning Don't use get in production! + * @returns resources.ParentalStatusView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetParentalStatusViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getParentalStatusView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PaymentsAccountService + */ + public get paymentsAccounts() { + const service = this.loadService("PaymentsAccountServiceClient") + + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/PaymentsAccountService#listpaymentsaccounts + */ + listPaymentsAccounts: async (request: services.ListPaymentsAccountsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listPaymentsAccounts(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductBiddingCategoryConstantService + */ + public get productBiddingCategoryConstants() { + const service = this.loadService("ProductBiddingCategoryConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.ProductBiddingCategoryConstant in full detail + * @warning Don't use get in production! + * @returns resources.ProductBiddingCategoryConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetProductBiddingCategoryConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getProductBiddingCategoryConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ProductGroupViewService + */ + public get productGroupViews() { + const service = this.loadService("ProductGroupViewServiceClient") + + return { + + /** + * @description Retrieve a resources.ProductGroupView in full detail + * @warning Don't use get in production! + * @returns resources.ProductGroupView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetProductGroupViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getProductGroupView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ReachPlanService + */ + public get reachPlans() { + const service = this.loadService("ReachPlanServiceClient") + + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ReachPlanService#listplannablelocations + */ + listPlannableLocations: async (request: services.ListPlannableLocationsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listPlannableLocations(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ReachPlanService#listplannableproducts + */ + listPlannableProducts: async (request: services.ListPlannableProductsRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.listPlannableProducts(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ReachPlanService#generateproductmixideas + */ + generateProductMixIdeas: async (request: services.GenerateProductMixIdeasRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.generateProductMixIdeas(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ReachPlanService#generatereachforecast + */ + generateReachForecast: async (request: services.GenerateReachForecastRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.generateReachForecast(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/RecommendationService + */ + public get recommendations() { + const service = this.loadService("RecommendationServiceClient") + + return { + + /** + * @description Retrieve a resources.Recommendation in full detail + * @warning Don't use get in production! + * @returns resources.Recommendation + */ + get: async (resourceName: string): Promise => { + const request = new services.GetRecommendationRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getRecommendation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/RecommendationService#applyrecommendation + */ + applyRecommendation: async (request: services.ApplyRecommendationRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.applyRecommendation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/RecommendationService#dismissrecommendation + */ + dismissRecommendation: async (request: services.DismissRecommendationRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.dismissRecommendation(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/SearchTermViewService + */ + public get searchTermViews() { + const service = this.loadService("SearchTermViewServiceClient") + + return { + + /** + * @description Retrieve a resources.SearchTermView in full detail + * @warning Don't use get in production! + * @returns resources.SearchTermView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetSearchTermViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getSearchTermView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ShoppingPerformanceViewService + */ + public get shoppingPerformanceViews() { + const service = this.loadService("ShoppingPerformanceViewServiceClient") + + return { + + /** + * @description Retrieve a resources.ShoppingPerformanceView in full detail + * @warning Don't use get in production! + * @returns resources.ShoppingPerformanceView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetShoppingPerformanceViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getShoppingPerformanceView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ThirdPartyAppAnalyticsLinkService + */ + public get thirdPartyAppAnalyticsLinks() { + const service = this.loadService("ThirdPartyAppAnalyticsLinkServiceClient") + + return { + + /** + * @description Retrieve a resources.ThirdPartyAppAnalyticsLink in full detail + * @warning Don't use get in production! + * @returns resources.ThirdPartyAppAnalyticsLink + */ + get: async (resourceName: string): Promise => { + const request = new services.GetThirdPartyAppAnalyticsLinkRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getThirdPartyAppAnalyticsLink(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + +, + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/ThirdPartyAppAnalyticsLinkService#regenerateshareablelinkid + */ + regenerateShareableLinkId: async (request: services.RegenerateShareableLinkIdRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.regenerateShareableLinkId(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TopicConstantService + */ + public get topicConstants() { + const service = this.loadService("TopicConstantServiceClient") + + return { + + /** + * @description Retrieve a resources.TopicConstant in full detail + * @warning Don't use get in production! + * @returns resources.TopicConstant + */ + get: async (resourceName: string): Promise => { + const request = new services.GetTopicConstantRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getTopicConstant(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/TopicViewService + */ + public get topicViews() { + const service = this.loadService("TopicViewServiceClient") + + return { + + /** + * @description Retrieve a resources.TopicView in full detail + * @warning Don't use get in production! + * @returns resources.TopicView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetTopicViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getTopicView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserDataService + */ + public get userData() { + const service = this.loadService("UserDataServiceClient") + + return { + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserDataService#uploaduserdata + */ + uploadUserData: async (request: services.UploadUserDataRequest): Promise => { + try { + // @ts-expect-error Response is an array type + const [response] = await service.uploadUserData(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserInterestService + */ + public get userInterests() { + const service = this.loadService("UserInterestServiceClient") + + return { + + /** + * @description Retrieve a resources.UserInterest in full detail + * @warning Don't use get in production! + * @returns resources.UserInterest + */ + get: async (resourceName: string): Promise => { + const request = new services.GetUserInterestRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getUserInterest(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/UserLocationViewService + */ + public get userLocationViews() { + const service = this.loadService("UserLocationViewServiceClient") + + return { + + /** + * @description Retrieve a resources.UserLocationView in full detail + * @warning Don't use get in production! + * @returns resources.UserLocationView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetUserLocationViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getUserLocationView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/VideoService + */ + public get videos() { + const service = this.loadService("VideoServiceClient") + + return { + + /** + * @description Retrieve a resources.Video in full detail + * @warning Don't use get in production! + * @returns resources.Video + */ + get: async (resourceName: string): Promise => { + const request = new services.GetVideoRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getVideo(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + + /** + * @link https://developers.google.com/google-ads/api/reference/rpc/v7/WebpageViewService + */ + public get webpageViews() { + const service = this.loadService("WebpageViewServiceClient") + + return { + + /** + * @description Retrieve a resources.WebpageView in full detail + * @warning Don't use get in production! + * @returns resources.WebpageView + */ + get: async (resourceName: string): Promise => { + const request = new services.GetWebpageViewRequest({ + resource_name: resourceName, + }); + try { + // @ts-expect-error Response is an array type + const [response] = await service.getWebpageView(request, { + // @ts-expect-error This arg doesn't exist in the type definitions + otherArgs: { + headers: this.callHeaders, + }, + }); + return response; + } catch (err) { + throw this.getGoogleAdsError(err); + } + } + + } + } + +} \ No newline at end of file diff --git a/src/protos/index.ts b/src/protos/index.ts index 7fb76983..07745106 100644 --- a/src/protos/index.ts +++ b/src/protos/index.ts @@ -2,18 +2,18 @@ import allProtos, { protos } from "google-ads-node"; import { googleAdsVersion } from "../version"; // "as vN" is required to avoid type issues later on -export const VERSION = googleAdsVersion as "v6"; +export const VERSION = googleAdsVersion as "v7"; // -- Expose the googleads generated types -- // The namespace path is shortened for ease of use -export import common = protos.google.ads.googleads.v6.common; -export import errors = protos.google.ads.googleads.v6.errors; -export import resources = protos.google.ads.googleads.v6.resources; -export import services = protos.google.ads.googleads.v6.services; +export import common = protos.google.ads.googleads.v7.common; +export import errors = protos.google.ads.googleads.v7.errors; +export import resources = protos.google.ads.googleads.v7.resources; +export import services = protos.google.ads.googleads.v7.services; // We compile enums ourselves, the Google ones should be used internally only -export import internalEnums = protos.google.ads.googleads.v6.enums; +export import internalEnums = protos.google.ads.googleads.v7.enums; export { enums } from "./autogen/enums"; export { fields } from "./autogen/fields"; diff --git a/src/service.spec.ts b/src/service.spec.ts index c106fa71..bc01cd6a 100644 --- a/src/service.spec.ts +++ b/src/service.spec.ts @@ -83,9 +83,8 @@ describe("Service", () => { ], }); - const failureBuffer = errors.GoogleAdsFailure.encode( - failureMessage - ).finish(); + const failureBuffer = + errors.GoogleAdsFailure.encode(failureMessage).finish(); const customer = newCustomer(); // @ts-expect-error Accessing private method for test purposes @@ -132,7 +131,7 @@ describe("Service", () => { failTestIfExecuted(); } catch (err) { expect(err instanceof Error).toEqual(true); - expect(err.code).toEqual("401"); + expect(err.code).toEqual(16); } }); }); @@ -160,15 +159,14 @@ describe("Service", () => { ], }); - const failureBuffer = errors.GoogleAdsFailure.encode( - failureMessage - ).finish(); + const failureBuffer = + errors.GoogleAdsFailure.encode(failureMessage).finish(); const response = new services.MutateGoogleAdsResponse({ partial_failure_error: new google.rpc.Status({ details: [ { - type_url: "google.ads.googleads.v6.errors.GoogleAdsFailure", + type_url: "google.ads.googleads.v7.errors.GoogleAdsFailure", value: failureBuffer, }, ], @@ -176,10 +174,10 @@ describe("Service", () => { }); const customer = newCustomer(); - // @ts-expect-error Accessing private method for test purposes - const parsedPartialFailureResponse = customer.decodePartialFailureError( - response - ); + + const parsedPartialFailureResponse = + // @ts-expect-error Accessing private method for test purposes + customer.decodePartialFailureError(response); expect(parsedPartialFailureResponse).toEqual({ mutate_operation_responses: [], diff --git a/src/service.ts b/src/service.ts index d3f19ec1..171199be 100644 --- a/src/service.ts +++ b/src/service.ts @@ -31,20 +31,17 @@ export interface CallHeaders { export class Service { protected readonly clientOptions: ClientOptions; protected readonly customerOptions: CustomerOptions; - protected readonly timeout: number; protected readonly hooks: Hooks; private serviceCache!: Record; constructor( clientOptions: ClientOptions, customerOptions: CustomerOptions, - hooks?: Hooks, - timeout = 3600000 // 1 hour + hooks?: Hooks ) { this.clientOptions = clientOptions; this.customerOptions = customerOptions; this.hooks = hooks ?? {}; - this.timeout = timeout; // @ts-expect-error All fields don't need to be set here this.serviceCache = {}; @@ -87,7 +84,7 @@ export class Service { protected loadService(service: ServiceName): T { if (this.serviceCache[service]) { - return (this.serviceCache[service] as unknown) as T; + return this.serviceCache[service] as unknown as T; } // eslint-disable-next-line @typescript-eslint/no-var-requires const { [service]: protoService } = require("google-ads-node"); @@ -98,7 +95,7 @@ export class Service { sslCreds: this.getCredentials(), }); this.serviceCache[service] = client; - return (client as unknown) as T; + return client as unknown as T; } protected getGoogleAdsError(error: Error): errors.GoogleAdsFailure | Error { @@ -149,13 +146,12 @@ export class Service { const service: GoogleAdsServiceClient = this.loadService( "GoogleAdsServiceClient" ); - const request: services.SearchGoogleAdsRequest = new services.SearchGoogleAdsRequest( - { + const request: services.SearchGoogleAdsRequest = + new services.SearchGoogleAdsRequest({ customer_id: this.customerOptions.customer_id, query: gaql, ...options, - } - ); + }); return { service, request }; } @@ -169,13 +165,12 @@ export class Service { const service: GoogleAdsServiceClient = this.loadService( "GoogleAdsServiceClient" ); - const request: services.SearchGoogleAdsStreamRequest = new services.SearchGoogleAdsStreamRequest( - { + const request: services.SearchGoogleAdsStreamRequest = + new services.SearchGoogleAdsStreamRequest({ customer_id: this.customerOptions.customer_id, query: gaql, ...options, - } - ); + }); return { service, request }; } @@ -237,7 +232,7 @@ export class Service { } return op; }); - return (ops as unknown) as Op[]; + return ops as unknown as Op[]; } protected buildRequest( @@ -249,6 +244,6 @@ export class Service { operations, ...options, }; - return (request as unknown) as Req; + return request as unknown as Req; } } diff --git a/src/version.ts b/src/version.ts index fdf2e0e8..68b70c4c 100644 --- a/src/version.ts +++ b/src/version.ts @@ -1 +1 @@ -export const googleAdsVersion = "v6"; +export const googleAdsVersion = "v7"; diff --git a/yarn.lock b/yarn.lock index 81f1cf1e..d2f570ac 100644 --- a/yarn.lock +++ b/yarn.lock @@ -294,22 +294,23 @@ minimatch "^3.0.4" strip-json-comments "^3.1.1" -"@grpc/grpc-js@~1.2.0": - version "1.2.5" - resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.2.5.tgz#d1ef9ae8b99c3b46bb6cc8c82be1aa80080b7300" - integrity sha512-CBCNwedw8McnEBq9jvoiJikws16WN0OiHFejQPovY71XkFWSiIqgvydYiDwpvIYDJmhPQ7qZNzW9BPndhXbx1Q== +"@grpc/grpc-js@~1.3.0": + version "1.3.2" + resolved "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.3.2.tgz#eae97e6daf5abd49a7818aadeca0744dfb1ebca1" + integrity sha512-UXepkOKCATJrhHGsxt+CGfpZy9zUn1q9mop5kfcXq1fBkTePxVNPOdnISlCbJFlCtld+pSLGyZCzr9/zVprFKA== dependencies: - "@types/node" "^12.12.47" - google-auth-library "^6.1.1" - semver "^6.2.0" + "@types/node" ">=12.12.47" -"@grpc/proto-loader@^0.5.1": - version "0.5.6" - resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.5.6.tgz#1dea4b8a6412b05e2d58514d507137b63a52a98d" - integrity sha512-DT14xgw3PSzPxwS13auTEwxhMMOoz33DPUKNtmYK/QYbBSpLXJy78FGGs5yVoxVobEqPm4iW9MOIoz0A3bLTRQ== +"@grpc/proto-loader@^0.6.1": + version "0.6.2" + resolved "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.6.2.tgz#412575f3ff5ef0a9b79d4ea12c08cba5601041cb" + integrity sha512-q2Qle60Ht2OQBCp9S5hv1JbI4uBBq6/mqSevFNK3ZEgRDBCAkWqZPUhD/K9gXOHrHKluliHiVq2L9sw1mVyAIg== dependencies: + "@types/long" "^4.0.1" lodash.camelcase "^4.3.0" - protobufjs "^6.8.6" + long "^4.0.0" + protobufjs "^6.10.0" + yargs "^16.1.1" "@istanbuljs/load-nyc-config@^1.0.0": version "1.1.0" @@ -668,10 +669,10 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-14.14.22.tgz#0d29f382472c4ccf3bd96ff0ce47daf5b7b84b18" integrity sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw== -"@types/node@^12.12.47": - version "12.19.15" - resolved "https://registry.yarnpkg.com/@types/node/-/node-12.19.15.tgz#0de7e978fb43db62da369db18ea088a63673c182" - integrity sha512-lowukE3GUI+VSYSu6VcBXl14d61Rp5hA1D+61r16qnwC0lYNSqdxcvRh0pswejorHfS+HgwBasM8jLXz0/aOsw== +"@types/node@>=12.12.47", "@types/node@>=13.7.0": + version "15.6.1" + resolved "https://registry.npmjs.org/@types/node/-/node-15.6.1.tgz#32d43390d5c62c5b6ec486a9bc9c59544de39a08" + integrity sha512-7EIraBEyRHEe7CH+Fm1XvgqU6uwZN8Q7jppJGcqjROMT29qhAuuOxYB1uEY5UMYQKEmA5D+5tBnhdaPXSsLONA== "@types/node@^13.7.0": version "13.13.40" @@ -1218,6 +1219,15 @@ cliui@^6.0.0: strip-ansi "^6.0.0" wrap-ansi "^6.2.0" +cliui@^7.0.2: + version "7.0.4" + resolved "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz#a0265ee655476fc807aea9df3df8df7783808b4f" + integrity sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ== + dependencies: + string-width "^4.2.0" + strip-ansi "^6.0.0" + wrap-ansi "^7.0.0" + co@^4.6.0: version "4.6.0" resolved "https://registry.yarnpkg.com/co/-/co-4.6.0.tgz#6ea6bdf3d853ae54ccb8e47bfa0bf3f9031fb184" @@ -1500,6 +1510,11 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +escalade@^3.1.1: + version "3.1.1" + resolved "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz#d8cfdc7000965c5a0174b4a82eaa5c0552742e40" + integrity sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw== + escape-string-regexp@^1.0.5: version "1.0.5" resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4" @@ -1906,9 +1921,9 @@ gensync@^1.0.0-beta.1: resolved "https://registry.yarnpkg.com/gensync/-/gensync-1.0.0-beta.2.tgz#32a6ee76c3d7f52d46b2b1ae5d93fea8580a25e0" integrity sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg== -get-caller-file@^2.0.1: +get-caller-file@^2.0.1, get-caller-file@^2.0.5: version "2.0.5" - resolved "https://registry.yarnpkg.com/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" + resolved "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz#4f94412a82db32f36e3b0b9741f8a97feb031f7e" integrity sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg== get-package-type@^0.1.0: @@ -1985,17 +2000,17 @@ globby@^11.0.1: merge2 "^1.3.0" slash "^3.0.0" -google-ads-node@^4.0.2: - version "4.0.2" - resolved "https://registry.yarnpkg.com/google-ads-node/-/google-ads-node-4.0.2.tgz#88b3ee999247f0d0945d363bd1bdadb8c47d3f5b" - integrity sha512-CTtB3EsRcM3LqzDg4XXeaNOkuj6g9CiwcLJB5e4aJWeobZof7yOtHOA+EWC/Gw4NwpGppHx3FqNDQONrKYy2og== +google-ads-node@^5.0.0: + version "5.0.0" + resolved "https://registry.npmjs.org/google-ads-node/-/google-ads-node-5.0.0.tgz#542b3bc801ff77264fc30e7fca99a92e62b879cd" + integrity sha512-8sYv3zcSoqQN6mfTFrR2xmOIY9FAy+bUD2LWaXPjFo6ybNlRzvAN543HHwu1x4VyOUDKQtZ0JP179s+3E5QfMw== dependencies: - google-gax "^2.11.0" + google-gax "^2.14.0" -google-auth-library@^6.1.1, google-auth-library@^6.1.3: - version "6.1.6" - resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-6.1.6.tgz#deacdcdb883d9ed6bac78bb5d79a078877fdf572" - integrity sha512-Q+ZjUEvLQj/lrVHF/IQwRo6p3s8Nc44Zk/DALsN+ac3T4HY/g/3rrufkgtl+nZ1TW7DNAw5cTChdVp4apUXVgQ== +google-auth-library@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-7.0.2.tgz#cab6fc7f94ebecc97be6133d6519d9946ccf3e9d" + integrity sha512-vjyNZR3pDLC0u7GHLfj+Hw9tGprrJwoMwkYGqURCXYITjCrP9HprOyxVV+KekdLgATtWGuDkQG2MTh0qpUPUgg== dependencies: arrify "^2.0.0" base64-js "^1.3.0" @@ -2007,10 +2022,10 @@ google-auth-library@^6.1.1, google-auth-library@^6.1.3: jws "^4.0.0" lru-cache "^6.0.0" -google-auth-library@^7.0.2: - version "7.0.2" - resolved "https://registry.yarnpkg.com/google-auth-library/-/google-auth-library-7.0.2.tgz#cab6fc7f94ebecc97be6133d6519d9946ccf3e9d" - integrity sha512-vjyNZR3pDLC0u7GHLfj+Hw9tGprrJwoMwkYGqURCXYITjCrP9HprOyxVV+KekdLgATtWGuDkQG2MTh0qpUPUgg== +google-auth-library@^7.1.0: + version "7.1.0" + resolved "https://registry.npmjs.org/google-auth-library/-/google-auth-library-7.1.0.tgz#d83b6bed1d170e30649e15e9b5b17cb375e88919" + integrity sha512-X+gbkGjnLN3HUZP2W3KBREuA603BXd80ITvL0PeS0QpyDNYz/u0pIZ7aRuGnrSuUc0grk/qxEgtVTFt1ogbP+A== dependencies: arrify "^2.0.0" base64-js "^1.3.0" @@ -2022,30 +2037,13 @@ google-auth-library@^7.0.2: jws "^4.0.0" lru-cache "^6.0.0" -google-gax@^2.10.2: - version "2.10.2" - resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-2.10.2.tgz#6d3dc047140e57987d0a2c2d9791faac9bc959b1" - integrity sha512-adECud3d5jsk24SvPkKQG3Kw1szpy4We0OqKfsdBHKWlSWhdY4hVQEOG7iBBp469Zm327fzz7NZz8BMLOYZJHg== +google-gax@^2.14.0: + version "2.14.0" + resolved "https://registry.npmjs.org/google-gax/-/google-gax-2.14.0.tgz#20fe11987bac13e4ba5e2a71c675d5d2db8f2d9e" + integrity sha512-G/iApJcvOeVb/eT9f+kigJsf3Iwwj6Z67QmQbRgmZ8gEu6WeOo3U5cyd8qPX8HUsH+pdj8/ViVJRzn6maUvyAA== dependencies: - "@grpc/grpc-js" "~1.2.0" - "@grpc/proto-loader" "^0.5.1" - "@types/long" "^4.0.0" - abort-controller "^3.0.0" - duplexify "^4.0.0" - fast-text-encoding "^1.0.3" - google-auth-library "^6.1.3" - is-stream-ended "^0.1.4" - node-fetch "^2.6.1" - protobufjs "^6.10.2" - retry-request "^4.0.0" - -google-gax@^2.11.0: - version "2.11.2" - resolved "https://registry.yarnpkg.com/google-gax/-/google-gax-2.11.2.tgz#9ef7773b94aaa61c4588fb2408d62e8444995026" - integrity sha512-PNqXv7Oi5XBMgoMWVxLZHUidfMv7cPHrDSDXqLyEd6kY6pqFnVKC8jt2T1df4JPSc2+VLPdeo6L7X9mbdQG8Xw== - dependencies: - "@grpc/grpc-js" "~1.2.0" - "@grpc/proto-loader" "^0.5.1" + "@grpc/grpc-js" "~1.3.0" + "@grpc/proto-loader" "^0.6.1" "@types/long" "^4.0.0" abort-controller "^3.0.0" duplexify "^4.0.0" @@ -2053,6 +2051,7 @@ google-gax@^2.11.0: google-auth-library "^7.0.2" is-stream-ended "^0.1.4" node-fetch "^2.6.1" + object-hash "^2.1.1" protobufjs "^6.10.2" retry-request "^4.0.0" @@ -3298,6 +3297,11 @@ object-copy@^0.1.0: define-property "^0.2.5" kind-of "^3.0.3" +object-hash@^2.1.1: + version "2.2.0" + resolved "https://registry.npmjs.org/object-hash/-/object-hash-2.2.0.tgz#5ad518581eefc443bd763472b8ff2e9c2c0d54a5" + integrity sha512-gScRMn0bS5fH+IuwyIFgnh9zBdo4DV+6GhygmWM9HyNJSgS0hScp1f5vjtm7oIIOiT9trXrShAkLFSc2IqKNgw== + object-visit@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/object-visit/-/object-visit-1.0.1.tgz#f79c4493af0c5377b59fe39d395e41042dd045bb" @@ -3503,7 +3507,26 @@ prompts@^2.0.1: kleur "^3.0.3" sisteransi "^1.0.5" -protobufjs@^6.10.2, protobufjs@^6.8.6: +protobufjs@^6.10.0: + version "6.11.2" + resolved "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz#de39fabd4ed32beaa08e9bb1e30d08544c1edf8b" + integrity sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/long" "^4.0.1" + "@types/node" ">=13.7.0" + long "^4.0.0" + +protobufjs@^6.10.2: version "6.10.2" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.10.2.tgz#b9cb6bd8ec8f87514592ba3fdfd28e93f33a469b" integrity sha512-27yj+04uF6ya9l+qfpH187aqEzfCF4+Uit0I9ZBQVqK09hk/SQzKa2MUqUpXaVa7LOFRg1TSSr3lVxGOk6c0SQ== @@ -3783,7 +3806,7 @@ semver@7.x, semver@^7.2.1, semver@^7.3.2: dependencies: lru-cache "^6.0.0" -semver@^6.0.0, semver@^6.2.0, semver@^6.3.0: +semver@^6.0.0, semver@^6.3.0: version "6.3.0" resolved "https://registry.yarnpkg.com/semver/-/semver-6.3.0.tgz#ee0a64c8af5e8ceea67687b133761e1becbd1d3d" integrity sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw== @@ -4437,6 +4460,15 @@ wrap-ansi@^6.2.0: string-width "^4.1.0" strip-ansi "^6.0.0" +wrap-ansi@^7.0.0: + version "7.0.0" + resolved "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz#67e145cff510a6a6984bdf1152911d69d2eb9e43" + integrity sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q== + dependencies: + ansi-styles "^4.0.0" + string-width "^4.1.0" + strip-ansi "^6.0.0" + wrappy@1: version "1.0.2" resolved "https://registry.yarnpkg.com/wrappy/-/wrappy-1.0.2.tgz#b5243d8f3ec1aa35f1364605bc0d1036e30ab69f" @@ -4472,6 +4504,11 @@ y18n@^4.0.0: resolved "https://registry.yarnpkg.com/y18n/-/y18n-4.0.1.tgz#8db2b83c31c5d75099bb890b23f3094891e247d4" integrity sha512-wNcy4NvjMYL8gogWWYAO7ZFWFfHcbdbE57tZO8e4cbpj8tfUcwrwqSl3ad8HxpYWCdXcJUCeKKZS62Av1affwQ== +y18n@^5.0.5: + version "5.0.8" + resolved "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz#7f4934d0f7ca8c56f95314939ddcd2dd91ce1d55" + integrity sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA== + yallist@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/yallist/-/yallist-4.0.0.tgz#9bb92790d9c0effec63be73519e11a35019a3a72" @@ -4490,6 +4527,11 @@ yargs-parser@^18.1.2: camelcase "^5.0.0" decamelize "^1.2.0" +yargs-parser@^20.2.2: + version "20.2.7" + resolved "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.7.tgz#61df85c113edfb5a7a4e36eb8aa60ef423cbc90a" + integrity sha512-FiNkvbeHzB/syOjIUxFDCnhSfzAL8R5vs40MgLFBorXACCOAEaWu0gRZl14vG8MR9AOJIZbmkjhusqBYZ3HTHw== + yargs@^15.4.1: version "15.4.1" resolved "https://registry.yarnpkg.com/yargs/-/yargs-15.4.1.tgz#0d87a16de01aee9d8bec2bfbf74f67851730f4f8" @@ -4506,3 +4548,16 @@ yargs@^15.4.1: which-module "^2.0.0" y18n "^4.0.0" yargs-parser "^18.1.2" + +yargs@^16.1.1: + version "16.2.0" + resolved "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz#1c82bf0f6b6a66eafce7ef30e376f49a12477f66" + integrity sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw== + dependencies: + cliui "^7.0.2" + escalade "^3.1.1" + get-caller-file "^2.0.5" + require-directory "^2.1.1" + string-width "^4.2.0" + y18n "^5.0.5" + yargs-parser "^20.2.2"