google-ads-api 19.0.1 → 19.0.2
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/CHANGELOG.md +4 -0
- package/README.md +2 -2
- package/build/src/customer.d.ts +2 -2
- package/build/src/customer.js +4 -3
- package/build/src/query.d.ts +2 -2
- package/build/src/types.d.ts +15 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -11,6 +11,10 @@ While these changes are inconvenient, the performance of the REST api is signifi
|
|
|
11
11
|
|
|
12
12
|
To prepare for this change, we recommend you use the install the `19.0.0-rest-beta` version of this library and test your application with it.
|
|
13
13
|
|
|
14
|
+
### 19.0.2
|
|
15
|
+
|
|
16
|
+
- Fix issue with reportCount() not giving the correct total results count.
|
|
17
|
+
|
|
14
18
|
## 19.0.1
|
|
15
19
|
|
|
16
20
|
- Fix issue with type interface for search_settings not showing any valid fields.
|
package/README.md
CHANGED
|
@@ -444,7 +444,7 @@ const [summaryRow, ...response] = await customer.report({
|
|
|
444
444
|
entity: "campaign",
|
|
445
445
|
metrics: ["metrics.clicks", "metrics.all_conversions"],
|
|
446
446
|
search_settings: {
|
|
447
|
-
return_summary_row:
|
|
447
|
+
return_summary_row: true,
|
|
448
448
|
},
|
|
449
449
|
});
|
|
450
450
|
```
|
|
@@ -456,7 +456,7 @@ const stream = customer.reportStream({
|
|
|
456
456
|
entity: "campaign",
|
|
457
457
|
metrics: ["metrics.clicks", "metrics.all_conversions"],
|
|
458
458
|
search_settings: {
|
|
459
|
-
return_summary_row:
|
|
459
|
+
return_summary_row: true,
|
|
460
460
|
},
|
|
461
461
|
});
|
|
462
462
|
|
package/build/src/customer.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { ClientOptions } from "./client";
|
|
|
3
3
|
import { Hooks } from "./hooks";
|
|
4
4
|
import { services } from "./protos";
|
|
5
5
|
import ServiceFactory from "./protos/autogen/serviceFactory";
|
|
6
|
-
import { CustomerOptions, MutateOperation, MutateOptions, ReportOptions, RequestOptions } from "./types";
|
|
6
|
+
import { CustomerOptions, MutateOperation, MutateOptions, ReportOptions, ReportOptionsWithTotalResults, RequestOptions } from "./types";
|
|
7
7
|
export declare class Customer extends ServiceFactory {
|
|
8
8
|
constructor(clientOptions: ClientOptions, customerOptions: CustomerOptions, hooks?: Hooks);
|
|
9
9
|
/**
|
|
@@ -30,7 +30,7 @@ export declare class Customer extends ServiceFactory {
|
|
|
30
30
|
@description Get the total row count of a report.
|
|
31
31
|
@hooks none
|
|
32
32
|
*/
|
|
33
|
-
reportCount(options: Readonly<
|
|
33
|
+
reportCount(options: Readonly<ReportOptionsWithTotalResults>): Promise<number | undefined>;
|
|
34
34
|
/**
|
|
35
35
|
@description Stream query using ReportOptions. If a generic type is provided, it must be the type of a single row.
|
|
36
36
|
If a summary row is requested then this will be the last emitted row of the stream.
|
package/build/src/customer.js
CHANGED
|
@@ -49,9 +49,10 @@ class Customer extends serviceFactory_1.default {
|
|
|
49
49
|
@hooks none
|
|
50
50
|
*/
|
|
51
51
|
async reportCount(options) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
// must get at least one row
|
|
53
|
+
const { gaqlQuery, requestOptions } = (0, query_1.buildQuery)({ ...options, limit: 1 });
|
|
54
|
+
// We do not allow this field in reportOptions, however it is still a valid request option
|
|
55
|
+
requestOptions.search_settings = { return_total_results_count: true };
|
|
55
56
|
const useHooks = false; // to avoid cacheing conflicts
|
|
56
57
|
const { totalResultsCount } = await this.querier(gaqlQuery, requestOptions, options, useHooks);
|
|
57
58
|
return totalResultsCount;
|
package/build/src/query.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { fields } from "./protos";
|
|
2
|
-
import { ConstraintKey, ConstraintOperation, ConstraintValue, ReportOptions, RequestOptions, SortOrder } from "./types";
|
|
2
|
+
import { ConstraintKey, ConstraintOperation, ConstraintValue, ReportOptions, RequestOptions, RequestOptionsWithTotalResults, SortOrder } from "./types";
|
|
3
3
|
declare enum QueryKeywords {
|
|
4
4
|
SELECT = "SELECT",
|
|
5
5
|
FROM = "FROM",
|
|
@@ -57,6 +57,6 @@ export declare function buildOrderClause(order: Readonly<ReportOptions["order"]>
|
|
|
57
57
|
export declare function buildRequestOptions(reportOptions: Readonly<ReportOptions>): RequestOptions;
|
|
58
58
|
export declare function buildQuery(reportOptions: Readonly<ReportOptions>): {
|
|
59
59
|
gaqlQuery: Query;
|
|
60
|
-
requestOptions:
|
|
60
|
+
requestOptions: RequestOptionsWithTotalResults;
|
|
61
61
|
};
|
|
62
62
|
export {};
|
package/build/src/types.d.ts
CHANGED
|
@@ -27,6 +27,20 @@ export interface ReportOptions extends RequestOptions {
|
|
|
27
27
|
from_date?: string;
|
|
28
28
|
to_date?: string;
|
|
29
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Add back optional return_total_results_count as it is still a valid request option
|
|
32
|
+
*/
|
|
33
|
+
type SearchSettingsWithOptionalTotalCount = {
|
|
34
|
+
search_settings?: Pick<services.ISearchSettings, "return_total_results_count" | "return_summary_row">;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Request Options with optional total count in search_settings
|
|
38
|
+
*/
|
|
39
|
+
export type RequestOptionsWithTotalResults = Omit<RequestOptions, "search_settings"> & SearchSettingsWithOptionalTotalCount;
|
|
40
|
+
/**
|
|
41
|
+
* Report Options with optional total count in search_settings
|
|
42
|
+
*/
|
|
43
|
+
export type ReportOptionsWithTotalResults = Omit<ReportOptions, "search_settings"> & SearchSettingsWithOptionalTotalCount;
|
|
30
44
|
export type DateConstant = "TODAY" | "YESTERDAY" | "LAST_7_DAYS" | "LAST_BUSINESS_WEEK" | "THIS_MONTH" | "LAST_MONTH" | "LAST_14_DAYS" | "LAST_30_DAYS" | "THIS_WEEK_SUN_TODAY" | "THIS_WEEK_MON_TODAY" | "LAST_WEEK_SUN_SAT" | "LAST_WEEK_MON_SUN";
|
|
31
45
|
export declare const dateConstants: DateConstant[];
|
|
32
46
|
export type SortOrder = "ASC" | "DESC";
|
|
@@ -58,3 +72,4 @@ export type MutateOperation<T> = {
|
|
|
58
72
|
exempt_policy_violation_keys?: services.AdGroupCriterionOperation["exempt_policy_violation_keys"];
|
|
59
73
|
} & Partial<Omit<T, "toJSON">>;
|
|
60
74
|
export type PageToken = services.ISearchGoogleAdsResponse["next_page_token"];
|
|
75
|
+
export {};
|