|
1 | 1 | /* |
2 | | - * Copyright 2023 Google LLC |
| 2 | + * Copyright 2024 Google LLC |
3 | 3 | * |
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
5 | 5 | * you may not use this file except in compliance with the License. |
|
73 | 73 | * <p>Note: close() needs to be called on the DatastoreClient object to clean up resources such as |
74 | 74 | * threads. In the example above, try-with-resources is used, which automatically calls close(). |
75 | 75 | * |
76 | | - * <p>The surface of this class includes several types of Java methods for each of the API's |
77 | | - * methods: |
78 | | - * |
79 | | - * <ol> |
80 | | - * <li>A "flattened" method. With this type of method, the fields of the request type have been |
81 | | - * converted into function parameters. It may be the case that not all fields are available as |
82 | | - * parameters, and not every API method will have a flattened method entry point. |
83 | | - * <li>A "request object" method. This type of method only takes one parameter, a request object, |
84 | | - * which must be constructed before the call. Not every API method will have a request object |
85 | | - * method. |
86 | | - * <li>A "callable" method. This type of method takes no parameters and returns an immutable API |
87 | | - * callable object, which can be used to initiate calls to the service. |
88 | | - * </ol> |
| 76 | + * <table> |
| 77 | + * <caption>Methods</caption> |
| 78 | + * <tr> |
| 79 | + * <th>Method</th> |
| 80 | + * <th>Description</th> |
| 81 | + * <th>Method Variants</th> |
| 82 | + * </tr> |
| 83 | + * <tr> |
| 84 | + * <td><p> Lookup</td> |
| 85 | + * <td><p> Looks up entities by key.</td> |
| 86 | + * <td> |
| 87 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 88 | + * <ul> |
| 89 | + * <li><p> lookup(LookupRequest request) |
| 90 | + * </ul> |
| 91 | + * <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p> |
| 92 | + * <ul> |
| 93 | + * <li><p> lookup(String projectId, ReadOptions readOptions, List<Key> keys) |
| 94 | + * </ul> |
| 95 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 96 | + * <ul> |
| 97 | + * <li><p> lookupCallable() |
| 98 | + * </ul> |
| 99 | + * </td> |
| 100 | + * </tr> |
| 101 | + * <tr> |
| 102 | + * <td><p> RunQuery</td> |
| 103 | + * <td><p> Queries for entities.</td> |
| 104 | + * <td> |
| 105 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 106 | + * <ul> |
| 107 | + * <li><p> runQuery(RunQueryRequest request) |
| 108 | + * </ul> |
| 109 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 110 | + * <ul> |
| 111 | + * <li><p> runQueryCallable() |
| 112 | + * </ul> |
| 113 | + * </td> |
| 114 | + * </tr> |
| 115 | + * <tr> |
| 116 | + * <td><p> RunAggregationQuery</td> |
| 117 | + * <td><p> Runs an aggregation query.</td> |
| 118 | + * <td> |
| 119 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 120 | + * <ul> |
| 121 | + * <li><p> runAggregationQuery(RunAggregationQueryRequest request) |
| 122 | + * </ul> |
| 123 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 124 | + * <ul> |
| 125 | + * <li><p> runAggregationQueryCallable() |
| 126 | + * </ul> |
| 127 | + * </td> |
| 128 | + * </tr> |
| 129 | + * <tr> |
| 130 | + * <td><p> BeginTransaction</td> |
| 131 | + * <td><p> Begins a new transaction.</td> |
| 132 | + * <td> |
| 133 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 134 | + * <ul> |
| 135 | + * <li><p> beginTransaction(BeginTransactionRequest request) |
| 136 | + * </ul> |
| 137 | + * <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p> |
| 138 | + * <ul> |
| 139 | + * <li><p> beginTransaction(String projectId) |
| 140 | + * </ul> |
| 141 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 142 | + * <ul> |
| 143 | + * <li><p> beginTransactionCallable() |
| 144 | + * </ul> |
| 145 | + * </td> |
| 146 | + * </tr> |
| 147 | + * <tr> |
| 148 | + * <td><p> Commit</td> |
| 149 | + * <td><p> Commits a transaction, optionally creating, deleting or modifying some entities.</td> |
| 150 | + * <td> |
| 151 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 152 | + * <ul> |
| 153 | + * <li><p> commit(CommitRequest request) |
| 154 | + * </ul> |
| 155 | + * <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p> |
| 156 | + * <ul> |
| 157 | + * <li><p> commit(String projectId, CommitRequest.Mode mode, List<Mutation> mutations) |
| 158 | + * <li><p> commit(String projectId, CommitRequest.Mode mode, ByteString transaction, List<Mutation> mutations) |
| 159 | + * </ul> |
| 160 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 161 | + * <ul> |
| 162 | + * <li><p> commitCallable() |
| 163 | + * </ul> |
| 164 | + * </td> |
| 165 | + * </tr> |
| 166 | + * <tr> |
| 167 | + * <td><p> Rollback</td> |
| 168 | + * <td><p> Rolls back a transaction.</td> |
| 169 | + * <td> |
| 170 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 171 | + * <ul> |
| 172 | + * <li><p> rollback(RollbackRequest request) |
| 173 | + * </ul> |
| 174 | + * <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p> |
| 175 | + * <ul> |
| 176 | + * <li><p> rollback(String projectId, ByteString transaction) |
| 177 | + * </ul> |
| 178 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 179 | + * <ul> |
| 180 | + * <li><p> rollbackCallable() |
| 181 | + * </ul> |
| 182 | + * </td> |
| 183 | + * </tr> |
| 184 | + * <tr> |
| 185 | + * <td><p> AllocateIds</td> |
| 186 | + * <td><p> Allocates IDs for the given keys, which is useful for referencing an entity before it is inserted.</td> |
| 187 | + * <td> |
| 188 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 189 | + * <ul> |
| 190 | + * <li><p> allocateIds(AllocateIdsRequest request) |
| 191 | + * </ul> |
| 192 | + * <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p> |
| 193 | + * <ul> |
| 194 | + * <li><p> allocateIds(String projectId, List<Key> keys) |
| 195 | + * </ul> |
| 196 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 197 | + * <ul> |
| 198 | + * <li><p> allocateIdsCallable() |
| 199 | + * </ul> |
| 200 | + * </td> |
| 201 | + * </tr> |
| 202 | + * <tr> |
| 203 | + * <td><p> ReserveIds</td> |
| 204 | + * <td><p> Prevents the supplied keys' IDs from being auto-allocated by Cloud Datastore.</td> |
| 205 | + * <td> |
| 206 | + * <p>Request object method variants only take one parameter, a request object, which must be constructed before the call.</p> |
| 207 | + * <ul> |
| 208 | + * <li><p> reserveIds(ReserveIdsRequest request) |
| 209 | + * </ul> |
| 210 | + * <p>"Flattened" method variants have converted the fields of the request object into function parameters to enable multiple ways to call the same method.</p> |
| 211 | + * <ul> |
| 212 | + * <li><p> reserveIds(String projectId, List<Key> keys) |
| 213 | + * </ul> |
| 214 | + * <p>Callable method variants take no parameters and return an immutable API callable object, which can be used to initiate calls to the service.</p> |
| 215 | + * <ul> |
| 216 | + * <li><p> reserveIdsCallable() |
| 217 | + * </ul> |
| 218 | + * </td> |
| 219 | + * </tr> |
| 220 | + * </table> |
89 | 221 | * |
90 | 222 | * <p>See the individual methods for example code. |
91 | 223 | * |
@@ -241,6 +373,7 @@ public final LookupResponse lookup(String projectId, ReadOptions readOptions, Li |
241 | 373 | * .setDatabaseId("databaseId1688905718") |
242 | 374 | * .setReadOptions(ReadOptions.newBuilder().build()) |
243 | 375 | * .addAllKeys(new ArrayList<Key>()) |
| 376 | + * .setPropertyMask(PropertyMask.newBuilder().build()) |
244 | 377 | * .build(); |
245 | 378 | * LookupResponse response = datastoreClient.lookup(request); |
246 | 379 | * } |
@@ -272,6 +405,7 @@ public final LookupResponse lookup(LookupRequest request) { |
272 | 405 | * .setDatabaseId("databaseId1688905718") |
273 | 406 | * .setReadOptions(ReadOptions.newBuilder().build()) |
274 | 407 | * .addAllKeys(new ArrayList<Key>()) |
| 408 | + * .setPropertyMask(PropertyMask.newBuilder().build()) |
275 | 409 | * .build(); |
276 | 410 | * ApiFuture<LookupResponse> future = datastoreClient.lookupCallable().futureCall(request); |
277 | 411 | * // Do something. |
@@ -302,6 +436,8 @@ public final UnaryCallable<LookupRequest, LookupResponse> lookupCallable() { |
302 | 436 | * .setDatabaseId("databaseId1688905718") |
303 | 437 | * .setPartitionId(PartitionId.newBuilder().build()) |
304 | 438 | * .setReadOptions(ReadOptions.newBuilder().build()) |
| 439 | + * .setPropertyMask(PropertyMask.newBuilder().build()) |
| 440 | + * .setExplainOptions(ExplainOptions.newBuilder().build()) |
305 | 441 | * .build(); |
306 | 442 | * RunQueryResponse response = datastoreClient.runQuery(request); |
307 | 443 | * } |
@@ -333,6 +469,8 @@ public final RunQueryResponse runQuery(RunQueryRequest request) { |
333 | 469 | * .setDatabaseId("databaseId1688905718") |
334 | 470 | * .setPartitionId(PartitionId.newBuilder().build()) |
335 | 471 | * .setReadOptions(ReadOptions.newBuilder().build()) |
| 472 | + * .setPropertyMask(PropertyMask.newBuilder().build()) |
| 473 | + * .setExplainOptions(ExplainOptions.newBuilder().build()) |
336 | 474 | * .build(); |
337 | 475 | * ApiFuture<RunQueryResponse> future = datastoreClient.runQueryCallable().futureCall(request); |
338 | 476 | * // Do something. |
@@ -363,6 +501,7 @@ public final UnaryCallable<RunQueryRequest, RunQueryResponse> runQueryCallable() |
363 | 501 | * .setDatabaseId("databaseId1688905718") |
364 | 502 | * .setPartitionId(PartitionId.newBuilder().build()) |
365 | 503 | * .setReadOptions(ReadOptions.newBuilder().build()) |
| 504 | + * .setExplainOptions(ExplainOptions.newBuilder().build()) |
366 | 505 | * .build(); |
367 | 506 | * RunAggregationQueryResponse response = datastoreClient.runAggregationQuery(request); |
368 | 507 | * } |
@@ -394,6 +533,7 @@ public final RunAggregationQueryResponse runAggregationQuery(RunAggregationQuery |
394 | 533 | * .setDatabaseId("databaseId1688905718") |
395 | 534 | * .setPartitionId(PartitionId.newBuilder().build()) |
396 | 535 | * .setReadOptions(ReadOptions.newBuilder().build()) |
| 536 | + * .setExplainOptions(ExplainOptions.newBuilder().build()) |
397 | 537 | * .build(); |
398 | 538 | * ApiFuture<RunAggregationQueryResponse> future = |
399 | 539 | * datastoreClient.runAggregationQueryCallable().futureCall(request); |
|
0 commit comments