Skip to content

Commit

Permalink
Merge branch 'master' into rest-reports
Browse files Browse the repository at this point in the history
  • Loading branch information
avermeil committed Sep 27, 2024
2 parents d9ca0ba + 7363dec commit 87007da
Show file tree
Hide file tree
Showing 10 changed files with 4,974 additions and 1,669 deletions.
50 changes: 33 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</p>
<p align="center">
<a href="https://developers.google.com/google-ads/api/docs/release-notes">
<img src="https://img.shields.io/badge/google%20ads-v16.1.0-009688.svg?style=flat-square">
<img src="https://img.shields.io/badge/google%20ads-v17.1.0-009688.svg?style=flat-square">
</a>
<a href="https://www.npmjs.com/package/google-ads-api">
<img src="https://img.shields.io/npm/v/google-ads-api.svg?style=flat-square">
Expand Down Expand Up @@ -379,32 +379,34 @@ import {
} from "google-ads-api";

// Ad Group to which you want to add the keyword
const adGroupResourceName = 'customers/123/adGroups/456'
const adGroupResourceName = "customers/123/adGroups/456";

const keyword = '24 hour locksmith harlem'
const keyword = "24 hour locksmith harlem";

const operations: MutateOperation<
resources.IAdGroupCriterion & { exempt_policy_violation_keys?: google.ads.googleads.v16.common.IPolicyViolationKey[]}
resources.IAdGroupCriterion & {
exempt_policy_violation_keys?: google.ads.googleads.v17.common.IPolicyViolationKey[];
}
>[] = [
{
entity: 'ad_group_criterion',
entity: "ad_group_criterion",
operation: "create",
resource: {
// Keyword with policy violation exemptions
ad_group: adGroupResourceName,
keyword: {
text: '24 hour locksmith harlem',
match_type: enums.KeywordMatchType.PHRASE,
},
status: enums.AdGroupStatus.ENABLED ,
ad_group: adGroupResourceName,
keyword: {
text: "24 hour locksmith harlem",
match_type: enums.KeywordMatchType.PHRASE,
},
status: enums.AdGroupStatus.ENABLED,
},
exempt_policy_violation_keys: [
{
policy_name: 'LOCAL_SERVICES',
violating_text: keyword,
},
{
policy_name: "LOCAL_SERVICES",
violating_text: keyword,
},
],
}
},
];

const result = await customer.mutateResources(operations);
Expand Down Expand Up @@ -683,7 +685,7 @@ try {
// Get the first one and explicitly check for a certain error type
const [firstError] = err.errors;
if (
firstError.error_code ===
firstError.error_code.query_error ===
errors.QueryErrorEnum.QueryError.UNRECOGNIZED_FIELD
) {
console.log(
Expand All @@ -693,3 +695,17 @@ try {
}
}
```

# Updating this library to the latest Google Ads API version

1. Update google-ads-node & publish to NPM. Check that package for instructions.
2. Update google-ads-node & google-gax in package.json. google-gax must be the same version as google-ads-node,
Otherwise you are likely to get a `TypeError: Channel credentials must be a ChannelCredentials object` error.
3. Update the version in `version.ts`.
4. Update the versions in `src/protos/index.ts`.
5. Run `yarn compile` to update the generated files. The `tsc` command might fail -- if so, temporarily add @ts-nocheck to the top of problematic files so that the compile script can continue. After the compile script has run, those @ts-nocheck lines should no longer be required. The compile step depends on some environment variables being set (see scripts/fields.ts), so make sure to set those.
6. Prettify the generated files so the the diffs are easier to read.
7. Check that the diffs are expected and that the generated files are correct. New Gads versions will often add new services, fields, and enums.
8. Test with `yarn test`.
9. Test by linking to a real project and making some real requests.
10. Once confident, bump the major version & publish to NPM.
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "google-ads-api",
"version": "16.0.0-rest-beta3",
"version": "17.1.0-rest-beta",
"description": "Google Ads API Client Library for Node.js",
"repository": "https://github.com/Opteo/google-ads-api",
"main": "build/src/index.js",
Expand All @@ -20,17 +20,17 @@
"@isaacs/ttlcache": "^1.2.2",
"axios": "^1.6.7",
"circ-json": "^1.0.4",
"google-ads-node": "^13.0.0",
"google-ads-node": "14.0.0",
"google-auth-library": "^7.1.0",
"google-gax": "^4.3.1",
"google-gax": "^4.4.1",
"long": "^4.0.0",
"map-obj": "^4.0.0",
"stream-json": "^1.8.0"
},
"devDependencies": {
"@types/jest": "^29.0.1",
"@types/lodash": "^4.14.202",
"@types/node": "^20.11.30",
"@types/node": "^22.5.4",
"@types/pluralize": "^0.0.29",
"@types/stream-json": "^1.7.7",
"@typescript-eslint/eslint-plugin": "^4.8.2",
Expand All @@ -43,7 +43,7 @@
"pluralize": "^8.0.0",
"protobufjs": "^7.2.6",
"ts-jest": "^29.1.2",
"typescript": "^5.4.3"
"typescript": "^5.5.4"
},
"keywords": [
"google ads",
Expand Down
Loading

0 comments on commit 87007da

Please sign in to comment.