Skip to content

Commit

Permalink
Update google ads API version to v14.1 (#474)
Browse files Browse the repository at this point in the history
* start migration to v14

* fix for enums generation script (ShoppingAddProductsToCampaignRecommendationEnum did not follow usual format)

* compile enums, resourceNames, serviceFactory (fields still needed)

* compiled `fields`

* updated readme

* v14.1.0

* remove ts-ignores from `parser.spec.ts`

* update google-ads-node to avoid longs in protos

* proper version

* revert parser.spec change

---------

Co-authored-by: WillCooter <[email protected]>
  • Loading branch information
avermeil and wcoots authored Sep 20, 2023
1 parent 9e15ff6 commit 0ff8d1f
Show file tree
Hide file tree
Showing 10 changed files with 1,986 additions and 1,350 deletions.
8 changes: 1 addition & 7 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-v13.0.0-009688.svg?style=flat-square">
<img src="https://img.shields.io/badge/google%20ads-v14.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 All @@ -30,12 +30,6 @@
- Typescript definitions for all resources, enums, errors and services
- Provides all API functionality

> The Google Ads API is the new replacement to the AdWords API. Google will deprecate the AdWords API on the 27th of April, 2022.
# Hiring

We're currently hiring full-stack engineers at [Opteo](https://opteo.com)! If you're interested in working on this library and other exciting projects, say hello at [[email protected]](mailto:[email protected])

# Installation

```bash
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "google-ads-api",
"version": "13.0.1",
"version": "14.1.0",
"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,9 +18,9 @@
"license": "MIT",
"dependencies": {
"@isaacs/ttlcache": "^1.2.2",
"google-ads-node": "^11.0.0",
"google-ads-node": "^12.0.2",
"google-auth-library": "^7.1.0",
"google-gax": "^3.6.0",
"google-gax": "^4.0.3",
"long": "^4.0.0"
},
"devDependencies": {
Expand Down
9 changes: 8 additions & 1 deletion scripts/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@ export async function compileEnums(): Promise<void> {

for (const [fullName, def] of Object.entries(internalEnums)) {
const [name] = fullName.split("Enum");
const values = (def as any)[name];
const values = Object.entries(def).find(
([, val]) => typeof val !== "function" // Get the object field which isn't a function, which happens to be the enum values
)?.[1];

if (!values) {
throw new Error("Could not find values for enum " + fullName);
}

const pairs = Object.keys(values).map((key) => {
const protoVal = values[key];
return `${key} = ${protoVal}, // ${key}`;
Expand Down
771 changes: 464 additions & 307 deletions src/protos/autogen/enums.ts

Large diffs are not rendered by default.

1,212 changes: 1,005 additions & 207 deletions src/protos/autogen/fields.ts

Large diffs are not rendered by default.

76 changes: 50 additions & 26 deletions src/protos/autogen/resourceNames.ts
Original file line number Diff line number Diff line change
Expand Up @@ -934,32 +934,6 @@ export function campaignCriterion(
return `customers/${customerId}/campaignCriteria/${campaignId}~${criterionId}` as const;
}

/* CampaignCriterionSimulation */
export type CampaignCriterionSimulationResourceName =
`customers/${StrNum}/campaignCriterionSimulations/${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}~${StrNum}`;
/**
* @param {string | number} customerId
* @param {string | number} campaignId
* @param {string | number} criterionId
* @param {string | number} type
* @param {string | number} modificationMethod
* @param {string | number} startDate
* @param {string | number} endDate
* @returns `CampaignCriterionSimulationResourceName`
* @example const campaignCriterionSimulation: ResourceNames.CampaignCriterionSimulationResourceName = ResourceNames.campaignCriterionSimulation(10987417, 21974834, 43949668, 87899336, 175798672, 351597344, 703194688)
*/
export function campaignCriterionSimulation(
customerId: string | number,
campaignId: string | number,
criterionId: string | number,
type: string | number,
modificationMethod: string | number,
startDate: string | number,
endDate: string | number
): CampaignCriterionSimulationResourceName {
return `customers/${customerId}/campaignCriterionSimulations/${campaignId}~${criterionId}~${type}~${modificationMethod}~${startDate}~${endDate}` as const;
}

/* CampaignCustomizer */
export type CampaignCustomizerResourceName =
`customers/${StrNum}/campaignCustomizers/${StrNum}~${StrNum}`;
Expand Down Expand Up @@ -1066,6 +1040,24 @@ export function campaignLabel(
return `customers/${customerId}/campaignLabels/${campaignId}~${labelId}` as const;
}

/* CampaignSearchTermInsight */
export type CampaignSearchTermInsightResourceName =
`customers/${StrNum}/campaignSearchTermInsights/${StrNum}~${StrNum}`;
/**
* @param {string | number} customerId
* @param {string | number} campaignId
* @param {string | number} clusterId
* @returns `CampaignSearchTermInsightResourceName`
* @example const campaignSearchTermInsight: ResourceNames.CampaignSearchTermInsightResourceName = ResourceNames.campaignSearchTermInsight(10987417, 21974834, 43949668)
*/
export function campaignSearchTermInsight(
customerId: string | number,
campaignId: string | number,
clusterId: string | number
): CampaignSearchTermInsightResourceName {
return `customers/${customerId}/campaignSearchTermInsights/${campaignId}~${clusterId}` as const;
}

/* CampaignSharedSet */
export type CampaignSharedSetResourceName =
`customers/${StrNum}/campaignSharedSets/${StrNum}~${StrNum}`;
Expand Down Expand Up @@ -1527,6 +1519,38 @@ export function customerNegativeCriterion(
return `customers/${customerId}/customerNegativeCriteria/${criterionId}` as const;
}

/* CustomerSearchTermInsight */
export type CustomerSearchTermInsightResourceName =
`customers/${StrNum}/customerSearchTermInsights/${StrNum}`;
/**
* @param {string | number} customerId
* @param {string | number} clusterId
* @returns `CustomerSearchTermInsightResourceName`
* @example const customerSearchTermInsight: ResourceNames.CustomerSearchTermInsightResourceName = ResourceNames.customerSearchTermInsight(10987417, 21974834)
*/
export function customerSearchTermInsight(
customerId: string | number,
clusterId: string | number
): CustomerSearchTermInsightResourceName {
return `customers/${customerId}/customerSearchTermInsights/${clusterId}` as const;
}

/* CustomerSkAdNetworkConversionValueSchema */
export type CustomerSkAdNetworkConversionValueSchemaResourceName =
`customers/${StrNum}/customerSkAdNetworkConversionValueSchemas/${StrNum}`;
/**
* @param {string | number} customerId
* @param {string | number} accountLinkId
* @returns `CustomerSkAdNetworkConversionValueSchemaResourceName`
* @example const customerSkAdNetworkConversionValueSchema: ResourceNames.CustomerSkAdNetworkConversionValueSchemaResourceName = ResourceNames.customerSkAdNetworkConversionValueSchema(10987417, 21974834)
*/
export function customerSkAdNetworkConversionValueSchema(
customerId: string | number,
accountLinkId: string | number
): CustomerSkAdNetworkConversionValueSchemaResourceName {
return `customers/${customerId}/customerSkAdNetworkConversionValueSchemas/${accountLinkId}` as const;
}

/* CustomerUserAccess */
export type CustomerUserAccessResourceName =
`customers/${StrNum}/customerUserAccesses/${StrNum}`;
Expand Down
Loading

0 comments on commit 0ff8d1f

Please sign in to comment.