@maxim_mazurok/gapi.client.keep-v1 0.0.20220725
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 +453 -0
- package/package.json +20 -0
- package/readme.md +96 -0
- package/tests.ts +153 -0
- package/tsconfig.json +18 -0
- package/tslint.json +6 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,453 @@
|
|
|
1
|
+
/* Type definitions for non-npm package Google Keep API v1 0.0 */
|
|
2
|
+
// Project: https://developers.google.com/keep/api
|
|
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://keep.googleapis.com/$discovery/rest?version=v1
|
|
13
|
+
// Revision: 20220725
|
|
14
|
+
|
|
15
|
+
/// <reference types="gapi.client" />
|
|
16
|
+
|
|
17
|
+
declare namespace gapi.client {
|
|
18
|
+
/** Load Google Keep API v1 */
|
|
19
|
+
function load(urlOrObject: "https://keep.googleapis.com/$discovery/rest?version=v1"): Promise<void>;
|
|
20
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
21
|
+
function load(name: "keep", version: "v1"): Promise<void>;
|
|
22
|
+
/** @deprecated Please load APIs with discovery documents. */
|
|
23
|
+
function load(name: "keep", version: "v1", callback: () => any): void;
|
|
24
|
+
|
|
25
|
+
namespace keep {
|
|
26
|
+
interface Attachment {
|
|
27
|
+
/** The MIME types (IANA media types) in which the attachment is available. */
|
|
28
|
+
mimeType?: string[];
|
|
29
|
+
/** The resource name; */
|
|
30
|
+
name?: string;
|
|
31
|
+
}
|
|
32
|
+
interface BatchCreatePermissionsRequest {
|
|
33
|
+
/** The request message specifying the resources to create. */
|
|
34
|
+
requests?: CreatePermissionRequest[];
|
|
35
|
+
}
|
|
36
|
+
interface BatchCreatePermissionsResponse {
|
|
37
|
+
/** Permissions created. */
|
|
38
|
+
permissions?: Permission[];
|
|
39
|
+
}
|
|
40
|
+
interface BatchDeletePermissionsRequest {
|
|
41
|
+
/** Required. The names of the permissions to delete. Format: `notes/{note}/permissions/{permission}` */
|
|
42
|
+
names?: string[];
|
|
43
|
+
}
|
|
44
|
+
interface CreatePermissionRequest {
|
|
45
|
+
/** Required. The parent note where this permission will be created. Format: `notes/{note}` */
|
|
46
|
+
parent?: string;
|
|
47
|
+
/** Required. The permission to create. One of Permission.email, User.email or Group.email must be supplied. */
|
|
48
|
+
permission?: Permission;
|
|
49
|
+
}
|
|
50
|
+
// tslint:disable-next-line:no-empty-interface
|
|
51
|
+
interface Empty {
|
|
52
|
+
}
|
|
53
|
+
// tslint:disable-next-line:no-empty-interface
|
|
54
|
+
interface Family {
|
|
55
|
+
}
|
|
56
|
+
interface Group {
|
|
57
|
+
/** The group email. */
|
|
58
|
+
email?: string;
|
|
59
|
+
}
|
|
60
|
+
interface ListContent {
|
|
61
|
+
/** The items in the list. The number of items must be less than 1,000. */
|
|
62
|
+
listItems?: ListItem[];
|
|
63
|
+
}
|
|
64
|
+
interface ListItem {
|
|
65
|
+
/** Whether this item has been checked off or not. */
|
|
66
|
+
checked?: boolean;
|
|
67
|
+
/** If set, list of list items nested under this list item. Only one level of nesting is allowed. */
|
|
68
|
+
childListItems?: ListItem[];
|
|
69
|
+
/** The text of this item. Length must be less than 1,000 characters. */
|
|
70
|
+
text?: TextContent;
|
|
71
|
+
}
|
|
72
|
+
interface ListNotesResponse {
|
|
73
|
+
/** Next page's `page_token` field. */
|
|
74
|
+
nextPageToken?: string;
|
|
75
|
+
/** A page of notes. */
|
|
76
|
+
notes?: Note[];
|
|
77
|
+
}
|
|
78
|
+
interface Note {
|
|
79
|
+
/** Output only. The attachments attached to this note. */
|
|
80
|
+
attachments?: Attachment[];
|
|
81
|
+
/** The body of the note. */
|
|
82
|
+
body?: Section;
|
|
83
|
+
/** Output only. When this note was created. */
|
|
84
|
+
createTime?: string;
|
|
85
|
+
/** Output only. The resource name of this note. See general note on identifiers in KeepService. */
|
|
86
|
+
name?: string;
|
|
87
|
+
/** Output only. The list of permissions set on the note. Contains at least one entry for the note owner. */
|
|
88
|
+
permissions?: Permission[];
|
|
89
|
+
/** The title of the note. Length must be less than 1,000 characters. */
|
|
90
|
+
title?: string;
|
|
91
|
+
/** Output only. `true` if this note has been trashed. If trashed, the note is eventually deleted. */
|
|
92
|
+
trashed?: boolean;
|
|
93
|
+
/** Output only. When this note was trashed. If `trashed`, the note is eventually deleted. If the note is not trashed, this field is not set (and the trashed field is `false`). */
|
|
94
|
+
trashTime?: string;
|
|
95
|
+
/** Output only. When this note was last modified. */
|
|
96
|
+
updateTime?: string;
|
|
97
|
+
}
|
|
98
|
+
interface Permission {
|
|
99
|
+
/** Output only. Whether this member has been deleted. If the member is recovered, this value is set to false and the recovered member retains the role on the note. */
|
|
100
|
+
deleted?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* The email associated with the member. If set on create, the `email` field in the `User` or `Group` message must either be empty or match this field. On read, may be unset if the
|
|
103
|
+
* member does not have an associated email.
|
|
104
|
+
*/
|
|
105
|
+
email?: string;
|
|
106
|
+
/** Output only. The Google Family to which this role applies. */
|
|
107
|
+
family?: any;
|
|
108
|
+
/** Output only. The group to which this role applies. */
|
|
109
|
+
group?: Group;
|
|
110
|
+
/** Output only. The resource name. */
|
|
111
|
+
name?: string;
|
|
112
|
+
/** The role granted by this permission. The role determines the entity’s ability to read, write, and share notes. */
|
|
113
|
+
role?: string;
|
|
114
|
+
/** Output only. The user to whom this role applies. */
|
|
115
|
+
user?: User;
|
|
116
|
+
}
|
|
117
|
+
interface Section {
|
|
118
|
+
/** Used if this section's content is a list. */
|
|
119
|
+
list?: ListContent;
|
|
120
|
+
/** Used if this section's content is a block of text. The length of the text content must be less than 20,000 characters. */
|
|
121
|
+
text?: TextContent;
|
|
122
|
+
}
|
|
123
|
+
interface TextContent {
|
|
124
|
+
/** The text of the note. The limits on this vary with the specific field using this type. */
|
|
125
|
+
text?: string;
|
|
126
|
+
}
|
|
127
|
+
interface User {
|
|
128
|
+
/** The user's email. */
|
|
129
|
+
email?: string;
|
|
130
|
+
}
|
|
131
|
+
interface MediaResource {
|
|
132
|
+
/**
|
|
133
|
+
* Gets an attachment. To download attachment media via REST requires the alt=media query parameter. Returns a 400 bad request error if attachment media is not available in the
|
|
134
|
+
* requested MIME type.
|
|
135
|
+
*/
|
|
136
|
+
download(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
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
146
|
+
fields?: string;
|
|
147
|
+
/** 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. */
|
|
148
|
+
key?: string;
|
|
149
|
+
/** The IANA MIME type format requested. The requested MIME type must be one specified in the attachment.mime_type. Required when downloading attachment media and ignored otherwise. */
|
|
150
|
+
mimeType?: string;
|
|
151
|
+
/** Required. The name of the attachment. */
|
|
152
|
+
name: string;
|
|
153
|
+
/** OAuth 2.0 token for the current user. */
|
|
154
|
+
oauth_token?: string;
|
|
155
|
+
/** Returns response with indentations and line breaks. */
|
|
156
|
+
prettyPrint?: boolean;
|
|
157
|
+
/** 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. */
|
|
158
|
+
quotaUser?: string;
|
|
159
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
160
|
+
upload_protocol?: string;
|
|
161
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
162
|
+
uploadType?: string;
|
|
163
|
+
}): Request<Attachment>;
|
|
164
|
+
}
|
|
165
|
+
interface PermissionsResource {
|
|
166
|
+
/**
|
|
167
|
+
* Creates one or more permissions on the note. Only permissions with the `WRITER` role may be created. If adding any permission fails, then the entire request fails and no changes are
|
|
168
|
+
* made.
|
|
169
|
+
*/
|
|
170
|
+
batchCreate(request: {
|
|
171
|
+
/** V1 error format. */
|
|
172
|
+
"$.xgafv"?: string;
|
|
173
|
+
/** OAuth access token. */
|
|
174
|
+
access_token?: string;
|
|
175
|
+
/** Data format for response. */
|
|
176
|
+
alt?: string;
|
|
177
|
+
/** JSONP */
|
|
178
|
+
callback?: string;
|
|
179
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
180
|
+
fields?: string;
|
|
181
|
+
/** 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. */
|
|
182
|
+
key?: string;
|
|
183
|
+
/** OAuth 2.0 token for the current user. */
|
|
184
|
+
oauth_token?: string;
|
|
185
|
+
/**
|
|
186
|
+
* The parent resource shared by all Permissions being created. Format: `notes/{note}` If this is set, the parent field in the CreatePermission messages must either be empty or
|
|
187
|
+
* match this field.
|
|
188
|
+
*/
|
|
189
|
+
parent: string;
|
|
190
|
+
/** Returns response with indentations and line breaks. */
|
|
191
|
+
prettyPrint?: boolean;
|
|
192
|
+
/** 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. */
|
|
193
|
+
quotaUser?: string;
|
|
194
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
195
|
+
upload_protocol?: string;
|
|
196
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
197
|
+
uploadType?: string;
|
|
198
|
+
/** Request body */
|
|
199
|
+
resource: BatchCreatePermissionsRequest;
|
|
200
|
+
}): Request<BatchCreatePermissionsResponse>;
|
|
201
|
+
batchCreate(request: {
|
|
202
|
+
/** V1 error format. */
|
|
203
|
+
"$.xgafv"?: string;
|
|
204
|
+
/** OAuth access token. */
|
|
205
|
+
access_token?: string;
|
|
206
|
+
/** Data format for response. */
|
|
207
|
+
alt?: string;
|
|
208
|
+
/** JSONP */
|
|
209
|
+
callback?: string;
|
|
210
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
211
|
+
fields?: string;
|
|
212
|
+
/** 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. */
|
|
213
|
+
key?: string;
|
|
214
|
+
/** OAuth 2.0 token for the current user. */
|
|
215
|
+
oauth_token?: string;
|
|
216
|
+
/**
|
|
217
|
+
* The parent resource shared by all Permissions being created. Format: `notes/{note}` If this is set, the parent field in the CreatePermission messages must either be empty or
|
|
218
|
+
* match this field.
|
|
219
|
+
*/
|
|
220
|
+
parent: string;
|
|
221
|
+
/** Returns response with indentations and line breaks. */
|
|
222
|
+
prettyPrint?: boolean;
|
|
223
|
+
/** 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. */
|
|
224
|
+
quotaUser?: string;
|
|
225
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
226
|
+
upload_protocol?: string;
|
|
227
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
228
|
+
uploadType?: string;
|
|
229
|
+
},
|
|
230
|
+
body: BatchCreatePermissionsRequest): Request<BatchCreatePermissionsResponse>;
|
|
231
|
+
/**
|
|
232
|
+
* Deletes one or more permissions on the note. The specified entities will immediately lose access. A permission with the `OWNER` role can't be removed. If removing a permission
|
|
233
|
+
* fails, then the entire request fails and no changes are made. Returns a 400 bad request error if a specified permission does not exist on the note.
|
|
234
|
+
*/
|
|
235
|
+
batchDelete(request: {
|
|
236
|
+
/** V1 error format. */
|
|
237
|
+
"$.xgafv"?: string;
|
|
238
|
+
/** OAuth access token. */
|
|
239
|
+
access_token?: string;
|
|
240
|
+
/** Data format for response. */
|
|
241
|
+
alt?: string;
|
|
242
|
+
/** JSONP */
|
|
243
|
+
callback?: string;
|
|
244
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
245
|
+
fields?: string;
|
|
246
|
+
/** 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. */
|
|
247
|
+
key?: string;
|
|
248
|
+
/** OAuth 2.0 token for the current user. */
|
|
249
|
+
oauth_token?: string;
|
|
250
|
+
/**
|
|
251
|
+
* The parent resource shared by all permissions being deleted. Format: `notes/{note}` If this is set, the parent of all of the permissions specified in the DeletePermissionRequest
|
|
252
|
+
* messages must match this field.
|
|
253
|
+
*/
|
|
254
|
+
parent: string;
|
|
255
|
+
/** Returns response with indentations and line breaks. */
|
|
256
|
+
prettyPrint?: boolean;
|
|
257
|
+
/** 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. */
|
|
258
|
+
quotaUser?: string;
|
|
259
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
260
|
+
upload_protocol?: string;
|
|
261
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
262
|
+
uploadType?: string;
|
|
263
|
+
/** Request body */
|
|
264
|
+
resource: BatchDeletePermissionsRequest;
|
|
265
|
+
}): Request<{}>;
|
|
266
|
+
batchDelete(request: {
|
|
267
|
+
/** V1 error format. */
|
|
268
|
+
"$.xgafv"?: string;
|
|
269
|
+
/** OAuth access token. */
|
|
270
|
+
access_token?: string;
|
|
271
|
+
/** Data format for response. */
|
|
272
|
+
alt?: string;
|
|
273
|
+
/** JSONP */
|
|
274
|
+
callback?: string;
|
|
275
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
276
|
+
fields?: string;
|
|
277
|
+
/** 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. */
|
|
278
|
+
key?: string;
|
|
279
|
+
/** OAuth 2.0 token for the current user. */
|
|
280
|
+
oauth_token?: string;
|
|
281
|
+
/**
|
|
282
|
+
* The parent resource shared by all permissions being deleted. Format: `notes/{note}` If this is set, the parent of all of the permissions specified in the DeletePermissionRequest
|
|
283
|
+
* messages must match this field.
|
|
284
|
+
*/
|
|
285
|
+
parent: string;
|
|
286
|
+
/** Returns response with indentations and line breaks. */
|
|
287
|
+
prettyPrint?: boolean;
|
|
288
|
+
/** 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. */
|
|
289
|
+
quotaUser?: string;
|
|
290
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
291
|
+
upload_protocol?: string;
|
|
292
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
293
|
+
uploadType?: string;
|
|
294
|
+
},
|
|
295
|
+
body: BatchDeletePermissionsRequest): Request<{}>;
|
|
296
|
+
}
|
|
297
|
+
interface NotesResource {
|
|
298
|
+
/** Creates a new note. */
|
|
299
|
+
create(request: {
|
|
300
|
+
/** V1 error format. */
|
|
301
|
+
"$.xgafv"?: string;
|
|
302
|
+
/** OAuth access token. */
|
|
303
|
+
access_token?: string;
|
|
304
|
+
/** Data format for response. */
|
|
305
|
+
alt?: string;
|
|
306
|
+
/** JSONP */
|
|
307
|
+
callback?: string;
|
|
308
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
309
|
+
fields?: string;
|
|
310
|
+
/** 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. */
|
|
311
|
+
key?: string;
|
|
312
|
+
/** OAuth 2.0 token for the current user. */
|
|
313
|
+
oauth_token?: string;
|
|
314
|
+
/** Returns response with indentations and line breaks. */
|
|
315
|
+
prettyPrint?: boolean;
|
|
316
|
+
/** 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. */
|
|
317
|
+
quotaUser?: string;
|
|
318
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
319
|
+
upload_protocol?: string;
|
|
320
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
321
|
+
uploadType?: string;
|
|
322
|
+
/** Request body */
|
|
323
|
+
resource: Note;
|
|
324
|
+
}): Request<Note>;
|
|
325
|
+
create(request: {
|
|
326
|
+
/** V1 error format. */
|
|
327
|
+
"$.xgafv"?: string;
|
|
328
|
+
/** OAuth access token. */
|
|
329
|
+
access_token?: string;
|
|
330
|
+
/** Data format for response. */
|
|
331
|
+
alt?: string;
|
|
332
|
+
/** JSONP */
|
|
333
|
+
callback?: string;
|
|
334
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
335
|
+
fields?: string;
|
|
336
|
+
/** 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. */
|
|
337
|
+
key?: string;
|
|
338
|
+
/** OAuth 2.0 token for the current user. */
|
|
339
|
+
oauth_token?: string;
|
|
340
|
+
/** Returns response with indentations and line breaks. */
|
|
341
|
+
prettyPrint?: boolean;
|
|
342
|
+
/** 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. */
|
|
343
|
+
quotaUser?: string;
|
|
344
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
345
|
+
upload_protocol?: string;
|
|
346
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
347
|
+
uploadType?: string;
|
|
348
|
+
},
|
|
349
|
+
body: Note): Request<Note>;
|
|
350
|
+
/**
|
|
351
|
+
* Deletes a note. Caller must have the `OWNER` role on the note to delete. Deleting a note removes the resource immediately and cannot be undone. Any collaborators will lose access to
|
|
352
|
+
* the note.
|
|
353
|
+
*/
|
|
354
|
+
delete(request?: {
|
|
355
|
+
/** V1 error format. */
|
|
356
|
+
"$.xgafv"?: string;
|
|
357
|
+
/** OAuth access token. */
|
|
358
|
+
access_token?: string;
|
|
359
|
+
/** Data format for response. */
|
|
360
|
+
alt?: string;
|
|
361
|
+
/** JSONP */
|
|
362
|
+
callback?: string;
|
|
363
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
364
|
+
fields?: string;
|
|
365
|
+
/** 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. */
|
|
366
|
+
key?: string;
|
|
367
|
+
/** Required. Name of the note to delete. */
|
|
368
|
+
name: string;
|
|
369
|
+
/** OAuth 2.0 token for the current user. */
|
|
370
|
+
oauth_token?: string;
|
|
371
|
+
/** Returns response with indentations and line breaks. */
|
|
372
|
+
prettyPrint?: boolean;
|
|
373
|
+
/** 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. */
|
|
374
|
+
quotaUser?: string;
|
|
375
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
376
|
+
upload_protocol?: string;
|
|
377
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
378
|
+
uploadType?: string;
|
|
379
|
+
}): Request<{}>;
|
|
380
|
+
/** Gets a note. */
|
|
381
|
+
get(request?: {
|
|
382
|
+
/** V1 error format. */
|
|
383
|
+
"$.xgafv"?: string;
|
|
384
|
+
/** OAuth access token. */
|
|
385
|
+
access_token?: string;
|
|
386
|
+
/** Data format for response. */
|
|
387
|
+
alt?: string;
|
|
388
|
+
/** JSONP */
|
|
389
|
+
callback?: string;
|
|
390
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
391
|
+
fields?: string;
|
|
392
|
+
/** 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. */
|
|
393
|
+
key?: string;
|
|
394
|
+
/** Required. Name of the resource. */
|
|
395
|
+
name: string;
|
|
396
|
+
/** OAuth 2.0 token for the current user. */
|
|
397
|
+
oauth_token?: string;
|
|
398
|
+
/** Returns response with indentations and line breaks. */
|
|
399
|
+
prettyPrint?: boolean;
|
|
400
|
+
/** 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. */
|
|
401
|
+
quotaUser?: string;
|
|
402
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
403
|
+
upload_protocol?: string;
|
|
404
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
405
|
+
uploadType?: string;
|
|
406
|
+
}): Request<Note>;
|
|
407
|
+
/**
|
|
408
|
+
* Lists notes. Every list call returns a page of results with `page_size` as the upper bound of returned items. A `page_size` of zero allows the server to choose the upper bound. The
|
|
409
|
+
* ListNotesResponse contains at most `page_size` entries. If there are more things left to list, it provides a `next_page_token` value. (Page tokens are opaque values.) To get the
|
|
410
|
+
* next page of results, copy the result's `next_page_token` into the next request's `page_token`. Repeat until the `next_page_token` returned with a page of results is empty.
|
|
411
|
+
* ListNotes return consistent results in the face of concurrent changes, or signals that it cannot with an ABORTED error.
|
|
412
|
+
*/
|
|
413
|
+
list(request?: {
|
|
414
|
+
/** V1 error format. */
|
|
415
|
+
"$.xgafv"?: string;
|
|
416
|
+
/** OAuth access token. */
|
|
417
|
+
access_token?: string;
|
|
418
|
+
/** Data format for response. */
|
|
419
|
+
alt?: string;
|
|
420
|
+
/** JSONP */
|
|
421
|
+
callback?: string;
|
|
422
|
+
/** Selector specifying which fields to include in a partial response. */
|
|
423
|
+
fields?: string;
|
|
424
|
+
/**
|
|
425
|
+
* Filter for list results. If no filter is supplied, the `trashed` filter is applied by default. Valid fields to filter by are: `create_time`, `update_time`, `trash_time`, and
|
|
426
|
+
* `trashed`. Filter syntax follows the [Google AIP filtering spec](https://aip.dev/160).
|
|
427
|
+
*/
|
|
428
|
+
filter?: string;
|
|
429
|
+
/** 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. */
|
|
430
|
+
key?: string;
|
|
431
|
+
/** OAuth 2.0 token for the current user. */
|
|
432
|
+
oauth_token?: string;
|
|
433
|
+
/** The maximum number of results to return. */
|
|
434
|
+
pageSize?: number;
|
|
435
|
+
/** The previous page's `next_page_token` field. */
|
|
436
|
+
pageToken?: string;
|
|
437
|
+
/** Returns response with indentations and line breaks. */
|
|
438
|
+
prettyPrint?: boolean;
|
|
439
|
+
/** 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. */
|
|
440
|
+
quotaUser?: string;
|
|
441
|
+
/** Upload protocol for media (e.g. "raw", "multipart"). */
|
|
442
|
+
upload_protocol?: string;
|
|
443
|
+
/** Legacy upload protocol for media (e.g. "media", "multipart"). */
|
|
444
|
+
uploadType?: string;
|
|
445
|
+
}): Request<ListNotesResponse>;
|
|
446
|
+
permissions: PermissionsResource;
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const media: MediaResource;
|
|
450
|
+
|
|
451
|
+
const notes: NotesResource;
|
|
452
|
+
}
|
|
453
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@maxim_mazurok/gapi.client.keep-v1",
|
|
3
|
+
"version": "0.0.20220725",
|
|
4
|
+
"description": "TypeScript typings for Google Keep 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,96 @@
|
|
|
1
|
+
# TypeScript typings for Google Keep API v1
|
|
2
|
+
|
|
3
|
+
The Google Keep API is used in an enterprise environment to manage Google Keep content and resolve issues identified by cloud security software.
|
|
4
|
+
For detailed description please check [documentation](https://developers.google.com/keep/api).
|
|
5
|
+
|
|
6
|
+
## Installing
|
|
7
|
+
|
|
8
|
+
Install typings for Google Keep API:
|
|
9
|
+
|
|
10
|
+
```
|
|
11
|
+
npm install @types/gapi.client.keep-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://keep.googleapis.com/$discovery/rest?version=v1', () => {
|
|
29
|
+
// now we can use:
|
|
30
|
+
// gapi.client.keep
|
|
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('keep', 'v1', () => {
|
|
37
|
+
// now we can use:
|
|
38
|
+
// gapi.client.keep
|
|
39
|
+
});
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Don't forget to authenticate your client before sending any request to resources:
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// declare client_id registered in Google Developers Console
|
|
46
|
+
var client_id = '',
|
|
47
|
+
scope = [
|
|
48
|
+
// See, edit, create and permanently delete all your Google Keep data
|
|
49
|
+
'https://www.googleapis.com/auth/keep',
|
|
50
|
+
|
|
51
|
+
// View all your Google Keep data
|
|
52
|
+
'https://www.googleapis.com/auth/keep.readonly',
|
|
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
|
+
After that you can use Google Keep API resources: <!-- TODO: make this work for multiple namespaces -->
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
|
|
72
|
+
/*
|
|
73
|
+
Gets an attachment. To download attachment media via REST requires the alt=media query parameter. Returns a 400 bad request error if attachment media is not available in the requested MIME type.
|
|
74
|
+
*/
|
|
75
|
+
await gapi.client.keep.media.download({ name: "name", });
|
|
76
|
+
|
|
77
|
+
/*
|
|
78
|
+
Creates a new note.
|
|
79
|
+
*/
|
|
80
|
+
await gapi.client.keep.notes.create({ });
|
|
81
|
+
|
|
82
|
+
/*
|
|
83
|
+
Deletes a note. Caller must have the `OWNER` role on the note to delete. Deleting a note removes the resource immediately and cannot be undone. Any collaborators will lose access to the note.
|
|
84
|
+
*/
|
|
85
|
+
await gapi.client.keep.notes.delete({ name: "name", });
|
|
86
|
+
|
|
87
|
+
/*
|
|
88
|
+
Gets a note.
|
|
89
|
+
*/
|
|
90
|
+
await gapi.client.keep.notes.get({ name: "name", });
|
|
91
|
+
|
|
92
|
+
/*
|
|
93
|
+
Lists notes. Every list call returns a page of results with `page_size` as the upper bound of returned items. A `page_size` of zero allows the server to choose the upper bound. The ListNotesResponse contains at most `page_size` entries. If there are more things left to list, it provides a `next_page_token` value. (Page tokens are opaque values.) To get the next page of results, copy the result's `next_page_token` into the next request's `page_token`. Repeat until the `next_page_token` returned with a page of results is empty. ListNotes return consistent results in the face of concurrent changes, or signals that it cannot with an ABORTED error.
|
|
94
|
+
*/
|
|
95
|
+
await gapi.client.keep.notes.list({ });
|
|
96
|
+
```
|
package/tests.ts
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/* This is stub file for gapi.client.keep-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: 20220725
|
|
7
|
+
|
|
8
|
+
gapi.load('client', async () => {
|
|
9
|
+
/** now we can use gapi.client */
|
|
10
|
+
|
|
11
|
+
await gapi.client.load('https://keep.googleapis.com/$discovery/rest?version=v1');
|
|
12
|
+
/** now we can use gapi.client.keep */
|
|
13
|
+
|
|
14
|
+
/** don't forget to authenticate your client before sending any request to resources: */
|
|
15
|
+
/** declare client_id registered in Google Developers Console */
|
|
16
|
+
const client_id = '<<PUT YOUR CLIENT ID HERE>>';
|
|
17
|
+
const scope = [
|
|
18
|
+
/** See, edit, create and permanently delete all your Google Keep data */
|
|
19
|
+
'https://www.googleapis.com/auth/keep',
|
|
20
|
+
/** View all your Google Keep data */
|
|
21
|
+
'https://www.googleapis.com/auth/keep.readonly',
|
|
22
|
+
];
|
|
23
|
+
const immediate = false;
|
|
24
|
+
gapi.auth.authorize({ client_id, scope, immediate }, authResult => {
|
|
25
|
+
if (authResult && !authResult.error) {
|
|
26
|
+
/** handle successful authorization */
|
|
27
|
+
run();
|
|
28
|
+
} else {
|
|
29
|
+
/** handle authorization error */
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
async function run() {
|
|
34
|
+
/**
|
|
35
|
+
* Gets an attachment. To download attachment media via REST requires the alt=media query parameter. Returns a 400 bad request error if attachment media is not available in the requested
|
|
36
|
+
* MIME type.
|
|
37
|
+
*/
|
|
38
|
+
await gapi.client.keep.media.download({
|
|
39
|
+
mimeType: "Test string",
|
|
40
|
+
name: "Test string",
|
|
41
|
+
});
|
|
42
|
+
/** Creates a new note. */
|
|
43
|
+
await gapi.client.keep.notes.create({
|
|
44
|
+
}, {
|
|
45
|
+
attachments: [
|
|
46
|
+
{
|
|
47
|
+
mimeType: [
|
|
48
|
+
"Test string"
|
|
49
|
+
],
|
|
50
|
+
name: "Test string",
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
body: {
|
|
54
|
+
list: {
|
|
55
|
+
listItems: [
|
|
56
|
+
{
|
|
57
|
+
checked: true,
|
|
58
|
+
childListItems: undefined,
|
|
59
|
+
text: {
|
|
60
|
+
text: "Test string",
|
|
61
|
+
},
|
|
62
|
+
}
|
|
63
|
+
],
|
|
64
|
+
},
|
|
65
|
+
text: {
|
|
66
|
+
text: "Test string",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
createTime: "Test string",
|
|
70
|
+
name: "Test string",
|
|
71
|
+
permissions: [
|
|
72
|
+
{
|
|
73
|
+
deleted: true,
|
|
74
|
+
email: "Test string",
|
|
75
|
+
family: {
|
|
76
|
+
},
|
|
77
|
+
group: {
|
|
78
|
+
email: "Test string",
|
|
79
|
+
},
|
|
80
|
+
name: "Test string",
|
|
81
|
+
role: "Test string",
|
|
82
|
+
user: {
|
|
83
|
+
email: "Test string",
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
],
|
|
87
|
+
title: "Test string",
|
|
88
|
+
trashed: true,
|
|
89
|
+
trashTime: "Test string",
|
|
90
|
+
updateTime: "Test string",
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* Deletes a note. Caller must have the `OWNER` role on the note to delete. Deleting a note removes the resource immediately and cannot be undone. Any collaborators will lose access to the
|
|
94
|
+
* note.
|
|
95
|
+
*/
|
|
96
|
+
await gapi.client.keep.notes.delete({
|
|
97
|
+
name: "Test string",
|
|
98
|
+
});
|
|
99
|
+
/** Gets a note. */
|
|
100
|
+
await gapi.client.keep.notes.get({
|
|
101
|
+
name: "Test string",
|
|
102
|
+
});
|
|
103
|
+
/**
|
|
104
|
+
* Lists notes. Every list call returns a page of results with `page_size` as the upper bound of returned items. A `page_size` of zero allows the server to choose the upper bound. The
|
|
105
|
+
* ListNotesResponse contains at most `page_size` entries. If there are more things left to list, it provides a `next_page_token` value. (Page tokens are opaque values.) To get the next
|
|
106
|
+
* page of results, copy the result's `next_page_token` into the next request's `page_token`. Repeat until the `next_page_token` returned with a page of results is empty. ListNotes return
|
|
107
|
+
* consistent results in the face of concurrent changes, or signals that it cannot with an ABORTED error.
|
|
108
|
+
*/
|
|
109
|
+
await gapi.client.keep.notes.list({
|
|
110
|
+
filter: "Test string",
|
|
111
|
+
pageSize: 42,
|
|
112
|
+
pageToken: "Test string",
|
|
113
|
+
});
|
|
114
|
+
/**
|
|
115
|
+
* Creates one or more permissions on the note. Only permissions with the `WRITER` role may be created. If adding any permission fails, then the entire request fails and no changes are
|
|
116
|
+
* made.
|
|
117
|
+
*/
|
|
118
|
+
await gapi.client.keep.notes.permissions.batchCreate({
|
|
119
|
+
parent: "Test string",
|
|
120
|
+
}, {
|
|
121
|
+
requests: [
|
|
122
|
+
{
|
|
123
|
+
parent: "Test string",
|
|
124
|
+
permission: {
|
|
125
|
+
deleted: true,
|
|
126
|
+
email: "Test string",
|
|
127
|
+
family: {
|
|
128
|
+
},
|
|
129
|
+
group: {
|
|
130
|
+
email: "Test string",
|
|
131
|
+
},
|
|
132
|
+
name: "Test string",
|
|
133
|
+
role: "Test string",
|
|
134
|
+
user: {
|
|
135
|
+
email: "Test string",
|
|
136
|
+
},
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
],
|
|
140
|
+
});
|
|
141
|
+
/**
|
|
142
|
+
* Deletes one or more permissions on the note. The specified entities will immediately lose access. A permission with the `OWNER` role can't be removed. If removing a permission fails,
|
|
143
|
+
* then the entire request fails and no changes are made. Returns a 400 bad request error if a specified permission does not exist on the note.
|
|
144
|
+
*/
|
|
145
|
+
await gapi.client.keep.notes.permissions.batchDelete({
|
|
146
|
+
parent: "Test string",
|
|
147
|
+
}, {
|
|
148
|
+
names: [
|
|
149
|
+
"Test string"
|
|
150
|
+
],
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
});
|
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
|
+
}
|