Skip to content

Commit

Permalink
update to latest google-ads-node and re-compile everything
Browse files Browse the repository at this point in the history
  • Loading branch information
avermeil committed Sep 9, 2024
1 parent 46d3b22 commit 7ae50a1
Show file tree
Hide file tree
Showing 9 changed files with 4,974 additions and 1,670 deletions.
50 changes: 35 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
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.v16.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 @@ -693,3 +695,21 @@ 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 this file
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.
9 changes: 5 additions & 4 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",
"version": "17.0.0-beta.5",
"description": "Google Ads API Client Library for Node.js",
"repository": "https://github.com/Opteo/google-ads-api",
"main": "build/src/index.js",
Expand All @@ -18,21 +18,22 @@
"license": "MIT",
"dependencies": {
"@isaacs/ttlcache": "^1.2.2",
"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"
},
"devDependencies": {
"@types/jest": "^29.0.1",
"@types/node": "^22.5.4",
"@types/pluralize": "^0.0.29",
"@typescript-eslint/eslint-plugin": "^4.8.2",
"@typescript-eslint/parser": "^4.8.2",
"eslint": "^7.14.0",
"jest": "^29.0.3",
"pluralize": "^8.0.0",
"ts-jest": "^29.0.0",
"typescript": "^4.1.2"
"typescript": "^5.5.4"
},
"keywords": [
"google ads",
Expand Down
Loading

0 comments on commit 7ae50a1

Please sign in to comment.