@google-cloud/nodejs-common 1.5.2-beta → 1.5.4-beta
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/package.json
CHANGED
|
@@ -26,7 +26,7 @@ const { getLogger } = require('../components/utils.js');
|
|
|
26
26
|
const API_SCOPES = Object.freeze([
|
|
27
27
|
'https://www.googleapis.com/auth/doubleclickbidmanager',
|
|
28
28
|
]);
|
|
29
|
-
const API_VERSION = '
|
|
29
|
+
const API_VERSION = 'v2';
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
32
|
* The returned information of get a query.
|
|
@@ -85,45 +85,51 @@ class DoubleClickBidManager {
|
|
|
85
85
|
|
|
86
86
|
/**
|
|
87
87
|
* Starts to run a query.
|
|
88
|
-
* See https://developers.google.com/bid-manager/
|
|
89
|
-
* This API returns empty HTTP content.
|
|
88
|
+
* See https://developers.google.com/bid-manager/reference/rest/v2/queries/run
|
|
90
89
|
* @param {number} queryId
|
|
91
90
|
* @param {!RequestBody|undefined=} requestBody Data range of the report.
|
|
92
|
-
* @return {!Promise<
|
|
91
|
+
* @return {!Promise<number>} Report Id.
|
|
93
92
|
*/
|
|
94
93
|
async runQuery(queryId, requestBody = undefined) {
|
|
95
94
|
const doubleclickbidmanager = await this.getApiClient_();
|
|
96
|
-
const response = await doubleclickbidmanager.queries.
|
|
95
|
+
const response = await doubleclickbidmanager.queries.run(
|
|
97
96
|
{queryId, requestBody});
|
|
98
|
-
return response.
|
|
97
|
+
return response.data.key.reportId;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
/**
|
|
102
101
|
* Gets a query resource.
|
|
103
|
-
* See https://developers.google.com/bid-manager/
|
|
102
|
+
* See https://developers.google.com/bid-manager/reference/rest/v2/queries/get
|
|
104
103
|
* @param {number} queryId Id of the query.
|
|
105
104
|
* @return {!Promise<!QueryResource>} Query resource, see
|
|
106
|
-
* https://developers.google.com/bid-manager/
|
|
105
|
+
* https://developers.google.com/bid-manager/reference/rest/v2/queries#Query
|
|
107
106
|
*/
|
|
108
107
|
async getQuery(queryId) {
|
|
109
108
|
const doubleclickbidmanager = await this.getApiClient_();
|
|
110
|
-
const response = await doubleclickbidmanager.queries.
|
|
109
|
+
const response = await doubleclickbidmanager.queries.get({ queryId });
|
|
111
110
|
return response.data.metadata;
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
/**
|
|
115
114
|
* Creates a query.
|
|
116
115
|
* @param {Object} query The DV360 query object, for more details, see:
|
|
117
|
-
* https://developers.google.com/bid-manager/
|
|
116
|
+
* https://developers.google.com/bid-manager/reference/rest/v2/queries#Query
|
|
118
117
|
* @return {!Promise<number>} Id of created query.
|
|
119
118
|
*/
|
|
120
119
|
async createQuery(query) {
|
|
121
120
|
const doubleclickbidmanager = await this.getApiClient_();
|
|
122
|
-
const response = await doubleclickbidmanager.queries.
|
|
121
|
+
const response = await doubleclickbidmanager.queries.create(
|
|
123
122
|
{requestBody: query});
|
|
124
123
|
return response.data.queryId;
|
|
125
124
|
}
|
|
126
125
|
|
|
126
|
+
async getQueryReport(queryId, reportId) {
|
|
127
|
+
const doubleclickbidmanager = await this.getApiClient_();
|
|
128
|
+
const response = await doubleclickbidmanager.queries.reports.get(
|
|
129
|
+
{ queryId, reportId });
|
|
130
|
+
return response.data.metadata;
|
|
131
|
+
}
|
|
132
|
+
|
|
127
133
|
/**
|
|
128
134
|
* Deletes a query.
|
|
129
135
|
* @param {number} queryId
|
|
@@ -132,8 +138,8 @@ class DoubleClickBidManager {
|
|
|
132
138
|
async deleteQuery(queryId) {
|
|
133
139
|
const doubleclickbidmanager = await this.getApiClient_();
|
|
134
140
|
try {
|
|
135
|
-
await doubleclickbidmanager.queries.
|
|
136
|
-
return
|
|
141
|
+
const { status } = await doubleclickbidmanager.queries.delete({ queryId });
|
|
142
|
+
return status === 200;
|
|
137
143
|
} catch (error) {
|
|
138
144
|
console.error(error);
|
|
139
145
|
return false;
|