@google-cloud/nodejs-common 1.7.2-alpha → 1.7.9-alpha
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/bin/install_functions.sh +1 -0
- package/package.json +16 -16
- package/src/apis/ads_data_hub.js +42 -8
package/bin/install_functions.sh
CHANGED
|
@@ -92,6 +92,7 @@ declare -A GOOGLE_CLOUD_APIS
|
|
|
92
92
|
GOOGLE_CLOUD_APIS=(
|
|
93
93
|
["appengine.googleapis.com"]="App Engine Admin API"
|
|
94
94
|
["cloudbuild.googleapis.com"]="Google Build API"
|
|
95
|
+
["artifactregistry.googleapis.com"]="Artifact Registry API"
|
|
95
96
|
["cloudresourcemanager.googleapis.com"]="Resource Manager API"
|
|
96
97
|
["iam.googleapis.com"]="Cloud Identity and Access Management API"
|
|
97
98
|
)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@google-cloud/nodejs-common",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.9-alpha",
|
|
4
4
|
"description": "A NodeJs common library for solutions based on Cloud Functions",
|
|
5
5
|
"author": "Google Inc.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -16,26 +16,26 @@
|
|
|
16
16
|
},
|
|
17
17
|
"homepage": "https://github.com/GoogleCloudPlatform/cloud-for-marketing/blob/master/marketing-analytics/activation/common-libs/nodejs-common/README.md",
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@google-cloud/aiplatform": "^
|
|
20
|
-
"@google-cloud/automl": "^
|
|
21
|
-
"@google-cloud/bigquery": "^
|
|
22
|
-
"@google-cloud/datastore": "^
|
|
23
|
-
"@google-cloud/firestore": "^6.
|
|
24
|
-
"@google-cloud/logging-winston": "^
|
|
25
|
-
"@google-cloud/pubsub": "^
|
|
26
|
-
"@google-cloud/storage": "^
|
|
27
|
-
"@google-cloud/scheduler": "^
|
|
28
|
-
"@google-cloud/secret-manager": "^
|
|
29
|
-
"gaxios": "^
|
|
19
|
+
"@google-cloud/aiplatform": "^3.0.0",
|
|
20
|
+
"@google-cloud/automl": "^4.0.0",
|
|
21
|
+
"@google-cloud/bigquery": "^7.2.0",
|
|
22
|
+
"@google-cloud/datastore": "^8.0.0",
|
|
23
|
+
"@google-cloud/firestore": "^6.7.0",
|
|
24
|
+
"@google-cloud/logging-winston": "^6.0.0",
|
|
25
|
+
"@google-cloud/pubsub": "^4.0.2",
|
|
26
|
+
"@google-cloud/storage": "^7.0.1",
|
|
27
|
+
"@google-cloud/scheduler": "^4.0.0",
|
|
28
|
+
"@google-cloud/secret-manager": "^5.0.0",
|
|
29
|
+
"gaxios": "^6.1.0",
|
|
30
30
|
"google-ads-api": "^13.0.1",
|
|
31
31
|
"google-ads-node": "^11.0.0",
|
|
32
|
-
"google-auth-library": "^
|
|
33
|
-
"googleapis": "^
|
|
34
|
-
"winston": "^3.
|
|
32
|
+
"google-auth-library": "^9.0.0",
|
|
33
|
+
"googleapis": "^126.0.1",
|
|
34
|
+
"winston": "^3.10.0",
|
|
35
35
|
"lodash": "^4.17.21"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"jasmine": "^
|
|
38
|
+
"jasmine": "^5.1.0"
|
|
39
39
|
},
|
|
40
40
|
"scripts": {
|
|
41
41
|
"test": "node node_modules/jasmine/bin/jasmine"
|
package/src/apis/ads_data_hub.js
CHANGED
|
@@ -122,17 +122,44 @@ class AdsDataHub {
|
|
|
122
122
|
/**
|
|
123
123
|
* Lists the analysis queries owned by the specified customer.
|
|
124
124
|
* @see https://developers.google.com/ads-data-hub/reference/rest/v1/customers.analysisQueries/list
|
|
125
|
+
* @param {Object=} parameters The query parameter object.
|
|
125
126
|
* @param {string=} customerId
|
|
126
127
|
* @return {!Promise<{
|
|
127
128
|
* queries:Array<Object>,
|
|
128
129
|
* nextPageToken:string,
|
|
129
130
|
* }>}
|
|
130
131
|
*/
|
|
131
|
-
async listQuery(customerId = this.customerId) {
|
|
132
|
-
const
|
|
132
|
+
async listQuery(parameters = {}, customerId = this.customerId) {
|
|
133
|
+
const querystring = this.getQueryString_(parameters);
|
|
134
|
+
const path = `customers/${customerId}/analysisQueries`
|
|
135
|
+
+ (querystring ? `?${querystring}` : '');
|
|
133
136
|
return this.sendRequestAndReturnResponse_(path);
|
|
134
137
|
}
|
|
135
138
|
|
|
139
|
+
/**
|
|
140
|
+
* Starts execution on a transient analysis query. The results will be written
|
|
141
|
+
* to the specified BigQuery destination table. The returned operation name
|
|
142
|
+
* can be used to poll for query completion status.
|
|
143
|
+
* @see https://developers.google.com/ads-data-hub/reference/rest/v1/customers.analysisQueries/startTransient
|
|
144
|
+
* @param {string} queryText The content of the query.
|
|
145
|
+
* @param {Object} spec Defines the query execution parameters.
|
|
146
|
+
* @see https://developers.google.com/ads-data-hub/reference/rest/v1/QueryExecutionSpec
|
|
147
|
+
* @param {string} destTable Destination BigQuery table for query results with
|
|
148
|
+
* the format 'project.dataset.table_name'. If specified, the project must
|
|
149
|
+
* be explicitly whitelisted for the customer's ADH account. If project is
|
|
150
|
+
* not specified, uses default project for the provided customer. If
|
|
151
|
+
* neither project nor dataset is specified, uses the default project and
|
|
152
|
+
* dataset.
|
|
153
|
+
* @param {string=} customerId
|
|
154
|
+
* @return {!Promise<Object>} Promised operation object.
|
|
155
|
+
* @see https://developers.google.com/ads-data-hub/reference/rest/v1/operations#Operation
|
|
156
|
+
*/
|
|
157
|
+
async startTransientQuery(queryText, spec, destTable, customerId = this.customerId) {
|
|
158
|
+
const path = `customers/${customerId}/analysisQueries:startTransient`;
|
|
159
|
+
const data = { query: { queryText }, spec, destTable };
|
|
160
|
+
return this.sendRequestAndReturnResponse_(path, 'POST', data);
|
|
161
|
+
}
|
|
162
|
+
|
|
136
163
|
/**
|
|
137
164
|
* Creates a query and returns the unique query name in the form of
|
|
138
165
|
* 'customers/[customerId]/analysisQueries/[resource_id]'.
|
|
@@ -140,12 +167,6 @@ class AdsDataHub {
|
|
|
140
167
|
* @param {string} title The title of the query.
|
|
141
168
|
* @param {string} queryText The content of the query
|
|
142
169
|
* @return {!Promise<string>} Promised unique name of created query.
|
|
143
|
-
*
|
|
144
|
-
* TODO: currently here only take two properties of customers.analysisQueries
|
|
145
|
-
* which may be not enough in future requests. If that happened, the
|
|
146
|
-
* arguments of this function should be refactored into an object to
|
|
147
|
-
* present an AnalysisQuery.
|
|
148
|
-
* See https://developers.google.com/ads-data-hub/reference/rest/v1/customers.analysisQueries#resource:-analysisquery
|
|
149
170
|
*/
|
|
150
171
|
async createQuery(title, queryText) {
|
|
151
172
|
const path = `customers/${this.customerId}/analysisQueries`;
|
|
@@ -202,6 +223,19 @@ class AdsDataHub {
|
|
|
202
223
|
async getQueryStatus(operationName) {
|
|
203
224
|
return this.sendRequestAndReturnResponse_(operationName);
|
|
204
225
|
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Gets the query string of a parameter object.
|
|
229
|
+
* @param {Object} parameters The object of key-value pairs which will be
|
|
230
|
+
* converted into query string format.
|
|
231
|
+
* @return string
|
|
232
|
+
* @private
|
|
233
|
+
*/
|
|
234
|
+
getQueryString_(parameters = {}) {
|
|
235
|
+
return Object.keys(parameters)
|
|
236
|
+
.map((key) => key + '=' + encodeURIComponent(parameters[key]))
|
|
237
|
+
.join('&');
|
|
238
|
+
}
|
|
205
239
|
}
|
|
206
240
|
|
|
207
241
|
exports.AdsDataHub = AdsDataHub;
|