@maxim_mazurok/gapi.client.drive-v3 0.0.20220731

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/package.json ADDED
@@ -0,0 +1,20 @@
1
+ {
2
+ "name": "@maxim_mazurok/gapi.client.drive-v3",
3
+ "version": "0.0.20220731",
4
+ "description": "TypeScript typings for Drive API v3",
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,329 @@
1
+ # TypeScript typings for Drive API v3
2
+
3
+ Manages files in Drive including uploading, downloading, searching, detecting changes, and updating sharing permissions.
4
+ For detailed description please check [documentation](https://developers.google.com/drive/).
5
+
6
+ ## Installing
7
+
8
+ Install typings for Drive API:
9
+
10
+ ```
11
+ npm install @types/gapi.client.drive-v3 --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://www.googleapis.com/discovery/v1/apis/drive/v3/rest', () => {
29
+ // now we can use:
30
+ // gapi.client.drive
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('drive', 'v3', () => {
37
+ // now we can use:
38
+ // gapi.client.drive
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 delete all of your Google Drive files
49
+ 'https://www.googleapis.com/auth/drive',
50
+
51
+ // See, create, and delete its own configuration data in your Google Drive
52
+ 'https://www.googleapis.com/auth/drive.appdata',
53
+
54
+ // See, edit, create, and delete only the specific Google Drive files you use with this app
55
+ 'https://www.googleapis.com/auth/drive.file',
56
+
57
+ // View and manage metadata of files in your Google Drive
58
+ 'https://www.googleapis.com/auth/drive.metadata',
59
+
60
+ // See information about your Google Drive files
61
+ 'https://www.googleapis.com/auth/drive.metadata.readonly',
62
+
63
+ // View the photos, videos and albums in your Google Photos
64
+ 'https://www.googleapis.com/auth/drive.photos.readonly',
65
+
66
+ // See and download all your Google Drive files
67
+ 'https://www.googleapis.com/auth/drive.readonly',
68
+
69
+ // Modify your Google Apps Script scripts' behavior
70
+ 'https://www.googleapis.com/auth/drive.scripts',
71
+ ],
72
+ immediate = true;
73
+ // ...
74
+
75
+ gapi.auth.authorize(
76
+ { client_id: client_id, scope: scope, immediate: immediate },
77
+ authResult => {
78
+ if (authResult && !authResult.error) {
79
+ /* handle successful authorization */
80
+ } else {
81
+ /* handle authorization error */
82
+ }
83
+ });
84
+ ```
85
+
86
+ After that you can use Drive API resources: <!-- TODO: make this work for multiple namespaces -->
87
+
88
+ ```typescript
89
+
90
+ /*
91
+ Gets information about the user, the user's Drive, and system capabilities.
92
+ */
93
+ await gapi.client.drive.about.get({ });
94
+
95
+ /*
96
+ Gets the starting pageToken for listing future changes.
97
+ */
98
+ await gapi.client.drive.changes.getStartPageToken({ });
99
+
100
+ /*
101
+ Lists the changes for a user or shared drive.
102
+ */
103
+ await gapi.client.drive.changes.list({ pageToken: "pageToken", });
104
+
105
+ /*
106
+ Subscribes to changes for a user.
107
+ */
108
+ await gapi.client.drive.changes.watch({ pageToken: "pageToken", });
109
+
110
+ /*
111
+ Stop watching resources through this channel
112
+ */
113
+ await gapi.client.drive.channels.stop({ });
114
+
115
+ /*
116
+ Creates a new comment on a file.
117
+ */
118
+ await gapi.client.drive.comments.create({ fileId: "fileId", });
119
+
120
+ /*
121
+ Deletes a comment.
122
+ */
123
+ await gapi.client.drive.comments.delete({ commentId: "commentId", fileId: "fileId", });
124
+
125
+ /*
126
+ Gets a comment by ID.
127
+ */
128
+ await gapi.client.drive.comments.get({ commentId: "commentId", fileId: "fileId", });
129
+
130
+ /*
131
+ Lists a file's comments.
132
+ */
133
+ await gapi.client.drive.comments.list({ fileId: "fileId", });
134
+
135
+ /*
136
+ Updates a comment with patch semantics.
137
+ */
138
+ await gapi.client.drive.comments.update({ commentId: "commentId", fileId: "fileId", });
139
+
140
+ /*
141
+ Creates a new shared drive.
142
+ */
143
+ await gapi.client.drive.drives.create({ requestId: "requestId", });
144
+
145
+ /*
146
+ Permanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items.
147
+ */
148
+ await gapi.client.drive.drives.delete({ driveId: "driveId", });
149
+
150
+ /*
151
+ Gets a shared drive's metadata by ID.
152
+ */
153
+ await gapi.client.drive.drives.get({ driveId: "driveId", });
154
+
155
+ /*
156
+ Hides a shared drive from the default view.
157
+ */
158
+ await gapi.client.drive.drives.hide({ driveId: "driveId", });
159
+
160
+ /*
161
+ Lists the user's shared drives.
162
+ */
163
+ await gapi.client.drive.drives.list({ });
164
+
165
+ /*
166
+ Restores a shared drive to the default view.
167
+ */
168
+ await gapi.client.drive.drives.unhide({ driveId: "driveId", });
169
+
170
+ /*
171
+ Updates the metadate for a shared drive.
172
+ */
173
+ await gapi.client.drive.drives.update({ driveId: "driveId", });
174
+
175
+ /*
176
+ Creates a copy of a file and applies any requested updates with patch semantics. Folders cannot be copied.
177
+ */
178
+ await gapi.client.drive.files.copy({ fileId: "fileId", });
179
+
180
+ /*
181
+ Creates a new file.
182
+ */
183
+ await gapi.client.drive.files.create({ });
184
+
185
+ /*
186
+ Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted.
187
+ */
188
+ await gapi.client.drive.files.delete({ fileId: "fileId", });
189
+
190
+ /*
191
+ Permanently deletes all of the user's trashed files.
192
+ */
193
+ await gapi.client.drive.files.emptyTrash({ });
194
+
195
+ /*
196
+ Exports a Google Workspace document to the requested MIME type and returns exported byte content. Note that the exported content is limited to 10MB.
197
+ */
198
+ await gapi.client.drive.files.export({ fileId: "fileId", mimeType: "mimeType", });
199
+
200
+ /*
201
+ Generates a set of file IDs which can be provided in create or copy requests.
202
+ */
203
+ await gapi.client.drive.files.generateIds({ });
204
+
205
+ /*
206
+ Gets a file's metadata or content by ID.
207
+ */
208
+ await gapi.client.drive.files.get({ fileId: "fileId", });
209
+
210
+ /*
211
+ Lists or searches files.
212
+ */
213
+ await gapi.client.drive.files.list({ });
214
+
215
+ /*
216
+ Lists the labels on a file.
217
+ */
218
+ await gapi.client.drive.files.listLabels({ fileId: "fileId", });
219
+
220
+ /*
221
+ Modifies the set of labels on a file.
222
+ */
223
+ await gapi.client.drive.files.modifyLabels({ fileId: "fileId", });
224
+
225
+ /*
226
+ Updates a file's metadata and/or content. When calling this method, only populate fields in the request that you want to modify. When updating fields, some fields might change automatically, such as modifiedDate. This method supports patch semantics.
227
+ */
228
+ await gapi.client.drive.files.update({ fileId: "fileId", });
229
+
230
+ /*
231
+ Subscribes to changes to a file. While you can establish a channel for changes to a file on a shared drive, a change to a shared drive file won't create a notification.
232
+ */
233
+ await gapi.client.drive.files.watch({ fileId: "fileId", });
234
+
235
+ /*
236
+ Creates a permission for a file or shared drive.
237
+ */
238
+ await gapi.client.drive.permissions.create({ fileId: "fileId", });
239
+
240
+ /*
241
+ Deletes a permission.
242
+ */
243
+ await gapi.client.drive.permissions.delete({ fileId: "fileId", permissionId: "permissionId", });
244
+
245
+ /*
246
+ Gets a permission by ID.
247
+ */
248
+ await gapi.client.drive.permissions.get({ fileId: "fileId", permissionId: "permissionId", });
249
+
250
+ /*
251
+ Lists a file's or shared drive's permissions.
252
+ */
253
+ await gapi.client.drive.permissions.list({ fileId: "fileId", });
254
+
255
+ /*
256
+ Updates a permission with patch semantics.
257
+ */
258
+ await gapi.client.drive.permissions.update({ fileId: "fileId", permissionId: "permissionId", });
259
+
260
+ /*
261
+ Creates a new reply to a comment.
262
+ */
263
+ await gapi.client.drive.replies.create({ commentId: "commentId", fileId: "fileId", });
264
+
265
+ /*
266
+ Deletes a reply.
267
+ */
268
+ await gapi.client.drive.replies.delete({ commentId: "commentId", fileId: "fileId", replyId: "replyId", });
269
+
270
+ /*
271
+ Gets a reply by ID.
272
+ */
273
+ await gapi.client.drive.replies.get({ commentId: "commentId", fileId: "fileId", replyId: "replyId", });
274
+
275
+ /*
276
+ Lists a comment's replies.
277
+ */
278
+ await gapi.client.drive.replies.list({ commentId: "commentId", fileId: "fileId", });
279
+
280
+ /*
281
+ Updates a reply with patch semantics.
282
+ */
283
+ await gapi.client.drive.replies.update({ commentId: "commentId", fileId: "fileId", replyId: "replyId", });
284
+
285
+ /*
286
+ Permanently deletes a file version. You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.
287
+ */
288
+ await gapi.client.drive.revisions.delete({ fileId: "fileId", revisionId: "revisionId", });
289
+
290
+ /*
291
+ Gets a revision's metadata or content by ID.
292
+ */
293
+ await gapi.client.drive.revisions.get({ fileId: "fileId", revisionId: "revisionId", });
294
+
295
+ /*
296
+ Lists a file's revisions.
297
+ */
298
+ await gapi.client.drive.revisions.list({ fileId: "fileId", });
299
+
300
+ /*
301
+ Updates a revision with patch semantics.
302
+ */
303
+ await gapi.client.drive.revisions.update({ fileId: "fileId", revisionId: "revisionId", });
304
+
305
+ /*
306
+ Deprecated use drives.create instead.
307
+ */
308
+ await gapi.client.drive.teamdrives.create({ requestId: "requestId", });
309
+
310
+ /*
311
+ Deprecated use drives.delete instead.
312
+ */
313
+ await gapi.client.drive.teamdrives.delete({ teamDriveId: "teamDriveId", });
314
+
315
+ /*
316
+ Deprecated use drives.get instead.
317
+ */
318
+ await gapi.client.drive.teamdrives.get({ teamDriveId: "teamDriveId", });
319
+
320
+ /*
321
+ Deprecated use drives.list instead.
322
+ */
323
+ await gapi.client.drive.teamdrives.list({ });
324
+
325
+ /*
326
+ Deprecated use drives.update instead
327
+ */
328
+ await gapi.client.drive.teamdrives.update({ teamDriveId: "teamDriveId", });
329
+ ```