@maxim_mazurok/gapi.client.businessprofileperformance-v1 0.0.20220809
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/index.d.ts +191 -0
- package/package.json +20 -0
- package/readme.md +52 -0
- package/tests.ts +56 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Business Profile Performance API v1 0.0 */
|
|
2
|
+
// Project: https://developers.google.com/my-business/
|
|
3
|
+
// Definitions by: Maxim Mazurok <https://github.com/Maxim-Mazurok>
|
|
4
|
+
// Nick Amoscato <https://github.com/namoscato>
|
|
5
|
+
// Declan Vong <https://github.com/declanvong>
|
|
6
|
+
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
7
|
+
// TypeScript Version: 2.8
|
|
8
|
+
|
|
9
|
+
// IMPORTANT
|
|
10
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
11
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
12
|
+
// Generated from: https://businessprofileperformance.googleapis.com/$discovery/rest?version=v1
|
|
13
|
+
// Revision: 20220809
|
|
14
|
+
|
|
15
|
+
/// <reference types="gapi.client" />
|
|
16
|
+
|
|
17
|
+
declare namespace gapi.client {
|
|
18
|
+
/** Load Business Profile Performance API v1 */
|
|
19
|
+
function load(urlOrObject: "https://businessprofileperformance.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
|
|
20
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
21
|
+
function load(name: "businessprofileperformance", version: "v1"): Promise<void>;
|
|
22
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
23
|
+
function load(name: "businessprofileperformance", version: "v1", callback: () => any): void;
|
|
24
|
+
|
|
25
|
+
namespace businessprofileperformance {
|
|
26
|
+
interface Date {
|
|
27
|
+
/** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */
|
|
28
|
+
day?: number;
|
|
29
|
+
/** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
|
|
30
|
+
month?: number;
|
|
31
|
+
/** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
|
|
32
|
+
year?: number;
|
|
33
|
+
}
|
|
34
|
+
interface DatedValue {
|
|
35
|
+
/** The date that the datapoint corresponds to. This represents a month value if the day field is not set. */
|
|
36
|
+
date?: Date;
|
|
37
|
+
/** The value of the datapoint. */
|
|
38
|
+
value?: string;
|
|
39
|
+
}
|
|
40
|
+
interface GetDailyMetricsTimeSeriesResponse {
|
|
41
|
+
/** The daily time series. */
|
|
42
|
+
timeSeries?: TimeSeries;
|
|
43
|
+
}
|
|
44
|
+
interface InsightsValue {
|
|
45
|
+
/** Represents the threshold below which the actual value falls. */
|
|
46
|
+
threshold?: string;
|
|
47
|
+
/** Represents the actual value. */
|
|
48
|
+
value?: string;
|
|
49
|
+
}
|
|
50
|
+
interface ListSearchKeywordImpressionsMonthlyResponse {
|
|
51
|
+
/**
|
|
52
|
+
* A token indicating the last paginated result returned. This can be used by succeeding requests to get the next "page" of keywords. It will only be present when there are more
|
|
53
|
+
* results to be returned.
|
|
54
|
+
*/
|
|
55
|
+
nextPageToken?: string;
|
|
56
|
+
/** Search terms which have been used to find a business. */
|
|
57
|
+
searchKeywordsCounts?: SearchKeywordCount[];
|
|
58
|
+
}
|
|
59
|
+
interface SearchKeywordCount {
|
|
60
|
+
/**
|
|
61
|
+
* One of either: 1) The sum of the number of unique users that used the keyword in a month, aggregated for each month requested. 2) A threshold that indicates that the actual value is
|
|
62
|
+
* below this threshold.
|
|
63
|
+
*/
|
|
64
|
+
insightsValue?: InsightsValue;
|
|
65
|
+
/** The lower-cased string that the user entered. */
|
|
66
|
+
searchKeyword?: string;
|
|
67
|
+
}
|
|
68
|
+
interface TimeSeries {
|
|
69
|
+
/** List of datapoints in the timeseries, where each datapoint is a date-value pair. */
|
|
70
|
+
datedValues?: DatedValue[];
|
|
71
|
+
}
|
|
72
|
+
interface MonthlyResource {
|
|
73
|
+
// tslint:disable:max-line-length
|
|
74
|
+
/**
|
|
75
|
+
* Returns the search keywords used to find a business in search or maps. Each search keyword is accompanied by impressions which are aggregated on a monthly basis. Example request:
|
|
76
|
+
* `GET
|
|
77
|
+
* https://businessprofileperformance.googleapis.com/v1/locations/12345/searchkeywords/impressions/monthly?monthly_range.start_month.year=2022&monthly_range.start_month.month=1&monthly_range.end_month.year=2022&monthly_range.end_month.month=3`
|
|
78
|
+
*/
|
|
79
|
+
// tslint:enable:max-line-length
|
|
80
|
+
list(request?: {
|
|
81
|
+
/** V1 error format. */
|
|
82
|
+
"$.xgafv"?: string;
|
|
83
|
+
/** OAuth access token. */
|
|
84
|
+
access_token?: string;
|
|
85
|
+
/** Data format for response. */
|
|
86
|
+
alt?: string;
|
|
87
|
+
/** JSONP */
|
|
88
|
+
callback?: string;
|
|
89
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
90
|
+
fields?: string;
|
|
91
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
92
|
+
key?: string;
|
|
93
|
+
/** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */
|
|
94
|
+
"monthlyRange.endMonth.day"?: number;
|
|
95
|
+
/** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
|
|
96
|
+
"monthlyRange.endMonth.month"?: number;
|
|
97
|
+
/** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
|
|
98
|
+
"monthlyRange.endMonth.year"?: number;
|
|
99
|
+
/** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */
|
|
100
|
+
"monthlyRange.startMonth.day"?: number;
|
|
101
|
+
/** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
|
|
102
|
+
"monthlyRange.startMonth.month"?: number;
|
|
103
|
+
/** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
|
|
104
|
+
"monthlyRange.startMonth.year"?: number;
|
|
105
|
+
/** OAuth 2.0 token for the current user. */
|
|
106
|
+
oauth_token?: string;
|
|
107
|
+
/** Optional. The number of results requested. The default page size is 100. Page size can be set to a maximum of 100. */
|
|
108
|
+
pageSize?: number;
|
|
109
|
+
/** Optional. A token indicating the next paginated result to be returned. */
|
|
110
|
+
pageToken?: string;
|
|
111
|
+
/** Required. The location for which the time series should be fetched. Format: locations/{location_id} where location_id is an unobfuscated listing id. */
|
|
112
|
+
parent: string;
|
|
113
|
+
/** Returns response with indentations and line breaks. */
|
|
114
|
+
prettyPrint?: boolean;
|
|
115
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
116
|
+
quotaUser?: string;
|
|
117
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
118
|
+
upload_protocol?: string;
|
|
119
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
120
|
+
uploadType?: string;
|
|
121
|
+
}): Request<ListSearchKeywordImpressionsMonthlyResponse>;
|
|
122
|
+
}
|
|
123
|
+
interface ImpressionsResource {
|
|
124
|
+
monthly: MonthlyResource;
|
|
125
|
+
}
|
|
126
|
+
interface SearchkeywordsResource {
|
|
127
|
+
impressions: ImpressionsResource;
|
|
128
|
+
}
|
|
129
|
+
interface LocationsResource {
|
|
130
|
+
// tslint:disable:max-line-length
|
|
131
|
+
/**
|
|
132
|
+
* Returns the values for each date from a given time range that are associated with the specific daily metric. Example request: `GET
|
|
133
|
+
* https://businessprofileperformance.googleapis.com/v1/locations/12345:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
|
|
134
|
+
*/
|
|
135
|
+
// tslint:enable:max-line-length
|
|
136
|
+
getDailyMetricsTimeSeries(request?: {
|
|
137
|
+
/** V1 error format. */
|
|
138
|
+
"$.xgafv"?: string;
|
|
139
|
+
/** OAuth access token. */
|
|
140
|
+
access_token?: string;
|
|
141
|
+
/** Data format for response. */
|
|
142
|
+
alt?: string;
|
|
143
|
+
/** JSONP */
|
|
144
|
+
callback?: string;
|
|
145
|
+
/** Required. The metric to retrieve time series. */
|
|
146
|
+
dailyMetric?: string;
|
|
147
|
+
/** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */
|
|
148
|
+
"dailyRange.endDate.day"?: number;
|
|
149
|
+
/** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
|
|
150
|
+
"dailyRange.endDate.month"?: number;
|
|
151
|
+
/** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
|
|
152
|
+
"dailyRange.endDate.year"?: number;
|
|
153
|
+
/** Day of a month. Must be from 1 to 31 and valid for the year and month, or 0 to specify a year by itself or a year and month where the day isn't significant. */
|
|
154
|
+
"dailyRange.startDate.day"?: number;
|
|
155
|
+
/** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
|
|
156
|
+
"dailyRange.startDate.month"?: number;
|
|
157
|
+
/** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
|
|
158
|
+
"dailyRange.startDate.year"?: number;
|
|
159
|
+
/** Represents the day of the week. Eg: MONDAY. */
|
|
160
|
+
"dailySubEntityType.dayOfWeek"?: string;
|
|
161
|
+
/** Hours of day in 24 hour format. Should be from 0 to 23. An API may choose to allow the value "24:00:00" for scenarios like business closing time. */
|
|
162
|
+
"dailySubEntityType.timeOfDay.hours"?: number;
|
|
163
|
+
/** Minutes of hour of day. Must be from 0 to 59. */
|
|
164
|
+
"dailySubEntityType.timeOfDay.minutes"?: number;
|
|
165
|
+
/** Fractions of seconds in nanoseconds. Must be from 0 to 999,999,999. */
|
|
166
|
+
"dailySubEntityType.timeOfDay.nanos"?: number;
|
|
167
|
+
/** Seconds of minutes of the time. Must normally be from 0 to 59. An API may allow the value 60 if it allows leap-seconds. */
|
|
168
|
+
"dailySubEntityType.timeOfDay.seconds"?: number;
|
|
169
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
170
|
+
fields?: string;
|
|
171
|
+
/** API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. */
|
|
172
|
+
key?: string;
|
|
173
|
+
/** Required. The location for which the time series should be fetched. Format: locations/{location_id} where location_id is an unobfuscated listing id. */
|
|
174
|
+
name: string;
|
|
175
|
+
/** OAuth 2.0 token for the current user. */
|
|
176
|
+
oauth_token?: string;
|
|
177
|
+
/** Returns response with indentations and line breaks. */
|
|
178
|
+
prettyPrint?: boolean;
|
|
179
|
+
/** Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. */
|
|
180
|
+
quotaUser?: string;
|
|
181
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
182
|
+
upload_protocol?: string;
|
|
183
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
184
|
+
uploadType?: string;
|
|
185
|
+
}): Request<GetDailyMetricsTimeSeriesResponse>;
|
|
186
|
+
searchkeywords: SearchkeywordsResource;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
const locations: LocationsResource;
|
|
190
|
+
}
|
|
191
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.businessprofileperformance-v1",
|
|
3
|
+
"version": "0.0.20220809",
|
|
4
|
+
"description": "TypeScript typings for Business Profile Performance API v1",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": {
|
|
7
|
+
"email": "maxim@mazurok.com",
|
|
8
|
+
"name": "Maxim Mazurok",
|
|
9
|
+
"url": "https://maxim.mazurok.com"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
14
|
+
},
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/gapi.client": "*",
|
|
18
|
+
"@types/gapi.client.discovery": "*"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# TypeScript typings for Business Profile Performance API v1
|
|
2
|
+
|
|
3
|
+
The Business Profile Performance API allows merchants to fetch performance reports about their business profile on Google.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/my-business/).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Business Profile Performance API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.businessprofileperformance-v1 --save-dev
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
You need to initialize Google API client in your code:
|
|
17
|
+
|
|
18
|
+
```typescript
|
|
19
|
+
gapi.load('client', () => {
|
|
20
|
+
// now we can use gapi.client
|
|
21
|
+
// ...
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Then load api client wrapper:
|
|
26
|
+
|
|
27
|
+
```typescript
|
|
28
|
+
gapi.client.load('https://businessprofileperformance.googleapis.com/$discovery/rest?version=v1', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.businessprofileperformance
|
|
31
|
+
});
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
|
|
36
|
+
gapi.client.load('businessprofileperformance', 'v1', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.businessprofileperformance
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
After that you can use Business Profile Performance API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
45
|
+
|
|
46
|
+
```typescript
|
|
47
|
+
|
|
48
|
+
/*
|
|
49
|
+
Returns the values for each date from a given time range that are associated with the specific daily metric. Example request: `GET https://businessprofileperformance.googleapis.com/v1/locations/12345:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
|
|
50
|
+
*/
|
|
51
|
+
await gapi.client.businessprofileperformance.locations.getDailyMetricsTimeSeries({ name: "name", });
|
|
52
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.businessprofileperformance-v1 definition tests */
|
|
2
|
+
// IMPORTANT
|
|
3
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
4
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
5
|
+
|
|
6
|
+
// Revision: 20220809
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://businessprofileperformance.googleapis.com/$discovery/rest?version=v1');
|
|
12
|
+
/** now we can use gapi.client.businessprofileperformance */
|
|
13
|
+
|
|
14
|
+
run();
|
|
15
|
+
|
|
16
|
+
async function run() {
|
|
17
|
+
// tslint:disable:max-line-length
|
|
18
|
+
/**
|
|
19
|
+
* Returns the values for each date from a given time range that are associated with the specific daily metric. Example request: `GET
|
|
20
|
+
* https://businessprofileperformance.googleapis.com/v1/locations/12345:getDailyMetricsTimeSeries?dailyMetric=WEBSITE_CLICKS&daily_range.start_date.year=2022&daily_range.start_date.month=1&daily_range.start_date.day=1&daily_range.end_date.year=2022&daily_range.end_date.month=3&daily_range.end_date.day=31`
|
|
21
|
+
*/
|
|
22
|
+
// tslint:enable:max-line-length
|
|
23
|
+
await gapi.client.businessprofileperformance.locations.getDailyMetricsTimeSeries({
|
|
24
|
+
dailyMetric: "Test string",
|
|
25
|
+
"dailyRange.endDate.day": 42,
|
|
26
|
+
"dailyRange.endDate.month": 42,
|
|
27
|
+
"dailyRange.endDate.year": 42,
|
|
28
|
+
"dailyRange.startDate.day": 42,
|
|
29
|
+
"dailyRange.startDate.month": 42,
|
|
30
|
+
"dailyRange.startDate.year": 42,
|
|
31
|
+
"dailySubEntityType.dayOfWeek": "Test string",
|
|
32
|
+
"dailySubEntityType.timeOfDay.hours": 42,
|
|
33
|
+
"dailySubEntityType.timeOfDay.minutes": 42,
|
|
34
|
+
"dailySubEntityType.timeOfDay.nanos": 42,
|
|
35
|
+
"dailySubEntityType.timeOfDay.seconds": 42,
|
|
36
|
+
name: "Test string",
|
|
37
|
+
});
|
|
38
|
+
// tslint:disable:max-line-length
|
|
39
|
+
/**
|
|
40
|
+
* Returns the search keywords used to find a business in search or maps. Each search keyword is accompanied by impressions which are aggregated on a monthly basis. Example request: `GET
|
|
41
|
+
* https://businessprofileperformance.googleapis.com/v1/locations/12345/searchkeywords/impressions/monthly?monthly_range.start_month.year=2022&monthly_range.start_month.month=1&monthly_range.end_month.year=2022&monthly_range.end_month.month=3`
|
|
42
|
+
*/
|
|
43
|
+
// tslint:enable:max-line-length
|
|
44
|
+
await gapi.client.businessprofileperformance.locations.searchkeywords.impressions.monthly.list({
|
|
45
|
+
"monthlyRange.endMonth.day": 42,
|
|
46
|
+
"monthlyRange.endMonth.month": 42,
|
|
47
|
+
"monthlyRange.endMonth.year": 42,
|
|
48
|
+
"monthlyRange.startMonth.day": 42,
|
|
49
|
+
"monthlyRange.startMonth.month": 42,
|
|
50
|
+
"monthlyRange.startMonth.year": 42,
|
|
51
|
+
pageSize: 42,
|
|
52
|
+
pageToken: "Test string",
|
|
53
|
+
parent: "Test string",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"module": "commonjs",
|
|
4
|
+
"lib": ["es6", "dom"],
|
|
5
|
+
"noImplicitAny": true,
|
|
6
|
+
"noImplicitThis": true,
|
|
7
|
+
"strictNullChecks": true,
|
|
8
|
+
"baseUrl": "../",
|
|
9
|
+
"typeRoots": [
|
|
10
|
+
"../"
|
|
11
|
+
],
|
|
12
|
+
"types": [],
|
|
13
|
+
"noEmit": true,
|
|
14
|
+
"forceConsistentCasingInFileNames": true,
|
|
15
|
+
"strictFunctionTypes": true
|
|
16
|
+
},
|
|
17
|
+
"files": ["index.d.ts", "tests.ts"]
|
|
18
|
+
}
|