Skip to content

[CHANGE ME] Re-generated to pick up changes from googleapis. #299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .kokoro/build.bat
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
:: See documentation in type-shell-output.bat

"C:\Program Files\Git\bin\bash.exe" %~dp0build.sh
"C:\Program Files\Git\bin\bash.exe" github/java-firestore/.kokoro/build.sh
11 changes: 1 addition & 10 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,7 @@ mvn -Penable-samples clean verify
```

2. [Activate](#profile-activation) the profile.
3. Define your samples in a normal Maven project in the `samples/` directory.

### Code Formatting

Code in this repo is formatted with
[google-java-format](https://github.com/google/google-java-format).
To run formatting on your project, you can run:
```
mvn com.coveo:fmt-maven-plugin:format
```
3. Define your samples in a normal Maven project in the `samples/` directory

### Profile Activation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@
import com.google.common.util.concurrent.MoreExecutors;
import com.google.firestore.v1.BatchGetDocumentsRequest;
import com.google.firestore.v1.BatchGetDocumentsResponse;
import com.google.firestore.v1.BatchWriteRequest;
import com.google.firestore.v1.BatchWriteResponse;
import com.google.firestore.v1.BeginTransactionRequest;
import com.google.firestore.v1.BeginTransactionResponse;
import com.google.firestore.v1.CommitRequest;
import com.google.firestore.v1.CommitResponse;
import com.google.firestore.v1.CreateDocumentRequest;
import com.google.firestore.v1.Cursor;
import com.google.firestore.v1.DeleteDocumentRequest;
import com.google.firestore.v1.Document;
import com.google.firestore.v1.DocumentMask;
Expand All @@ -47,6 +50,8 @@
import com.google.firestore.v1.ListDocumentsResponse;
import com.google.firestore.v1.ListenRequest;
import com.google.firestore.v1.ListenResponse;
import com.google.firestore.v1.PartitionQueryRequest;
import com.google.firestore.v1.PartitionQueryResponse;
import com.google.firestore.v1.RollbackRequest;
import com.google.firestore.v1.RunQueryRequest;
import com.google.firestore.v1.RunQueryResponse;
Expand Down Expand Up @@ -539,6 +544,67 @@ public final UnaryCallable<DeleteDocumentRequest, Empty> deleteDocumentCallable(
return stub.batchGetDocumentsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Applies a batch of write operations.
*
* <p>The BatchWrite method does not apply the write operations atomically and can apply them out
* of order. Method does not allow more than one write per document. Each write succeeds or fails
* independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
* success status of each write.
*
* <p>If you require an atomically applied set of writes, use
* [Commit][google.firestore.v1.Firestore.Commit] instead.
*
* <p>Sample code:
*
* <pre><code>
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
* String database = "";
* BatchWriteRequest request = BatchWriteRequest.newBuilder()
* .setDatabase(database)
* .build();
* BatchWriteResponse response = firestoreClient.batchWrite(request);
* }
* </code></pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final BatchWriteResponse batchWrite(BatchWriteRequest request) {
return batchWriteCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Applies a batch of write operations.
*
* <p>The BatchWrite method does not apply the write operations atomically and can apply them out
* of order. Method does not allow more than one write per document. Each write succeeds or fails
* independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
* success status of each write.
*
* <p>If you require an atomically applied set of writes, use
* [Commit][google.firestore.v1.Firestore.Commit] instead.
*
* <p>Sample code:
*
* <pre><code>
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
* String database = "";
* BatchWriteRequest request = BatchWriteRequest.newBuilder()
* .setDatabase(database)
* .build();
* ApiFuture&lt;BatchWriteResponse&gt; future = firestoreClient.batchWriteCallable().futureCall(request);
* // Do something
* BatchWriteResponse response = future.get();
* }
* </code></pre>
*/
public final UnaryCallable<BatchWriteRequest, BatchWriteResponse> batchWriteCallable() {
return stub.batchWriteCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Starts a new transaction.
Expand Down Expand Up @@ -937,6 +1003,94 @@ public final ListCollectionIdsPagedResponse listCollectionIds(ListCollectionIdsR
return stub.listCollectionIdsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Partitions a query by returning partition cursors that can be used to run the query in
* parallel. The returned partition cursors are split points that can be used by RunQuery as
* starting/end points for the query results.
*
* <p>Sample code:
*
* <pre><code>
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
* String parent = "";
* PartitionQueryRequest request = PartitionQueryRequest.newBuilder()
* .setParent(parent)
* .build();
* for (Cursor element : firestoreClient.partitionQuery(request).iterateAll()) {
* // doThingsWith(element);
* }
* }
* </code></pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
public final PartitionQueryPagedResponse partitionQuery(PartitionQueryRequest request) {
return partitionQueryPagedCallable().call(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Partitions a query by returning partition cursors that can be used to run the query in
* parallel. The returned partition cursors are split points that can be used by RunQuery as
* starting/end points for the query results.
*
* <p>Sample code:
*
* <pre><code>
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
* String parent = "";
* PartitionQueryRequest request = PartitionQueryRequest.newBuilder()
* .setParent(parent)
* .build();
* ApiFuture&lt;PartitionQueryPagedResponse&gt; future = firestoreClient.partitionQueryPagedCallable().futureCall(request);
* // Do something
* for (Cursor element : future.get().iterateAll()) {
* // doThingsWith(element);
* }
* }
* </code></pre>
*/
public final UnaryCallable<PartitionQueryRequest, PartitionQueryPagedResponse>
partitionQueryPagedCallable() {
return stub.partitionQueryPagedCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD
/**
* Partitions a query by returning partition cursors that can be used to run the query in
* parallel. The returned partition cursors are split points that can be used by RunQuery as
* starting/end points for the query results.
*
* <p>Sample code:
*
* <pre><code>
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
* String parent = "";
* PartitionQueryRequest request = PartitionQueryRequest.newBuilder()
* .setParent(parent)
* .build();
* while (true) {
* PartitionQueryResponse response = firestoreClient.partitionQueryCallable().call(request);
* for (Cursor element : response.getPartitionsList()) {
* // doThingsWith(element);
* }
* String nextPageToken = response.getNextPageToken();
* if (!Strings.isNullOrEmpty(nextPageToken)) {
* request = request.toBuilder().setPageToken(nextPageToken).build();
* } else {
* break;
* }
* }
* }
* </code></pre>
*/
public final UnaryCallable<PartitionQueryRequest, PartitionQueryResponse>
partitionQueryCallable() {
return stub.partitionQueryCallable();
}

@Override
public final void close() {
stub.close();
Expand Down Expand Up @@ -1129,4 +1283,85 @@ protected ListCollectionIdsFixedSizeCollection createCollection(
return new ListCollectionIdsFixedSizeCollection(pages, collectionSize);
}
}

public static class PartitionQueryPagedResponse
extends AbstractPagedListResponse<
PartitionQueryRequest,
PartitionQueryResponse,
Cursor,
PartitionQueryPage,
PartitionQueryFixedSizeCollection> {

public static ApiFuture<PartitionQueryPagedResponse> createAsync(
PageContext<PartitionQueryRequest, PartitionQueryResponse, Cursor> context,
ApiFuture<PartitionQueryResponse> futureResponse) {
ApiFuture<PartitionQueryPage> futurePage =
PartitionQueryPage.createEmptyPage().createPageAsync(context, futureResponse);
return ApiFutures.transform(
futurePage,
new ApiFunction<PartitionQueryPage, PartitionQueryPagedResponse>() {
@Override
public PartitionQueryPagedResponse apply(PartitionQueryPage input) {
return new PartitionQueryPagedResponse(input);
}
},
MoreExecutors.directExecutor());
}

private PartitionQueryPagedResponse(PartitionQueryPage page) {
super(page, PartitionQueryFixedSizeCollection.createEmptyCollection());
}
}

public static class PartitionQueryPage
extends AbstractPage<
PartitionQueryRequest, PartitionQueryResponse, Cursor, PartitionQueryPage> {

private PartitionQueryPage(
PageContext<PartitionQueryRequest, PartitionQueryResponse, Cursor> context,
PartitionQueryResponse response) {
super(context, response);
}

private static PartitionQueryPage createEmptyPage() {
return new PartitionQueryPage(null, null);
}

@Override
protected PartitionQueryPage createPage(
PageContext<PartitionQueryRequest, PartitionQueryResponse, Cursor> context,
PartitionQueryResponse response) {
return new PartitionQueryPage(context, response);
}

@Override
public ApiFuture<PartitionQueryPage> createPageAsync(
PageContext<PartitionQueryRequest, PartitionQueryResponse, Cursor> context,
ApiFuture<PartitionQueryResponse> futureResponse) {
return super.createPageAsync(context, futureResponse);
}
}

public static class PartitionQueryFixedSizeCollection
extends AbstractFixedSizeCollection<
PartitionQueryRequest,
PartitionQueryResponse,
Cursor,
PartitionQueryPage,
PartitionQueryFixedSizeCollection> {

private PartitionQueryFixedSizeCollection(List<PartitionQueryPage> pages, int collectionSize) {
super(pages, collectionSize);
}

private static PartitionQueryFixedSizeCollection createEmptyCollection() {
return new PartitionQueryFixedSizeCollection(null, 0);
}

@Override
protected PartitionQueryFixedSizeCollection createCollection(
List<PartitionQueryPage> pages, int collectionSize) {
return new PartitionQueryFixedSizeCollection(pages, collectionSize);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static com.google.cloud.firestore.v1.FirestoreClient.ListCollectionIdsPagedResponse;
import static com.google.cloud.firestore.v1.FirestoreClient.ListDocumentsPagedResponse;
import static com.google.cloud.firestore.v1.FirestoreClient.PartitionQueryPagedResponse;

import com.google.api.core.ApiFunction;
import com.google.api.core.BetaApi;
Expand All @@ -34,6 +35,8 @@
import com.google.cloud.firestore.v1.stub.FirestoreStubSettings;
import com.google.firestore.v1.BatchGetDocumentsRequest;
import com.google.firestore.v1.BatchGetDocumentsResponse;
import com.google.firestore.v1.BatchWriteRequest;
import com.google.firestore.v1.BatchWriteResponse;
import com.google.firestore.v1.BeginTransactionRequest;
import com.google.firestore.v1.BeginTransactionResponse;
import com.google.firestore.v1.CommitRequest;
Expand All @@ -48,6 +51,8 @@
import com.google.firestore.v1.ListDocumentsResponse;
import com.google.firestore.v1.ListenRequest;
import com.google.firestore.v1.ListenResponse;
import com.google.firestore.v1.PartitionQueryRequest;
import com.google.firestore.v1.PartitionQueryResponse;
import com.google.firestore.v1.RollbackRequest;
import com.google.firestore.v1.RunQueryRequest;
import com.google.firestore.v1.RunQueryResponse;
Expand Down Expand Up @@ -124,6 +129,11 @@ public UnaryCallSettings<DeleteDocumentRequest, Empty> deleteDocumentSettings()
return ((FirestoreStubSettings) getStubSettings()).batchGetDocumentsSettings();
}

/** Returns the object with the settings used for calls to batchWrite. */
public UnaryCallSettings<BatchWriteRequest, BatchWriteResponse> batchWriteSettings() {
return ((FirestoreStubSettings) getStubSettings()).batchWriteSettings();
}

/** Returns the object with the settings used for calls to beginTransaction. */
public UnaryCallSettings<BeginTransactionRequest, BeginTransactionResponse>
beginTransactionSettings() {
Expand Down Expand Up @@ -162,6 +172,13 @@ public StreamingCallSettings<ListenRequest, ListenResponse> listenSettings() {
return ((FirestoreStubSettings) getStubSettings()).listCollectionIdsSettings();
}

/** Returns the object with the settings used for calls to partitionQuery. */
public PagedCallSettings<
PartitionQueryRequest, PartitionQueryResponse, PartitionQueryPagedResponse>
partitionQuerySettings() {
return ((FirestoreStubSettings) getStubSettings()).partitionQuerySettings();
}

public static final FirestoreSettings create(FirestoreStubSettings stub) throws IOException {
return new FirestoreSettings.Builder(stub.toBuilder()).build();
}
Expand Down Expand Up @@ -291,6 +308,11 @@ public UnaryCallSettings.Builder<DeleteDocumentRequest, Empty> deleteDocumentSet
return getStubSettingsBuilder().batchGetDocumentsSettings();
}

/** Returns the builder for the settings used for calls to batchWrite. */
public UnaryCallSettings.Builder<BatchWriteRequest, BatchWriteResponse> batchWriteSettings() {
return getStubSettingsBuilder().batchWriteSettings();
}

/** Returns the builder for the settings used for calls to beginTransaction. */
public UnaryCallSettings.Builder<BeginTransactionRequest, BeginTransactionResponse>
beginTransactionSettings() {
Expand Down Expand Up @@ -330,6 +352,13 @@ public StreamingCallSettings.Builder<ListenRequest, ListenResponse> listenSettin
return getStubSettingsBuilder().listCollectionIdsSettings();
}

/** Returns the builder for the settings used for calls to partitionQuery. */
public PagedCallSettings.Builder<
PartitionQueryRequest, PartitionQueryResponse, PartitionQueryPagedResponse>
partitionQuerySettings() {
return getStubSettingsBuilder().partitionQuerySettings();
}

@Override
public FirestoreSettings build() throws IOException {
return new FirestoreSettings(this);
Expand Down
Loading