@maxim_mazurok/gapi.client.datastore-v1 0.0.20220921 → 0.0.20221018

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.
Files changed (4) hide show
  1. package/index.d.ts +121 -1
  2. package/package.json +1 -1
  3. package/readme.md +5 -0
  4. package/tests.ts +231 -1
package/index.d.ts CHANGED
@@ -9,7 +9,7 @@
9
9
  // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
10
10
  // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
11
11
  // Generated from: https://datastore.googleapis.com/$discovery/rest?version=v1
12
- // Revision: 20220921
12
+ // Revision: 20221018
13
13
 
14
14
  /// <reference types="gapi.client" />
15
15
 
@@ -22,6 +22,41 @@ declare namespace gapi.client {
22
22
  function load(name: "datastore", version: "v1", callback: () => any): void;
23
23
 
24
24
  namespace datastore {
25
+ interface Aggregation {
26
+ /**
27
+ * Optional. Optional name of the property to store the result of the aggregation. If not provided, Datastore will pick a default name following the format `property_`. For example:
28
+ * ``` AGGREGATE COUNT_UP_TO(1) AS count_up_to_1, COUNT_UP_TO(2), COUNT_UP_TO(3) AS count_up_to_3, COUNT_UP_TO(4) OVER ( ... ); ``` becomes: ``` AGGREGATE COUNT_UP_TO(1) AS
29
+ * count_up_to_1, COUNT_UP_TO(2) AS property_1, COUNT_UP_TO(3) AS count_up_to_3, COUNT_UP_TO(4) AS property_2 OVER ( ... ); ``` Requires: * Must be unique across all aggregation
30
+ * aliases. * Conform to entity property name limitations.
31
+ */
32
+ alias?: string;
33
+ /** Count aggregator. */
34
+ count?: Count;
35
+ }
36
+ interface AggregationQuery {
37
+ /** Optional. Series of aggregations to apply over the results of the `nested_query`. Requires: * A minimum of one and maximum of five aggregations per query. */
38
+ aggregations?: Aggregation[];
39
+ /** Nested query for aggregation */
40
+ nestedQuery?: Query;
41
+ }
42
+ interface AggregationResult {
43
+ /**
44
+ * The result of the aggregation functions, ex: `COUNT(*) AS total_entities`. The key is the alias assigned to the aggregation function on input and the size of this map equals the
45
+ * number of aggregation functions in the query.
46
+ */
47
+ aggregateProperties?: { [P in string]: Value };
48
+ }
49
+ interface AggregationResultBatch {
50
+ /** The aggregation results for this batch. */
51
+ aggregationResults?: AggregationResult[];
52
+ /** The state of the query after the current batch. Only COUNT(*) aggregations are supported in the initial launch. Therefore, expected result type is limited to `NO_MORE_RESULTS`. */
53
+ moreResults?: string;
54
+ /**
55
+ * Read timestamp this batch was returned from. In a single transaction, subsequent query result batches for the same query can have a greater timestamp. Each batch's read timestamp is
56
+ * valid for all preceding batches.
57
+ */
58
+ readTime?: string;
59
+ }
25
60
  interface AllocateIdsRequest {
26
61
  /** The ID of the database against which to make the request. '(default)' is not allowed; please use empty string '' to refer the default database. */
27
62
  databaseId?: string;
@@ -74,6 +109,14 @@ declare namespace gapi.client {
74
109
  /** The operator for combining multiple filters. */
75
110
  op?: string;
76
111
  }
112
+ interface Count {
113
+ /**
114
+ * Optional. Optional constraint on the maximum number of entities to count. This provides a way to set an upper bound on the number of entities to scan, limiting latency and cost.
115
+ * Unspecified is interpreted as no bound. If a zero value is provided, a count result of zero should always be expected. High-Level Example: ``` AGGREGATE COUNT_UP_TO(1000) OVER (
116
+ * SELECT * FROM k ); ``` Requires: * Must be non-negative when present.
117
+ */
118
+ upTo?: string;
119
+ }
77
120
  // tslint:disable-next-line:no-empty-interface
78
121
  interface Empty {
79
122
  }
@@ -578,6 +621,27 @@ declare namespace gapi.client {
578
621
  // tslint:disable-next-line:no-empty-interface
579
622
  interface RollbackResponse {
580
623
  }
624
+ interface RunAggregationQueryRequest {
625
+ /** The query to run. */
626
+ aggregationQuery?: AggregationQuery;
627
+ /** The ID of the database against which to make the request. '(default)' is not allowed; please use empty string '' to refer the default database. */
628
+ databaseId?: string;
629
+ /** The GQL query to run. This query must be an aggregation query. */
630
+ gqlQuery?: GqlQuery;
631
+ /**
632
+ * Entities are partitioned into subsets, identified by a partition ID. Queries are scoped to a single partition. This partition ID is normalized with the standard default context
633
+ * partition ID.
634
+ */
635
+ partitionId?: PartitionId;
636
+ /** The options for this query. */
637
+ readOptions?: ReadOptions;
638
+ }
639
+ interface RunAggregationQueryResponse {
640
+ /** A batch of aggregation results. Always present. */
641
+ batch?: AggregationResultBatch;
642
+ /** The parsed form of the `GqlQuery` from the request, if it was set. */
643
+ query?: AggregationQuery;
644
+ }
581
645
  interface RunQueryRequest {
582
646
  /** The ID of the database against which to make the request. '(default)' is not allowed; please use empty string '' to refer the default database. */
583
647
  databaseId?: string;
@@ -1386,6 +1450,62 @@ declare namespace gapi.client {
1386
1450
  uploadType?: string;
1387
1451
  },
1388
1452
  body: RollbackRequest): Request<{}>;
1453
+ /** Runs an aggregation query. */
1454
+ runAggregationQuery(request: {
1455
+ /** V1 error format. */
1456
+ "$.xgafv"?: string;
1457
+ /** OAuth access token. */
1458
+ access_token?: string;
1459
+ /** Data format for response. */
1460
+ alt?: string;
1461
+ /** JSONP */
1462
+ callback?: string;
1463
+ /** Selector specifying which fields to include in a partial response. */
1464
+ fields?: string;
1465
+ /** 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. */
1466
+ key?: string;
1467
+ /** OAuth 2.0 token for the current user. */
1468
+ oauth_token?: string;
1469
+ /** Returns response with indentations and line breaks. */
1470
+ prettyPrint?: boolean;
1471
+ /** Required. The ID of the project against which to make the request. */
1472
+ projectId: string;
1473
+ /** 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. */
1474
+ quotaUser?: string;
1475
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
1476
+ upload_protocol?: string;
1477
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
1478
+ uploadType?: string;
1479
+ /** Request body */
1480
+ resource: RunAggregationQueryRequest;
1481
+ }): Request<RunAggregationQueryResponse>;
1482
+ runAggregationQuery(request: {
1483
+ /** V1 error format. */
1484
+ "$.xgafv"?: string;
1485
+ /** OAuth access token. */
1486
+ access_token?: string;
1487
+ /** Data format for response. */
1488
+ alt?: string;
1489
+ /** JSONP */
1490
+ callback?: string;
1491
+ /** Selector specifying which fields to include in a partial response. */
1492
+ fields?: string;
1493
+ /** 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. */
1494
+ key?: string;
1495
+ /** OAuth 2.0 token for the current user. */
1496
+ oauth_token?: string;
1497
+ /** Returns response with indentations and line breaks. */
1498
+ prettyPrint?: boolean;
1499
+ /** Required. The ID of the project against which to make the request. */
1500
+ projectId: string;
1501
+ /** 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. */
1502
+ quotaUser?: string;
1503
+ /** Upload protocol for media (e.g. "raw", "multipart"). */
1504
+ upload_protocol?: string;
1505
+ /** Legacy upload protocol for media (e.g. "media", "multipart"). */
1506
+ uploadType?: string;
1507
+ },
1508
+ body: RunAggregationQueryRequest): Request<RunAggregationQueryResponse>;
1389
1509
  /** Queries for entities. */
1390
1510
  runQuery(request: {
1391
1511
  /** V1 error format. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maxim_mazurok/gapi.client.datastore-v1",
3
- "version": "0.0.20220921",
3
+ "version": "0.0.20221018",
4
4
  "description": "TypeScript typings for Cloud Datastore API v1",
5
5
  "license": "MIT",
6
6
  "author": {
package/readme.md CHANGED
@@ -109,6 +109,11 @@ Rolls back a transaction.
109
109
  */
110
110
  await gapi.client.datastore.projects.rollback({ projectId: "projectId", });
111
111
 
112
+ /*
113
+ Runs an aggregation query.
114
+ */
115
+ await gapi.client.datastore.projects.runAggregationQuery({ projectId: "projectId", });
116
+
112
117
  /*
113
118
  Queries for entities.
114
119
  */
package/tests.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually.
4
4
  // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator
5
5
 
6
- // Revision: 20220921
6
+ // Revision: 20221018
7
7
 
8
8
  gapi.load('client', async () => {
9
9
  /** now we can use gapi.client */
@@ -345,6 +345,236 @@ gapi.load('client', async () => {
345
345
  databaseId: "Test string",
346
346
  transaction: "Test string",
347
347
  });
348
+ /** Runs an aggregation query. */
349
+ await gapi.client.datastore.projects.runAggregationQuery({
350
+ projectId: "Test string",
351
+ }, {
352
+ aggregationQuery: {
353
+ aggregations: [
354
+ {
355
+ alias: "Test string",
356
+ count: {
357
+ upTo: "Test string",
358
+ },
359
+ }
360
+ ],
361
+ nestedQuery: {
362
+ distinctOn: [
363
+ {
364
+ name: "Test string",
365
+ }
366
+ ],
367
+ endCursor: "Test string",
368
+ filter: {
369
+ compositeFilter: {
370
+ filters: undefined,
371
+ op: "Test string",
372
+ },
373
+ propertyFilter: {
374
+ op: "Test string",
375
+ property: {
376
+ name: "Test string",
377
+ },
378
+ value: {
379
+ arrayValue: {
380
+ values: undefined,
381
+ },
382
+ blobValue: "Test string",
383
+ booleanValue: true,
384
+ doubleValue: 42,
385
+ entityValue: {
386
+ key: {
387
+ partitionId: {
388
+ databaseId: "Test string",
389
+ namespaceId: "Test string",
390
+ projectId: "Test string",
391
+ },
392
+ path: [
393
+ {
394
+ id: "Test string",
395
+ kind: "Test string",
396
+ name: "Test string",
397
+ }
398
+ ],
399
+ },
400
+ properties: undefined,
401
+ },
402
+ excludeFromIndexes: true,
403
+ geoPointValue: {
404
+ latitude: 42,
405
+ longitude: 42,
406
+ },
407
+ integerValue: "Test string",
408
+ keyValue: {
409
+ partitionId: {
410
+ databaseId: "Test string",
411
+ namespaceId: "Test string",
412
+ projectId: "Test string",
413
+ },
414
+ path: [
415
+ {
416
+ id: "Test string",
417
+ kind: "Test string",
418
+ name: "Test string",
419
+ }
420
+ ],
421
+ },
422
+ meaning: 42,
423
+ nullValue: "Test string",
424
+ stringValue: "Test string",
425
+ timestampValue: "Test string",
426
+ },
427
+ },
428
+ },
429
+ kind: [
430
+ {
431
+ name: "Test string",
432
+ }
433
+ ],
434
+ limit: 42,
435
+ offset: 42,
436
+ order: [
437
+ {
438
+ direction: "Test string",
439
+ property: {
440
+ name: "Test string",
441
+ },
442
+ }
443
+ ],
444
+ projection: [
445
+ {
446
+ property: {
447
+ name: "Test string",
448
+ },
449
+ }
450
+ ],
451
+ startCursor: "Test string",
452
+ },
453
+ },
454
+ databaseId: "Test string",
455
+ gqlQuery: {
456
+ allowLiterals: true,
457
+ namedBindings: {
458
+ A: {
459
+ cursor: "Test string",
460
+ value: {
461
+ arrayValue: {
462
+ values: undefined,
463
+ },
464
+ blobValue: "Test string",
465
+ booleanValue: true,
466
+ doubleValue: 42,
467
+ entityValue: {
468
+ key: {
469
+ partitionId: {
470
+ databaseId: "Test string",
471
+ namespaceId: "Test string",
472
+ projectId: "Test string",
473
+ },
474
+ path: [
475
+ {
476
+ id: "Test string",
477
+ kind: "Test string",
478
+ name: "Test string",
479
+ }
480
+ ],
481
+ },
482
+ properties: undefined,
483
+ },
484
+ excludeFromIndexes: true,
485
+ geoPointValue: {
486
+ latitude: 42,
487
+ longitude: 42,
488
+ },
489
+ integerValue: "Test string",
490
+ keyValue: {
491
+ partitionId: {
492
+ databaseId: "Test string",
493
+ namespaceId: "Test string",
494
+ projectId: "Test string",
495
+ },
496
+ path: [
497
+ {
498
+ id: "Test string",
499
+ kind: "Test string",
500
+ name: "Test string",
501
+ }
502
+ ],
503
+ },
504
+ meaning: 42,
505
+ nullValue: "Test string",
506
+ stringValue: "Test string",
507
+ timestampValue: "Test string",
508
+ },
509
+ }
510
+ },
511
+ positionalBindings: [
512
+ {
513
+ cursor: "Test string",
514
+ value: {
515
+ arrayValue: {
516
+ values: undefined,
517
+ },
518
+ blobValue: "Test string",
519
+ booleanValue: true,
520
+ doubleValue: 42,
521
+ entityValue: {
522
+ key: {
523
+ partitionId: {
524
+ databaseId: "Test string",
525
+ namespaceId: "Test string",
526
+ projectId: "Test string",
527
+ },
528
+ path: [
529
+ {
530
+ id: "Test string",
531
+ kind: "Test string",
532
+ name: "Test string",
533
+ }
534
+ ],
535
+ },
536
+ properties: undefined,
537
+ },
538
+ excludeFromIndexes: true,
539
+ geoPointValue: {
540
+ latitude: 42,
541
+ longitude: 42,
542
+ },
543
+ integerValue: "Test string",
544
+ keyValue: {
545
+ partitionId: {
546
+ databaseId: "Test string",
547
+ namespaceId: "Test string",
548
+ projectId: "Test string",
549
+ },
550
+ path: [
551
+ {
552
+ id: "Test string",
553
+ kind: "Test string",
554
+ name: "Test string",
555
+ }
556
+ ],
557
+ },
558
+ meaning: 42,
559
+ nullValue: "Test string",
560
+ stringValue: "Test string",
561
+ timestampValue: "Test string",
562
+ },
563
+ }
564
+ ],
565
+ queryString: "Test string",
566
+ },
567
+ partitionId: {
568
+ databaseId: "Test string",
569
+ namespaceId: "Test string",
570
+ projectId: "Test string",
571
+ },
572
+ readOptions: {
573
+ readConsistency: "Test string",
574
+ readTime: "Test string",
575
+ transaction: "Test string",
576
+ },
577
+ });
348
578
  /** Queries for entities. */
349
579
  await gapi.client.datastore.projects.runQuery({
350
580
  projectId: "Test string",