Skip to content

Commit 1e01e65

Browse files
firestore: add BatchWrite to gapic yaml
PiperOrigin-RevId: 319105199 Source-Author: Google APIs <[email protected]> Source-Date: Tue Jun 30 14:56:36 2020 -0700 Source-Repo: googleapis/googleapis Source-Sha: cbd6f1d28bc0c461c234f9848bcbc1563126daf9 Source-Link: googleapis/googleapis@cbd6f1d
1 parent ec1afe9 commit 1e01e65

File tree

7 files changed

+178
-173
lines changed

7 files changed

+178
-173
lines changed

google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreClient.java

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,67 @@ public final UnaryCallable<DeleteDocumentRequest, Empty> deleteDocumentCallable(
544544
return stub.batchGetDocumentsCallable();
545545
}
546546

547+
// AUTO-GENERATED DOCUMENTATION AND METHOD
548+
/**
549+
* Applies a batch of write operations.
550+
*
551+
* <p>The BatchWrite method does not apply the write operations atomically and can apply them out
552+
* of order. Method does not allow more than one write per document. Each write succeeds or fails
553+
* independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
554+
* success status of each write.
555+
*
556+
* <p>If you require an atomically applied set of writes, use
557+
* [Commit][google.firestore.v1.Firestore.Commit] instead.
558+
*
559+
* <p>Sample code:
560+
*
561+
* <pre><code>
562+
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
563+
* String database = "";
564+
* BatchWriteRequest request = BatchWriteRequest.newBuilder()
565+
* .setDatabase(database)
566+
* .build();
567+
* BatchWriteResponse response = firestoreClient.batchWrite(request);
568+
* }
569+
* </code></pre>
570+
*
571+
* @param request The request object containing all of the parameters for the API call.
572+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
573+
*/
574+
public final BatchWriteResponse batchWrite(BatchWriteRequest request) {
575+
return batchWriteCallable().call(request);
576+
}
577+
578+
// AUTO-GENERATED DOCUMENTATION AND METHOD
579+
/**
580+
* Applies a batch of write operations.
581+
*
582+
* <p>The BatchWrite method does not apply the write operations atomically and can apply them out
583+
* of order. Method does not allow more than one write per document. Each write succeeds or fails
584+
* independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
585+
* success status of each write.
586+
*
587+
* <p>If you require an atomically applied set of writes, use
588+
* [Commit][google.firestore.v1.Firestore.Commit] instead.
589+
*
590+
* <p>Sample code:
591+
*
592+
* <pre><code>
593+
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
594+
* String database = "";
595+
* BatchWriteRequest request = BatchWriteRequest.newBuilder()
596+
* .setDatabase(database)
597+
* .build();
598+
* ApiFuture&lt;BatchWriteResponse&gt; future = firestoreClient.batchWriteCallable().futureCall(request);
599+
* // Do something
600+
* BatchWriteResponse response = future.get();
601+
* }
602+
* </code></pre>
603+
*/
604+
public final UnaryCallable<BatchWriteRequest, BatchWriteResponse> batchWriteCallable() {
605+
return stub.batchWriteCallable();
606+
}
607+
547608
// AUTO-GENERATED DOCUMENTATION AND METHOD
548609
/**
549610
* Starts a new transaction.
@@ -1030,67 +1091,6 @@ public final PartitionQueryPagedResponse partitionQuery(PartitionQueryRequest re
10301091
return stub.partitionQueryCallable();
10311092
}
10321093

1033-
// AUTO-GENERATED DOCUMENTATION AND METHOD
1034-
/**
1035-
* Applies a batch of write operations.
1036-
*
1037-
* <p>The BatchWrite method does not apply the write operations atomically and can apply them out
1038-
* of order. Method does not allow more than one write per document. Each write succeeds or fails
1039-
* independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
1040-
* success status of each write.
1041-
*
1042-
* <p>If you require an atomically applied set of writes, use
1043-
* [Commit][google.firestore.v1.Firestore.Commit] instead.
1044-
*
1045-
* <p>Sample code:
1046-
*
1047-
* <pre><code>
1048-
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
1049-
* String database = "";
1050-
* BatchWriteRequest request = BatchWriteRequest.newBuilder()
1051-
* .setDatabase(database)
1052-
* .build();
1053-
* BatchWriteResponse response = firestoreClient.batchWrite(request);
1054-
* }
1055-
* </code></pre>
1056-
*
1057-
* @param request The request object containing all of the parameters for the API call.
1058-
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
1059-
*/
1060-
public final BatchWriteResponse batchWrite(BatchWriteRequest request) {
1061-
return batchWriteCallable().call(request);
1062-
}
1063-
1064-
// AUTO-GENERATED DOCUMENTATION AND METHOD
1065-
/**
1066-
* Applies a batch of write operations.
1067-
*
1068-
* <p>The BatchWrite method does not apply the write operations atomically and can apply them out
1069-
* of order. Method does not allow more than one write per document. Each write succeeds or fails
1070-
* independently. See the [BatchWriteResponse][google.firestore.v1.BatchWriteResponse] for the
1071-
* success status of each write.
1072-
*
1073-
* <p>If you require an atomically applied set of writes, use
1074-
* [Commit][google.firestore.v1.Firestore.Commit] instead.
1075-
*
1076-
* <p>Sample code:
1077-
*
1078-
* <pre><code>
1079-
* try (FirestoreClient firestoreClient = FirestoreClient.create()) {
1080-
* String database = "";
1081-
* BatchWriteRequest request = BatchWriteRequest.newBuilder()
1082-
* .setDatabase(database)
1083-
* .build();
1084-
* ApiFuture&lt;BatchWriteResponse&gt; future = firestoreClient.batchWriteCallable().futureCall(request);
1085-
* // Do something
1086-
* BatchWriteResponse response = future.get();
1087-
* }
1088-
* </code></pre>
1089-
*/
1090-
public final UnaryCallable<BatchWriteRequest, BatchWriteResponse> batchWriteCallable() {
1091-
return stub.batchWriteCallable();
1092-
}
1093-
10941094
@Override
10951095
public final void close() {
10961096
stub.close();

google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/FirestoreSettings.java

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,11 @@ public UnaryCallSettings<DeleteDocumentRequest, Empty> deleteDocumentSettings()
129129
return ((FirestoreStubSettings) getStubSettings()).batchGetDocumentsSettings();
130130
}
131131

132+
/** Returns the object with the settings used for calls to batchWrite. */
133+
public UnaryCallSettings<BatchWriteRequest, BatchWriteResponse> batchWriteSettings() {
134+
return ((FirestoreStubSettings) getStubSettings()).batchWriteSettings();
135+
}
136+
132137
/** Returns the object with the settings used for calls to beginTransaction. */
133138
public UnaryCallSettings<BeginTransactionRequest, BeginTransactionResponse>
134139
beginTransactionSettings() {
@@ -174,11 +179,6 @@ public StreamingCallSettings<ListenRequest, ListenResponse> listenSettings() {
174179
return ((FirestoreStubSettings) getStubSettings()).partitionQuerySettings();
175180
}
176181

177-
/** Returns the object with the settings used for calls to batchWrite. */
178-
public UnaryCallSettings<BatchWriteRequest, BatchWriteResponse> batchWriteSettings() {
179-
return ((FirestoreStubSettings) getStubSettings()).batchWriteSettings();
180-
}
181-
182182
public static final FirestoreSettings create(FirestoreStubSettings stub) throws IOException {
183183
return new FirestoreSettings.Builder(stub.toBuilder()).build();
184184
}
@@ -308,6 +308,11 @@ public UnaryCallSettings.Builder<DeleteDocumentRequest, Empty> deleteDocumentSet
308308
return getStubSettingsBuilder().batchGetDocumentsSettings();
309309
}
310310

311+
/** Returns the builder for the settings used for calls to batchWrite. */
312+
public UnaryCallSettings.Builder<BatchWriteRequest, BatchWriteResponse> batchWriteSettings() {
313+
return getStubSettingsBuilder().batchWriteSettings();
314+
}
315+
311316
/** Returns the builder for the settings used for calls to beginTransaction. */
312317
public UnaryCallSettings.Builder<BeginTransactionRequest, BeginTransactionResponse>
313318
beginTransactionSettings() {
@@ -354,11 +359,6 @@ public StreamingCallSettings.Builder<ListenRequest, ListenResponse> listenSettin
354359
return getStubSettingsBuilder().partitionQuerySettings();
355360
}
356361

357-
/** Returns the builder for the settings used for calls to batchWrite. */
358-
public UnaryCallSettings.Builder<BatchWriteRequest, BatchWriteResponse> batchWriteSettings() {
359-
return getStubSettingsBuilder().batchWriteSettings();
360-
}
361-
362362
@Override
363363
public FirestoreSettings build() throws IOException {
364364
return new FirestoreSettings(this);

google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1/stub/FirestoreStub.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,10 @@ public UnaryCallable<DeleteDocumentRequest, Empty> deleteDocumentCallable() {
9393
throw new UnsupportedOperationException("Not implemented: batchGetDocumentsCallable()");
9494
}
9595

96+
public UnaryCallable<BatchWriteRequest, BatchWriteResponse> batchWriteCallable() {
97+
throw new UnsupportedOperationException("Not implemented: batchWriteCallable()");
98+
}
99+
96100
public UnaryCallable<BeginTransactionRequest, BeginTransactionResponse>
97101
beginTransactionCallable() {
98102
throw new UnsupportedOperationException("Not implemented: beginTransactionCallable()");
@@ -137,10 +141,6 @@ public UnaryCallable<PartitionQueryRequest, PartitionQueryResponse> partitionQue
137141
throw new UnsupportedOperationException("Not implemented: partitionQueryCallable()");
138142
}
139143

140-
public UnaryCallable<BatchWriteRequest, BatchWriteResponse> batchWriteCallable() {
141-
throw new UnsupportedOperationException("Not implemented: batchWriteCallable()");
142-
}
143-
144144
@Override
145145
public abstract void close();
146146
}

0 commit comments

Comments
 (0)