OLD | NEW |
| (Empty) |
1 // This is a generated file (see the discoveryapis_generator project). | |
2 | |
3 library googleapis_beta.datastore.v1beta2; | |
4 | |
5 import 'dart:core' as core; | |
6 import 'dart:async' as async; | |
7 import 'dart:convert' as convert; | |
8 | |
9 import 'package:_discoveryapis_commons/_discoveryapis_commons.dart' as commons; | |
10 import 'package:http/http.dart' as http; | |
11 | |
12 export 'package:_discoveryapis_commons/_discoveryapis_commons.dart' show | |
13 ApiRequestError, DetailedApiRequestError; | |
14 | |
15 const core.String USER_AGENT = 'dart-api-client datastore/v1beta2'; | |
16 | |
17 /** Stores and queries data in Google Cloud Datastore. */ | |
18 class DatastoreApi { | |
19 /** View and manage your data across Google Cloud Platform services */ | |
20 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; | |
21 | |
22 /** View and manage your Google Cloud Datastore data */ | |
23 static const DatastoreScope = "https://www.googleapis.com/auth/datastore"; | |
24 | |
25 /** View your email address */ | |
26 static const UserinfoEmailScope = "https://www.googleapis.com/auth/userinfo.em
ail"; | |
27 | |
28 | |
29 final commons.ApiRequester _requester; | |
30 | |
31 DatasetsResourceApi get datasets => new DatasetsResourceApi(_requester); | |
32 | |
33 DatastoreApi(http.Client client, {core.String rootUrl: "https://www.googleapis
.com/", core.String servicePath: "datastore/v1beta2/datasets/"}) : | |
34 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | |
35 } | |
36 | |
37 | |
38 class DatasetsResourceApi { | |
39 final commons.ApiRequester _requester; | |
40 | |
41 DatasetsResourceApi(commons.ApiRequester client) : | |
42 _requester = client; | |
43 | |
44 /** | |
45 * Allocate IDs for incomplete keys (useful for referencing an entity before | |
46 * it is inserted). | |
47 * | |
48 * [request] - The metadata request object. | |
49 * | |
50 * Request parameters: | |
51 * | |
52 * [datasetId] - Identifies the dataset. | |
53 * | |
54 * Completes with a [AllocateIdsResponse]. | |
55 * | |
56 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
57 * error. | |
58 * | |
59 * If the used [http.Client] completes with an error when making a REST call, | |
60 * this method will complete with the same error. | |
61 */ | |
62 async.Future<AllocateIdsResponse> allocateIds(AllocateIdsRequest request, core
.String datasetId) { | |
63 var _url = null; | |
64 var _queryParams = new core.Map(); | |
65 var _uploadMedia = null; | |
66 var _uploadOptions = null; | |
67 var _downloadOptions = commons.DownloadOptions.Metadata; | |
68 var _body = null; | |
69 | |
70 if (request != null) { | |
71 _body = convert.JSON.encode((request).toJson()); | |
72 } | |
73 if (datasetId == null) { | |
74 throw new core.ArgumentError("Parameter datasetId is required."); | |
75 } | |
76 | |
77 _url = commons.Escaper.ecapeVariable('$datasetId') + '/allocateIds'; | |
78 | |
79 var _response = _requester.request(_url, | |
80 "POST", | |
81 body: _body, | |
82 queryParams: _queryParams, | |
83 uploadOptions: _uploadOptions, | |
84 uploadMedia: _uploadMedia, | |
85 downloadOptions: _downloadOptions); | |
86 return _response.then((data) => new AllocateIdsResponse.fromJson(data)); | |
87 } | |
88 | |
89 /** | |
90 * Begin a new transaction. | |
91 * | |
92 * [request] - The metadata request object. | |
93 * | |
94 * Request parameters: | |
95 * | |
96 * [datasetId] - Identifies the dataset. | |
97 * | |
98 * Completes with a [BeginTransactionResponse]. | |
99 * | |
100 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
101 * error. | |
102 * | |
103 * If the used [http.Client] completes with an error when making a REST call, | |
104 * this method will complete with the same error. | |
105 */ | |
106 async.Future<BeginTransactionResponse> beginTransaction(BeginTransactionReques
t request, core.String datasetId) { | |
107 var _url = null; | |
108 var _queryParams = new core.Map(); | |
109 var _uploadMedia = null; | |
110 var _uploadOptions = null; | |
111 var _downloadOptions = commons.DownloadOptions.Metadata; | |
112 var _body = null; | |
113 | |
114 if (request != null) { | |
115 _body = convert.JSON.encode((request).toJson()); | |
116 } | |
117 if (datasetId == null) { | |
118 throw new core.ArgumentError("Parameter datasetId is required."); | |
119 } | |
120 | |
121 _url = commons.Escaper.ecapeVariable('$datasetId') + '/beginTransaction'; | |
122 | |
123 var _response = _requester.request(_url, | |
124 "POST", | |
125 body: _body, | |
126 queryParams: _queryParams, | |
127 uploadOptions: _uploadOptions, | |
128 uploadMedia: _uploadMedia, | |
129 downloadOptions: _downloadOptions); | |
130 return _response.then((data) => new BeginTransactionResponse.fromJson(data))
; | |
131 } | |
132 | |
133 /** | |
134 * Commit a transaction, optionally creating, deleting or modifying some | |
135 * entities. | |
136 * | |
137 * [request] - The metadata request object. | |
138 * | |
139 * Request parameters: | |
140 * | |
141 * [datasetId] - Identifies the dataset. | |
142 * | |
143 * Completes with a [CommitResponse]. | |
144 * | |
145 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
146 * error. | |
147 * | |
148 * If the used [http.Client] completes with an error when making a REST call, | |
149 * this method will complete with the same error. | |
150 */ | |
151 async.Future<CommitResponse> commit(CommitRequest request, core.String dataset
Id) { | |
152 var _url = null; | |
153 var _queryParams = new core.Map(); | |
154 var _uploadMedia = null; | |
155 var _uploadOptions = null; | |
156 var _downloadOptions = commons.DownloadOptions.Metadata; | |
157 var _body = null; | |
158 | |
159 if (request != null) { | |
160 _body = convert.JSON.encode((request).toJson()); | |
161 } | |
162 if (datasetId == null) { | |
163 throw new core.ArgumentError("Parameter datasetId is required."); | |
164 } | |
165 | |
166 _url = commons.Escaper.ecapeVariable('$datasetId') + '/commit'; | |
167 | |
168 var _response = _requester.request(_url, | |
169 "POST", | |
170 body: _body, | |
171 queryParams: _queryParams, | |
172 uploadOptions: _uploadOptions, | |
173 uploadMedia: _uploadMedia, | |
174 downloadOptions: _downloadOptions); | |
175 return _response.then((data) => new CommitResponse.fromJson(data)); | |
176 } | |
177 | |
178 /** | |
179 * Look up some entities by key. | |
180 * | |
181 * [request] - The metadata request object. | |
182 * | |
183 * Request parameters: | |
184 * | |
185 * [datasetId] - Identifies the dataset. | |
186 * | |
187 * Completes with a [LookupResponse]. | |
188 * | |
189 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
190 * error. | |
191 * | |
192 * If the used [http.Client] completes with an error when making a REST call, | |
193 * this method will complete with the same error. | |
194 */ | |
195 async.Future<LookupResponse> lookup(LookupRequest request, core.String dataset
Id) { | |
196 var _url = null; | |
197 var _queryParams = new core.Map(); | |
198 var _uploadMedia = null; | |
199 var _uploadOptions = null; | |
200 var _downloadOptions = commons.DownloadOptions.Metadata; | |
201 var _body = null; | |
202 | |
203 if (request != null) { | |
204 _body = convert.JSON.encode((request).toJson()); | |
205 } | |
206 if (datasetId == null) { | |
207 throw new core.ArgumentError("Parameter datasetId is required."); | |
208 } | |
209 | |
210 _url = commons.Escaper.ecapeVariable('$datasetId') + '/lookup'; | |
211 | |
212 var _response = _requester.request(_url, | |
213 "POST", | |
214 body: _body, | |
215 queryParams: _queryParams, | |
216 uploadOptions: _uploadOptions, | |
217 uploadMedia: _uploadMedia, | |
218 downloadOptions: _downloadOptions); | |
219 return _response.then((data) => new LookupResponse.fromJson(data)); | |
220 } | |
221 | |
222 /** | |
223 * Roll back a transaction. | |
224 * | |
225 * [request] - The metadata request object. | |
226 * | |
227 * Request parameters: | |
228 * | |
229 * [datasetId] - Identifies the dataset. | |
230 * | |
231 * Completes with a [RollbackResponse]. | |
232 * | |
233 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
234 * error. | |
235 * | |
236 * If the used [http.Client] completes with an error when making a REST call, | |
237 * this method will complete with the same error. | |
238 */ | |
239 async.Future<RollbackResponse> rollback(RollbackRequest request, core.String d
atasetId) { | |
240 var _url = null; | |
241 var _queryParams = new core.Map(); | |
242 var _uploadMedia = null; | |
243 var _uploadOptions = null; | |
244 var _downloadOptions = commons.DownloadOptions.Metadata; | |
245 var _body = null; | |
246 | |
247 if (request != null) { | |
248 _body = convert.JSON.encode((request).toJson()); | |
249 } | |
250 if (datasetId == null) { | |
251 throw new core.ArgumentError("Parameter datasetId is required."); | |
252 } | |
253 | |
254 _url = commons.Escaper.ecapeVariable('$datasetId') + '/rollback'; | |
255 | |
256 var _response = _requester.request(_url, | |
257 "POST", | |
258 body: _body, | |
259 queryParams: _queryParams, | |
260 uploadOptions: _uploadOptions, | |
261 uploadMedia: _uploadMedia, | |
262 downloadOptions: _downloadOptions); | |
263 return _response.then((data) => new RollbackResponse.fromJson(data)); | |
264 } | |
265 | |
266 /** | |
267 * Query for entities. | |
268 * | |
269 * [request] - The metadata request object. | |
270 * | |
271 * Request parameters: | |
272 * | |
273 * [datasetId] - Identifies the dataset. | |
274 * | |
275 * Completes with a [RunQueryResponse]. | |
276 * | |
277 * Completes with a [commons.ApiRequestError] if the API endpoint returned an | |
278 * error. | |
279 * | |
280 * If the used [http.Client] completes with an error when making a REST call, | |
281 * this method will complete with the same error. | |
282 */ | |
283 async.Future<RunQueryResponse> runQuery(RunQueryRequest request, core.String d
atasetId) { | |
284 var _url = null; | |
285 var _queryParams = new core.Map(); | |
286 var _uploadMedia = null; | |
287 var _uploadOptions = null; | |
288 var _downloadOptions = commons.DownloadOptions.Metadata; | |
289 var _body = null; | |
290 | |
291 if (request != null) { | |
292 _body = convert.JSON.encode((request).toJson()); | |
293 } | |
294 if (datasetId == null) { | |
295 throw new core.ArgumentError("Parameter datasetId is required."); | |
296 } | |
297 | |
298 _url = commons.Escaper.ecapeVariable('$datasetId') + '/runQuery'; | |
299 | |
300 var _response = _requester.request(_url, | |
301 "POST", | |
302 body: _body, | |
303 queryParams: _queryParams, | |
304 uploadOptions: _uploadOptions, | |
305 uploadMedia: _uploadMedia, | |
306 downloadOptions: _downloadOptions); | |
307 return _response.then((data) => new RunQueryResponse.fromJson(data)); | |
308 } | |
309 | |
310 } | |
311 | |
312 | |
313 | |
314 class AllocateIdsRequest { | |
315 /** | |
316 * A list of keys with incomplete key paths to allocate IDs for. No key may be | |
317 * reserved/read-only. | |
318 */ | |
319 core.List<Key> keys; | |
320 | |
321 AllocateIdsRequest(); | |
322 | |
323 AllocateIdsRequest.fromJson(core.Map _json) { | |
324 if (_json.containsKey("keys")) { | |
325 keys = _json["keys"].map((value) => new Key.fromJson(value)).toList(); | |
326 } | |
327 } | |
328 | |
329 core.Map toJson() { | |
330 var _json = new core.Map(); | |
331 if (keys != null) { | |
332 _json["keys"] = keys.map((value) => (value).toJson()).toList(); | |
333 } | |
334 return _json; | |
335 } | |
336 } | |
337 | |
338 class AllocateIdsResponse { | |
339 ResponseHeader header; | |
340 /** | |
341 * The keys specified in the request (in the same order), each with its key | |
342 * path completed with a newly allocated ID. | |
343 */ | |
344 core.List<Key> keys; | |
345 | |
346 AllocateIdsResponse(); | |
347 | |
348 AllocateIdsResponse.fromJson(core.Map _json) { | |
349 if (_json.containsKey("header")) { | |
350 header = new ResponseHeader.fromJson(_json["header"]); | |
351 } | |
352 if (_json.containsKey("keys")) { | |
353 keys = _json["keys"].map((value) => new Key.fromJson(value)).toList(); | |
354 } | |
355 } | |
356 | |
357 core.Map toJson() { | |
358 var _json = new core.Map(); | |
359 if (header != null) { | |
360 _json["header"] = (header).toJson(); | |
361 } | |
362 if (keys != null) { | |
363 _json["keys"] = keys.map((value) => (value).toJson()).toList(); | |
364 } | |
365 return _json; | |
366 } | |
367 } | |
368 | |
369 class BeginTransactionRequest { | |
370 /** | |
371 * The transaction isolation level. Either snapshot or serializable. The | |
372 * default isolation level is snapshot isolation, which means that another | |
373 * transaction may not concurrently modify the data that is modified by this | |
374 * transaction. Optionally, a transaction can request to be made serializable | |
375 * which means that another transaction cannot concurrently modify the data | |
376 * that is read or modified by this transaction. | |
377 * Possible string values are: | |
378 * - "SERIALIZABLE" | |
379 * - "SNAPSHOT" | |
380 */ | |
381 core.String isolationLevel; | |
382 | |
383 BeginTransactionRequest(); | |
384 | |
385 BeginTransactionRequest.fromJson(core.Map _json) { | |
386 if (_json.containsKey("isolationLevel")) { | |
387 isolationLevel = _json["isolationLevel"]; | |
388 } | |
389 } | |
390 | |
391 core.Map toJson() { | |
392 var _json = new core.Map(); | |
393 if (isolationLevel != null) { | |
394 _json["isolationLevel"] = isolationLevel; | |
395 } | |
396 return _json; | |
397 } | |
398 } | |
399 | |
400 class BeginTransactionResponse { | |
401 ResponseHeader header; | |
402 /** The transaction identifier (always present). */ | |
403 core.String transaction; | |
404 core.List<core.int> get transactionAsBytes { | |
405 return convert.BASE64.decode(transaction); | |
406 } | |
407 | |
408 void set transactionAsBytes(core.List<core.int> _bytes) { | |
409 transaction = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
410 } | |
411 | |
412 BeginTransactionResponse(); | |
413 | |
414 BeginTransactionResponse.fromJson(core.Map _json) { | |
415 if (_json.containsKey("header")) { | |
416 header = new ResponseHeader.fromJson(_json["header"]); | |
417 } | |
418 if (_json.containsKey("transaction")) { | |
419 transaction = _json["transaction"]; | |
420 } | |
421 } | |
422 | |
423 core.Map toJson() { | |
424 var _json = new core.Map(); | |
425 if (header != null) { | |
426 _json["header"] = (header).toJson(); | |
427 } | |
428 if (transaction != null) { | |
429 _json["transaction"] = transaction; | |
430 } | |
431 return _json; | |
432 } | |
433 } | |
434 | |
435 class CommitRequest { | |
436 core.bool ignoreReadOnly; | |
437 /** | |
438 * The type of commit to perform. Either TRANSACTIONAL or NON_TRANSACTIONAL. | |
439 * Possible string values are: | |
440 * - "NON_TRANSACTIONAL" | |
441 * - "TRANSACTIONAL" | |
442 */ | |
443 core.String mode; | |
444 /** The mutation to perform. Optional. */ | |
445 Mutation mutation; | |
446 /** | |
447 * The transaction identifier, returned by a call to beginTransaction. Must be | |
448 * set when mode is TRANSACTIONAL. | |
449 */ | |
450 core.String transaction; | |
451 core.List<core.int> get transactionAsBytes { | |
452 return convert.BASE64.decode(transaction); | |
453 } | |
454 | |
455 void set transactionAsBytes(core.List<core.int> _bytes) { | |
456 transaction = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
457 } | |
458 | |
459 CommitRequest(); | |
460 | |
461 CommitRequest.fromJson(core.Map _json) { | |
462 if (_json.containsKey("ignoreReadOnly")) { | |
463 ignoreReadOnly = _json["ignoreReadOnly"]; | |
464 } | |
465 if (_json.containsKey("mode")) { | |
466 mode = _json["mode"]; | |
467 } | |
468 if (_json.containsKey("mutation")) { | |
469 mutation = new Mutation.fromJson(_json["mutation"]); | |
470 } | |
471 if (_json.containsKey("transaction")) { | |
472 transaction = _json["transaction"]; | |
473 } | |
474 } | |
475 | |
476 core.Map toJson() { | |
477 var _json = new core.Map(); | |
478 if (ignoreReadOnly != null) { | |
479 _json["ignoreReadOnly"] = ignoreReadOnly; | |
480 } | |
481 if (mode != null) { | |
482 _json["mode"] = mode; | |
483 } | |
484 if (mutation != null) { | |
485 _json["mutation"] = (mutation).toJson(); | |
486 } | |
487 if (transaction != null) { | |
488 _json["transaction"] = transaction; | |
489 } | |
490 return _json; | |
491 } | |
492 } | |
493 | |
494 class CommitResponse { | |
495 ResponseHeader header; | |
496 /** The result of performing the mutation (if any). */ | |
497 MutationResult mutationResult; | |
498 | |
499 CommitResponse(); | |
500 | |
501 CommitResponse.fromJson(core.Map _json) { | |
502 if (_json.containsKey("header")) { | |
503 header = new ResponseHeader.fromJson(_json["header"]); | |
504 } | |
505 if (_json.containsKey("mutationResult")) { | |
506 mutationResult = new MutationResult.fromJson(_json["mutationResult"]); | |
507 } | |
508 } | |
509 | |
510 core.Map toJson() { | |
511 var _json = new core.Map(); | |
512 if (header != null) { | |
513 _json["header"] = (header).toJson(); | |
514 } | |
515 if (mutationResult != null) { | |
516 _json["mutationResult"] = (mutationResult).toJson(); | |
517 } | |
518 return _json; | |
519 } | |
520 } | |
521 | |
522 /** | |
523 * A filter that merges the multiple other filters using the given operation. | |
524 */ | |
525 class CompositeFilter { | |
526 /** The list of filters to combine. Must contain at least one filter. */ | |
527 core.List<Filter> filters; | |
528 /** | |
529 * The operator for combining multiple filters. Only "and" is currently | |
530 * supported. | |
531 * Possible string values are: | |
532 * - "AND" | |
533 */ | |
534 core.String operator; | |
535 | |
536 CompositeFilter(); | |
537 | |
538 CompositeFilter.fromJson(core.Map _json) { | |
539 if (_json.containsKey("filters")) { | |
540 filters = _json["filters"].map((value) => new Filter.fromJson(value)).toLi
st(); | |
541 } | |
542 if (_json.containsKey("operator")) { | |
543 operator = _json["operator"]; | |
544 } | |
545 } | |
546 | |
547 core.Map toJson() { | |
548 var _json = new core.Map(); | |
549 if (filters != null) { | |
550 _json["filters"] = filters.map((value) => (value).toJson()).toList(); | |
551 } | |
552 if (operator != null) { | |
553 _json["operator"] = operator; | |
554 } | |
555 return _json; | |
556 } | |
557 } | |
558 | |
559 /** An entity. */ | |
560 class Entity { | |
561 /** | |
562 * The entity's key. | |
563 * | |
564 * An entity must have a key, unless otherwise documented (for example, an | |
565 * entity in Value.entityValue may have no key). An entity's kind is its key's | |
566 * path's last element's kind, or null if it has no key. | |
567 */ | |
568 Key key; | |
569 /** The entity's properties. */ | |
570 core.Map<core.String, Property> properties; | |
571 | |
572 Entity(); | |
573 | |
574 Entity.fromJson(core.Map _json) { | |
575 if (_json.containsKey("key")) { | |
576 key = new Key.fromJson(_json["key"]); | |
577 } | |
578 if (_json.containsKey("properties")) { | |
579 properties = commons.mapMap(_json["properties"], (item) => new Property.fr
omJson(item)); | |
580 } | |
581 } | |
582 | |
583 core.Map toJson() { | |
584 var _json = new core.Map(); | |
585 if (key != null) { | |
586 _json["key"] = (key).toJson(); | |
587 } | |
588 if (properties != null) { | |
589 _json["properties"] = commons.mapMap(properties, (item) => (item).toJson()
); | |
590 } | |
591 return _json; | |
592 } | |
593 } | |
594 | |
595 /** The result of fetching an entity from the datastore. */ | |
596 class EntityResult { | |
597 /** The resulting entity. */ | |
598 Entity entity; | |
599 | |
600 EntityResult(); | |
601 | |
602 EntityResult.fromJson(core.Map _json) { | |
603 if (_json.containsKey("entity")) { | |
604 entity = new Entity.fromJson(_json["entity"]); | |
605 } | |
606 } | |
607 | |
608 core.Map toJson() { | |
609 var _json = new core.Map(); | |
610 if (entity != null) { | |
611 _json["entity"] = (entity).toJson(); | |
612 } | |
613 return _json; | |
614 } | |
615 } | |
616 | |
617 /** A holder for any type of filter. Exactly one field should be specified. */ | |
618 class Filter { | |
619 /** A composite filter. */ | |
620 CompositeFilter compositeFilter; | |
621 /** A filter on a property. */ | |
622 PropertyFilter propertyFilter; | |
623 | |
624 Filter(); | |
625 | |
626 Filter.fromJson(core.Map _json) { | |
627 if (_json.containsKey("compositeFilter")) { | |
628 compositeFilter = new CompositeFilter.fromJson(_json["compositeFilter"]); | |
629 } | |
630 if (_json.containsKey("propertyFilter")) { | |
631 propertyFilter = new PropertyFilter.fromJson(_json["propertyFilter"]); | |
632 } | |
633 } | |
634 | |
635 core.Map toJson() { | |
636 var _json = new core.Map(); | |
637 if (compositeFilter != null) { | |
638 _json["compositeFilter"] = (compositeFilter).toJson(); | |
639 } | |
640 if (propertyFilter != null) { | |
641 _json["propertyFilter"] = (propertyFilter).toJson(); | |
642 } | |
643 return _json; | |
644 } | |
645 } | |
646 | |
647 /** A GQL query. */ | |
648 class GqlQuery { | |
649 /** When false, the query string must not contain a literal. */ | |
650 core.bool allowLiteral; | |
651 /** | |
652 * A named argument must set field GqlQueryArg.name. No two named arguments | |
653 * may have the same name. For each non-reserved named binding site in the | |
654 * query string, there must be a named argument with that name, but not | |
655 * necessarily the inverse. | |
656 */ | |
657 core.List<GqlQueryArg> nameArgs; | |
658 /** | |
659 * Numbered binding site @1 references the first numbered argument, | |
660 * effectively using 1-based indexing, rather than the usual 0. A numbered | |
661 * argument must NOT set field GqlQueryArg.name. For each binding site | |
662 * numbered i in query_string, there must be an ith numbered argument. The | |
663 * inverse must also be true. | |
664 */ | |
665 core.List<GqlQueryArg> numberArgs; | |
666 /** The query string. */ | |
667 core.String queryString; | |
668 | |
669 GqlQuery(); | |
670 | |
671 GqlQuery.fromJson(core.Map _json) { | |
672 if (_json.containsKey("allowLiteral")) { | |
673 allowLiteral = _json["allowLiteral"]; | |
674 } | |
675 if (_json.containsKey("nameArgs")) { | |
676 nameArgs = _json["nameArgs"].map((value) => new GqlQueryArg.fromJson(value
)).toList(); | |
677 } | |
678 if (_json.containsKey("numberArgs")) { | |
679 numberArgs = _json["numberArgs"].map((value) => new GqlQueryArg.fromJson(v
alue)).toList(); | |
680 } | |
681 if (_json.containsKey("queryString")) { | |
682 queryString = _json["queryString"]; | |
683 } | |
684 } | |
685 | |
686 core.Map toJson() { | |
687 var _json = new core.Map(); | |
688 if (allowLiteral != null) { | |
689 _json["allowLiteral"] = allowLiteral; | |
690 } | |
691 if (nameArgs != null) { | |
692 _json["nameArgs"] = nameArgs.map((value) => (value).toJson()).toList(); | |
693 } | |
694 if (numberArgs != null) { | |
695 _json["numberArgs"] = numberArgs.map((value) => (value).toJson()).toList()
; | |
696 } | |
697 if (queryString != null) { | |
698 _json["queryString"] = queryString; | |
699 } | |
700 return _json; | |
701 } | |
702 } | |
703 | |
704 /** A binding argument for a GQL query. */ | |
705 class GqlQueryArg { | |
706 core.String cursor; | |
707 core.List<core.int> get cursorAsBytes { | |
708 return convert.BASE64.decode(cursor); | |
709 } | |
710 | |
711 void set cursorAsBytes(core.List<core.int> _bytes) { | |
712 cursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+",
"-"); | |
713 } | |
714 /** | |
715 * Must match regex "[A-Za-z_$][A-Za-z_$0-9]*". Must not match regex "__.*__". | |
716 * Must not be "". | |
717 */ | |
718 core.String name; | |
719 Value value; | |
720 | |
721 GqlQueryArg(); | |
722 | |
723 GqlQueryArg.fromJson(core.Map _json) { | |
724 if (_json.containsKey("cursor")) { | |
725 cursor = _json["cursor"]; | |
726 } | |
727 if (_json.containsKey("name")) { | |
728 name = _json["name"]; | |
729 } | |
730 if (_json.containsKey("value")) { | |
731 value = new Value.fromJson(_json["value"]); | |
732 } | |
733 } | |
734 | |
735 core.Map toJson() { | |
736 var _json = new core.Map(); | |
737 if (cursor != null) { | |
738 _json["cursor"] = cursor; | |
739 } | |
740 if (name != null) { | |
741 _json["name"] = name; | |
742 } | |
743 if (value != null) { | |
744 _json["value"] = (value).toJson(); | |
745 } | |
746 return _json; | |
747 } | |
748 } | |
749 | |
750 /** A unique identifier for an entity. */ | |
751 class Key { | |
752 /** | |
753 * Entities are partitioned into subsets, currently identified by a dataset | |
754 * (usually implicitly specified by the project) and namespace ID. Queries are | |
755 * scoped to a single partition. | |
756 */ | |
757 PartitionId partitionId; | |
758 /** | |
759 * The entity path. An entity path consists of one or more elements composed | |
760 * of a kind and a string or numerical identifier, which identify entities. | |
761 * The first element identifies a root entity, the second element identifies a | |
762 * child of the root entity, the third element a child of the second entity, | |
763 * and so forth. The entities identified by all prefixes of the path are | |
764 * called the element's ancestors. An entity path is always fully complete: | |
765 * ALL of the entity's ancestors are required to be in the path along with the | |
766 * entity identifier itself. The only exception is that in some documented | |
767 * cases, the identifier in the last path element (for the entity) itself may | |
768 * be omitted. A path can never be empty. The path can have at most 100 | |
769 * elements. | |
770 */ | |
771 core.List<KeyPathElement> path; | |
772 | |
773 Key(); | |
774 | |
775 Key.fromJson(core.Map _json) { | |
776 if (_json.containsKey("partitionId")) { | |
777 partitionId = new PartitionId.fromJson(_json["partitionId"]); | |
778 } | |
779 if (_json.containsKey("path")) { | |
780 path = _json["path"].map((value) => new KeyPathElement.fromJson(value)).to
List(); | |
781 } | |
782 } | |
783 | |
784 core.Map toJson() { | |
785 var _json = new core.Map(); | |
786 if (partitionId != null) { | |
787 _json["partitionId"] = (partitionId).toJson(); | |
788 } | |
789 if (path != null) { | |
790 _json["path"] = path.map((value) => (value).toJson()).toList(); | |
791 } | |
792 return _json; | |
793 } | |
794 } | |
795 | |
796 /** | |
797 * A (kind, ID/name) pair used to construct a key path. | |
798 * | |
799 * At most one of name or ID may be set. If either is set, the element is | |
800 * complete. If neither is set, the element is incomplete. | |
801 */ | |
802 class KeyPathElement { | |
803 /** | |
804 * The ID of the entity. Never equal to zero. Values less than zero are | |
805 * discouraged and will not be supported in the future. | |
806 */ | |
807 core.String id; | |
808 /** | |
809 * The kind of the entity. A kind matching regex "__.*__" is | |
810 * reserved/read-only. A kind must not contain more than 500 characters. | |
811 * Cannot be "". | |
812 */ | |
813 core.String kind; | |
814 /** | |
815 * The name of the entity. A name matching regex "__.*__" is | |
816 * reserved/read-only. A name must not be more than 500 characters. Cannot be | |
817 * "". | |
818 */ | |
819 core.String name; | |
820 | |
821 KeyPathElement(); | |
822 | |
823 KeyPathElement.fromJson(core.Map _json) { | |
824 if (_json.containsKey("id")) { | |
825 id = _json["id"]; | |
826 } | |
827 if (_json.containsKey("kind")) { | |
828 kind = _json["kind"]; | |
829 } | |
830 if (_json.containsKey("name")) { | |
831 name = _json["name"]; | |
832 } | |
833 } | |
834 | |
835 core.Map toJson() { | |
836 var _json = new core.Map(); | |
837 if (id != null) { | |
838 _json["id"] = id; | |
839 } | |
840 if (kind != null) { | |
841 _json["kind"] = kind; | |
842 } | |
843 if (name != null) { | |
844 _json["name"] = name; | |
845 } | |
846 return _json; | |
847 } | |
848 } | |
849 | |
850 /** A representation of a kind. */ | |
851 class KindExpression { | |
852 /** The name of the kind. */ | |
853 core.String name; | |
854 | |
855 KindExpression(); | |
856 | |
857 KindExpression.fromJson(core.Map _json) { | |
858 if (_json.containsKey("name")) { | |
859 name = _json["name"]; | |
860 } | |
861 } | |
862 | |
863 core.Map toJson() { | |
864 var _json = new core.Map(); | |
865 if (name != null) { | |
866 _json["name"] = name; | |
867 } | |
868 return _json; | |
869 } | |
870 } | |
871 | |
872 class LookupRequest { | |
873 /** Keys of entities to look up from the datastore. */ | |
874 core.List<Key> keys; | |
875 /** Options for this lookup request. Optional. */ | |
876 ReadOptions readOptions; | |
877 | |
878 LookupRequest(); | |
879 | |
880 LookupRequest.fromJson(core.Map _json) { | |
881 if (_json.containsKey("keys")) { | |
882 keys = _json["keys"].map((value) => new Key.fromJson(value)).toList(); | |
883 } | |
884 if (_json.containsKey("readOptions")) { | |
885 readOptions = new ReadOptions.fromJson(_json["readOptions"]); | |
886 } | |
887 } | |
888 | |
889 core.Map toJson() { | |
890 var _json = new core.Map(); | |
891 if (keys != null) { | |
892 _json["keys"] = keys.map((value) => (value).toJson()).toList(); | |
893 } | |
894 if (readOptions != null) { | |
895 _json["readOptions"] = (readOptions).toJson(); | |
896 } | |
897 return _json; | |
898 } | |
899 } | |
900 | |
901 class LookupResponse { | |
902 /** A list of keys that were not looked up due to resource constraints. */ | |
903 core.List<Key> deferred; | |
904 /** Entities found. */ | |
905 core.List<EntityResult> found; | |
906 ResponseHeader header; | |
907 /** Entities not found, with only the key populated. */ | |
908 core.List<EntityResult> missing; | |
909 | |
910 LookupResponse(); | |
911 | |
912 LookupResponse.fromJson(core.Map _json) { | |
913 if (_json.containsKey("deferred")) { | |
914 deferred = _json["deferred"].map((value) => new Key.fromJson(value)).toLis
t(); | |
915 } | |
916 if (_json.containsKey("found")) { | |
917 found = _json["found"].map((value) => new EntityResult.fromJson(value)).to
List(); | |
918 } | |
919 if (_json.containsKey("header")) { | |
920 header = new ResponseHeader.fromJson(_json["header"]); | |
921 } | |
922 if (_json.containsKey("missing")) { | |
923 missing = _json["missing"].map((value) => new EntityResult.fromJson(value)
).toList(); | |
924 } | |
925 } | |
926 | |
927 core.Map toJson() { | |
928 var _json = new core.Map(); | |
929 if (deferred != null) { | |
930 _json["deferred"] = deferred.map((value) => (value).toJson()).toList(); | |
931 } | |
932 if (found != null) { | |
933 _json["found"] = found.map((value) => (value).toJson()).toList(); | |
934 } | |
935 if (header != null) { | |
936 _json["header"] = (header).toJson(); | |
937 } | |
938 if (missing != null) { | |
939 _json["missing"] = missing.map((value) => (value).toJson()).toList(); | |
940 } | |
941 return _json; | |
942 } | |
943 } | |
944 | |
945 /** A set of changes to apply. */ | |
946 class Mutation { | |
947 /** | |
948 * Keys of entities to delete. Each key must have a complete key path and must | |
949 * not be reserved/read-only. | |
950 */ | |
951 core.List<Key> delete; | |
952 /** Ignore a user specified read-only period. Optional. */ | |
953 core.bool force; | |
954 /** | |
955 * Entities to insert. Each inserted entity's key must have a complete path | |
956 * and must not be reserved/read-only. | |
957 */ | |
958 core.List<Entity> insert; | |
959 /** | |
960 * Insert entities with a newly allocated ID. Each inserted entity's key must | |
961 * omit the final identifier in its path and must not be reserved/read-only. | |
962 */ | |
963 core.List<Entity> insertAutoId; | |
964 /** | |
965 * Entities to update. Each updated entity's key must have a complete path and | |
966 * must not be reserved/read-only. | |
967 */ | |
968 core.List<Entity> update; | |
969 /** | |
970 * Entities to upsert. Each upserted entity's key must have a complete path | |
971 * and must not be reserved/read-only. | |
972 */ | |
973 core.List<Entity> upsert; | |
974 | |
975 Mutation(); | |
976 | |
977 Mutation.fromJson(core.Map _json) { | |
978 if (_json.containsKey("delete")) { | |
979 delete = _json["delete"].map((value) => new Key.fromJson(value)).toList(); | |
980 } | |
981 if (_json.containsKey("force")) { | |
982 force = _json["force"]; | |
983 } | |
984 if (_json.containsKey("insert")) { | |
985 insert = _json["insert"].map((value) => new Entity.fromJson(value)).toList
(); | |
986 } | |
987 if (_json.containsKey("insertAutoId")) { | |
988 insertAutoId = _json["insertAutoId"].map((value) => new Entity.fromJson(va
lue)).toList(); | |
989 } | |
990 if (_json.containsKey("update")) { | |
991 update = _json["update"].map((value) => new Entity.fromJson(value)).toList
(); | |
992 } | |
993 if (_json.containsKey("upsert")) { | |
994 upsert = _json["upsert"].map((value) => new Entity.fromJson(value)).toList
(); | |
995 } | |
996 } | |
997 | |
998 core.Map toJson() { | |
999 var _json = new core.Map(); | |
1000 if (delete != null) { | |
1001 _json["delete"] = delete.map((value) => (value).toJson()).toList(); | |
1002 } | |
1003 if (force != null) { | |
1004 _json["force"] = force; | |
1005 } | |
1006 if (insert != null) { | |
1007 _json["insert"] = insert.map((value) => (value).toJson()).toList(); | |
1008 } | |
1009 if (insertAutoId != null) { | |
1010 _json["insertAutoId"] = insertAutoId.map((value) => (value).toJson()).toLi
st(); | |
1011 } | |
1012 if (update != null) { | |
1013 _json["update"] = update.map((value) => (value).toJson()).toList(); | |
1014 } | |
1015 if (upsert != null) { | |
1016 _json["upsert"] = upsert.map((value) => (value).toJson()).toList(); | |
1017 } | |
1018 return _json; | |
1019 } | |
1020 } | |
1021 | |
1022 class MutationResult { | |
1023 /** Number of index writes. */ | |
1024 core.int indexUpdates; | |
1025 /** | |
1026 * Keys for insertAutoId entities. One per entity from the request, in the | |
1027 * same order. | |
1028 */ | |
1029 core.List<Key> insertAutoIdKeys; | |
1030 | |
1031 MutationResult(); | |
1032 | |
1033 MutationResult.fromJson(core.Map _json) { | |
1034 if (_json.containsKey("indexUpdates")) { | |
1035 indexUpdates = _json["indexUpdates"]; | |
1036 } | |
1037 if (_json.containsKey("insertAutoIdKeys")) { | |
1038 insertAutoIdKeys = _json["insertAutoIdKeys"].map((value) => new Key.fromJs
on(value)).toList(); | |
1039 } | |
1040 } | |
1041 | |
1042 core.Map toJson() { | |
1043 var _json = new core.Map(); | |
1044 if (indexUpdates != null) { | |
1045 _json["indexUpdates"] = indexUpdates; | |
1046 } | |
1047 if (insertAutoIdKeys != null) { | |
1048 _json["insertAutoIdKeys"] = insertAutoIdKeys.map((value) => (value).toJson
()).toList(); | |
1049 } | |
1050 return _json; | |
1051 } | |
1052 } | |
1053 | |
1054 /** | |
1055 * An identifier for a particular subset of entities. | |
1056 * | |
1057 * Entities are partitioned into various subsets, each used by different | |
1058 * datasets and different namespaces within a dataset and so forth. | |
1059 */ | |
1060 class PartitionId { | |
1061 /** The dataset ID. */ | |
1062 core.String datasetId; | |
1063 /** The namespace. */ | |
1064 core.String namespace; | |
1065 | |
1066 PartitionId(); | |
1067 | |
1068 PartitionId.fromJson(core.Map _json) { | |
1069 if (_json.containsKey("datasetId")) { | |
1070 datasetId = _json["datasetId"]; | |
1071 } | |
1072 if (_json.containsKey("namespace")) { | |
1073 namespace = _json["namespace"]; | |
1074 } | |
1075 } | |
1076 | |
1077 core.Map toJson() { | |
1078 var _json = new core.Map(); | |
1079 if (datasetId != null) { | |
1080 _json["datasetId"] = datasetId; | |
1081 } | |
1082 if (namespace != null) { | |
1083 _json["namespace"] = namespace; | |
1084 } | |
1085 return _json; | |
1086 } | |
1087 } | |
1088 | |
1089 /** An entity property. */ | |
1090 class Property { | |
1091 /** A blob key value. */ | |
1092 core.String blobKeyValue; | |
1093 /** | |
1094 * A blob value. May be a maximum of 1,000,000 bytes. When indexed is true, | |
1095 * may have at most 500 bytes. | |
1096 */ | |
1097 core.String blobValue; | |
1098 core.List<core.int> get blobValueAsBytes { | |
1099 return convert.BASE64.decode(blobValue); | |
1100 } | |
1101 | |
1102 void set blobValueAsBytes(core.List<core.int> _bytes) { | |
1103 blobValue = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+
", "-"); | |
1104 } | |
1105 /** A boolean value. */ | |
1106 core.bool booleanValue; | |
1107 /** A timestamp value. */ | |
1108 core.DateTime dateTimeValue; | |
1109 /** A double value. */ | |
1110 core.double doubleValue; | |
1111 /** | |
1112 * An entity value. May have no key. May have a key with an incomplete key | |
1113 * path. May have a reserved/read-only key. | |
1114 */ | |
1115 Entity entityValue; | |
1116 /** | |
1117 * If the value should be indexed. | |
1118 * | |
1119 * The indexed property may be set for a null value. When indexed is true, | |
1120 * stringValue is limited to 500 characters and the blob value is limited to | |
1121 * 500 bytes. Input values by default have indexed set to true; however, you | |
1122 * can explicitly set indexed to true if you want. (An output value never has | |
1123 * indexed explicitly set to true.) If a value is itself an entity, it cannot | |
1124 * have indexed set to true. | |
1125 */ | |
1126 core.bool indexed; | |
1127 /** An integer value. */ | |
1128 core.String integerValue; | |
1129 /** A key value. */ | |
1130 Key keyValue; | |
1131 /** | |
1132 * A list value. Cannot contain another list value. A Value instance that sets | |
1133 * field list_value must not set field meaning or field indexed. | |
1134 */ | |
1135 core.List<Value> listValue; | |
1136 /** The meaning field is reserved and should not be used. */ | |
1137 core.int meaning; | |
1138 /** | |
1139 * A UTF-8 encoded string value. When indexed is true, may have at most 500 | |
1140 * characters. | |
1141 */ | |
1142 core.String stringValue; | |
1143 | |
1144 Property(); | |
1145 | |
1146 Property.fromJson(core.Map _json) { | |
1147 if (_json.containsKey("blobKeyValue")) { | |
1148 blobKeyValue = _json["blobKeyValue"]; | |
1149 } | |
1150 if (_json.containsKey("blobValue")) { | |
1151 blobValue = _json["blobValue"]; | |
1152 } | |
1153 if (_json.containsKey("booleanValue")) { | |
1154 booleanValue = _json["booleanValue"]; | |
1155 } | |
1156 if (_json.containsKey("dateTimeValue")) { | |
1157 dateTimeValue = core.DateTime.parse(_json["dateTimeValue"]); | |
1158 } | |
1159 if (_json.containsKey("doubleValue")) { | |
1160 doubleValue = _json["doubleValue"]; | |
1161 } | |
1162 if (_json.containsKey("entityValue")) { | |
1163 entityValue = new Entity.fromJson(_json["entityValue"]); | |
1164 } | |
1165 if (_json.containsKey("indexed")) { | |
1166 indexed = _json["indexed"]; | |
1167 } | |
1168 if (_json.containsKey("integerValue")) { | |
1169 integerValue = _json["integerValue"]; | |
1170 } | |
1171 if (_json.containsKey("keyValue")) { | |
1172 keyValue = new Key.fromJson(_json["keyValue"]); | |
1173 } | |
1174 if (_json.containsKey("listValue")) { | |
1175 listValue = _json["listValue"].map((value) => new Value.fromJson(value)).t
oList(); | |
1176 } | |
1177 if (_json.containsKey("meaning")) { | |
1178 meaning = _json["meaning"]; | |
1179 } | |
1180 if (_json.containsKey("stringValue")) { | |
1181 stringValue = _json["stringValue"]; | |
1182 } | |
1183 } | |
1184 | |
1185 core.Map toJson() { | |
1186 var _json = new core.Map(); | |
1187 if (blobKeyValue != null) { | |
1188 _json["blobKeyValue"] = blobKeyValue; | |
1189 } | |
1190 if (blobValue != null) { | |
1191 _json["blobValue"] = blobValue; | |
1192 } | |
1193 if (booleanValue != null) { | |
1194 _json["booleanValue"] = booleanValue; | |
1195 } | |
1196 if (dateTimeValue != null) { | |
1197 _json["dateTimeValue"] = (dateTimeValue).toIso8601String(); | |
1198 } | |
1199 if (doubleValue != null) { | |
1200 _json["doubleValue"] = doubleValue; | |
1201 } | |
1202 if (entityValue != null) { | |
1203 _json["entityValue"] = (entityValue).toJson(); | |
1204 } | |
1205 if (indexed != null) { | |
1206 _json["indexed"] = indexed; | |
1207 } | |
1208 if (integerValue != null) { | |
1209 _json["integerValue"] = integerValue; | |
1210 } | |
1211 if (keyValue != null) { | |
1212 _json["keyValue"] = (keyValue).toJson(); | |
1213 } | |
1214 if (listValue != null) { | |
1215 _json["listValue"] = listValue.map((value) => (value).toJson()).toList(); | |
1216 } | |
1217 if (meaning != null) { | |
1218 _json["meaning"] = meaning; | |
1219 } | |
1220 if (stringValue != null) { | |
1221 _json["stringValue"] = stringValue; | |
1222 } | |
1223 return _json; | |
1224 } | |
1225 } | |
1226 | |
1227 /** A representation of a property in a projection. */ | |
1228 class PropertyExpression { | |
1229 /** | |
1230 * The aggregation function to apply to the property. Optional. Can only be | |
1231 * used when grouping by at least one property. Must then be set on all | |
1232 * properties in the projection that are not being grouped by. Aggregation | |
1233 * functions: first selects the first result as determined by the query's | |
1234 * order. | |
1235 * Possible string values are: | |
1236 * - "FIRST" | |
1237 */ | |
1238 core.String aggregationFunction; | |
1239 /** The property to project. */ | |
1240 PropertyReference property; | |
1241 | |
1242 PropertyExpression(); | |
1243 | |
1244 PropertyExpression.fromJson(core.Map _json) { | |
1245 if (_json.containsKey("aggregationFunction")) { | |
1246 aggregationFunction = _json["aggregationFunction"]; | |
1247 } | |
1248 if (_json.containsKey("property")) { | |
1249 property = new PropertyReference.fromJson(_json["property"]); | |
1250 } | |
1251 } | |
1252 | |
1253 core.Map toJson() { | |
1254 var _json = new core.Map(); | |
1255 if (aggregationFunction != null) { | |
1256 _json["aggregationFunction"] = aggregationFunction; | |
1257 } | |
1258 if (property != null) { | |
1259 _json["property"] = (property).toJson(); | |
1260 } | |
1261 return _json; | |
1262 } | |
1263 } | |
1264 | |
1265 /** A filter on a specific property. */ | |
1266 class PropertyFilter { | |
1267 /** | |
1268 * The operator to filter by. One of lessThan, lessThanOrEqual, greaterThan, | |
1269 * greaterThanOrEqual, equal, or hasAncestor. | |
1270 * Possible string values are: | |
1271 * - "EQUAL" | |
1272 * - "GREATER_THAN" | |
1273 * - "GREATER_THAN_OR_EQUAL" | |
1274 * - "HAS_ANCESTOR" | |
1275 * - "LESS_THAN" | |
1276 * - "LESS_THAN_OR_EQUAL" | |
1277 */ | |
1278 core.String operator; | |
1279 /** The property to filter by. */ | |
1280 PropertyReference property; | |
1281 /** The value to compare the property to. */ | |
1282 Value value; | |
1283 | |
1284 PropertyFilter(); | |
1285 | |
1286 PropertyFilter.fromJson(core.Map _json) { | |
1287 if (_json.containsKey("operator")) { | |
1288 operator = _json["operator"]; | |
1289 } | |
1290 if (_json.containsKey("property")) { | |
1291 property = new PropertyReference.fromJson(_json["property"]); | |
1292 } | |
1293 if (_json.containsKey("value")) { | |
1294 value = new Value.fromJson(_json["value"]); | |
1295 } | |
1296 } | |
1297 | |
1298 core.Map toJson() { | |
1299 var _json = new core.Map(); | |
1300 if (operator != null) { | |
1301 _json["operator"] = operator; | |
1302 } | |
1303 if (property != null) { | |
1304 _json["property"] = (property).toJson(); | |
1305 } | |
1306 if (value != null) { | |
1307 _json["value"] = (value).toJson(); | |
1308 } | |
1309 return _json; | |
1310 } | |
1311 } | |
1312 | |
1313 /** The desired order for a specific property. */ | |
1314 class PropertyOrder { | |
1315 /** | |
1316 * The direction to order by. One of ascending or descending. Optional, | |
1317 * defaults to ascending. | |
1318 * Possible string values are: | |
1319 * - "ASCENDING" | |
1320 * - "DESCENDING" | |
1321 */ | |
1322 core.String direction; | |
1323 /** The property to order by. */ | |
1324 PropertyReference property; | |
1325 | |
1326 PropertyOrder(); | |
1327 | |
1328 PropertyOrder.fromJson(core.Map _json) { | |
1329 if (_json.containsKey("direction")) { | |
1330 direction = _json["direction"]; | |
1331 } | |
1332 if (_json.containsKey("property")) { | |
1333 property = new PropertyReference.fromJson(_json["property"]); | |
1334 } | |
1335 } | |
1336 | |
1337 core.Map toJson() { | |
1338 var _json = new core.Map(); | |
1339 if (direction != null) { | |
1340 _json["direction"] = direction; | |
1341 } | |
1342 if (property != null) { | |
1343 _json["property"] = (property).toJson(); | |
1344 } | |
1345 return _json; | |
1346 } | |
1347 } | |
1348 | |
1349 /** A reference to a property relative to the kind expressions. */ | |
1350 class PropertyReference { | |
1351 /** The name of the property. */ | |
1352 core.String name; | |
1353 | |
1354 PropertyReference(); | |
1355 | |
1356 PropertyReference.fromJson(core.Map _json) { | |
1357 if (_json.containsKey("name")) { | |
1358 name = _json["name"]; | |
1359 } | |
1360 } | |
1361 | |
1362 core.Map toJson() { | |
1363 var _json = new core.Map(); | |
1364 if (name != null) { | |
1365 _json["name"] = name; | |
1366 } | |
1367 return _json; | |
1368 } | |
1369 } | |
1370 | |
1371 /** A query. */ | |
1372 class Query { | |
1373 /** | |
1374 * An ending point for the query results. Optional. Query cursors are returned | |
1375 * in query result batches. | |
1376 */ | |
1377 core.String endCursor; | |
1378 core.List<core.int> get endCursorAsBytes { | |
1379 return convert.BASE64.decode(endCursor); | |
1380 } | |
1381 | |
1382 void set endCursorAsBytes(core.List<core.int> _bytes) { | |
1383 endCursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+
", "-"); | |
1384 } | |
1385 /** The filter to apply (optional). */ | |
1386 Filter filter; | |
1387 /** | |
1388 * The properties to group by (if empty, no grouping is applied to the result | |
1389 * set). | |
1390 */ | |
1391 core.List<PropertyReference> groupBy; | |
1392 /** The kinds to query (if empty, returns entities from all kinds). */ | |
1393 core.List<KindExpression> kinds; | |
1394 /** | |
1395 * The maximum number of results to return. Applies after all other | |
1396 * constraints. Optional. | |
1397 */ | |
1398 core.int limit; | |
1399 /** | |
1400 * The number of results to skip. Applies before limit, but after all other | |
1401 * constraints (optional, defaults to 0). | |
1402 */ | |
1403 core.int offset; | |
1404 /** | |
1405 * The order to apply to the query results (if empty, order is unspecified). | |
1406 */ | |
1407 core.List<PropertyOrder> order; | |
1408 /** The projection to return. If not set the entire entity is returned. */ | |
1409 core.List<PropertyExpression> projection; | |
1410 /** | |
1411 * A starting point for the query results. Optional. Query cursors are | |
1412 * returned in query result batches. | |
1413 */ | |
1414 core.String startCursor; | |
1415 core.List<core.int> get startCursorAsBytes { | |
1416 return convert.BASE64.decode(startCursor); | |
1417 } | |
1418 | |
1419 void set startCursorAsBytes(core.List<core.int> _bytes) { | |
1420 startCursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
1421 } | |
1422 | |
1423 Query(); | |
1424 | |
1425 Query.fromJson(core.Map _json) { | |
1426 if (_json.containsKey("endCursor")) { | |
1427 endCursor = _json["endCursor"]; | |
1428 } | |
1429 if (_json.containsKey("filter")) { | |
1430 filter = new Filter.fromJson(_json["filter"]); | |
1431 } | |
1432 if (_json.containsKey("groupBy")) { | |
1433 groupBy = _json["groupBy"].map((value) => new PropertyReference.fromJson(v
alue)).toList(); | |
1434 } | |
1435 if (_json.containsKey("kinds")) { | |
1436 kinds = _json["kinds"].map((value) => new KindExpression.fromJson(value)).
toList(); | |
1437 } | |
1438 if (_json.containsKey("limit")) { | |
1439 limit = _json["limit"]; | |
1440 } | |
1441 if (_json.containsKey("offset")) { | |
1442 offset = _json["offset"]; | |
1443 } | |
1444 if (_json.containsKey("order")) { | |
1445 order = _json["order"].map((value) => new PropertyOrder.fromJson(value)).t
oList(); | |
1446 } | |
1447 if (_json.containsKey("projection")) { | |
1448 projection = _json["projection"].map((value) => new PropertyExpression.fro
mJson(value)).toList(); | |
1449 } | |
1450 if (_json.containsKey("startCursor")) { | |
1451 startCursor = _json["startCursor"]; | |
1452 } | |
1453 } | |
1454 | |
1455 core.Map toJson() { | |
1456 var _json = new core.Map(); | |
1457 if (endCursor != null) { | |
1458 _json["endCursor"] = endCursor; | |
1459 } | |
1460 if (filter != null) { | |
1461 _json["filter"] = (filter).toJson(); | |
1462 } | |
1463 if (groupBy != null) { | |
1464 _json["groupBy"] = groupBy.map((value) => (value).toJson()).toList(); | |
1465 } | |
1466 if (kinds != null) { | |
1467 _json["kinds"] = kinds.map((value) => (value).toJson()).toList(); | |
1468 } | |
1469 if (limit != null) { | |
1470 _json["limit"] = limit; | |
1471 } | |
1472 if (offset != null) { | |
1473 _json["offset"] = offset; | |
1474 } | |
1475 if (order != null) { | |
1476 _json["order"] = order.map((value) => (value).toJson()).toList(); | |
1477 } | |
1478 if (projection != null) { | |
1479 _json["projection"] = projection.map((value) => (value).toJson()).toList()
; | |
1480 } | |
1481 if (startCursor != null) { | |
1482 _json["startCursor"] = startCursor; | |
1483 } | |
1484 return _json; | |
1485 } | |
1486 } | |
1487 | |
1488 /** A batch of results produced by a query. */ | |
1489 class QueryResultBatch { | |
1490 /** | |
1491 * A cursor that points to the position after the last result in the batch. | |
1492 * May be absent. TODO(arfuller): Once all plans produce cursors update | |
1493 * documentation here. | |
1494 */ | |
1495 core.String endCursor; | |
1496 core.List<core.int> get endCursorAsBytes { | |
1497 return convert.BASE64.decode(endCursor); | |
1498 } | |
1499 | |
1500 void set endCursorAsBytes(core.List<core.int> _bytes) { | |
1501 endCursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+
", "-"); | |
1502 } | |
1503 /** | |
1504 * The result type for every entity in entityResults. full for full entities, | |
1505 * projection for entities with only projected properties, keyOnly for | |
1506 * entities with only a key. | |
1507 * Possible string values are: | |
1508 * - "FULL" | |
1509 * - "KEY_ONLY" | |
1510 * - "PROJECTION" | |
1511 */ | |
1512 core.String entityResultType; | |
1513 /** The results for this batch. */ | |
1514 core.List<EntityResult> entityResults; | |
1515 /** | |
1516 * The state of the query after the current batch. One of notFinished, | |
1517 * moreResultsAfterLimit, noMoreResults. | |
1518 * Possible string values are: | |
1519 * - "MORE_RESULTS_AFTER_LIMIT" | |
1520 * - "NOT_FINISHED" | |
1521 * - "NO_MORE_RESULTS" | |
1522 */ | |
1523 core.String moreResults; | |
1524 /** The number of results skipped because of Query.offset. */ | |
1525 core.int skippedResults; | |
1526 | |
1527 QueryResultBatch(); | |
1528 | |
1529 QueryResultBatch.fromJson(core.Map _json) { | |
1530 if (_json.containsKey("endCursor")) { | |
1531 endCursor = _json["endCursor"]; | |
1532 } | |
1533 if (_json.containsKey("entityResultType")) { | |
1534 entityResultType = _json["entityResultType"]; | |
1535 } | |
1536 if (_json.containsKey("entityResults")) { | |
1537 entityResults = _json["entityResults"].map((value) => new EntityResult.fro
mJson(value)).toList(); | |
1538 } | |
1539 if (_json.containsKey("moreResults")) { | |
1540 moreResults = _json["moreResults"]; | |
1541 } | |
1542 if (_json.containsKey("skippedResults")) { | |
1543 skippedResults = _json["skippedResults"]; | |
1544 } | |
1545 } | |
1546 | |
1547 core.Map toJson() { | |
1548 var _json = new core.Map(); | |
1549 if (endCursor != null) { | |
1550 _json["endCursor"] = endCursor; | |
1551 } | |
1552 if (entityResultType != null) { | |
1553 _json["entityResultType"] = entityResultType; | |
1554 } | |
1555 if (entityResults != null) { | |
1556 _json["entityResults"] = entityResults.map((value) => (value).toJson()).to
List(); | |
1557 } | |
1558 if (moreResults != null) { | |
1559 _json["moreResults"] = moreResults; | |
1560 } | |
1561 if (skippedResults != null) { | |
1562 _json["skippedResults"] = skippedResults; | |
1563 } | |
1564 return _json; | |
1565 } | |
1566 } | |
1567 | |
1568 class ReadOptions { | |
1569 /** | |
1570 * The read consistency to use. One of default, strong, or eventual. Cannot be | |
1571 * set when transaction is set. Lookup and ancestor queries default to strong, | |
1572 * global queries default to eventual and cannot be set to strong. Optional. | |
1573 * Default is default. | |
1574 * Possible string values are: | |
1575 * - "DEFAULT" | |
1576 * - "EVENTUAL" | |
1577 * - "STRONG" | |
1578 */ | |
1579 core.String readConsistency; | |
1580 /** The transaction to use. Optional. */ | |
1581 core.String transaction; | |
1582 core.List<core.int> get transactionAsBytes { | |
1583 return convert.BASE64.decode(transaction); | |
1584 } | |
1585 | |
1586 void set transactionAsBytes(core.List<core.int> _bytes) { | |
1587 transaction = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
1588 } | |
1589 | |
1590 ReadOptions(); | |
1591 | |
1592 ReadOptions.fromJson(core.Map _json) { | |
1593 if (_json.containsKey("readConsistency")) { | |
1594 readConsistency = _json["readConsistency"]; | |
1595 } | |
1596 if (_json.containsKey("transaction")) { | |
1597 transaction = _json["transaction"]; | |
1598 } | |
1599 } | |
1600 | |
1601 core.Map toJson() { | |
1602 var _json = new core.Map(); | |
1603 if (readConsistency != null) { | |
1604 _json["readConsistency"] = readConsistency; | |
1605 } | |
1606 if (transaction != null) { | |
1607 _json["transaction"] = transaction; | |
1608 } | |
1609 return _json; | |
1610 } | |
1611 } | |
1612 | |
1613 class ResponseHeader { | |
1614 /** | |
1615 * Identifies what kind of resource this is. Value: the fixed string | |
1616 * "datastore#responseHeader". | |
1617 */ | |
1618 core.String kind; | |
1619 | |
1620 ResponseHeader(); | |
1621 | |
1622 ResponseHeader.fromJson(core.Map _json) { | |
1623 if (_json.containsKey("kind")) { | |
1624 kind = _json["kind"]; | |
1625 } | |
1626 } | |
1627 | |
1628 core.Map toJson() { | |
1629 var _json = new core.Map(); | |
1630 if (kind != null) { | |
1631 _json["kind"] = kind; | |
1632 } | |
1633 return _json; | |
1634 } | |
1635 } | |
1636 | |
1637 class RollbackRequest { | |
1638 /** The transaction identifier, returned by a call to beginTransaction. */ | |
1639 core.String transaction; | |
1640 core.List<core.int> get transactionAsBytes { | |
1641 return convert.BASE64.decode(transaction); | |
1642 } | |
1643 | |
1644 void set transactionAsBytes(core.List<core.int> _bytes) { | |
1645 transaction = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
1646 } | |
1647 | |
1648 RollbackRequest(); | |
1649 | |
1650 RollbackRequest.fromJson(core.Map _json) { | |
1651 if (_json.containsKey("transaction")) { | |
1652 transaction = _json["transaction"]; | |
1653 } | |
1654 } | |
1655 | |
1656 core.Map toJson() { | |
1657 var _json = new core.Map(); | |
1658 if (transaction != null) { | |
1659 _json["transaction"] = transaction; | |
1660 } | |
1661 return _json; | |
1662 } | |
1663 } | |
1664 | |
1665 class RollbackResponse { | |
1666 ResponseHeader header; | |
1667 | |
1668 RollbackResponse(); | |
1669 | |
1670 RollbackResponse.fromJson(core.Map _json) { | |
1671 if (_json.containsKey("header")) { | |
1672 header = new ResponseHeader.fromJson(_json["header"]); | |
1673 } | |
1674 } | |
1675 | |
1676 core.Map toJson() { | |
1677 var _json = new core.Map(); | |
1678 if (header != null) { | |
1679 _json["header"] = (header).toJson(); | |
1680 } | |
1681 return _json; | |
1682 } | |
1683 } | |
1684 | |
1685 class RunQueryRequest { | |
1686 /** | |
1687 * The GQL query to run. Either this field or field query must be set, but not | |
1688 * both. | |
1689 */ | |
1690 GqlQuery gqlQuery; | |
1691 /** | |
1692 * Entities are partitioned into subsets, identified by a dataset (usually | |
1693 * implicitly specified by the project) and namespace ID. Queries are scoped | |
1694 * to a single partition. This partition ID is normalized with the standard | |
1695 * default context partition ID, but all other partition IDs in | |
1696 * RunQueryRequest are normalized with this partition ID as the context | |
1697 * partition ID. | |
1698 */ | |
1699 PartitionId partitionId; | |
1700 /** | |
1701 * The query to run. Either this field or field gql_query must be set, but not | |
1702 * both. | |
1703 */ | |
1704 Query query; | |
1705 /** The options for this query. */ | |
1706 ReadOptions readOptions; | |
1707 | |
1708 RunQueryRequest(); | |
1709 | |
1710 RunQueryRequest.fromJson(core.Map _json) { | |
1711 if (_json.containsKey("gqlQuery")) { | |
1712 gqlQuery = new GqlQuery.fromJson(_json["gqlQuery"]); | |
1713 } | |
1714 if (_json.containsKey("partitionId")) { | |
1715 partitionId = new PartitionId.fromJson(_json["partitionId"]); | |
1716 } | |
1717 if (_json.containsKey("query")) { | |
1718 query = new Query.fromJson(_json["query"]); | |
1719 } | |
1720 if (_json.containsKey("readOptions")) { | |
1721 readOptions = new ReadOptions.fromJson(_json["readOptions"]); | |
1722 } | |
1723 } | |
1724 | |
1725 core.Map toJson() { | |
1726 var _json = new core.Map(); | |
1727 if (gqlQuery != null) { | |
1728 _json["gqlQuery"] = (gqlQuery).toJson(); | |
1729 } | |
1730 if (partitionId != null) { | |
1731 _json["partitionId"] = (partitionId).toJson(); | |
1732 } | |
1733 if (query != null) { | |
1734 _json["query"] = (query).toJson(); | |
1735 } | |
1736 if (readOptions != null) { | |
1737 _json["readOptions"] = (readOptions).toJson(); | |
1738 } | |
1739 return _json; | |
1740 } | |
1741 } | |
1742 | |
1743 class RunQueryResponse { | |
1744 /** A batch of query results (always present). */ | |
1745 QueryResultBatch batch; | |
1746 ResponseHeader header; | |
1747 | |
1748 RunQueryResponse(); | |
1749 | |
1750 RunQueryResponse.fromJson(core.Map _json) { | |
1751 if (_json.containsKey("batch")) { | |
1752 batch = new QueryResultBatch.fromJson(_json["batch"]); | |
1753 } | |
1754 if (_json.containsKey("header")) { | |
1755 header = new ResponseHeader.fromJson(_json["header"]); | |
1756 } | |
1757 } | |
1758 | |
1759 core.Map toJson() { | |
1760 var _json = new core.Map(); | |
1761 if (batch != null) { | |
1762 _json["batch"] = (batch).toJson(); | |
1763 } | |
1764 if (header != null) { | |
1765 _json["header"] = (header).toJson(); | |
1766 } | |
1767 return _json; | |
1768 } | |
1769 } | |
1770 | |
1771 /** | |
1772 * A message that can hold any of the supported value types and associated | |
1773 * metadata. | |
1774 */ | |
1775 class Value { | |
1776 /** A blob key value. */ | |
1777 core.String blobKeyValue; | |
1778 /** | |
1779 * A blob value. May be a maximum of 1,000,000 bytes. When indexed is true, | |
1780 * may have at most 500 bytes. | |
1781 */ | |
1782 core.String blobValue; | |
1783 core.List<core.int> get blobValueAsBytes { | |
1784 return convert.BASE64.decode(blobValue); | |
1785 } | |
1786 | |
1787 void set blobValueAsBytes(core.List<core.int> _bytes) { | |
1788 blobValue = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+
", "-"); | |
1789 } | |
1790 /** A boolean value. */ | |
1791 core.bool booleanValue; | |
1792 /** A timestamp value. */ | |
1793 core.DateTime dateTimeValue; | |
1794 /** A double value. */ | |
1795 core.double doubleValue; | |
1796 /** | |
1797 * An entity value. May have no key. May have a key with an incomplete key | |
1798 * path. May have a reserved/read-only key. | |
1799 */ | |
1800 Entity entityValue; | |
1801 /** | |
1802 * If the value should be indexed. | |
1803 * | |
1804 * The indexed property may be set for a null value. When indexed is true, | |
1805 * stringValue is limited to 500 characters and the blob value is limited to | |
1806 * 500 bytes. Input values by default have indexed set to true; however, you | |
1807 * can explicitly set indexed to true if you want. (An output value never has | |
1808 * indexed explicitly set to true.) If a value is itself an entity, it cannot | |
1809 * have indexed set to true. | |
1810 */ | |
1811 core.bool indexed; | |
1812 /** An integer value. */ | |
1813 core.String integerValue; | |
1814 /** A key value. */ | |
1815 Key keyValue; | |
1816 /** | |
1817 * A list value. Cannot contain another list value. A Value instance that sets | |
1818 * field list_value must not set field meaning or field indexed. | |
1819 */ | |
1820 core.List<Value> listValue; | |
1821 /** The meaning field is reserved and should not be used. */ | |
1822 core.int meaning; | |
1823 /** | |
1824 * A UTF-8 encoded string value. When indexed is true, may have at most 500 | |
1825 * characters. | |
1826 */ | |
1827 core.String stringValue; | |
1828 | |
1829 Value(); | |
1830 | |
1831 Value.fromJson(core.Map _json) { | |
1832 if (_json.containsKey("blobKeyValue")) { | |
1833 blobKeyValue = _json["blobKeyValue"]; | |
1834 } | |
1835 if (_json.containsKey("blobValue")) { | |
1836 blobValue = _json["blobValue"]; | |
1837 } | |
1838 if (_json.containsKey("booleanValue")) { | |
1839 booleanValue = _json["booleanValue"]; | |
1840 } | |
1841 if (_json.containsKey("dateTimeValue")) { | |
1842 dateTimeValue = core.DateTime.parse(_json["dateTimeValue"]); | |
1843 } | |
1844 if (_json.containsKey("doubleValue")) { | |
1845 doubleValue = _json["doubleValue"]; | |
1846 } | |
1847 if (_json.containsKey("entityValue")) { | |
1848 entityValue = new Entity.fromJson(_json["entityValue"]); | |
1849 } | |
1850 if (_json.containsKey("indexed")) { | |
1851 indexed = _json["indexed"]; | |
1852 } | |
1853 if (_json.containsKey("integerValue")) { | |
1854 integerValue = _json["integerValue"]; | |
1855 } | |
1856 if (_json.containsKey("keyValue")) { | |
1857 keyValue = new Key.fromJson(_json["keyValue"]); | |
1858 } | |
1859 if (_json.containsKey("listValue")) { | |
1860 listValue = _json["listValue"].map((value) => new Value.fromJson(value)).t
oList(); | |
1861 } | |
1862 if (_json.containsKey("meaning")) { | |
1863 meaning = _json["meaning"]; | |
1864 } | |
1865 if (_json.containsKey("stringValue")) { | |
1866 stringValue = _json["stringValue"]; | |
1867 } | |
1868 } | |
1869 | |
1870 core.Map toJson() { | |
1871 var _json = new core.Map(); | |
1872 if (blobKeyValue != null) { | |
1873 _json["blobKeyValue"] = blobKeyValue; | |
1874 } | |
1875 if (blobValue != null) { | |
1876 _json["blobValue"] = blobValue; | |
1877 } | |
1878 if (booleanValue != null) { | |
1879 _json["booleanValue"] = booleanValue; | |
1880 } | |
1881 if (dateTimeValue != null) { | |
1882 _json["dateTimeValue"] = (dateTimeValue).toIso8601String(); | |
1883 } | |
1884 if (doubleValue != null) { | |
1885 _json["doubleValue"] = doubleValue; | |
1886 } | |
1887 if (entityValue != null) { | |
1888 _json["entityValue"] = (entityValue).toJson(); | |
1889 } | |
1890 if (indexed != null) { | |
1891 _json["indexed"] = indexed; | |
1892 } | |
1893 if (integerValue != null) { | |
1894 _json["integerValue"] = integerValue; | |
1895 } | |
1896 if (keyValue != null) { | |
1897 _json["keyValue"] = (keyValue).toJson(); | |
1898 } | |
1899 if (listValue != null) { | |
1900 _json["listValue"] = listValue.map((value) => (value).toJson()).toList(); | |
1901 } | |
1902 if (meaning != null) { | |
1903 _json["meaning"] = meaning; | |
1904 } | |
1905 if (stringValue != null) { | |
1906 _json["stringValue"] = stringValue; | |
1907 } | |
1908 return _json; | |
1909 } | |
1910 } | |
OLD | NEW |