google-ads-api 11.0.0 → 11.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -11
- package/build/src/customer.js +11 -11
- package/build/src/index.js +5 -1
- package/build/src/parser.js +1 -1
- package/build/src/protos/autogen/enums.d.ts +106 -2
- package/build/src/protos/autogen/enums.js +106 -0
- package/build/src/protos/autogen/fields.d.ts +93 -90
- package/build/src/protos/autogen/fields.js +3 -0
- package/build/src/protos/autogen/serviceFactory.d.ts +4 -0
- package/build/src/protos/autogen/serviceFactory.js +63 -0
- package/build/src/service.js +7 -7
- package/build/src/testUtils.js +5 -1
- package/package.json +6 -5
|
@@ -257,6 +257,7 @@ var fields;
|
|
|
257
257
|
"asset.source": "AssetSource",
|
|
258
258
|
"asset.type": "AssetType",
|
|
259
259
|
"asset_field_type_view.field_type": "AssetFieldType",
|
|
260
|
+
"asset_group.ad_strength": "AdStrength",
|
|
260
261
|
"asset_group.status": "AssetGroupStatus",
|
|
261
262
|
"asset_group_asset.field_type": "AssetFieldType",
|
|
262
263
|
"asset_group_asset.performance_label": "AssetPerformanceLabel",
|
|
@@ -298,6 +299,7 @@ var fields;
|
|
|
298
299
|
"campaign.advertising_channel_type": "AdvertisingChannelType",
|
|
299
300
|
"campaign.app_campaign_setting.app_store": "AppCampaignAppStore",
|
|
300
301
|
"campaign.app_campaign_setting.bidding_strategy_goal_type": "AppCampaignBiddingStrategyGoalType",
|
|
302
|
+
"campaign.bidding_strategy_system_status": "BiddingStrategySystemStatus",
|
|
301
303
|
"campaign.bidding_strategy_type": "BiddingStrategyType",
|
|
302
304
|
"campaign.excluded_parent_asset_field_types": "AssetFieldType",
|
|
303
305
|
"campaign.experiment_type": "CampaignExperimentType",
|
|
@@ -508,6 +510,7 @@ var fields;
|
|
|
508
510
|
"user_list.rule_based_user_list.combined_rule_user_list.right_operand.rule_type": "UserListRuleType",
|
|
509
511
|
"user_list.rule_based_user_list.combined_rule_user_list.rule_operator": "UserListCombinedRuleOperator",
|
|
510
512
|
"user_list.rule_based_user_list.expression_rule_user_list.rule.rule_type": "UserListRuleType",
|
|
513
|
+
"user_list.rule_based_user_list.flexible_rule_user_list.inclusive_rule_operator": "UserListFlexibleRuleOperator",
|
|
511
514
|
"user_list.rule_based_user_list.prepopulation_status": "UserListPrepopulationStatus",
|
|
512
515
|
"user_list.size_range_for_display": "UserListSizeRange",
|
|
513
516
|
"user_list.size_range_for_search": "UserListSizeRange",
|
|
@@ -425,6 +425,10 @@ export default class ServiceFactory extends Service {
|
|
|
425
425
|
* @link https://developers.google.com/google-ads/api/reference/rpc/v11/AudienceInsightsService#listaudienceinsightsattributes
|
|
426
426
|
*/
|
|
427
427
|
listAudienceInsightsAttributes: (request: services.ListAudienceInsightsAttributesRequest) => Promise<services.ListAudienceInsightsAttributesResponse>;
|
|
428
|
+
/**
|
|
429
|
+
* @link https://developers.google.com/google-ads/api/reference/rpc/v11/AudienceInsightsService#generateaudiencecompositioninsights
|
|
430
|
+
*/
|
|
431
|
+
generateAudienceCompositionInsights: (request: services.GenerateAudienceCompositionInsightsRequest) => Promise<services.GenerateAudienceCompositionInsightsResponse>;
|
|
428
432
|
};
|
|
429
433
|
/**
|
|
430
434
|
* @link https://developers.google.com/google-ads/api/reference/rpc/v11/AudienceService
|
|
@@ -4298,6 +4298,69 @@ class ServiceFactory extends service_1.Service {
|
|
|
4298
4298
|
throw googleAdsError;
|
|
4299
4299
|
}
|
|
4300
4300
|
},
|
|
4301
|
+
/**
|
|
4302
|
+
* @link https://developers.google.com/google-ads/api/reference/rpc/v11/AudienceInsightsService#generateaudiencecompositioninsights
|
|
4303
|
+
*/
|
|
4304
|
+
generateAudienceCompositionInsights: async (request) => {
|
|
4305
|
+
const baseHookArguments = {
|
|
4306
|
+
credentials: this.credentials,
|
|
4307
|
+
method: "AudienceInsightsService.GenerateAudienceCompositionInsights",
|
|
4308
|
+
requestOptions: request,
|
|
4309
|
+
};
|
|
4310
|
+
if (this.hooks.onServiceStart) {
|
|
4311
|
+
const serviceCancellation = { cancelled: false };
|
|
4312
|
+
await this.hooks.onServiceStart({
|
|
4313
|
+
...baseHookArguments,
|
|
4314
|
+
cancel: (res) => {
|
|
4315
|
+
serviceCancellation.cancelled = true;
|
|
4316
|
+
serviceCancellation.res = res;
|
|
4317
|
+
},
|
|
4318
|
+
editOptions: (options) => {
|
|
4319
|
+
Object.entries(options).forEach(([key, val]) => {
|
|
4320
|
+
// @ts-expect-error Index with key type is fine
|
|
4321
|
+
request[key] = val;
|
|
4322
|
+
});
|
|
4323
|
+
},
|
|
4324
|
+
});
|
|
4325
|
+
if (serviceCancellation.cancelled) {
|
|
4326
|
+
return serviceCancellation.res;
|
|
4327
|
+
}
|
|
4328
|
+
}
|
|
4329
|
+
try {
|
|
4330
|
+
// @ts-expect-error Response is an array type
|
|
4331
|
+
const [response] = await service.generateAudienceCompositionInsights(request, {
|
|
4332
|
+
// @ts-expect-error This arg doesn't exist in the type definitions
|
|
4333
|
+
otherArgs: {
|
|
4334
|
+
headers: this.callHeaders,
|
|
4335
|
+
},
|
|
4336
|
+
});
|
|
4337
|
+
if (this.hooks.onServiceEnd) {
|
|
4338
|
+
const serviceResolution = { resolved: false };
|
|
4339
|
+
await this.hooks.onServiceEnd({
|
|
4340
|
+
...baseHookArguments,
|
|
4341
|
+
response,
|
|
4342
|
+
resolve: (res) => {
|
|
4343
|
+
serviceResolution.resolved = true;
|
|
4344
|
+
serviceResolution.res = res;
|
|
4345
|
+
},
|
|
4346
|
+
});
|
|
4347
|
+
if (serviceResolution.resolved) {
|
|
4348
|
+
return serviceResolution.res;
|
|
4349
|
+
}
|
|
4350
|
+
}
|
|
4351
|
+
return response;
|
|
4352
|
+
}
|
|
4353
|
+
catch (err) {
|
|
4354
|
+
const googleAdsError = this.getGoogleAdsError(err);
|
|
4355
|
+
if (this.hooks.onServiceError) {
|
|
4356
|
+
await this.hooks.onServiceError({
|
|
4357
|
+
...baseHookArguments,
|
|
4358
|
+
error: googleAdsError,
|
|
4359
|
+
});
|
|
4360
|
+
}
|
|
4361
|
+
throw googleAdsError;
|
|
4362
|
+
}
|
|
4363
|
+
},
|
|
4301
4364
|
};
|
|
4302
4365
|
}
|
|
4303
4366
|
/**
|
package/build/src/service.js
CHANGED
|
@@ -71,13 +71,13 @@ class Service {
|
|
|
71
71
|
return googleAdsFailure;
|
|
72
72
|
}
|
|
73
73
|
decodePartialFailureError(response) {
|
|
74
|
-
var _a
|
|
75
|
-
if (typeof (
|
|
76
|
-
!(
|
|
74
|
+
var _a;
|
|
75
|
+
if (typeof (response === null || response === void 0 ? void 0 : response.partial_failure_error) === "undefined" ||
|
|
76
|
+
!(response === null || response === void 0 ? void 0 : response.partial_failure_error)) {
|
|
77
77
|
return response;
|
|
78
78
|
}
|
|
79
79
|
const { details } = response.partial_failure_error;
|
|
80
|
-
const buffer = (
|
|
80
|
+
const buffer = (_a = details === null || details === void 0 ? void 0 : details.find((d) => d.type_url.includes("errors.GoogleAdsFailure"))) === null || _a === void 0 ? void 0 : _a.value;
|
|
81
81
|
if (typeof buffer === "undefined") {
|
|
82
82
|
return response;
|
|
83
83
|
}
|
|
@@ -109,13 +109,13 @@ class Service {
|
|
|
109
109
|
const service = this.loadService("GoogleAdsServiceClient");
|
|
110
110
|
const mutateOperations = mutations.map((mutation) => {
|
|
111
111
|
var _a;
|
|
112
|
-
const opKey = utils_1.toSnakeCase(`${mutation.entity}Operation`);
|
|
112
|
+
const opKey = (0, utils_1.toSnakeCase)(`${mutation.entity}Operation`);
|
|
113
113
|
const operation = {
|
|
114
114
|
[(_a = mutation.operation) !== null && _a !== void 0 ? _a : "create"]: mutation.resource,
|
|
115
115
|
};
|
|
116
116
|
if (mutation.operation === "update") {
|
|
117
117
|
// @ts-expect-error Resource operations should have updateMask defined
|
|
118
|
-
operation.update_mask = utils_1.getFieldMask(mutation.resource);
|
|
118
|
+
operation.update_mask = (0, utils_1.getFieldMask)(mutation.resource);
|
|
119
119
|
}
|
|
120
120
|
const mutateOperation = new protos_1.services.MutateOperation({
|
|
121
121
|
[opKey]: operation,
|
|
@@ -137,7 +137,7 @@ class Service {
|
|
|
137
137
|
};
|
|
138
138
|
if (type === "update") {
|
|
139
139
|
// @ts-expect-error Field required for updates
|
|
140
|
-
op.update_mask = utils_1.getFieldMask(
|
|
140
|
+
op.update_mask = (0, utils_1.getFieldMask)(
|
|
141
141
|
// @ts-expect-error Message types have a toObject method
|
|
142
142
|
message.toObject(e, {
|
|
143
143
|
defaults: false,
|
package/build/src/testUtils.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "google-ads-api",
|
|
3
|
-
"version": "11.
|
|
3
|
+
"version": "11.1.0",
|
|
4
4
|
"description": "Google Ads API Client Library for Node.js",
|
|
5
5
|
"repository": "https://github.com/Opteo/google-ads-api",
|
|
6
6
|
"main": "build/src/index.js",
|
|
@@ -17,19 +17,20 @@
|
|
|
17
17
|
"author": "Opteo",
|
|
18
18
|
"license": "MIT",
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"google-ads-node": "^9.
|
|
20
|
+
"google-ads-node": "^9.1.0",
|
|
21
21
|
"google-auth-library": "^7.1.0",
|
|
22
|
-
"google-gax": "^3.
|
|
22
|
+
"google-gax": "^3.5.1",
|
|
23
23
|
"long": "^4.0.0"
|
|
24
24
|
},
|
|
25
25
|
"devDependencies": {
|
|
26
|
+
"@types/jest": "^29.0.1",
|
|
26
27
|
"@types/pluralize": "^0.0.29",
|
|
27
28
|
"@typescript-eslint/eslint-plugin": "^4.8.2",
|
|
28
29
|
"@typescript-eslint/parser": "^4.8.2",
|
|
29
30
|
"eslint": "^7.14.0",
|
|
30
|
-
"jest": "^
|
|
31
|
+
"jest": "^29.0.3",
|
|
31
32
|
"pluralize": "^8.0.0",
|
|
32
|
-
"ts-jest": "^
|
|
33
|
+
"ts-jest": "^29.0.0",
|
|
33
34
|
"typescript": "^4.1.2"
|
|
34
35
|
},
|
|
35
36
|
"keywords": [
|