@maxim_mazurok/gapi.client.datastore-v1 0.0.20220715

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/tests.ts ADDED
@@ -0,0 +1,643 @@
1
+ /* This is stub file for gapi.client.datastore-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: 20220715
7
+
8
+ gapi.load('client', async () => {
9
+ /** now we can use gapi.client */
10
+
11
+ await gapi.client.load('https://datastore.googleapis.com/$discovery/rest?version=v1');
12
+ /** now we can use gapi.client.datastore */
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, configure, and delete your Google Cloud data and see the email address for your Google Account. */
19
+ 'https://www.googleapis.com/auth/cloud-platform',
20
+ /** View and manage your Google Cloud Datastore data */
21
+ 'https://www.googleapis.com/auth/datastore',
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
+ /** Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted. */
35
+ await gapi.client.datastore.projects.allocateIds({
36
+ projectId: "Test string",
37
+ }, {
38
+ databaseId: "Test string",
39
+ keys: [
40
+ {
41
+ partitionId: {
42
+ databaseId: "Test string",
43
+ namespaceId: "Test string",
44
+ projectId: "Test string",
45
+ },
46
+ path: [
47
+ {
48
+ id: "Test string",
49
+ kind: "Test string",
50
+ name: "Test string",
51
+ }
52
+ ],
53
+ }
54
+ ],
55
+ });
56
+ /** Begins a new transaction. */
57
+ await gapi.client.datastore.projects.beginTransaction({
58
+ projectId: "Test string",
59
+ }, {
60
+ databaseId: "Test string",
61
+ transactionOptions: {
62
+ readOnly: {
63
+ readTime: "Test string",
64
+ },
65
+ readWrite: {
66
+ previousTransaction: "Test string",
67
+ },
68
+ },
69
+ });
70
+ /** Commits a transaction, optionally creating, deleting or modifying some entities. */
71
+ await gapi.client.datastore.projects.commit({
72
+ projectId: "Test string",
73
+ }, {
74
+ databaseId: "Test string",
75
+ mode: "Test string",
76
+ mutations: [
77
+ {
78
+ baseVersion: "Test string",
79
+ delete: {
80
+ partitionId: {
81
+ databaseId: "Test string",
82
+ namespaceId: "Test string",
83
+ projectId: "Test string",
84
+ },
85
+ path: [
86
+ {
87
+ id: "Test string",
88
+ kind: "Test string",
89
+ name: "Test string",
90
+ }
91
+ ],
92
+ },
93
+ insert: {
94
+ key: {
95
+ partitionId: {
96
+ databaseId: "Test string",
97
+ namespaceId: "Test string",
98
+ projectId: "Test string",
99
+ },
100
+ path: [
101
+ {
102
+ id: "Test string",
103
+ kind: "Test string",
104
+ name: "Test string",
105
+ }
106
+ ],
107
+ },
108
+ properties: {
109
+ A: {
110
+ arrayValue: {
111
+ values: undefined,
112
+ },
113
+ blobValue: "Test string",
114
+ booleanValue: true,
115
+ doubleValue: 42,
116
+ entityValue: undefined,
117
+ excludeFromIndexes: true,
118
+ geoPointValue: {
119
+ latitude: 42,
120
+ longitude: 42,
121
+ },
122
+ integerValue: "Test string",
123
+ keyValue: {
124
+ partitionId: {
125
+ databaseId: "Test string",
126
+ namespaceId: "Test string",
127
+ projectId: "Test string",
128
+ },
129
+ path: [
130
+ {
131
+ id: "Test string",
132
+ kind: "Test string",
133
+ name: "Test string",
134
+ }
135
+ ],
136
+ },
137
+ meaning: 42,
138
+ nullValue: "Test string",
139
+ stringValue: "Test string",
140
+ timestampValue: "Test string",
141
+ }
142
+ },
143
+ },
144
+ update: {
145
+ key: {
146
+ partitionId: {
147
+ databaseId: "Test string",
148
+ namespaceId: "Test string",
149
+ projectId: "Test string",
150
+ },
151
+ path: [
152
+ {
153
+ id: "Test string",
154
+ kind: "Test string",
155
+ name: "Test string",
156
+ }
157
+ ],
158
+ },
159
+ properties: {
160
+ A: {
161
+ arrayValue: {
162
+ values: undefined,
163
+ },
164
+ blobValue: "Test string",
165
+ booleanValue: true,
166
+ doubleValue: 42,
167
+ entityValue: undefined,
168
+ excludeFromIndexes: true,
169
+ geoPointValue: {
170
+ latitude: 42,
171
+ longitude: 42,
172
+ },
173
+ integerValue: "Test string",
174
+ keyValue: {
175
+ partitionId: {
176
+ databaseId: "Test string",
177
+ namespaceId: "Test string",
178
+ projectId: "Test string",
179
+ },
180
+ path: [
181
+ {
182
+ id: "Test string",
183
+ kind: "Test string",
184
+ name: "Test string",
185
+ }
186
+ ],
187
+ },
188
+ meaning: 42,
189
+ nullValue: "Test string",
190
+ stringValue: "Test string",
191
+ timestampValue: "Test string",
192
+ }
193
+ },
194
+ },
195
+ updateTime: "Test string",
196
+ upsert: {
197
+ key: {
198
+ partitionId: {
199
+ databaseId: "Test string",
200
+ namespaceId: "Test string",
201
+ projectId: "Test string",
202
+ },
203
+ path: [
204
+ {
205
+ id: "Test string",
206
+ kind: "Test string",
207
+ name: "Test string",
208
+ }
209
+ ],
210
+ },
211
+ properties: {
212
+ A: {
213
+ arrayValue: {
214
+ values: undefined,
215
+ },
216
+ blobValue: "Test string",
217
+ booleanValue: true,
218
+ doubleValue: 42,
219
+ entityValue: undefined,
220
+ excludeFromIndexes: true,
221
+ geoPointValue: {
222
+ latitude: 42,
223
+ longitude: 42,
224
+ },
225
+ integerValue: "Test string",
226
+ keyValue: {
227
+ partitionId: {
228
+ databaseId: "Test string",
229
+ namespaceId: "Test string",
230
+ projectId: "Test string",
231
+ },
232
+ path: [
233
+ {
234
+ id: "Test string",
235
+ kind: "Test string",
236
+ name: "Test string",
237
+ }
238
+ ],
239
+ },
240
+ meaning: 42,
241
+ nullValue: "Test string",
242
+ stringValue: "Test string",
243
+ timestampValue: "Test string",
244
+ }
245
+ },
246
+ },
247
+ }
248
+ ],
249
+ transaction: "Test string",
250
+ });
251
+ /**
252
+ * Exports a copy of all or a subset of entities from Google Cloud Datastore to another storage system, such as Google Cloud Storage. Recent updates to entities may not be reflected in the
253
+ * export. The export occurs in the background and its progress can be monitored and managed via the Operation resource that is created. The output of an export may only be used once the
254
+ * associated operation is done. If an export operation is cancelled before completion it may leave partial data behind in Google Cloud Storage.
255
+ */
256
+ await gapi.client.datastore.projects.export({
257
+ projectId: "Test string",
258
+ }, {
259
+ entityFilter: {
260
+ kinds: [
261
+ "Test string"
262
+ ],
263
+ namespaceIds: [
264
+ "Test string"
265
+ ],
266
+ },
267
+ labels: {
268
+ A: "Test string"
269
+ },
270
+ outputUrlPrefix: "Test string",
271
+ });
272
+ /**
273
+ * Imports entities into Google Cloud Datastore. Existing entities with the same key are overwritten. The import occurs in the background and its progress can be monitored and managed via
274
+ * the Operation resource that is created. If an ImportEntities operation is cancelled, it is possible that a subset of the data has already been imported to Cloud Datastore.
275
+ */
276
+ await gapi.client.datastore.projects.import({
277
+ projectId: "Test string",
278
+ }, {
279
+ entityFilter: {
280
+ kinds: [
281
+ "Test string"
282
+ ],
283
+ namespaceIds: [
284
+ "Test string"
285
+ ],
286
+ },
287
+ inputUrl: "Test string",
288
+ labels: {
289
+ A: "Test string"
290
+ },
291
+ });
292
+ /** Looks up entities by key. */
293
+ await gapi.client.datastore.projects.lookup({
294
+ projectId: "Test string",
295
+ }, {
296
+ databaseId: "Test string",
297
+ keys: [
298
+ {
299
+ partitionId: {
300
+ databaseId: "Test string",
301
+ namespaceId: "Test string",
302
+ projectId: "Test string",
303
+ },
304
+ path: [
305
+ {
306
+ id: "Test string",
307
+ kind: "Test string",
308
+ name: "Test string",
309
+ }
310
+ ],
311
+ }
312
+ ],
313
+ readOptions: {
314
+ readConsistency: "Test string",
315
+ readTime: "Test string",
316
+ transaction: "Test string",
317
+ },
318
+ });
319
+ /** Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore. */
320
+ await gapi.client.datastore.projects.reserveIds({
321
+ projectId: "Test string",
322
+ }, {
323
+ databaseId: "Test string",
324
+ keys: [
325
+ {
326
+ partitionId: {
327
+ databaseId: "Test string",
328
+ namespaceId: "Test string",
329
+ projectId: "Test string",
330
+ },
331
+ path: [
332
+ {
333
+ id: "Test string",
334
+ kind: "Test string",
335
+ name: "Test string",
336
+ }
337
+ ],
338
+ }
339
+ ],
340
+ });
341
+ /** Rolls back a transaction. */
342
+ await gapi.client.datastore.projects.rollback({
343
+ projectId: "Test string",
344
+ }, {
345
+ databaseId: "Test string",
346
+ transaction: "Test string",
347
+ });
348
+ /** Queries for entities. */
349
+ await gapi.client.datastore.projects.runQuery({
350
+ projectId: "Test string",
351
+ }, {
352
+ databaseId: "Test string",
353
+ gqlQuery: {
354
+ allowLiterals: true,
355
+ namedBindings: {
356
+ A: {
357
+ cursor: "Test string",
358
+ value: {
359
+ arrayValue: {
360
+ values: undefined,
361
+ },
362
+ blobValue: "Test string",
363
+ booleanValue: true,
364
+ doubleValue: 42,
365
+ entityValue: {
366
+ key: {
367
+ partitionId: {
368
+ databaseId: "Test string",
369
+ namespaceId: "Test string",
370
+ projectId: "Test string",
371
+ },
372
+ path: [
373
+ {
374
+ id: "Test string",
375
+ kind: "Test string",
376
+ name: "Test string",
377
+ }
378
+ ],
379
+ },
380
+ properties: undefined,
381
+ },
382
+ excludeFromIndexes: true,
383
+ geoPointValue: {
384
+ latitude: 42,
385
+ longitude: 42,
386
+ },
387
+ integerValue: "Test string",
388
+ keyValue: {
389
+ partitionId: {
390
+ databaseId: "Test string",
391
+ namespaceId: "Test string",
392
+ projectId: "Test string",
393
+ },
394
+ path: [
395
+ {
396
+ id: "Test string",
397
+ kind: "Test string",
398
+ name: "Test string",
399
+ }
400
+ ],
401
+ },
402
+ meaning: 42,
403
+ nullValue: "Test string",
404
+ stringValue: "Test string",
405
+ timestampValue: "Test string",
406
+ },
407
+ }
408
+ },
409
+ positionalBindings: [
410
+ {
411
+ cursor: "Test string",
412
+ value: {
413
+ arrayValue: {
414
+ values: undefined,
415
+ },
416
+ blobValue: "Test string",
417
+ booleanValue: true,
418
+ doubleValue: 42,
419
+ entityValue: {
420
+ key: {
421
+ partitionId: {
422
+ databaseId: "Test string",
423
+ namespaceId: "Test string",
424
+ projectId: "Test string",
425
+ },
426
+ path: [
427
+ {
428
+ id: "Test string",
429
+ kind: "Test string",
430
+ name: "Test string",
431
+ }
432
+ ],
433
+ },
434
+ properties: undefined,
435
+ },
436
+ excludeFromIndexes: true,
437
+ geoPointValue: {
438
+ latitude: 42,
439
+ longitude: 42,
440
+ },
441
+ integerValue: "Test string",
442
+ keyValue: {
443
+ partitionId: {
444
+ databaseId: "Test string",
445
+ namespaceId: "Test string",
446
+ projectId: "Test string",
447
+ },
448
+ path: [
449
+ {
450
+ id: "Test string",
451
+ kind: "Test string",
452
+ name: "Test string",
453
+ }
454
+ ],
455
+ },
456
+ meaning: 42,
457
+ nullValue: "Test string",
458
+ stringValue: "Test string",
459
+ timestampValue: "Test string",
460
+ },
461
+ }
462
+ ],
463
+ queryString: "Test string",
464
+ },
465
+ partitionId: {
466
+ databaseId: "Test string",
467
+ namespaceId: "Test string",
468
+ projectId: "Test string",
469
+ },
470
+ query: {
471
+ distinctOn: [
472
+ {
473
+ name: "Test string",
474
+ }
475
+ ],
476
+ endCursor: "Test string",
477
+ filter: {
478
+ compositeFilter: {
479
+ filters: undefined,
480
+ op: "Test string",
481
+ },
482
+ propertyFilter: {
483
+ op: "Test string",
484
+ property: {
485
+ name: "Test string",
486
+ },
487
+ value: {
488
+ arrayValue: {
489
+ values: undefined,
490
+ },
491
+ blobValue: "Test string",
492
+ booleanValue: true,
493
+ doubleValue: 42,
494
+ entityValue: {
495
+ key: {
496
+ partitionId: {
497
+ databaseId: "Test string",
498
+ namespaceId: "Test string",
499
+ projectId: "Test string",
500
+ },
501
+ path: [
502
+ {
503
+ id: "Test string",
504
+ kind: "Test string",
505
+ name: "Test string",
506
+ }
507
+ ],
508
+ },
509
+ properties: undefined,
510
+ },
511
+ excludeFromIndexes: true,
512
+ geoPointValue: {
513
+ latitude: 42,
514
+ longitude: 42,
515
+ },
516
+ integerValue: "Test string",
517
+ keyValue: {
518
+ partitionId: {
519
+ databaseId: "Test string",
520
+ namespaceId: "Test string",
521
+ projectId: "Test string",
522
+ },
523
+ path: [
524
+ {
525
+ id: "Test string",
526
+ kind: "Test string",
527
+ name: "Test string",
528
+ }
529
+ ],
530
+ },
531
+ meaning: 42,
532
+ nullValue: "Test string",
533
+ stringValue: "Test string",
534
+ timestampValue: "Test string",
535
+ },
536
+ },
537
+ },
538
+ kind: [
539
+ {
540
+ name: "Test string",
541
+ }
542
+ ],
543
+ limit: 42,
544
+ offset: 42,
545
+ order: [
546
+ {
547
+ direction: "Test string",
548
+ property: {
549
+ name: "Test string",
550
+ },
551
+ }
552
+ ],
553
+ projection: [
554
+ {
555
+ property: {
556
+ name: "Test string",
557
+ },
558
+ }
559
+ ],
560
+ startCursor: "Test string",
561
+ },
562
+ readOptions: {
563
+ readConsistency: "Test string",
564
+ readTime: "Test string",
565
+ transaction: "Test string",
566
+ },
567
+ });
568
+ /**
569
+ * Creates the specified index. A newly created index's initial state is `CREATING`. On completion of the returned google.longrunning.Operation, the state will be `READY`. If the index
570
+ * already exists, the call will return an `ALREADY_EXISTS` status. During index creation, the process could result in an error, in which case the index will move to the `ERROR` state. The
571
+ * process can be recovered by fixing the data that caused the error, removing the index with delete, then re-creating the index with create. Indexes with a single property cannot be
572
+ * created.
573
+ */
574
+ await gapi.client.datastore.projects.indexes.create({
575
+ projectId: "Test string",
576
+ }, {
577
+ ancestor: "Test string",
578
+ indexId: "Test string",
579
+ kind: "Test string",
580
+ projectId: "Test string",
581
+ properties: [
582
+ {
583
+ direction: "Test string",
584
+ name: "Test string",
585
+ }
586
+ ],
587
+ state: "Test string",
588
+ });
589
+ /**
590
+ * Deletes an existing index. An index can only be deleted if it is in a `READY` or `ERROR` state. On successful execution of the request, the index will be in a `DELETING` state. And on
591
+ * completion of the returned google.longrunning.Operation, the index will be removed. During index deletion, the process could result in an error, in which case the index will move to the
592
+ * `ERROR` state. The process can be recovered by fixing the data that caused the error, followed by calling delete again.
593
+ */
594
+ await gapi.client.datastore.projects.indexes.delete({
595
+ indexId: "Test string",
596
+ projectId: "Test string",
597
+ });
598
+ /** Gets an index. */
599
+ await gapi.client.datastore.projects.indexes.get({
600
+ indexId: "Test string",
601
+ projectId: "Test string",
602
+ });
603
+ /** Lists the indexes that match the specified filters. Datastore uses an eventually consistent query to fetch the list of indexes and may occasionally return stale results. */
604
+ await gapi.client.datastore.projects.indexes.list({
605
+ filter: "Test string",
606
+ pageSize: 42,
607
+ pageToken: "Test string",
608
+ projectId: "Test string",
609
+ });
610
+ /**
611
+ * Starts asynchronous cancellation on a long-running operation. The server makes a best effort to cancel the operation, but success is not guaranteed. If the server doesn't support this
612
+ * method, it returns `google.rpc.Code.UNIMPLEMENTED`. Clients can use Operations.GetOperation or other methods to check whether the cancellation succeeded or whether the operation
613
+ * completed despite cancellation. On successful cancellation, the operation is not deleted; instead, it becomes an operation with an Operation.error value with a google.rpc.Status.code of
614
+ * 1, corresponding to `Code.CANCELLED`.
615
+ */
616
+ await gapi.client.datastore.projects.operations.cancel({
617
+ name: "Test string",
618
+ });
619
+ /**
620
+ * Deletes a long-running operation. This method indicates that the client is no longer interested in the operation result. It does not cancel the operation. If the server doesn't support
621
+ * this method, it returns `google.rpc.Code.UNIMPLEMENTED`.
622
+ */
623
+ await gapi.client.datastore.projects.operations.delete({
624
+ name: "Test string",
625
+ });
626
+ /** Gets the latest state of a long-running operation. Clients can use this method to poll the operation result at intervals as recommended by the API service. */
627
+ await gapi.client.datastore.projects.operations.get({
628
+ name: "Test string",
629
+ });
630
+ /**
631
+ * Lists operations that match the specified filter in the request. If the server doesn't support this method, it returns `UNIMPLEMENTED`. NOTE: the `name` binding allows API services to
632
+ * override the binding to use different resource name schemes, such as `users/*‍/operations`. To override the binding, API services can add a binding such as
633
+ * `"/v1/{name=users/*}/operations"` to their service configuration. For backwards compatibility, the default name includes the operations collection id, however overriding users must
634
+ * ensure the name binding is the parent resource, without the operations collection id.
635
+ */
636
+ await gapi.client.datastore.projects.operations.list({
637
+ filter: "Test string",
638
+ name: "Test string",
639
+ pageSize: 42,
640
+ pageToken: "Test string",
641
+ });
642
+ }
643
+ });
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
+ }
package/tslint.json ADDED
@@ -0,0 +1,6 @@
1
+ {
2
+ "extends": "dtslint/dtslint.json",
3
+ "rules": {
4
+ "no-redundant-jsdoc": false
5
+ }
6
+ }