@maxim_mazurok/gapi.client.pollen-v1 0.0.20240610
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 +209 -0
- package/package.json +20 -0
- package/readme.md +76 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Pollen API v1 0.0 */
|
|
2
|
+
// Project: https://developers.google.com/maps/documentation/pollen
|
|
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
|
+
|
|
8
|
+
// IMPORTANT
|
|
9
|
+
// This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
|
|
10
|
+
// In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
|
|
11
|
+
// Generated from: https://pollen.googleapis.com/$discovery/rest?version=v1
|
|
12
|
+
// Revision: 20240610
|
|
13
|
+
|
|
14
|
+
/// <reference types="gapi.client" />
|
|
15
|
+
|
|
16
|
+
declare namespace gapi.client {
|
|
17
|
+
/** Load Pollen API v1 */
|
|
18
|
+
function load(
|
|
19
|
+
urlOrObject: 'https://pollen.googleapis.com/$discovery/rest?version=v1'
|
|
20
|
+
): Promise<void>;
|
|
21
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
22
|
+
function load(name: 'pollen', version: 'v1'): Promise<void>;
|
|
23
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
24
|
+
function load(name: 'pollen', version: 'v1', callback: () => any): void;
|
|
25
|
+
|
|
26
|
+
namespace pollen {
|
|
27
|
+
interface Color {
|
|
28
|
+
/** The fraction of this color that should be applied to the pixel. That is, the final pixel color is defined by the equation: `pixel color = alpha * (this color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 corresponds to a solid color, whereas a value of 0.0 corresponds to a completely transparent color. This uses a wrapper message rather than a simple float scalar so that it is possible to distinguish between a default value and the value being unset. If omitted, this color object is rendered as a solid color (as if the alpha value had been explicitly given a value of 1.0). */
|
|
29
|
+
alpha?: number;
|
|
30
|
+
/** The amount of blue in the color as a value in the interval [0, 1]. */
|
|
31
|
+
blue?: number;
|
|
32
|
+
/** The amount of green in the color as a value in the interval [0, 1]. */
|
|
33
|
+
green?: number;
|
|
34
|
+
/** The amount of red in the color as a value in the interval [0, 1]. */
|
|
35
|
+
red?: number;
|
|
36
|
+
}
|
|
37
|
+
interface Date {
|
|
38
|
+
/** 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. */
|
|
39
|
+
day?: number;
|
|
40
|
+
/** Month of a year. Must be from 1 to 12, or 0 to specify a year without a month and day. */
|
|
41
|
+
month?: number;
|
|
42
|
+
/** Year of the date. Must be from 1 to 9999, or 0 to specify a date without a year. */
|
|
43
|
+
year?: number;
|
|
44
|
+
}
|
|
45
|
+
interface DayInfo {
|
|
46
|
+
/** The date in UTC at which the pollen forecast data is represented. */
|
|
47
|
+
date?: Date;
|
|
48
|
+
/** This list will include (up to) 15 pollen species affecting the location specified in the request. */
|
|
49
|
+
plantInfo?: PlantInfo[];
|
|
50
|
+
/** This list will include (up to) three pollen types (grass, weed, tree) affecting the location specified in the request. */
|
|
51
|
+
pollenTypeInfo?: PollenTypeInfo[];
|
|
52
|
+
}
|
|
53
|
+
interface HttpBody {
|
|
54
|
+
/** The HTTP Content-Type header value specifying the content type of the body. */
|
|
55
|
+
contentType?: string;
|
|
56
|
+
/** The HTTP request/response body as raw binary. */
|
|
57
|
+
data?: string;
|
|
58
|
+
/** Application specific response metadata. Must be set in the first response for streaming APIs. */
|
|
59
|
+
extensions?: Array<{[P in string]: any}>;
|
|
60
|
+
}
|
|
61
|
+
interface IndexInfo {
|
|
62
|
+
/** Text classification of index numerical score interpretation. The index consists of six categories: * 0: "None" * 1: "Very low" * 2: "Low" * 3: "Moderate" * 4: "High" * 5: "Very high */
|
|
63
|
+
category?: string;
|
|
64
|
+
/** The index's code. This field represents the index for programming purposes by using snake cases instead of spaces. Example: "UPI". */
|
|
65
|
+
code?: string;
|
|
66
|
+
/** The color used to represent the Pollen Index numeric score. */
|
|
67
|
+
color?: Color;
|
|
68
|
+
/** A human readable representation of the index name. Example: "Universal Pollen Index". */
|
|
69
|
+
displayName?: string;
|
|
70
|
+
/** Textual explanation of current index level. */
|
|
71
|
+
indexDescription?: string;
|
|
72
|
+
/** The index's numeric score. Numeric range is between 0 and 5. */
|
|
73
|
+
value?: number;
|
|
74
|
+
}
|
|
75
|
+
interface LookupForecastResponse {
|
|
76
|
+
/** Required. This object contains the daily forecast information for each day requested. */
|
|
77
|
+
dailyInfo?: DayInfo[];
|
|
78
|
+
/** Optional. The token to retrieve the next page. */
|
|
79
|
+
nextPageToken?: string;
|
|
80
|
+
/** The ISO_3166-1 alpha-2 code of the country/region corresponding to the location provided in the request. This field might be omitted from the response if the location provided in the request resides in a disputed territory. */
|
|
81
|
+
regionCode?: string;
|
|
82
|
+
}
|
|
83
|
+
interface PlantDescription {
|
|
84
|
+
/** Textual description of pollen cross reaction plants. Example: Alder, Hazel, Hornbeam, Beech, Willow, and Oak pollen. */
|
|
85
|
+
crossReaction?: string;
|
|
86
|
+
/** A human readable representation of the plant family name. Example: "Betulaceae (the Birch family)". */
|
|
87
|
+
family?: string;
|
|
88
|
+
/** Link to the picture of the plant. */
|
|
89
|
+
picture?: string;
|
|
90
|
+
/** Link to a closeup picture of the plant. */
|
|
91
|
+
pictureCloseup?: string;
|
|
92
|
+
/** Textual list of explanations of seasons where the pollen is active. Example: "Late winter, spring". */
|
|
93
|
+
season?: string;
|
|
94
|
+
/** Textual description of the plants' colors of leaves, bark, flowers or seeds that helps identify the plant. */
|
|
95
|
+
specialColors?: string;
|
|
96
|
+
/** Textual description of the plants' shapes of leaves, bark, flowers or seeds that helps identify the plant. */
|
|
97
|
+
specialShapes?: string;
|
|
98
|
+
/** The plant's pollen type. For example: "GRASS". A list of all available codes could be found here. */
|
|
99
|
+
type?: string;
|
|
100
|
+
}
|
|
101
|
+
interface PlantInfo {
|
|
102
|
+
/** The plant code name. For example: "COTTONWOOD". A list of all available codes could be found here. */
|
|
103
|
+
code?: string;
|
|
104
|
+
/** A human readable representation of the plant name. Example: “Cottonwood". */
|
|
105
|
+
displayName?: string;
|
|
106
|
+
/** This object contains data representing specific pollen index value, category and description. */
|
|
107
|
+
indexInfo?: IndexInfo;
|
|
108
|
+
/** Indication of either the plant is in season or not. */
|
|
109
|
+
inSeason?: boolean;
|
|
110
|
+
/** Contains general information about plants, including details on their seasonality, special shapes and colors, information about allergic cross-reactions, and plant photos. */
|
|
111
|
+
plantDescription?: PlantDescription;
|
|
112
|
+
}
|
|
113
|
+
interface PollenTypeInfo {
|
|
114
|
+
/** The pollen type's code name. For example: "GRASS" */
|
|
115
|
+
code?: string;
|
|
116
|
+
/** A human readable representation of the pollen type name. Example: "Grass" */
|
|
117
|
+
displayName?: string;
|
|
118
|
+
/** Textual list of explanations, related to health insights based on the current pollen levels. */
|
|
119
|
+
healthRecommendations?: string[];
|
|
120
|
+
/** Contains the Universal Pollen Index (UPI) data for the pollen type. */
|
|
121
|
+
indexInfo?: IndexInfo;
|
|
122
|
+
/** Indication whether the plant is in season or not. */
|
|
123
|
+
inSeason?: boolean;
|
|
124
|
+
}
|
|
125
|
+
interface ForecastResource {
|
|
126
|
+
/** Returns up to 5 days of daily pollen information in more than 65 countries, up to 1km resolution. */
|
|
127
|
+
lookup(request?: {
|
|
128
|
+
/** V1 error format. */
|
|
129
|
+
'$.xgafv'?: string;
|
|
130
|
+
/** OAuth access token. */
|
|
131
|
+
access_token?: string;
|
|
132
|
+
/** Data format for response. */
|
|
133
|
+
alt?: string;
|
|
134
|
+
/** JSONP */
|
|
135
|
+
callback?: string;
|
|
136
|
+
/** Required. A number that indicates how many forecast days to request (minimum value 1, maximum value is 5). */
|
|
137
|
+
days?: number;
|
|
138
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
139
|
+
fields?: string;
|
|
140
|
+
/** 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. */
|
|
141
|
+
key?: string;
|
|
142
|
+
/** Optional. Allows the client to choose the language for the response. If data cannot be provided for that language the API uses the closest match. Allowed values rely on the IETF BCP-47 standard. Default value is "en". */
|
|
143
|
+
languageCode?: string;
|
|
144
|
+
/** The latitude in degrees. It must be in the range [-90.0, +90.0]. */
|
|
145
|
+
'location.latitude'?: number;
|
|
146
|
+
/** The longitude in degrees. It must be in the range [-180.0, +180.0]. */
|
|
147
|
+
'location.longitude'?: number;
|
|
148
|
+
/** OAuth 2.0 token for the current user. */
|
|
149
|
+
oauth_token?: string;
|
|
150
|
+
/** Optional. The maximum number of daily info records to return per page. The default and max value is 5 (5 days of data). */
|
|
151
|
+
pageSize?: number;
|
|
152
|
+
/** Optional. A page token received from a previous daily call. It is used to retrieve the subsequent page. Note that when providing a value for the page token all other request parameters provided must match the previous call that provided the page token. */
|
|
153
|
+
pageToken?: string;
|
|
154
|
+
/** Optional. Contains general information about plants, including details on their seasonality, special shapes and colors, information about allergic cross-reactions, and plant photos. */
|
|
155
|
+
plantsDescription?: boolean;
|
|
156
|
+
/** Returns response with indentations and line breaks. */
|
|
157
|
+
prettyPrint?: boolean;
|
|
158
|
+
/** 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. */
|
|
159
|
+
quotaUser?: string;
|
|
160
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
161
|
+
upload_protocol?: string;
|
|
162
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
163
|
+
uploadType?: string;
|
|
164
|
+
}): Request<LookupForecastResponse>;
|
|
165
|
+
}
|
|
166
|
+
interface HeatmapTilesResource {
|
|
167
|
+
/** Returns a byte array containing the data of the tile PNG image. */
|
|
168
|
+
lookupHeatmapTile(request?: {
|
|
169
|
+
/** V1 error format. */
|
|
170
|
+
'$.xgafv'?: string;
|
|
171
|
+
/** OAuth access token. */
|
|
172
|
+
access_token?: string;
|
|
173
|
+
/** Data format for response. */
|
|
174
|
+
alt?: string;
|
|
175
|
+
/** JSONP */
|
|
176
|
+
callback?: string;
|
|
177
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
178
|
+
fields?: string;
|
|
179
|
+
/** 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. */
|
|
180
|
+
key?: string;
|
|
181
|
+
/** Required. The type of the pollen heatmap. Defines the combination of pollen type and index that the map will graphically represent. */
|
|
182
|
+
mapType: string;
|
|
183
|
+
/** OAuth 2.0 token for the current user. */
|
|
184
|
+
oauth_token?: string;
|
|
185
|
+
/** Returns response with indentations and line breaks. */
|
|
186
|
+
prettyPrint?: boolean;
|
|
187
|
+
/** 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. */
|
|
188
|
+
quotaUser?: string;
|
|
189
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
190
|
+
upload_protocol?: string;
|
|
191
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
192
|
+
uploadType?: string;
|
|
193
|
+
/** Required. Defines the east-west point in the requested tile. */
|
|
194
|
+
x: number;
|
|
195
|
+
/** Required. Defines the north-south point in the requested tile. */
|
|
196
|
+
y: number;
|
|
197
|
+
/** Required. The map's zoom level. Defines how large or small the contents of a map appear in a map view. * Zoom level 0 is the entire world in a single tile. * Zoom level 1 is the entire world in 4 tiles. * Zoom level 2 is the entire world in 16 tiles. * Zoom level 16 is the entire world in 65,536 tiles. Allowed values: 0-16 */
|
|
198
|
+
zoom: number;
|
|
199
|
+
}): Request<HttpBody>;
|
|
200
|
+
}
|
|
201
|
+
interface MapTypesResource {
|
|
202
|
+
heatmapTiles: HeatmapTilesResource;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
const forecast: ForecastResource;
|
|
206
|
+
|
|
207
|
+
const mapTypes: MapTypesResource;
|
|
208
|
+
}
|
|
209
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.pollen-v1",
|
|
3
|
+
"version": "0.0.20240610",
|
|
4
|
+
"description": "TypeScript typings for Pollen API v1",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "https://github.com/Maxim-Mazurok/google-api-typings-generator.git"
|
|
8
|
+
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": {
|
|
11
|
+
"name": "Maxim Mazurok",
|
|
12
|
+
"email": "maxim@mazurok.com",
|
|
13
|
+
"url": "https://maxim.mazurok.com"
|
|
14
|
+
},
|
|
15
|
+
"types": "index.d.ts",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@types/gapi.client": "*",
|
|
18
|
+
"@types/gapi.client.discovery-v1": "*"
|
|
19
|
+
}
|
|
20
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# TypeScript typings for Pollen API v1
|
|
2
|
+
|
|
3
|
+
The Pollen API.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/maps/documentation/pollen).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Pollen API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.pollen-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(
|
|
29
|
+
'https://pollen.googleapis.com/$discovery/rest?version=v1',
|
|
30
|
+
() => {
|
|
31
|
+
// now we can use:
|
|
32
|
+
// gapi.client.pollen
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
// Deprecated, use discovery document URL, see https://github.com/google/google-api-javascript-client/blob/master/docs/reference.md#----gapiclientloadname----version----callback--
|
|
39
|
+
gapi.client.load('pollen', 'v1', () => {
|
|
40
|
+
// now we can use:
|
|
41
|
+
// gapi.client.pollen
|
|
42
|
+
});
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Don't forget to authenticate your client before sending any request to resources:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
// declare client_id registered in Google Developers Console
|
|
49
|
+
var client_id = '',
|
|
50
|
+
scope = [
|
|
51
|
+
// See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
|
|
52
|
+
'https://www.googleapis.com/auth/cloud-platform',
|
|
53
|
+
],
|
|
54
|
+
immediate = true;
|
|
55
|
+
// ...
|
|
56
|
+
|
|
57
|
+
gapi.auth.authorize(
|
|
58
|
+
{client_id: client_id, scope: scope, immediate: immediate},
|
|
59
|
+
authResult => {
|
|
60
|
+
if (authResult && !authResult.error) {
|
|
61
|
+
/* handle successful authorization */
|
|
62
|
+
} else {
|
|
63
|
+
/* handle authorization error */
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
);
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
After that you can use Pollen API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
70
|
+
|
|
71
|
+
```typescript
|
|
72
|
+
/*
|
|
73
|
+
Returns up to 5 days of daily pollen information in more than 65 countries, up to 1km resolution.
|
|
74
|
+
*/
|
|
75
|
+
await gapi.client.pollen.forecast.lookup({});
|
|
76
|
+
```
|