google-ads-api 16.0.0-rest-beta2 → 16.0.0-rest-beta3
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/build/src/customer.js +7 -2
- package/package.json +1 -1
package/build/src/customer.js
CHANGED
|
@@ -162,7 +162,6 @@ class Customer extends serviceFactory_1.default {
|
|
|
162
162
|
When possible, use the searchStream method to avoid the overhead of pagination.
|
|
163
163
|
*/
|
|
164
164
|
if (requestOptions.page_size === undefined &&
|
|
165
|
-
// @ts-expect-error we do not allow this field in reportOptions, however it is still a valid request option
|
|
166
165
|
requestOptions.return_total_results_count === undefined) {
|
|
167
166
|
// If no pagination or summary options are set, we can use the non-paginated search method.
|
|
168
167
|
const { response } = await this.useStreamToImitateRegularSearch(gaqlQuery, requestOptions);
|
|
@@ -171,7 +170,13 @@ class Customer extends serviceFactory_1.default {
|
|
|
171
170
|
const response = [];
|
|
172
171
|
let nextPageToken = undefined;
|
|
173
172
|
const initialSearch = await this.search(gaqlQuery, requestOptions);
|
|
174
|
-
|
|
173
|
+
let totalResultsCount = initialSearch.totalResultsCount;
|
|
174
|
+
// Sometimes (when no results?) the totalResultsCount field is not included in the response.
|
|
175
|
+
// In this case, we set it to 0.
|
|
176
|
+
if (requestOptions.return_total_results_count &&
|
|
177
|
+
initialSearch.totalResultsCount === undefined) {
|
|
178
|
+
totalResultsCount = 0;
|
|
179
|
+
}
|
|
175
180
|
let summaryRow = initialSearch.summaryRow;
|
|
176
181
|
response.push(...initialSearch.response);
|
|
177
182
|
nextPageToken = initialSearch.nextPageToken;
|
package/package.json
CHANGED