@pipedream/google_ads 0.6.0 → 0.7.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.
@@ -7,7 +7,7 @@ export default {
7
7
  key: "google_ads-add-contact-to-list-by-email",
8
8
  name: "Add Contact to Customer List by Email",
9
9
  description: "Adds a contact to a specific customer list in Google Ads. Lists typically update in 6 to 12 hours after operation. [See the documentation](https://developers.google.com/google-ads/api/docs/remarketing/audience-segments/customer-match/get-started)",
10
- version: "0.1.7",
10
+ version: "0.1.8",
11
11
  annotations: {
12
12
  destructiveHint: true,
13
13
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_ads-create-ad-group-report",
7
7
  name: "Create Ad Group Report",
8
8
  description: "Creates a report for the Ad Group resource. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_ads-create-ad-report",
7
7
  name: "Create Ad Report",
8
8
  description: "Creates a report for the Ad resource. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_ads-create-campaign-report",
7
7
  name: "Create Campaign Report",
8
8
  description: "Creates a report for the Campaign resource. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -15,7 +15,7 @@ export default {
15
15
  key: "google_ads-create-customer-list",
16
16
  name: "Create Customer List",
17
17
  description: "Create a new customer list in Google Ads. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/UserList)",
18
- version: "0.0.8",
18
+ version: "0.0.9",
19
19
  annotations: {
20
20
  destructiveHint: false,
21
21
  openWorldHint: true,
@@ -6,7 +6,7 @@ export default {
6
6
  key: "google_ads-create-customer-report",
7
7
  name: "Create Customer Report",
8
8
  description: "Creates a report for the Customer resource. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
9
- version: "0.0.1",
9
+ version: "0.0.2",
10
10
  annotations: {
11
11
  destructiveHint: false,
12
12
  openWorldHint: true,
@@ -20,7 +20,7 @@ export default {
20
20
  key: "google_ads-create-report",
21
21
  name: "Create Report",
22
22
  description: "Generates a report from your Google Ads data. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
23
- version: "0.1.6",
23
+ version: "0.2.0",
24
24
  annotations: {
25
25
  destructiveHint: false,
26
26
  openWorldHint: true,
@@ -34,106 +34,100 @@ export default {
34
34
  label: "Resource",
35
35
  description: "The resource to generate a report for.",
36
36
  options: RESOURCES.map((r) => r.resourceOption),
37
- reloadProps: true,
38
37
  },
39
- },
40
- additionalProps() {
41
- const resource = RESOURCES.find((r) => r.resourceOption.value === this.resource);
42
- if (!resource) throw new ConfigurationError("Select one of the available resources.");
43
-
44
- const {
45
- label, value,
46
- } = resource.resourceOption;
47
-
48
- return {
49
- docsAlert: {
50
- type: "alert",
51
- alertType: "info",
52
- content: `[See the documentation](https://developers.google.com/google-ads/api/fields/v21/${value}) for more information on available fields, segments and metrics.`,
53
- },
54
- objectFilter: {
55
- type: "string[]",
56
- label: `Filter by ${label}s`,
57
- description: `Select the ${label}s to generate a report for (or leave blank for all ${label}s)`,
58
- optional: true,
59
- useQuery: true,
60
- options: async ({
61
- query, prevContext: { nextPageToken: pageToken },
62
- }) => {
63
- const {
64
- accountId, customerClientId, resource,
65
- } = this;
66
- const {
67
- results, nextPageToken,
68
- } = await this.googleAds.listResources({
69
- accountId,
70
- customerClientId,
71
- resource,
72
- query,
73
- pageToken,
74
- });
75
- const options = results?.map?.((item) => this.getResourceOption(item, resource));
76
- return {
77
- options,
78
- context: {
79
- nextPageToken,
80
- },
81
- };
82
- },
83
- },
84
- dateRange: {
85
- type: "string",
86
- label: "Date Range",
87
- description: "Select a date range for the report",
88
- options: DATE_RANGE_OPTIONS,
89
- optional: true,
90
- reloadProps: true,
38
+ objectFilter: {
39
+ type: "string[]",
40
+ label: "Filter by Resources",
41
+ description: "Google Ads resource IDs to limit the report to. Pass a string array of numeric IDs (e.g. `[\"1234567890\", \"9876543210\"]`). Omit to include all resources.",
42
+ optional: true,
43
+ useQuery: true,
44
+ async options({
45
+ query, prevContext = {},
46
+ }) {
47
+ const { nextPageToken: pageToken } = prevContext;
48
+ const {
49
+ accountId, customerClientId, resource,
50
+ } = this;
51
+ const {
52
+ results, nextPageToken,
53
+ } = await this.googleAds.listResources({
54
+ accountId,
55
+ customerClientId,
56
+ resource,
57
+ query,
58
+ pageToken,
59
+ });
60
+ const options = results?.map?.((item) => this.getResourceOption(item, resource));
61
+ return {
62
+ options,
63
+ context: {
64
+ nextPageToken,
65
+ },
66
+ };
91
67
  },
92
- ...(this.dateRange === "CUSTOM" && {
93
- startDate: {
94
- type: "string",
95
- label: "Start Date",
96
- description: "The start date, in `YYYY-MM-DD` format",
97
- },
98
- endDate: {
99
- type: "string",
100
- label: "End Date",
101
- description: "The end date, in `YYYY-MM-DD` format",
102
- },
103
- }),
104
- fields: {
105
- type: "string[]",
106
- label: "Fields",
107
- description: "Select any fields you want to include in your report.",
108
- options: resource.fields,
109
- optional: true,
110
- reloadProps: true,
68
+ },
69
+ dateRange: {
70
+ type: "string",
71
+ label: "Date Range",
72
+ description: "Predefined Google Ads date range keyword (e.g. `LAST_30_DAYS`, `THIS_MONTH`). For a custom range, use `CUSTOM` with `startDate` and `endDate` in `YYYY-MM-DD` format (e.g. `2024-01-01`, `2024-01-31`).",
73
+ options: DATE_RANGE_OPTIONS,
74
+ optional: true,
75
+ },
76
+ startDate: {
77
+ type: "string",
78
+ label: "Start Date",
79
+ description: "The start date in `YYYY-MM-DD` format (e.g. `2024-01-01`). Only relevant if `Date Range` is set to `CUSTOM`.",
80
+ optional: true,
81
+ },
82
+ endDate: {
83
+ type: "string",
84
+ label: "End Date",
85
+ description: "The end date in `YYYY-MM-DD` format (e.g. `2024-01-31`). Only relevant if `Date Range` is set to `CUSTOM`.",
86
+ optional: true,
87
+ },
88
+ fields: {
89
+ type: "string[]",
90
+ label: "Fields",
91
+ description: "Resource field names for the GAQL SELECT clause. Pass a string array (e.g. `[\"id\", \"name\"]` or `[\"campaign.id\", \"campaign.name\"]` for campaign reports).",
92
+ options() {
93
+ const resource = RESOURCES.find((r) => r.resourceOption.value === this.resource);
94
+ if (!resource) throw new ConfigurationError("Select one of the available resources.");
95
+ return resource.fields;
111
96
  },
112
- segments: {
113
- type: "string[]",
114
- label: "Segments",
115
- description: "Select any segments you want to include in your report. See the documentation [here](https://developers.google.com/google-ads/api/reference/rpc/v21/Segments)",
116
- options: resource.segments,
117
- default: [
118
- "segments.date",
119
- ],
120
- optional: true,
121
- reloadProps: true,
97
+ optional: true,
98
+ },
99
+ segments: {
100
+ type: "string[]",
101
+ label: "Segments",
102
+ description: "Segment field names to include (e.g. `[\"date\"]` or `[\"segments.date\"]`). See the documentation [here](https://developers.google.com/google-ads/api/reference/rpc/v21/Segments).",
103
+ options() {
104
+ const resource = RESOURCES.find((r) => r.resourceOption.value === this.resource);
105
+ if (!resource) throw new ConfigurationError("Select one of the available resources.");
106
+ return resource.segments;
122
107
  },
123
- metrics: {
124
- type: "string[]",
125
- label: "Metrics",
126
- description: "Select any metrics you want to include in your report. See the documentation [here](https://developers.google.com/google-ads/api/reference/rpc/v21/Metrics)",
127
- options: resource.metrics,
128
- optional: true,
129
- reloadProps: true,
108
+ default: [
109
+ "segments.date",
110
+ ],
111
+ optional: true,
112
+ },
113
+ metrics: {
114
+ type: "string[]",
115
+ label: "Metrics",
116
+ description: "Metric field names to include (e.g. `[\"impressions\", \"clicks\"]` or `[\"metrics.impressions\", \"metrics.clicks\"]`). See the documentation [here](https://developers.google.com/google-ads/api/reference/rpc/v21/Metrics).",
117
+ options() {
118
+ const resource = RESOURCES.find((r) => r.resourceOption.value === this.resource);
119
+ if (!resource) throw new ConfigurationError("Select one of the available resources.");
120
+ return resource.metrics;
130
121
  },
131
- orderBy: {
132
- type: "string",
133
- label: "Order By",
134
- description: "The field to order the results by",
135
- optional: true,
136
- options: [
122
+ optional: true,
123
+ },
124
+ orderBy: {
125
+ type: "string",
126
+ label: "Order By",
127
+ description: "The field to order the results by",
128
+ optional: true,
129
+ options() {
130
+ return [
137
131
  this.fields,
138
132
  this.segments,
139
133
  this.metrics,
@@ -147,32 +141,32 @@ export default {
147
141
  }
148
142
  }
149
143
  return returnValue?.map?.((str) => str.trim());
150
- }),
144
+ });
151
145
  },
152
- direction: {
153
- type: "string",
154
- label: "Direction",
155
- description: "The direction to order the results by, if `Order By` is specified",
156
- optional: true,
157
- options: [
158
- {
159
- label: "Ascending",
160
- value: "ASC",
161
- },
162
- {
163
- label: "Descending",
164
- value: "DESC",
165
- },
166
- ],
167
- default: "ASC",
168
- },
169
- limit: {
170
- type: "integer",
171
- label: "Limit",
172
- description: "The maximum number of results to return",
173
- optional: true,
174
- },
175
- };
146
+ },
147
+ direction: {
148
+ type: "string",
149
+ label: "Direction",
150
+ description: "The direction to order the results by, if `Order By` is specified",
151
+ optional: true,
152
+ options: [
153
+ {
154
+ label: "Ascending",
155
+ value: "ASC",
156
+ },
157
+ {
158
+ label: "Descending",
159
+ value: "DESC",
160
+ },
161
+ ],
162
+ default: "ASC",
163
+ },
164
+ limit: {
165
+ type: "integer",
166
+ label: "Limit",
167
+ description: "The maximum number of results to return",
168
+ optional: true,
169
+ },
176
170
  },
177
171
  methods: {
178
172
  getResourceOption(item, resource) {
@@ -249,6 +243,14 @@ export default {
249
243
  },
250
244
  },
251
245
  async run({ $ }) {
246
+ if (!RESOURCES.find((r) => r.resourceOption.value === this.resource)) {
247
+ throw new ConfigurationError("Select one of the available resources.");
248
+ }
249
+
250
+ if (this.dateRange === "CUSTOM" && (!this.startDate || !this.endDate)) {
251
+ throw new ConfigurationError("Start and end dates are required if using a custom date range.");
252
+ }
253
+
252
254
  const query = this.buildQuery();
253
255
  const results = (await this.googleAds.createReport({
254
256
  $,
@@ -9,7 +9,7 @@ export default {
9
9
  key: "google_ads-generate-keyword-ideas",
10
10
  name: "Generate Keyword Ideas",
11
11
  description: `Generate keyword ideas using the Google Ads API. [See the documentation](${docLink})`,
12
- version: "0.0.2",
12
+ version: "0.0.3",
13
13
  type: "action",
14
14
  annotations: {
15
15
  destructiveHint: false,
@@ -4,7 +4,7 @@ export default {
4
4
  key: "google_ads-list-account-id-options",
5
5
  name: "List Account ID Options",
6
6
  description: "Retrieves available options for the Account ID field.",
7
- version: "0.0.1",
7
+ version: "0.0.2",
8
8
  type: "action",
9
9
  annotations: {
10
10
  destructiveHint: false,
@@ -0,0 +1,43 @@
1
+ import googleAds from "../../google_ads.app.mjs";
2
+
3
+ export default {
4
+ key: "google_ads-list-customer-clients",
5
+ name: "List Customer Clients",
6
+ description: "List all customer clients for a given account. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
7
+ version: "0.0.1",
8
+ annotations: {
9
+ destructiveHint: false,
10
+ openWorldHint: true,
11
+ readOnlyHint: true,
12
+ },
13
+ type: "action",
14
+ props: {
15
+ googleAds,
16
+ accountId: {
17
+ propDefinition: [
18
+ googleAds,
19
+ "accountId",
20
+ ],
21
+ },
22
+ query: {
23
+ type: "string",
24
+ label: "Query",
25
+ description: "Partial match text for the customer client descriptive name (e.g. `Acme` matches names containing \"Acme\"). Omit to return clients up to level 3.",
26
+ optional: true,
27
+ },
28
+ },
29
+ async run({ $ }) {
30
+ const response = await this.googleAds.listCustomerClients({
31
+ $,
32
+ accountId: this.accountId,
33
+ query: this.query,
34
+ });
35
+ const clients = Array.isArray(response)
36
+ ? response
37
+ : [];
38
+ $.export("$summary", `Successfully retrieved ${clients.length} customer client${clients.length === 1
39
+ ? ""
40
+ : "s"}`);
41
+ return clients;
42
+ },
43
+ };
@@ -8,7 +8,7 @@ export default {
8
8
  key: "google_ads-send-offline-conversion",
9
9
  name: "Send Offline Conversion",
10
10
  description: "Send an event to Google Ads to track offline conversions. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/ConversionAction)",
11
- version: "0.0.8",
11
+ version: "0.0.9",
12
12
  annotations: {
13
13
  destructiveHint: false,
14
14
  openWorldHint: true,
@@ -36,7 +36,7 @@ export default {
36
36
  accountId: {
37
37
  type: "string",
38
38
  label: "Use Google Ads As",
39
- description: "Select an account from the list of [customers directly accessible by the authenticated user](https://developers.google.com/google-ads/api/reference/rpc/v21/CustomerService/ListAccessibleCustomers?transport=rest). This is usually a **Manager Account**, used as `login-customer-id`",
39
+ description: "The ID of an account of a [customer directly accessible by the authenticated user](https://developers.google.com/google-ads/api/reference/rpc/v21/CustomerService/ListAccessibleCustomers?transport=rest). This is usually a Manager Account, used as `login-customer-id` (e.g., `1234567890`). Use the **List Account ID Options** action to get the list of accessible accounts.",
40
40
  async options() {
41
41
  const response = await this.listAccessibleCustomers();
42
42
  return response?.map(((resourceName) => ({
@@ -48,7 +48,7 @@ export default {
48
48
  customerClientId: {
49
49
  type: "string",
50
50
  label: "Managed Account",
51
- description: "Select a [customer client](https://developers.google.com/google-ads/api/reference/rpc/v21/CustomerClient) from the list of [customers linked to the selected account](https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy).",
51
+ description: "The ID of a [customer client](https://developers.google.com/google-ads/api/reference/rpc/v21/CustomerClient) from the list of [customers linked to the selected account](https://developers.google.com/google-ads/api/docs/account-management/get-account-hierarchy) (e.g., `1234567890`). Use the **List Customer Clients** action to get the list of customer clients.",
52
52
  useQuery: true,
53
53
  optional: true,
54
54
  async options({
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pipedream/google_ads",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "Pipedream Google Ads Components",
5
5
  "main": "google_ads.app.mjs",
6
6
  "keywords": [
@@ -7,7 +7,7 @@ export default {
7
7
  key: "google_ads-new-campaign-created",
8
8
  name: "New Campaign Created",
9
9
  description: "Emit new event when a new campaign is created. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
10
- version: "0.0.7",
10
+ version: "0.0.8",
11
11
  type: "source",
12
12
  dedupe: "unique",
13
13
  sampleEmit,
@@ -8,7 +8,7 @@ export default {
8
8
  key: "google_ads-new-lead-form-entry",
9
9
  name: "New Lead Form Entry",
10
10
  description: "Emit new event for new leads on a Lead Form. [See the documentation](https://developers.google.com/google-ads/api/reference/rpc/v21/GoogleAdsService/Search?transport=rest)",
11
- version: "0.0.7",
11
+ version: "0.0.8",
12
12
  type: "source",
13
13
  dedupe: "unique",
14
14
  sampleEmit,