| OLD | NEW |
| (Empty) |
| 1 // This is a generated file (see the discoveryapis_generator project). | |
| 2 | |
| 3 library googleapis_beta.datastore.v1beta3; | |
| 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/v1beta3'; | |
| 16 | |
| 17 /** | |
| 18 * Accesses the schemaless NoSQL database to provide fully managed, robust, | |
| 19 * scalable storage for your application. | |
| 20 */ | |
| 21 class DatastoreApi { | |
| 22 /** View and manage your data across Google Cloud Platform services */ | |
| 23 static const CloudPlatformScope = "https://www.googleapis.com/auth/cloud-platf
orm"; | |
| 24 | |
| 25 /** View and manage your Google Cloud Datastore data */ | |
| 26 static const DatastoreScope = "https://www.googleapis.com/auth/datastore"; | |
| 27 | |
| 28 | |
| 29 final commons.ApiRequester _requester; | |
| 30 | |
| 31 ProjectsResourceApi get projects => new ProjectsResourceApi(_requester); | |
| 32 | |
| 33 DatastoreApi(http.Client client, {core.String rootUrl: "https://datastore.goog
leapis.com/", core.String servicePath: ""}) : | |
| 34 _requester = new commons.ApiRequester(client, rootUrl, servicePath, USER_A
GENT); | |
| 35 } | |
| 36 | |
| 37 | |
| 38 class ProjectsResourceApi { | |
| 39 final commons.ApiRequester _requester; | |
| 40 | |
| 41 ProjectsResourceApi(commons.ApiRequester client) : | |
| 42 _requester = client; | |
| 43 | |
| 44 /** | |
| 45 * Allocates IDs for the given keys, which is useful for referencing an entity | |
| 46 * before it is inserted. | |
| 47 * | |
| 48 * [request] - The metadata request object. | |
| 49 * | |
| 50 * Request parameters: | |
| 51 * | |
| 52 * [projectId] - The ID of the project against which to make the request. | |
| 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 projectId) { | |
| 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 (projectId == null) { | |
| 74 throw new core.ArgumentError("Parameter projectId is required."); | |
| 75 } | |
| 76 | |
| 77 _url = 'v1beta3/projects/' + commons.Escaper.ecapeVariable('$projectId') + '
: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 * Begins a new transaction. | |
| 91 * | |
| 92 * [request] - The metadata request object. | |
| 93 * | |
| 94 * Request parameters: | |
| 95 * | |
| 96 * [projectId] - The ID of the project against which to make the request. | |
| 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 projectId) { | |
| 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 (projectId == null) { | |
| 118 throw new core.ArgumentError("Parameter projectId is required."); | |
| 119 } | |
| 120 | |
| 121 _url = 'v1beta3/projects/' + commons.Escaper.ecapeVariable('$projectId') + '
: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 * Commits a transaction, optionally creating, deleting or modifying some | |
| 135 * entities. | |
| 136 * | |
| 137 * [request] - The metadata request object. | |
| 138 * | |
| 139 * Request parameters: | |
| 140 * | |
| 141 * [projectId] - The ID of the project against which to make the request. | |
| 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 project
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 (projectId == null) { | |
| 163 throw new core.ArgumentError("Parameter projectId is required."); | |
| 164 } | |
| 165 | |
| 166 _url = 'v1beta3/projects/' + commons.Escaper.ecapeVariable('$projectId') + '
: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 * Looks up entities by key. | |
| 180 * | |
| 181 * [request] - The metadata request object. | |
| 182 * | |
| 183 * Request parameters: | |
| 184 * | |
| 185 * [projectId] - The ID of the project against which to make the request. | |
| 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 project
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 (projectId == null) { | |
| 207 throw new core.ArgumentError("Parameter projectId is required."); | |
| 208 } | |
| 209 | |
| 210 _url = 'v1beta3/projects/' + commons.Escaper.ecapeVariable('$projectId') + '
: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 * Rolls back a transaction. | |
| 224 * | |
| 225 * [request] - The metadata request object. | |
| 226 * | |
| 227 * Request parameters: | |
| 228 * | |
| 229 * [projectId] - The ID of the project against which to make the request. | |
| 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 p
rojectId) { | |
| 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 (projectId == null) { | |
| 251 throw new core.ArgumentError("Parameter projectId is required."); | |
| 252 } | |
| 253 | |
| 254 _url = 'v1beta3/projects/' + commons.Escaper.ecapeVariable('$projectId') + '
: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 * Queries for entities. | |
| 268 * | |
| 269 * [request] - The metadata request object. | |
| 270 * | |
| 271 * Request parameters: | |
| 272 * | |
| 273 * [projectId] - The ID of the project against which to make the request. | |
| 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 p
rojectId) { | |
| 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 (projectId == null) { | |
| 295 throw new core.ArgumentError("Parameter projectId is required."); | |
| 296 } | |
| 297 | |
| 298 _url = 'v1beta3/projects/' + commons.Escaper.ecapeVariable('$projectId') + '
: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 /** The request for Datastore.AllocateIds. */ | |
| 315 class AllocateIdsRequest { | |
| 316 /** | |
| 317 * A list of keys with incomplete key paths for which to allocate IDs. | |
| 318 * No key may be reserved/read-only. | |
| 319 */ | |
| 320 core.List<Key> keys; | |
| 321 | |
| 322 AllocateIdsRequest(); | |
| 323 | |
| 324 AllocateIdsRequest.fromJson(core.Map _json) { | |
| 325 if (_json.containsKey("keys")) { | |
| 326 keys = _json["keys"].map((value) => new Key.fromJson(value)).toList(); | |
| 327 } | |
| 328 } | |
| 329 | |
| 330 core.Map toJson() { | |
| 331 var _json = new core.Map(); | |
| 332 if (keys != null) { | |
| 333 _json["keys"] = keys.map((value) => (value).toJson()).toList(); | |
| 334 } | |
| 335 return _json; | |
| 336 } | |
| 337 } | |
| 338 | |
| 339 /** The response for Datastore.AllocateIds. */ | |
| 340 class AllocateIdsResponse { | |
| 341 /** | |
| 342 * The keys specified in the request (in the same order), each with | |
| 343 * its key path completed with a newly allocated ID. | |
| 344 */ | |
| 345 core.List<Key> keys; | |
| 346 | |
| 347 AllocateIdsResponse(); | |
| 348 | |
| 349 AllocateIdsResponse.fromJson(core.Map _json) { | |
| 350 if (_json.containsKey("keys")) { | |
| 351 keys = _json["keys"].map((value) => new Key.fromJson(value)).toList(); | |
| 352 } | |
| 353 } | |
| 354 | |
| 355 core.Map toJson() { | |
| 356 var _json = new core.Map(); | |
| 357 if (keys != null) { | |
| 358 _json["keys"] = keys.map((value) => (value).toJson()).toList(); | |
| 359 } | |
| 360 return _json; | |
| 361 } | |
| 362 } | |
| 363 | |
| 364 /** An array value. */ | |
| 365 class ArrayValue { | |
| 366 /** | |
| 367 * Values in the array. | |
| 368 * The order of this array may not be preserved if it contains a mix of | |
| 369 * indexed and unindexed values. | |
| 370 */ | |
| 371 core.List<Value> values; | |
| 372 | |
| 373 ArrayValue(); | |
| 374 | |
| 375 ArrayValue.fromJson(core.Map _json) { | |
| 376 if (_json.containsKey("values")) { | |
| 377 values = _json["values"].map((value) => new Value.fromJson(value)).toList(
); | |
| 378 } | |
| 379 } | |
| 380 | |
| 381 core.Map toJson() { | |
| 382 var _json = new core.Map(); | |
| 383 if (values != null) { | |
| 384 _json["values"] = values.map((value) => (value).toJson()).toList(); | |
| 385 } | |
| 386 return _json; | |
| 387 } | |
| 388 } | |
| 389 | |
| 390 /** The request for Datastore.BeginTransaction. */ | |
| 391 class BeginTransactionRequest { | |
| 392 | |
| 393 BeginTransactionRequest(); | |
| 394 | |
| 395 BeginTransactionRequest.fromJson(core.Map _json) { | |
| 396 } | |
| 397 | |
| 398 core.Map toJson() { | |
| 399 var _json = new core.Map(); | |
| 400 return _json; | |
| 401 } | |
| 402 } | |
| 403 | |
| 404 /** The response for Datastore.BeginTransaction. */ | |
| 405 class BeginTransactionResponse { | |
| 406 /** The transaction identifier (always present). */ | |
| 407 core.String transaction; | |
| 408 core.List<core.int> get transactionAsBytes { | |
| 409 return convert.BASE64.decode(transaction); | |
| 410 } | |
| 411 | |
| 412 void set transactionAsBytes(core.List<core.int> _bytes) { | |
| 413 transaction = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
| 414 } | |
| 415 | |
| 416 BeginTransactionResponse(); | |
| 417 | |
| 418 BeginTransactionResponse.fromJson(core.Map _json) { | |
| 419 if (_json.containsKey("transaction")) { | |
| 420 transaction = _json["transaction"]; | |
| 421 } | |
| 422 } | |
| 423 | |
| 424 core.Map toJson() { | |
| 425 var _json = new core.Map(); | |
| 426 if (transaction != null) { | |
| 427 _json["transaction"] = transaction; | |
| 428 } | |
| 429 return _json; | |
| 430 } | |
| 431 } | |
| 432 | |
| 433 /** The request for Datastore.Commit. */ | |
| 434 class CommitRequest { | |
| 435 /** | |
| 436 * The type of commit to perform. Defaults to `TRANSACTIONAL`. | |
| 437 * Possible string values are: | |
| 438 * - "MODE_UNSPECIFIED" : Unspecified. This value must not be used. | |
| 439 * - "TRANSACTIONAL" : Transactional: The mutations are either all applied, or | |
| 440 * none are applied. | |
| 441 * Learn about transactions | |
| 442 * [here](https://cloud.google.com/datastore/docs/concepts/transactions). | |
| 443 * - "NON_TRANSACTIONAL" : Non-transactional: The mutations may not apply as | |
| 444 * all or none. | |
| 445 */ | |
| 446 core.String mode; | |
| 447 /** | |
| 448 * The mutations to perform. | |
| 449 * | |
| 450 * When mode is `TRANSACTIONAL`, mutations affecting a single entity are | |
| 451 * applied in order. The following sequences of mutations affecting a single | |
| 452 * entity are not permitted in a single `Commit` request: | |
| 453 * | |
| 454 * - `insert` followed by `insert` | |
| 455 * - `update` followed by `insert` | |
| 456 * - `upsert` followed by `insert` | |
| 457 * - `delete` followed by `update` | |
| 458 * | |
| 459 * When mode is `NON_TRANSACTIONAL`, no two mutations may affect a single | |
| 460 * entity. | |
| 461 */ | |
| 462 core.List<Mutation> mutations; | |
| 463 /** | |
| 464 * The identifier of the transaction associated with the commit. A | |
| 465 * transaction identifier is returned by a call to | |
| 466 * Datastore.BeginTransaction. | |
| 467 */ | |
| 468 core.String transaction; | |
| 469 core.List<core.int> get transactionAsBytes { | |
| 470 return convert.BASE64.decode(transaction); | |
| 471 } | |
| 472 | |
| 473 void set transactionAsBytes(core.List<core.int> _bytes) { | |
| 474 transaction = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
| 475 } | |
| 476 | |
| 477 CommitRequest(); | |
| 478 | |
| 479 CommitRequest.fromJson(core.Map _json) { | |
| 480 if (_json.containsKey("mode")) { | |
| 481 mode = _json["mode"]; | |
| 482 } | |
| 483 if (_json.containsKey("mutations")) { | |
| 484 mutations = _json["mutations"].map((value) => new Mutation.fromJson(value)
).toList(); | |
| 485 } | |
| 486 if (_json.containsKey("transaction")) { | |
| 487 transaction = _json["transaction"]; | |
| 488 } | |
| 489 } | |
| 490 | |
| 491 core.Map toJson() { | |
| 492 var _json = new core.Map(); | |
| 493 if (mode != null) { | |
| 494 _json["mode"] = mode; | |
| 495 } | |
| 496 if (mutations != null) { | |
| 497 _json["mutations"] = mutations.map((value) => (value).toJson()).toList(); | |
| 498 } | |
| 499 if (transaction != null) { | |
| 500 _json["transaction"] = transaction; | |
| 501 } | |
| 502 return _json; | |
| 503 } | |
| 504 } | |
| 505 | |
| 506 /** The response for Datastore.Commit. */ | |
| 507 class CommitResponse { | |
| 508 /** | |
| 509 * The number of index entries updated during the commit, or zero if none were | |
| 510 * updated. | |
| 511 */ | |
| 512 core.int indexUpdates; | |
| 513 /** | |
| 514 * The result of performing the mutations. | |
| 515 * The i-th mutation result corresponds to the i-th mutation in the request. | |
| 516 */ | |
| 517 core.List<MutationResult> mutationResults; | |
| 518 | |
| 519 CommitResponse(); | |
| 520 | |
| 521 CommitResponse.fromJson(core.Map _json) { | |
| 522 if (_json.containsKey("indexUpdates")) { | |
| 523 indexUpdates = _json["indexUpdates"]; | |
| 524 } | |
| 525 if (_json.containsKey("mutationResults")) { | |
| 526 mutationResults = _json["mutationResults"].map((value) => new MutationResu
lt.fromJson(value)).toList(); | |
| 527 } | |
| 528 } | |
| 529 | |
| 530 core.Map toJson() { | |
| 531 var _json = new core.Map(); | |
| 532 if (indexUpdates != null) { | |
| 533 _json["indexUpdates"] = indexUpdates; | |
| 534 } | |
| 535 if (mutationResults != null) { | |
| 536 _json["mutationResults"] = mutationResults.map((value) => (value).toJson()
).toList(); | |
| 537 } | |
| 538 return _json; | |
| 539 } | |
| 540 } | |
| 541 | |
| 542 /** A filter that merges multiple other filters using the given operator. */ | |
| 543 class CompositeFilter { | |
| 544 /** | |
| 545 * The list of filters to combine. | |
| 546 * Must contain at least one filter. | |
| 547 */ | |
| 548 core.List<Filter> filters; | |
| 549 /** | |
| 550 * The operator for combining multiple filters. | |
| 551 * Possible string values are: | |
| 552 * - "OPERATOR_UNSPECIFIED" : Unspecified. This value must not be used. | |
| 553 * - "AND" : The results are required to satisfy each of the combined filters. | |
| 554 */ | |
| 555 core.String op; | |
| 556 | |
| 557 CompositeFilter(); | |
| 558 | |
| 559 CompositeFilter.fromJson(core.Map _json) { | |
| 560 if (_json.containsKey("filters")) { | |
| 561 filters = _json["filters"].map((value) => new Filter.fromJson(value)).toLi
st(); | |
| 562 } | |
| 563 if (_json.containsKey("op")) { | |
| 564 op = _json["op"]; | |
| 565 } | |
| 566 } | |
| 567 | |
| 568 core.Map toJson() { | |
| 569 var _json = new core.Map(); | |
| 570 if (filters != null) { | |
| 571 _json["filters"] = filters.map((value) => (value).toJson()).toList(); | |
| 572 } | |
| 573 if (op != null) { | |
| 574 _json["op"] = op; | |
| 575 } | |
| 576 return _json; | |
| 577 } | |
| 578 } | |
| 579 | |
| 580 /** | |
| 581 * A Datastore data object. | |
| 582 * | |
| 583 * An entity is limited to 1 megabyte when stored. That _roughly_ | |
| 584 * corresponds to a limit of 1 megabyte for the serialized form of this | |
| 585 * message. | |
| 586 */ | |
| 587 class Entity { | |
| 588 /** | |
| 589 * The entity's key. | |
| 590 * | |
| 591 * An entity must have a key, unless otherwise documented (for example, | |
| 592 * an entity in `Value.entity_value` may have no key). | |
| 593 * An entity's kind is its key path's last element's kind, | |
| 594 * or null if it has no key. | |
| 595 */ | |
| 596 Key key; | |
| 597 /** | |
| 598 * The entity's properties. | |
| 599 * The map's keys are property names. | |
| 600 * A property name matching regex `__.*__` is reserved. | |
| 601 * A reserved property name is forbidden in certain documented contexts. | |
| 602 * The name must not contain more than 500 characters. | |
| 603 * The name cannot be `""`. | |
| 604 */ | |
| 605 core.Map<core.String, Value> properties; | |
| 606 | |
| 607 Entity(); | |
| 608 | |
| 609 Entity.fromJson(core.Map _json) { | |
| 610 if (_json.containsKey("key")) { | |
| 611 key = new Key.fromJson(_json["key"]); | |
| 612 } | |
| 613 if (_json.containsKey("properties")) { | |
| 614 properties = commons.mapMap(_json["properties"], (item) => new Value.fromJ
son(item)); | |
| 615 } | |
| 616 } | |
| 617 | |
| 618 core.Map toJson() { | |
| 619 var _json = new core.Map(); | |
| 620 if (key != null) { | |
| 621 _json["key"] = (key).toJson(); | |
| 622 } | |
| 623 if (properties != null) { | |
| 624 _json["properties"] = commons.mapMap(properties, (item) => (item).toJson()
); | |
| 625 } | |
| 626 return _json; | |
| 627 } | |
| 628 } | |
| 629 | |
| 630 /** The result of fetching an entity from Datastore. */ | |
| 631 class EntityResult { | |
| 632 /** | |
| 633 * A cursor that points to the position after the result entity. | |
| 634 * Set only when the `EntityResult` is part of a `QueryResultBatch` message. | |
| 635 */ | |
| 636 core.String cursor; | |
| 637 core.List<core.int> get cursorAsBytes { | |
| 638 return convert.BASE64.decode(cursor); | |
| 639 } | |
| 640 | |
| 641 void set cursorAsBytes(core.List<core.int> _bytes) { | |
| 642 cursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+",
"-"); | |
| 643 } | |
| 644 /** The resulting entity. */ | |
| 645 Entity entity; | |
| 646 /** | |
| 647 * The version of the entity, a strictly positive number that monotonically | |
| 648 * increases with changes to the entity. | |
| 649 * | |
| 650 * This field is set for `FULL` entity | |
| 651 * results. | |
| 652 * | |
| 653 * For missing entities in `LookupResponse`, this | |
| 654 * is the version of the snapshot that was used to look up the entity, and it | |
| 655 * is always set except for eventually consistent reads. | |
| 656 */ | |
| 657 core.String version; | |
| 658 | |
| 659 EntityResult(); | |
| 660 | |
| 661 EntityResult.fromJson(core.Map _json) { | |
| 662 if (_json.containsKey("cursor")) { | |
| 663 cursor = _json["cursor"]; | |
| 664 } | |
| 665 if (_json.containsKey("entity")) { | |
| 666 entity = new Entity.fromJson(_json["entity"]); | |
| 667 } | |
| 668 if (_json.containsKey("version")) { | |
| 669 version = _json["version"]; | |
| 670 } | |
| 671 } | |
| 672 | |
| 673 core.Map toJson() { | |
| 674 var _json = new core.Map(); | |
| 675 if (cursor != null) { | |
| 676 _json["cursor"] = cursor; | |
| 677 } | |
| 678 if (entity != null) { | |
| 679 _json["entity"] = (entity).toJson(); | |
| 680 } | |
| 681 if (version != null) { | |
| 682 _json["version"] = version; | |
| 683 } | |
| 684 return _json; | |
| 685 } | |
| 686 } | |
| 687 | |
| 688 /** A holder for any type of filter. */ | |
| 689 class Filter { | |
| 690 /** A composite filter. */ | |
| 691 CompositeFilter compositeFilter; | |
| 692 /** A filter on a property. */ | |
| 693 PropertyFilter propertyFilter; | |
| 694 | |
| 695 Filter(); | |
| 696 | |
| 697 Filter.fromJson(core.Map _json) { | |
| 698 if (_json.containsKey("compositeFilter")) { | |
| 699 compositeFilter = new CompositeFilter.fromJson(_json["compositeFilter"]); | |
| 700 } | |
| 701 if (_json.containsKey("propertyFilter")) { | |
| 702 propertyFilter = new PropertyFilter.fromJson(_json["propertyFilter"]); | |
| 703 } | |
| 704 } | |
| 705 | |
| 706 core.Map toJson() { | |
| 707 var _json = new core.Map(); | |
| 708 if (compositeFilter != null) { | |
| 709 _json["compositeFilter"] = (compositeFilter).toJson(); | |
| 710 } | |
| 711 if (propertyFilter != null) { | |
| 712 _json["propertyFilter"] = (propertyFilter).toJson(); | |
| 713 } | |
| 714 return _json; | |
| 715 } | |
| 716 } | |
| 717 | |
| 718 /** | |
| 719 * A [GQL | |
| 720 * query](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). | |
| 721 */ | |
| 722 class GqlQuery { | |
| 723 /** | |
| 724 * When false, the query string must not contain any literals and instead must | |
| 725 * bind all values. For example, | |
| 726 * `SELECT * FROM Kind WHERE a = 'string literal'` is not allowed, while | |
| 727 * `SELECT * FROM Kind WHERE a = @value` is. | |
| 728 */ | |
| 729 core.bool allowLiterals; | |
| 730 /** | |
| 731 * For each non-reserved named binding site in the query string, there must be | |
| 732 * a named parameter with that name, but not necessarily the inverse. | |
| 733 * | |
| 734 * Key must match regex `A-Za-z_$*`, must not match regex | |
| 735 * `__.*__`, and must not be `""`. | |
| 736 */ | |
| 737 core.Map<core.String, GqlQueryParameter> namedBindings; | |
| 738 /** | |
| 739 * Numbered binding site @1 references the first numbered parameter, | |
| 740 * effectively using 1-based indexing, rather than the usual 0. | |
| 741 * | |
| 742 * For each binding site numbered i in `query_string`, there must be an i-th | |
| 743 * numbered parameter. The inverse must also be true. | |
| 744 */ | |
| 745 core.List<GqlQueryParameter> positionalBindings; | |
| 746 /** | |
| 747 * A string of the format described | |
| 748 * [here](https://cloud.google.com/datastore/docs/apis/gql/gql_reference). | |
| 749 */ | |
| 750 core.String queryString; | |
| 751 | |
| 752 GqlQuery(); | |
| 753 | |
| 754 GqlQuery.fromJson(core.Map _json) { | |
| 755 if (_json.containsKey("allowLiterals")) { | |
| 756 allowLiterals = _json["allowLiterals"]; | |
| 757 } | |
| 758 if (_json.containsKey("namedBindings")) { | |
| 759 namedBindings = commons.mapMap(_json["namedBindings"], (item) => new GqlQu
eryParameter.fromJson(item)); | |
| 760 } | |
| 761 if (_json.containsKey("positionalBindings")) { | |
| 762 positionalBindings = _json["positionalBindings"].map((value) => new GqlQue
ryParameter.fromJson(value)).toList(); | |
| 763 } | |
| 764 if (_json.containsKey("queryString")) { | |
| 765 queryString = _json["queryString"]; | |
| 766 } | |
| 767 } | |
| 768 | |
| 769 core.Map toJson() { | |
| 770 var _json = new core.Map(); | |
| 771 if (allowLiterals != null) { | |
| 772 _json["allowLiterals"] = allowLiterals; | |
| 773 } | |
| 774 if (namedBindings != null) { | |
| 775 _json["namedBindings"] = commons.mapMap(namedBindings, (item) => (item).to
Json()); | |
| 776 } | |
| 777 if (positionalBindings != null) { | |
| 778 _json["positionalBindings"] = positionalBindings.map((value) => (value).to
Json()).toList(); | |
| 779 } | |
| 780 if (queryString != null) { | |
| 781 _json["queryString"] = queryString; | |
| 782 } | |
| 783 return _json; | |
| 784 } | |
| 785 } | |
| 786 | |
| 787 /** A binding parameter for a GQL query. */ | |
| 788 class GqlQueryParameter { | |
| 789 /** | |
| 790 * A query cursor. Query cursors are returned in query | |
| 791 * result batches. | |
| 792 */ | |
| 793 core.String cursor; | |
| 794 core.List<core.int> get cursorAsBytes { | |
| 795 return convert.BASE64.decode(cursor); | |
| 796 } | |
| 797 | |
| 798 void set cursorAsBytes(core.List<core.int> _bytes) { | |
| 799 cursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+",
"-"); | |
| 800 } | |
| 801 /** A value parameter. */ | |
| 802 Value value; | |
| 803 | |
| 804 GqlQueryParameter(); | |
| 805 | |
| 806 GqlQueryParameter.fromJson(core.Map _json) { | |
| 807 if (_json.containsKey("cursor")) { | |
| 808 cursor = _json["cursor"]; | |
| 809 } | |
| 810 if (_json.containsKey("value")) { | |
| 811 value = new Value.fromJson(_json["value"]); | |
| 812 } | |
| 813 } | |
| 814 | |
| 815 core.Map toJson() { | |
| 816 var _json = new core.Map(); | |
| 817 if (cursor != null) { | |
| 818 _json["cursor"] = cursor; | |
| 819 } | |
| 820 if (value != null) { | |
| 821 _json["value"] = (value).toJson(); | |
| 822 } | |
| 823 return _json; | |
| 824 } | |
| 825 } | |
| 826 | |
| 827 /** | |
| 828 * A unique identifier for an entity. | |
| 829 * If a key's partition ID or any of its path kinds or names are | |
| 830 * reserved/read-only, the key is reserved/read-only. | |
| 831 * A reserved/read-only key is forbidden in certain documented contexts. | |
| 832 */ | |
| 833 class Key { | |
| 834 /** | |
| 835 * Entities are partitioned into subsets, currently identified by a project | |
| 836 * ID and namespace ID. | |
| 837 * Queries are scoped to a single partition. | |
| 838 */ | |
| 839 PartitionId partitionId; | |
| 840 /** | |
| 841 * The entity path. | |
| 842 * An entity path consists of one or more elements composed of a kind and a | |
| 843 * string or numerical identifier, which identify entities. The first | |
| 844 * element identifies a _root entity_, the second element identifies | |
| 845 * a _child_ of the root entity, the third element identifies a child of the | |
| 846 * second entity, and so forth. The entities identified by all prefixes of | |
| 847 * the path are called the element's _ancestors_. | |
| 848 * | |
| 849 * An entity path is always fully complete: *all* of the entity's ancestors | |
| 850 * are required to be in the path along with the entity identifier itself. | |
| 851 * The only exception is that in some documented cases, the identifier in the | |
| 852 * last path element (for the entity) itself may be omitted. For example, | |
| 853 * the last path element of the key of `Mutation.insert` may have no | |
| 854 * identifier. | |
| 855 * | |
| 856 * A path can never be empty, and a path can have at most 100 elements. | |
| 857 */ | |
| 858 core.List<PathElement> path; | |
| 859 | |
| 860 Key(); | |
| 861 | |
| 862 Key.fromJson(core.Map _json) { | |
| 863 if (_json.containsKey("partitionId")) { | |
| 864 partitionId = new PartitionId.fromJson(_json["partitionId"]); | |
| 865 } | |
| 866 if (_json.containsKey("path")) { | |
| 867 path = _json["path"].map((value) => new PathElement.fromJson(value)).toLis
t(); | |
| 868 } | |
| 869 } | |
| 870 | |
| 871 core.Map toJson() { | |
| 872 var _json = new core.Map(); | |
| 873 if (partitionId != null) { | |
| 874 _json["partitionId"] = (partitionId).toJson(); | |
| 875 } | |
| 876 if (path != null) { | |
| 877 _json["path"] = path.map((value) => (value).toJson()).toList(); | |
| 878 } | |
| 879 return _json; | |
| 880 } | |
| 881 } | |
| 882 | |
| 883 /** A representation of a kind. */ | |
| 884 class KindExpression { | |
| 885 /** The name of the kind. */ | |
| 886 core.String name; | |
| 887 | |
| 888 KindExpression(); | |
| 889 | |
| 890 KindExpression.fromJson(core.Map _json) { | |
| 891 if (_json.containsKey("name")) { | |
| 892 name = _json["name"]; | |
| 893 } | |
| 894 } | |
| 895 | |
| 896 core.Map toJson() { | |
| 897 var _json = new core.Map(); | |
| 898 if (name != null) { | |
| 899 _json["name"] = name; | |
| 900 } | |
| 901 return _json; | |
| 902 } | |
| 903 } | |
| 904 | |
| 905 /** | |
| 906 * An object representing a latitude/longitude pair. This is expressed as a pair | |
| 907 * of doubles representing degrees latitude and degrees longitude. Unless | |
| 908 * specified otherwise, this must conform to the | |
| 909 * <a href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84 | |
| 910 * standard</a>. Values must be within normalized ranges. | |
| 911 * | |
| 912 * Example of normalization code in Python: | |
| 913 * | |
| 914 * def NormalizeLongitude(longitude): | |
| 915 * """Wraps decimal degrees longitude to [-180.0, 180.0].""" | |
| 916 * q, r = divmod(longitude, 360.0) | |
| 917 * if r > 180.0 or (r == 180.0 and q <= -1.0): | |
| 918 * return r - 360.0 | |
| 919 * return r | |
| 920 * | |
| 921 * def NormalizeLatLng(latitude, longitude): | |
| 922 * """Wraps decimal degrees latitude and longitude to | |
| 923 * [-90.0, 90.0] and [-180.0, 180.0], respectively.""" | |
| 924 * r = latitude % 360.0 | |
| 925 * if r <= 90.0: | |
| 926 * return r, NormalizeLongitude(longitude) | |
| 927 * elif r >= 270.0: | |
| 928 * return r - 360, NormalizeLongitude(longitude) | |
| 929 * else: | |
| 930 * return 180 - r, NormalizeLongitude(longitude + 180.0) | |
| 931 * | |
| 932 * assert 180.0 == NormalizeLongitude(180.0) | |
| 933 * assert -180.0 == NormalizeLongitude(-180.0) | |
| 934 * assert -179.0 == NormalizeLongitude(181.0) | |
| 935 * assert (0.0, 0.0) == NormalizeLatLng(360.0, 0.0) | |
| 936 * assert (0.0, 0.0) == NormalizeLatLng(-360.0, 0.0) | |
| 937 * assert (85.0, 180.0) == NormalizeLatLng(95.0, 0.0) | |
| 938 * assert (-85.0, -170.0) == NormalizeLatLng(-95.0, 10.0) | |
| 939 * assert (90.0, 10.0) == NormalizeLatLng(90.0, 10.0) | |
| 940 * assert (-90.0, -10.0) == NormalizeLatLng(-90.0, -10.0) | |
| 941 * assert (0.0, -170.0) == NormalizeLatLng(-180.0, 10.0) | |
| 942 * assert (0.0, -170.0) == NormalizeLatLng(180.0, 10.0) | |
| 943 * assert (-90.0, 10.0) == NormalizeLatLng(270.0, 10.0) | |
| 944 * assert (90.0, 10.0) == NormalizeLatLng(-270.0, 10.0) | |
| 945 * | |
| 946 * The code in logs/storage/validator/logs_validator_traits.cc treats this type | |
| 947 * as if it were annotated as ST_LOCATION. | |
| 948 */ | |
| 949 class LatLng { | |
| 950 /** The latitude in degrees. It must be in the range [-90.0, +90.0]. */ | |
| 951 core.double latitude; | |
| 952 /** The longitude in degrees. It must be in the range [-180.0, +180.0]. */ | |
| 953 core.double longitude; | |
| 954 | |
| 955 LatLng(); | |
| 956 | |
| 957 LatLng.fromJson(core.Map _json) { | |
| 958 if (_json.containsKey("latitude")) { | |
| 959 latitude = _json["latitude"]; | |
| 960 } | |
| 961 if (_json.containsKey("longitude")) { | |
| 962 longitude = _json["longitude"]; | |
| 963 } | |
| 964 } | |
| 965 | |
| 966 core.Map toJson() { | |
| 967 var _json = new core.Map(); | |
| 968 if (latitude != null) { | |
| 969 _json["latitude"] = latitude; | |
| 970 } | |
| 971 if (longitude != null) { | |
| 972 _json["longitude"] = longitude; | |
| 973 } | |
| 974 return _json; | |
| 975 } | |
| 976 } | |
| 977 | |
| 978 /** The request for Datastore.Lookup. */ | |
| 979 class LookupRequest { | |
| 980 /** Keys of entities to look up. */ | |
| 981 core.List<Key> keys; | |
| 982 /** The options for this lookup request. */ | |
| 983 ReadOptions readOptions; | |
| 984 | |
| 985 LookupRequest(); | |
| 986 | |
| 987 LookupRequest.fromJson(core.Map _json) { | |
| 988 if (_json.containsKey("keys")) { | |
| 989 keys = _json["keys"].map((value) => new Key.fromJson(value)).toList(); | |
| 990 } | |
| 991 if (_json.containsKey("readOptions")) { | |
| 992 readOptions = new ReadOptions.fromJson(_json["readOptions"]); | |
| 993 } | |
| 994 } | |
| 995 | |
| 996 core.Map toJson() { | |
| 997 var _json = new core.Map(); | |
| 998 if (keys != null) { | |
| 999 _json["keys"] = keys.map((value) => (value).toJson()).toList(); | |
| 1000 } | |
| 1001 if (readOptions != null) { | |
| 1002 _json["readOptions"] = (readOptions).toJson(); | |
| 1003 } | |
| 1004 return _json; | |
| 1005 } | |
| 1006 } | |
| 1007 | |
| 1008 /** The response for Datastore.Lookup. */ | |
| 1009 class LookupResponse { | |
| 1010 /** | |
| 1011 * A list of keys that were not looked up due to resource constraints. The | |
| 1012 * order of results in this field is undefined and has no relation to the | |
| 1013 * order of the keys in the input. | |
| 1014 */ | |
| 1015 core.List<Key> deferred; | |
| 1016 /** | |
| 1017 * Entities found as `ResultType.FULL` entities. The order of results in this | |
| 1018 * field is undefined and has no relation to the order of the keys in the | |
| 1019 * input. | |
| 1020 */ | |
| 1021 core.List<EntityResult> found; | |
| 1022 /** | |
| 1023 * Entities not found as `ResultType.KEY_ONLY` entities. The order of results | |
| 1024 * in this field is undefined and has no relation to the order of the keys | |
| 1025 * in the input. | |
| 1026 */ | |
| 1027 core.List<EntityResult> missing; | |
| 1028 | |
| 1029 LookupResponse(); | |
| 1030 | |
| 1031 LookupResponse.fromJson(core.Map _json) { | |
| 1032 if (_json.containsKey("deferred")) { | |
| 1033 deferred = _json["deferred"].map((value) => new Key.fromJson(value)).toLis
t(); | |
| 1034 } | |
| 1035 if (_json.containsKey("found")) { | |
| 1036 found = _json["found"].map((value) => new EntityResult.fromJson(value)).to
List(); | |
| 1037 } | |
| 1038 if (_json.containsKey("missing")) { | |
| 1039 missing = _json["missing"].map((value) => new EntityResult.fromJson(value)
).toList(); | |
| 1040 } | |
| 1041 } | |
| 1042 | |
| 1043 core.Map toJson() { | |
| 1044 var _json = new core.Map(); | |
| 1045 if (deferred != null) { | |
| 1046 _json["deferred"] = deferred.map((value) => (value).toJson()).toList(); | |
| 1047 } | |
| 1048 if (found != null) { | |
| 1049 _json["found"] = found.map((value) => (value).toJson()).toList(); | |
| 1050 } | |
| 1051 if (missing != null) { | |
| 1052 _json["missing"] = missing.map((value) => (value).toJson()).toList(); | |
| 1053 } | |
| 1054 return _json; | |
| 1055 } | |
| 1056 } | |
| 1057 | |
| 1058 /** A mutation to apply to an entity. */ | |
| 1059 class Mutation { | |
| 1060 /** | |
| 1061 * The version of the entity that this mutation is being applied to. If this | |
| 1062 * does not match the current version on the server, the mutation conflicts. | |
| 1063 */ | |
| 1064 core.String baseVersion; | |
| 1065 /** | |
| 1066 * The key of the entity to delete. The entity may or may not already exist. | |
| 1067 * Must have a complete key path and must not be reserved/read-only. | |
| 1068 */ | |
| 1069 Key delete; | |
| 1070 /** | |
| 1071 * The entity to insert. The entity must not already exist. | |
| 1072 * The entity key's final path element may be incomplete. | |
| 1073 */ | |
| 1074 Entity insert; | |
| 1075 /** | |
| 1076 * The entity to update. The entity must already exist. | |
| 1077 * Must have a complete key path. | |
| 1078 */ | |
| 1079 Entity update; | |
| 1080 /** | |
| 1081 * The entity to upsert. The entity may or may not already exist. | |
| 1082 * The entity key's final path element may be incomplete. | |
| 1083 */ | |
| 1084 Entity upsert; | |
| 1085 | |
| 1086 Mutation(); | |
| 1087 | |
| 1088 Mutation.fromJson(core.Map _json) { | |
| 1089 if (_json.containsKey("baseVersion")) { | |
| 1090 baseVersion = _json["baseVersion"]; | |
| 1091 } | |
| 1092 if (_json.containsKey("delete")) { | |
| 1093 delete = new Key.fromJson(_json["delete"]); | |
| 1094 } | |
| 1095 if (_json.containsKey("insert")) { | |
| 1096 insert = new Entity.fromJson(_json["insert"]); | |
| 1097 } | |
| 1098 if (_json.containsKey("update")) { | |
| 1099 update = new Entity.fromJson(_json["update"]); | |
| 1100 } | |
| 1101 if (_json.containsKey("upsert")) { | |
| 1102 upsert = new Entity.fromJson(_json["upsert"]); | |
| 1103 } | |
| 1104 } | |
| 1105 | |
| 1106 core.Map toJson() { | |
| 1107 var _json = new core.Map(); | |
| 1108 if (baseVersion != null) { | |
| 1109 _json["baseVersion"] = baseVersion; | |
| 1110 } | |
| 1111 if (delete != null) { | |
| 1112 _json["delete"] = (delete).toJson(); | |
| 1113 } | |
| 1114 if (insert != null) { | |
| 1115 _json["insert"] = (insert).toJson(); | |
| 1116 } | |
| 1117 if (update != null) { | |
| 1118 _json["update"] = (update).toJson(); | |
| 1119 } | |
| 1120 if (upsert != null) { | |
| 1121 _json["upsert"] = (upsert).toJson(); | |
| 1122 } | |
| 1123 return _json; | |
| 1124 } | |
| 1125 } | |
| 1126 | |
| 1127 /** The result of applying a mutation. */ | |
| 1128 class MutationResult { | |
| 1129 /** | |
| 1130 * Whether a conflict was detected for this mutation. Always false when a | |
| 1131 * conflict detection strategy field is not set in the mutation. | |
| 1132 */ | |
| 1133 core.bool conflictDetected; | |
| 1134 /** | |
| 1135 * The automatically allocated key. | |
| 1136 * Set only when the mutation allocated a key. | |
| 1137 */ | |
| 1138 Key key; | |
| 1139 /** | |
| 1140 * The version of the entity on the server after processing the mutation. If | |
| 1141 * the mutation doesn't change anything on the server, then the version will | |
| 1142 * be the version of the current entity or, if no entity is present, a version | |
| 1143 * that is strictly greater than the version of any previous entity and less | |
| 1144 * than the version of any possible future entity. | |
| 1145 */ | |
| 1146 core.String version; | |
| 1147 | |
| 1148 MutationResult(); | |
| 1149 | |
| 1150 MutationResult.fromJson(core.Map _json) { | |
| 1151 if (_json.containsKey("conflictDetected")) { | |
| 1152 conflictDetected = _json["conflictDetected"]; | |
| 1153 } | |
| 1154 if (_json.containsKey("key")) { | |
| 1155 key = new Key.fromJson(_json["key"]); | |
| 1156 } | |
| 1157 if (_json.containsKey("version")) { | |
| 1158 version = _json["version"]; | |
| 1159 } | |
| 1160 } | |
| 1161 | |
| 1162 core.Map toJson() { | |
| 1163 var _json = new core.Map(); | |
| 1164 if (conflictDetected != null) { | |
| 1165 _json["conflictDetected"] = conflictDetected; | |
| 1166 } | |
| 1167 if (key != null) { | |
| 1168 _json["key"] = (key).toJson(); | |
| 1169 } | |
| 1170 if (version != null) { | |
| 1171 _json["version"] = version; | |
| 1172 } | |
| 1173 return _json; | |
| 1174 } | |
| 1175 } | |
| 1176 | |
| 1177 /** | |
| 1178 * A partition ID identifies a grouping of entities. The grouping is always | |
| 1179 * by project and namespace, however the namespace ID may be empty. | |
| 1180 * | |
| 1181 * A partition ID contains several dimensions: | |
| 1182 * project ID and namespace ID. | |
| 1183 * | |
| 1184 * Partition dimensions: | |
| 1185 * | |
| 1186 * - May be `""`. | |
| 1187 * - Must be valid UTF-8 bytes. | |
| 1188 * - Must have values that match regex `[A-Za-z\d\.\-_]{1,100}` | |
| 1189 * If the value of any dimension matches regex `__.*__`, the partition is | |
| 1190 * reserved/read-only. | |
| 1191 * A reserved/read-only partition ID is forbidden in certain documented | |
| 1192 * contexts. | |
| 1193 * | |
| 1194 * Foreign partition IDs (in which the project ID does | |
| 1195 * not match the context project ID ) are discouraged. | |
| 1196 * Reads and writes of foreign partition IDs may fail if the project is not in | |
| 1197 * an active state. | |
| 1198 */ | |
| 1199 class PartitionId { | |
| 1200 /** If not empty, the ID of the namespace to which the entities belong. */ | |
| 1201 core.String namespaceId; | |
| 1202 /** The ID of the project to which the entities belong. */ | |
| 1203 core.String projectId; | |
| 1204 | |
| 1205 PartitionId(); | |
| 1206 | |
| 1207 PartitionId.fromJson(core.Map _json) { | |
| 1208 if (_json.containsKey("namespaceId")) { | |
| 1209 namespaceId = _json["namespaceId"]; | |
| 1210 } | |
| 1211 if (_json.containsKey("projectId")) { | |
| 1212 projectId = _json["projectId"]; | |
| 1213 } | |
| 1214 } | |
| 1215 | |
| 1216 core.Map toJson() { | |
| 1217 var _json = new core.Map(); | |
| 1218 if (namespaceId != null) { | |
| 1219 _json["namespaceId"] = namespaceId; | |
| 1220 } | |
| 1221 if (projectId != null) { | |
| 1222 _json["projectId"] = projectId; | |
| 1223 } | |
| 1224 return _json; | |
| 1225 } | |
| 1226 } | |
| 1227 | |
| 1228 /** | |
| 1229 * A (kind, ID/name) pair used to construct a key path. | |
| 1230 * | |
| 1231 * If either name or ID is set, the element is complete. | |
| 1232 * If neither is set, the element is incomplete. | |
| 1233 */ | |
| 1234 class PathElement { | |
| 1235 /** | |
| 1236 * The auto-allocated ID of the entity. | |
| 1237 * Never equal to zero. Values less than zero are discouraged and may not | |
| 1238 * be supported in the future. | |
| 1239 */ | |
| 1240 core.String id; | |
| 1241 /** | |
| 1242 * The kind of the entity. | |
| 1243 * A kind matching regex `__.*__` is reserved/read-only. | |
| 1244 * A kind must not contain more than 1500 bytes when UTF-8 encoded. | |
| 1245 * Cannot be `""`. | |
| 1246 */ | |
| 1247 core.String kind; | |
| 1248 /** | |
| 1249 * The name of the entity. | |
| 1250 * A name matching regex `__.*__` is reserved/read-only. | |
| 1251 * A name must not be more than 1500 bytes when UTF-8 encoded. | |
| 1252 * Cannot be `""`. | |
| 1253 */ | |
| 1254 core.String name; | |
| 1255 | |
| 1256 PathElement(); | |
| 1257 | |
| 1258 PathElement.fromJson(core.Map _json) { | |
| 1259 if (_json.containsKey("id")) { | |
| 1260 id = _json["id"]; | |
| 1261 } | |
| 1262 if (_json.containsKey("kind")) { | |
| 1263 kind = _json["kind"]; | |
| 1264 } | |
| 1265 if (_json.containsKey("name")) { | |
| 1266 name = _json["name"]; | |
| 1267 } | |
| 1268 } | |
| 1269 | |
| 1270 core.Map toJson() { | |
| 1271 var _json = new core.Map(); | |
| 1272 if (id != null) { | |
| 1273 _json["id"] = id; | |
| 1274 } | |
| 1275 if (kind != null) { | |
| 1276 _json["kind"] = kind; | |
| 1277 } | |
| 1278 if (name != null) { | |
| 1279 _json["name"] = name; | |
| 1280 } | |
| 1281 return _json; | |
| 1282 } | |
| 1283 } | |
| 1284 | |
| 1285 /** A representation of a property in a projection. */ | |
| 1286 class Projection { | |
| 1287 /** The property to project. */ | |
| 1288 PropertyReference property; | |
| 1289 | |
| 1290 Projection(); | |
| 1291 | |
| 1292 Projection.fromJson(core.Map _json) { | |
| 1293 if (_json.containsKey("property")) { | |
| 1294 property = new PropertyReference.fromJson(_json["property"]); | |
| 1295 } | |
| 1296 } | |
| 1297 | |
| 1298 core.Map toJson() { | |
| 1299 var _json = new core.Map(); | |
| 1300 if (property != null) { | |
| 1301 _json["property"] = (property).toJson(); | |
| 1302 } | |
| 1303 return _json; | |
| 1304 } | |
| 1305 } | |
| 1306 | |
| 1307 /** A filter on a specific property. */ | |
| 1308 class PropertyFilter { | |
| 1309 /** | |
| 1310 * The operator to filter by. | |
| 1311 * Possible string values are: | |
| 1312 * - "OPERATOR_UNSPECIFIED" : Unspecified. This value must not be used. | |
| 1313 * - "LESS_THAN" : Less than. | |
| 1314 * - "LESS_THAN_OR_EQUAL" : Less than or equal. | |
| 1315 * - "GREATER_THAN" : Greater than. | |
| 1316 * - "GREATER_THAN_OR_EQUAL" : Greater than or equal. | |
| 1317 * - "EQUAL" : Equal. | |
| 1318 * - "HAS_ANCESTOR" : Has ancestor. | |
| 1319 */ | |
| 1320 core.String op; | |
| 1321 /** The property to filter by. */ | |
| 1322 PropertyReference property; | |
| 1323 /** The value to compare the property to. */ | |
| 1324 Value value; | |
| 1325 | |
| 1326 PropertyFilter(); | |
| 1327 | |
| 1328 PropertyFilter.fromJson(core.Map _json) { | |
| 1329 if (_json.containsKey("op")) { | |
| 1330 op = _json["op"]; | |
| 1331 } | |
| 1332 if (_json.containsKey("property")) { | |
| 1333 property = new PropertyReference.fromJson(_json["property"]); | |
| 1334 } | |
| 1335 if (_json.containsKey("value")) { | |
| 1336 value = new Value.fromJson(_json["value"]); | |
| 1337 } | |
| 1338 } | |
| 1339 | |
| 1340 core.Map toJson() { | |
| 1341 var _json = new core.Map(); | |
| 1342 if (op != null) { | |
| 1343 _json["op"] = op; | |
| 1344 } | |
| 1345 if (property != null) { | |
| 1346 _json["property"] = (property).toJson(); | |
| 1347 } | |
| 1348 if (value != null) { | |
| 1349 _json["value"] = (value).toJson(); | |
| 1350 } | |
| 1351 return _json; | |
| 1352 } | |
| 1353 } | |
| 1354 | |
| 1355 /** The desired order for a specific property. */ | |
| 1356 class PropertyOrder { | |
| 1357 /** | |
| 1358 * The direction to order by. Defaults to `ASCENDING`. | |
| 1359 * Possible string values are: | |
| 1360 * - "DIRECTION_UNSPECIFIED" : Unspecified. This value must not be used. | |
| 1361 * - "ASCENDING" : Ascending. | |
| 1362 * - "DESCENDING" : Descending. | |
| 1363 */ | |
| 1364 core.String direction; | |
| 1365 /** The property to order by. */ | |
| 1366 PropertyReference property; | |
| 1367 | |
| 1368 PropertyOrder(); | |
| 1369 | |
| 1370 PropertyOrder.fromJson(core.Map _json) { | |
| 1371 if (_json.containsKey("direction")) { | |
| 1372 direction = _json["direction"]; | |
| 1373 } | |
| 1374 if (_json.containsKey("property")) { | |
| 1375 property = new PropertyReference.fromJson(_json["property"]); | |
| 1376 } | |
| 1377 } | |
| 1378 | |
| 1379 core.Map toJson() { | |
| 1380 var _json = new core.Map(); | |
| 1381 if (direction != null) { | |
| 1382 _json["direction"] = direction; | |
| 1383 } | |
| 1384 if (property != null) { | |
| 1385 _json["property"] = (property).toJson(); | |
| 1386 } | |
| 1387 return _json; | |
| 1388 } | |
| 1389 } | |
| 1390 | |
| 1391 /** A reference to a property relative to the kind expressions. */ | |
| 1392 class PropertyReference { | |
| 1393 /** | |
| 1394 * The name of the property. | |
| 1395 * If name includes "."s, it may be interpreted as a property name path. | |
| 1396 */ | |
| 1397 core.String name; | |
| 1398 | |
| 1399 PropertyReference(); | |
| 1400 | |
| 1401 PropertyReference.fromJson(core.Map _json) { | |
| 1402 if (_json.containsKey("name")) { | |
| 1403 name = _json["name"]; | |
| 1404 } | |
| 1405 } | |
| 1406 | |
| 1407 core.Map toJson() { | |
| 1408 var _json = new core.Map(); | |
| 1409 if (name != null) { | |
| 1410 _json["name"] = name; | |
| 1411 } | |
| 1412 return _json; | |
| 1413 } | |
| 1414 } | |
| 1415 | |
| 1416 /** A query for entities. */ | |
| 1417 class Query { | |
| 1418 /** | |
| 1419 * The properties to make distinct. The query results will contain the first | |
| 1420 * result for each distinct combination of values for the given properties | |
| 1421 * (if empty, all results are returned). | |
| 1422 */ | |
| 1423 core.List<PropertyReference> distinctOn; | |
| 1424 /** | |
| 1425 * An ending point for the query results. Query cursors are | |
| 1426 * returned in query result batches and | |
| 1427 * [can only be used to limit the same | |
| 1428 * query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_lim
its_and_offsets). | |
| 1429 */ | |
| 1430 core.String endCursor; | |
| 1431 core.List<core.int> get endCursorAsBytes { | |
| 1432 return convert.BASE64.decode(endCursor); | |
| 1433 } | |
| 1434 | |
| 1435 void set endCursorAsBytes(core.List<core.int> _bytes) { | |
| 1436 endCursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+
", "-"); | |
| 1437 } | |
| 1438 /** The filter to apply. */ | |
| 1439 Filter filter; | |
| 1440 /** | |
| 1441 * The kinds to query (if empty, returns entities of all kinds). | |
| 1442 * Currently at most 1 kind may be specified. | |
| 1443 */ | |
| 1444 core.List<KindExpression> kind; | |
| 1445 /** | |
| 1446 * The maximum number of results to return. Applies after all other | |
| 1447 * constraints. Optional. | |
| 1448 * Unspecified is interpreted as no limit. | |
| 1449 * Must be >= 0 if specified. | |
| 1450 */ | |
| 1451 core.int limit; | |
| 1452 /** | |
| 1453 * The number of results to skip. Applies before limit, but after all other | |
| 1454 * constraints. Optional. Must be >= 0 if specified. | |
| 1455 */ | |
| 1456 core.int offset; | |
| 1457 /** | |
| 1458 * The order to apply to the query results (if empty, order is unspecified). | |
| 1459 */ | |
| 1460 core.List<PropertyOrder> order; | |
| 1461 /** The projection to return. Defaults to returning all properties. */ | |
| 1462 core.List<Projection> projection; | |
| 1463 /** | |
| 1464 * A starting point for the query results. Query cursors are | |
| 1465 * returned in query result batches and | |
| 1466 * [can only be used to continue the same | |
| 1467 * query](https://cloud.google.com/datastore/docs/concepts/queries#cursors_lim
its_and_offsets). | |
| 1468 */ | |
| 1469 core.String startCursor; | |
| 1470 core.List<core.int> get startCursorAsBytes { | |
| 1471 return convert.BASE64.decode(startCursor); | |
| 1472 } | |
| 1473 | |
| 1474 void set startCursorAsBytes(core.List<core.int> _bytes) { | |
| 1475 startCursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
| 1476 } | |
| 1477 | |
| 1478 Query(); | |
| 1479 | |
| 1480 Query.fromJson(core.Map _json) { | |
| 1481 if (_json.containsKey("distinctOn")) { | |
| 1482 distinctOn = _json["distinctOn"].map((value) => new PropertyReference.from
Json(value)).toList(); | |
| 1483 } | |
| 1484 if (_json.containsKey("endCursor")) { | |
| 1485 endCursor = _json["endCursor"]; | |
| 1486 } | |
| 1487 if (_json.containsKey("filter")) { | |
| 1488 filter = new Filter.fromJson(_json["filter"]); | |
| 1489 } | |
| 1490 if (_json.containsKey("kind")) { | |
| 1491 kind = _json["kind"].map((value) => new KindExpression.fromJson(value)).to
List(); | |
| 1492 } | |
| 1493 if (_json.containsKey("limit")) { | |
| 1494 limit = _json["limit"]; | |
| 1495 } | |
| 1496 if (_json.containsKey("offset")) { | |
| 1497 offset = _json["offset"]; | |
| 1498 } | |
| 1499 if (_json.containsKey("order")) { | |
| 1500 order = _json["order"].map((value) => new PropertyOrder.fromJson(value)).t
oList(); | |
| 1501 } | |
| 1502 if (_json.containsKey("projection")) { | |
| 1503 projection = _json["projection"].map((value) => new Projection.fromJson(va
lue)).toList(); | |
| 1504 } | |
| 1505 if (_json.containsKey("startCursor")) { | |
| 1506 startCursor = _json["startCursor"]; | |
| 1507 } | |
| 1508 } | |
| 1509 | |
| 1510 core.Map toJson() { | |
| 1511 var _json = new core.Map(); | |
| 1512 if (distinctOn != null) { | |
| 1513 _json["distinctOn"] = distinctOn.map((value) => (value).toJson()).toList()
; | |
| 1514 } | |
| 1515 if (endCursor != null) { | |
| 1516 _json["endCursor"] = endCursor; | |
| 1517 } | |
| 1518 if (filter != null) { | |
| 1519 _json["filter"] = (filter).toJson(); | |
| 1520 } | |
| 1521 if (kind != null) { | |
| 1522 _json["kind"] = kind.map((value) => (value).toJson()).toList(); | |
| 1523 } | |
| 1524 if (limit != null) { | |
| 1525 _json["limit"] = limit; | |
| 1526 } | |
| 1527 if (offset != null) { | |
| 1528 _json["offset"] = offset; | |
| 1529 } | |
| 1530 if (order != null) { | |
| 1531 _json["order"] = order.map((value) => (value).toJson()).toList(); | |
| 1532 } | |
| 1533 if (projection != null) { | |
| 1534 _json["projection"] = projection.map((value) => (value).toJson()).toList()
; | |
| 1535 } | |
| 1536 if (startCursor != null) { | |
| 1537 _json["startCursor"] = startCursor; | |
| 1538 } | |
| 1539 return _json; | |
| 1540 } | |
| 1541 } | |
| 1542 | |
| 1543 /** A batch of results produced by a query. */ | |
| 1544 class QueryResultBatch { | |
| 1545 /** | |
| 1546 * A cursor that points to the position after the last result in the batch. | |
| 1547 */ | |
| 1548 core.String endCursor; | |
| 1549 core.List<core.int> get endCursorAsBytes { | |
| 1550 return convert.BASE64.decode(endCursor); | |
| 1551 } | |
| 1552 | |
| 1553 void set endCursorAsBytes(core.List<core.int> _bytes) { | |
| 1554 endCursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+
", "-"); | |
| 1555 } | |
| 1556 /** | |
| 1557 * The result type for every entity in `entity_results`. | |
| 1558 * Possible string values are: | |
| 1559 * - "RESULT_TYPE_UNSPECIFIED" : Unspecified. This value is never used. | |
| 1560 * - "FULL" : The key and properties. | |
| 1561 * - "PROJECTION" : A projected subset of properties. The entity may have no | |
| 1562 * key. | |
| 1563 * - "KEY_ONLY" : Only the key. | |
| 1564 */ | |
| 1565 core.String entityResultType; | |
| 1566 /** The results for this batch. */ | |
| 1567 core.List<EntityResult> entityResults; | |
| 1568 /** | |
| 1569 * The state of the query after the current batch. | |
| 1570 * Possible string values are: | |
| 1571 * - "MORE_RESULTS_TYPE_UNSPECIFIED" : Unspecified. This value is never used. | |
| 1572 * - "NOT_FINISHED" : There may be additional batches to fetch from this | |
| 1573 * query. | |
| 1574 * - "MORE_RESULTS_AFTER_LIMIT" : The query is finished, but there may be more | |
| 1575 * results after the limit. | |
| 1576 * - "MORE_RESULTS_AFTER_CURSOR" : The query is finished, but there may be | |
| 1577 * more results after the end | |
| 1578 * cursor. | |
| 1579 * - "NO_MORE_RESULTS" : The query has been exhausted. | |
| 1580 */ | |
| 1581 core.String moreResults; | |
| 1582 /** | |
| 1583 * A cursor that points to the position after the last skipped result. | |
| 1584 * Will be set when `skipped_results` != 0. | |
| 1585 */ | |
| 1586 core.String skippedCursor; | |
| 1587 core.List<core.int> get skippedCursorAsBytes { | |
| 1588 return convert.BASE64.decode(skippedCursor); | |
| 1589 } | |
| 1590 | |
| 1591 void set skippedCursorAsBytes(core.List<core.int> _bytes) { | |
| 1592 skippedCursor = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAl
l("+", "-"); | |
| 1593 } | |
| 1594 /** The number of results skipped, typically because of an offset. */ | |
| 1595 core.int skippedResults; | |
| 1596 /** | |
| 1597 * The version number of the snapshot this batch was returned from. | |
| 1598 * This applies to the range of results from the query's `start_cursor` (or | |
| 1599 * the beginning of the query if no cursor was given) to this batch's | |
| 1600 * `end_cursor` (not the query's `end_cursor`). | |
| 1601 * | |
| 1602 * In a single transaction, subsequent query result batches for the same query | |
| 1603 * can have a greater snapshot version number. Each batch's snapshot version | |
| 1604 * is valid for all preceding batches. | |
| 1605 * The value will be zero for eventually consistent queries. | |
| 1606 */ | |
| 1607 core.String snapshotVersion; | |
| 1608 | |
| 1609 QueryResultBatch(); | |
| 1610 | |
| 1611 QueryResultBatch.fromJson(core.Map _json) { | |
| 1612 if (_json.containsKey("endCursor")) { | |
| 1613 endCursor = _json["endCursor"]; | |
| 1614 } | |
| 1615 if (_json.containsKey("entityResultType")) { | |
| 1616 entityResultType = _json["entityResultType"]; | |
| 1617 } | |
| 1618 if (_json.containsKey("entityResults")) { | |
| 1619 entityResults = _json["entityResults"].map((value) => new EntityResult.fro
mJson(value)).toList(); | |
| 1620 } | |
| 1621 if (_json.containsKey("moreResults")) { | |
| 1622 moreResults = _json["moreResults"]; | |
| 1623 } | |
| 1624 if (_json.containsKey("skippedCursor")) { | |
| 1625 skippedCursor = _json["skippedCursor"]; | |
| 1626 } | |
| 1627 if (_json.containsKey("skippedResults")) { | |
| 1628 skippedResults = _json["skippedResults"]; | |
| 1629 } | |
| 1630 if (_json.containsKey("snapshotVersion")) { | |
| 1631 snapshotVersion = _json["snapshotVersion"]; | |
| 1632 } | |
| 1633 } | |
| 1634 | |
| 1635 core.Map toJson() { | |
| 1636 var _json = new core.Map(); | |
| 1637 if (endCursor != null) { | |
| 1638 _json["endCursor"] = endCursor; | |
| 1639 } | |
| 1640 if (entityResultType != null) { | |
| 1641 _json["entityResultType"] = entityResultType; | |
| 1642 } | |
| 1643 if (entityResults != null) { | |
| 1644 _json["entityResults"] = entityResults.map((value) => (value).toJson()).to
List(); | |
| 1645 } | |
| 1646 if (moreResults != null) { | |
| 1647 _json["moreResults"] = moreResults; | |
| 1648 } | |
| 1649 if (skippedCursor != null) { | |
| 1650 _json["skippedCursor"] = skippedCursor; | |
| 1651 } | |
| 1652 if (skippedResults != null) { | |
| 1653 _json["skippedResults"] = skippedResults; | |
| 1654 } | |
| 1655 if (snapshotVersion != null) { | |
| 1656 _json["snapshotVersion"] = snapshotVersion; | |
| 1657 } | |
| 1658 return _json; | |
| 1659 } | |
| 1660 } | |
| 1661 | |
| 1662 /** The options shared by read requests. */ | |
| 1663 class ReadOptions { | |
| 1664 /** | |
| 1665 * The non-transactional read consistency to use. | |
| 1666 * Cannot be set to `STRONG` for global queries. | |
| 1667 * Possible string values are: | |
| 1668 * - "READ_CONSISTENCY_UNSPECIFIED" : Unspecified. This value must not be | |
| 1669 * used. | |
| 1670 * - "STRONG" : Strong consistency. | |
| 1671 * - "EVENTUAL" : Eventual consistency. | |
| 1672 */ | |
| 1673 core.String readConsistency; | |
| 1674 /** | |
| 1675 * The identifier of the transaction in which to read. A | |
| 1676 * transaction identifier is returned by a call to | |
| 1677 * Datastore.BeginTransaction. | |
| 1678 */ | |
| 1679 core.String transaction; | |
| 1680 core.List<core.int> get transactionAsBytes { | |
| 1681 return convert.BASE64.decode(transaction); | |
| 1682 } | |
| 1683 | |
| 1684 void set transactionAsBytes(core.List<core.int> _bytes) { | |
| 1685 transaction = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
| 1686 } | |
| 1687 | |
| 1688 ReadOptions(); | |
| 1689 | |
| 1690 ReadOptions.fromJson(core.Map _json) { | |
| 1691 if (_json.containsKey("readConsistency")) { | |
| 1692 readConsistency = _json["readConsistency"]; | |
| 1693 } | |
| 1694 if (_json.containsKey("transaction")) { | |
| 1695 transaction = _json["transaction"]; | |
| 1696 } | |
| 1697 } | |
| 1698 | |
| 1699 core.Map toJson() { | |
| 1700 var _json = new core.Map(); | |
| 1701 if (readConsistency != null) { | |
| 1702 _json["readConsistency"] = readConsistency; | |
| 1703 } | |
| 1704 if (transaction != null) { | |
| 1705 _json["transaction"] = transaction; | |
| 1706 } | |
| 1707 return _json; | |
| 1708 } | |
| 1709 } | |
| 1710 | |
| 1711 /** The request for Datastore.Rollback. */ | |
| 1712 class RollbackRequest { | |
| 1713 /** | |
| 1714 * The transaction identifier, returned by a call to | |
| 1715 * Datastore.BeginTransaction. | |
| 1716 */ | |
| 1717 core.String transaction; | |
| 1718 core.List<core.int> get transactionAsBytes { | |
| 1719 return convert.BASE64.decode(transaction); | |
| 1720 } | |
| 1721 | |
| 1722 void set transactionAsBytes(core.List<core.int> _bytes) { | |
| 1723 transaction = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll(
"+", "-"); | |
| 1724 } | |
| 1725 | |
| 1726 RollbackRequest(); | |
| 1727 | |
| 1728 RollbackRequest.fromJson(core.Map _json) { | |
| 1729 if (_json.containsKey("transaction")) { | |
| 1730 transaction = _json["transaction"]; | |
| 1731 } | |
| 1732 } | |
| 1733 | |
| 1734 core.Map toJson() { | |
| 1735 var _json = new core.Map(); | |
| 1736 if (transaction != null) { | |
| 1737 _json["transaction"] = transaction; | |
| 1738 } | |
| 1739 return _json; | |
| 1740 } | |
| 1741 } | |
| 1742 | |
| 1743 /** | |
| 1744 * The response for Datastore.Rollback. | |
| 1745 * (an empty message). | |
| 1746 */ | |
| 1747 class RollbackResponse { | |
| 1748 | |
| 1749 RollbackResponse(); | |
| 1750 | |
| 1751 RollbackResponse.fromJson(core.Map _json) { | |
| 1752 } | |
| 1753 | |
| 1754 core.Map toJson() { | |
| 1755 var _json = new core.Map(); | |
| 1756 return _json; | |
| 1757 } | |
| 1758 } | |
| 1759 | |
| 1760 /** The request for Datastore.RunQuery. */ | |
| 1761 class RunQueryRequest { | |
| 1762 /** The GQL query to run. */ | |
| 1763 GqlQuery gqlQuery; | |
| 1764 /** | |
| 1765 * Entities are partitioned into subsets, identified by a partition ID. | |
| 1766 * Queries are scoped to a single partition. | |
| 1767 * This partition ID is normalized with the standard default context | |
| 1768 * partition ID. | |
| 1769 */ | |
| 1770 PartitionId partitionId; | |
| 1771 /** The query to run. */ | |
| 1772 Query query; | |
| 1773 /** The options for this query. */ | |
| 1774 ReadOptions readOptions; | |
| 1775 | |
| 1776 RunQueryRequest(); | |
| 1777 | |
| 1778 RunQueryRequest.fromJson(core.Map _json) { | |
| 1779 if (_json.containsKey("gqlQuery")) { | |
| 1780 gqlQuery = new GqlQuery.fromJson(_json["gqlQuery"]); | |
| 1781 } | |
| 1782 if (_json.containsKey("partitionId")) { | |
| 1783 partitionId = new PartitionId.fromJson(_json["partitionId"]); | |
| 1784 } | |
| 1785 if (_json.containsKey("query")) { | |
| 1786 query = new Query.fromJson(_json["query"]); | |
| 1787 } | |
| 1788 if (_json.containsKey("readOptions")) { | |
| 1789 readOptions = new ReadOptions.fromJson(_json["readOptions"]); | |
| 1790 } | |
| 1791 } | |
| 1792 | |
| 1793 core.Map toJson() { | |
| 1794 var _json = new core.Map(); | |
| 1795 if (gqlQuery != null) { | |
| 1796 _json["gqlQuery"] = (gqlQuery).toJson(); | |
| 1797 } | |
| 1798 if (partitionId != null) { | |
| 1799 _json["partitionId"] = (partitionId).toJson(); | |
| 1800 } | |
| 1801 if (query != null) { | |
| 1802 _json["query"] = (query).toJson(); | |
| 1803 } | |
| 1804 if (readOptions != null) { | |
| 1805 _json["readOptions"] = (readOptions).toJson(); | |
| 1806 } | |
| 1807 return _json; | |
| 1808 } | |
| 1809 } | |
| 1810 | |
| 1811 /** The response for Datastore.RunQuery. */ | |
| 1812 class RunQueryResponse { | |
| 1813 /** A batch of query results (always present). */ | |
| 1814 QueryResultBatch batch; | |
| 1815 /** The parsed form of the `GqlQuery` from the request, if it was set. */ | |
| 1816 Query query; | |
| 1817 | |
| 1818 RunQueryResponse(); | |
| 1819 | |
| 1820 RunQueryResponse.fromJson(core.Map _json) { | |
| 1821 if (_json.containsKey("batch")) { | |
| 1822 batch = new QueryResultBatch.fromJson(_json["batch"]); | |
| 1823 } | |
| 1824 if (_json.containsKey("query")) { | |
| 1825 query = new Query.fromJson(_json["query"]); | |
| 1826 } | |
| 1827 } | |
| 1828 | |
| 1829 core.Map toJson() { | |
| 1830 var _json = new core.Map(); | |
| 1831 if (batch != null) { | |
| 1832 _json["batch"] = (batch).toJson(); | |
| 1833 } | |
| 1834 if (query != null) { | |
| 1835 _json["query"] = (query).toJson(); | |
| 1836 } | |
| 1837 return _json; | |
| 1838 } | |
| 1839 } | |
| 1840 | |
| 1841 /** | |
| 1842 * A message that can hold any of the supported value types and associated | |
| 1843 * metadata. | |
| 1844 */ | |
| 1845 class Value { | |
| 1846 /** | |
| 1847 * An array value. | |
| 1848 * Cannot contain another array value. | |
| 1849 * A `Value` instance that sets field `array_value` must not set fields | |
| 1850 * `meaning` or `exclude_from_indexes`. | |
| 1851 */ | |
| 1852 ArrayValue arrayValue; | |
| 1853 /** | |
| 1854 * A blob value. | |
| 1855 * May have at most 1,000,000 bytes. | |
| 1856 * When `exclude_from_indexes` is false, may have at most 1500 bytes. | |
| 1857 * In JSON requests, must be base64-encoded. | |
| 1858 */ | |
| 1859 core.String blobValue; | |
| 1860 core.List<core.int> get blobValueAsBytes { | |
| 1861 return convert.BASE64.decode(blobValue); | |
| 1862 } | |
| 1863 | |
| 1864 void set blobValueAsBytes(core.List<core.int> _bytes) { | |
| 1865 blobValue = convert.BASE64.encode(_bytes).replaceAll("/", "_").replaceAll("+
", "-"); | |
| 1866 } | |
| 1867 /** A boolean value. */ | |
| 1868 core.bool booleanValue; | |
| 1869 /** A double value. */ | |
| 1870 core.double doubleValue; | |
| 1871 /** | |
| 1872 * An entity value. | |
| 1873 * | |
| 1874 * - May have no key. | |
| 1875 * - May have a key with an incomplete key path. | |
| 1876 * - May have a reserved/read-only key. | |
| 1877 */ | |
| 1878 Entity entityValue; | |
| 1879 /** | |
| 1880 * If the value should be excluded from all indexes including those defined | |
| 1881 * explicitly. | |
| 1882 */ | |
| 1883 core.bool excludeFromIndexes; | |
| 1884 /** A geo point value representing a point on the surface of Earth. */ | |
| 1885 LatLng geoPointValue; | |
| 1886 /** An integer value. */ | |
| 1887 core.String integerValue; | |
| 1888 /** A key value. */ | |
| 1889 Key keyValue; | |
| 1890 /** | |
| 1891 * The `meaning` field should only be populated for backwards compatibility. | |
| 1892 */ | |
| 1893 core.int meaning; | |
| 1894 /** | |
| 1895 * A null value. | |
| 1896 * Possible string values are: | |
| 1897 * - "NULL_VALUE" : Null value. | |
| 1898 */ | |
| 1899 core.String nullValue; | |
| 1900 /** | |
| 1901 * A UTF-8 encoded string value. | |
| 1902 * When `exclude_from_indexes` is false (it is indexed) , may have at most | |
| 1903 * 1500 bytes. | |
| 1904 * Otherwise, may be set to at least 1,000,000 bytes. | |
| 1905 */ | |
| 1906 core.String stringValue; | |
| 1907 /** | |
| 1908 * A timestamp value. | |
| 1909 * When stored in the Datastore, precise only to microseconds; | |
| 1910 * any additional precision is rounded down. | |
| 1911 */ | |
| 1912 core.String timestampValue; | |
| 1913 | |
| 1914 Value(); | |
| 1915 | |
| 1916 Value.fromJson(core.Map _json) { | |
| 1917 if (_json.containsKey("arrayValue")) { | |
| 1918 arrayValue = new ArrayValue.fromJson(_json["arrayValue"]); | |
| 1919 } | |
| 1920 if (_json.containsKey("blobValue")) { | |
| 1921 blobValue = _json["blobValue"]; | |
| 1922 } | |
| 1923 if (_json.containsKey("booleanValue")) { | |
| 1924 booleanValue = _json["booleanValue"]; | |
| 1925 } | |
| 1926 if (_json.containsKey("doubleValue")) { | |
| 1927 doubleValue = _json["doubleValue"]; | |
| 1928 } | |
| 1929 if (_json.containsKey("entityValue")) { | |
| 1930 entityValue = new Entity.fromJson(_json["entityValue"]); | |
| 1931 } | |
| 1932 if (_json.containsKey("excludeFromIndexes")) { | |
| 1933 excludeFromIndexes = _json["excludeFromIndexes"]; | |
| 1934 } | |
| 1935 if (_json.containsKey("geoPointValue")) { | |
| 1936 geoPointValue = new LatLng.fromJson(_json["geoPointValue"]); | |
| 1937 } | |
| 1938 if (_json.containsKey("integerValue")) { | |
| 1939 integerValue = _json["integerValue"]; | |
| 1940 } | |
| 1941 if (_json.containsKey("keyValue")) { | |
| 1942 keyValue = new Key.fromJson(_json["keyValue"]); | |
| 1943 } | |
| 1944 if (_json.containsKey("meaning")) { | |
| 1945 meaning = _json["meaning"]; | |
| 1946 } | |
| 1947 if (_json.containsKey("nullValue")) { | |
| 1948 nullValue = _json["nullValue"]; | |
| 1949 } | |
| 1950 if (_json.containsKey("stringValue")) { | |
| 1951 stringValue = _json["stringValue"]; | |
| 1952 } | |
| 1953 if (_json.containsKey("timestampValue")) { | |
| 1954 timestampValue = _json["timestampValue"]; | |
| 1955 } | |
| 1956 } | |
| 1957 | |
| 1958 core.Map toJson() { | |
| 1959 var _json = new core.Map(); | |
| 1960 if (arrayValue != null) { | |
| 1961 _json["arrayValue"] = (arrayValue).toJson(); | |
| 1962 } | |
| 1963 if (blobValue != null) { | |
| 1964 _json["blobValue"] = blobValue; | |
| 1965 } | |
| 1966 if (booleanValue != null) { | |
| 1967 _json["booleanValue"] = booleanValue; | |
| 1968 } | |
| 1969 if (doubleValue != null) { | |
| 1970 _json["doubleValue"] = doubleValue; | |
| 1971 } | |
| 1972 if (entityValue != null) { | |
| 1973 _json["entityValue"] = (entityValue).toJson(); | |
| 1974 } | |
| 1975 if (excludeFromIndexes != null) { | |
| 1976 _json["excludeFromIndexes"] = excludeFromIndexes; | |
| 1977 } | |
| 1978 if (geoPointValue != null) { | |
| 1979 _json["geoPointValue"] = (geoPointValue).toJson(); | |
| 1980 } | |
| 1981 if (integerValue != null) { | |
| 1982 _json["integerValue"] = integerValue; | |
| 1983 } | |
| 1984 if (keyValue != null) { | |
| 1985 _json["keyValue"] = (keyValue).toJson(); | |
| 1986 } | |
| 1987 if (meaning != null) { | |
| 1988 _json["meaning"] = meaning; | |
| 1989 } | |
| 1990 if (nullValue != null) { | |
| 1991 _json["nullValue"] = nullValue; | |
| 1992 } | |
| 1993 if (stringValue != null) { | |
| 1994 _json["stringValue"] = stringValue; | |
| 1995 } | |
| 1996 if (timestampValue != null) { | |
| 1997 _json["timestampValue"] = timestampValue; | |
| 1998 } | |
| 1999 return _json; | |
| 2000 } | |
| 2001 } | |
| OLD | NEW |