Skip to content

Commit e30b794

Browse files
Refreshing generated clients (#2557)
Breaking changes: - In Firestore, DatabaseName is renamed to DatabaseRootName - in Video Intelligence, annotateVideoAsync has parameters removed
1 parent ab5025a commit e30b794

34 files changed

Lines changed: 1559 additions & 219 deletions

File tree

google-cloud-datastore/pom.xml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,12 @@
3131
<groupId>com.google.cloud.datastore</groupId>
3232
<artifactId>datastore-v1-protos</artifactId>
3333
<version>1.3.0</version>
34+
<exclusions>
35+
<exclusion>
36+
<groupId>com.google.api.grpc</groupId>
37+
<artifactId>grpc-google-common-protos</artifactId>
38+
</exclusion>
39+
</exclusions>
3440
</dependency>
3541
<dependency>
3642
<groupId>com.google.cloud.datastore</groupId>
@@ -43,11 +49,6 @@
4349
</exclusion>
4450
</exclusions>
4551
</dependency>
46-
<dependency>
47-
<groupId>com.google.api.grpc</groupId>
48-
<artifactId>grpc-google-common-protos</artifactId>
49-
<version>${generatedProto.version}</version>
50-
</dependency>
5152
<dependency>
5253
<groupId>${project.groupId}</groupId>
5354
<artifactId>google-cloud-core</artifactId>

google-cloud-firestore/src/main/java/com/google/cloud/firestore/FirestoreImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
import com.google.firestore.v1beta1.ArrayValue;
2929
import com.google.firestore.v1beta1.BatchGetDocumentsRequest;
3030
import com.google.firestore.v1beta1.BatchGetDocumentsResponse;
31-
import com.google.firestore.v1beta1.DatabaseName;
31+
import com.google.firestore.v1beta1.DatabaseRootName;
3232
import com.google.firestore.v1beta1.MapValue;
3333
import com.google.firestore.v1beta1.Value;
3434
import com.google.protobuf.ByteString;
@@ -149,7 +149,7 @@ static Value encodeValue(@Nullable Object sanitizedObject) {
149149
"Failed to detect Project ID. "
150150
+ "Please explicitly set your Project ID in FirestoreOptions.");
151151
this.databasePath =
152-
ResourcePath.create(DatabaseName.create(options.getProjectId(), options.getDatabaseId()));
152+
ResourcePath.create(DatabaseRootName.create(options.getProjectId(), options.getDatabaseId()));
153153
}
154154

155155
@Nonnull

google-cloud-firestore/src/main/java/com/google/cloud/firestore/ResourcePath.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import com.google.auto.value.AutoValue;
2020
import com.google.common.collect.ImmutableList;
21-
import com.google.firestore.v1beta1.DatabaseName;
21+
import com.google.firestore.v1beta1.DatabaseRootName;
2222
import java.util.Arrays;
2323
import javax.annotation.Nullable;
2424

@@ -32,7 +32,7 @@ abstract class ResourcePath extends BasePath<ResourcePath> {
3232
* @param databaseName The Firestore database name.
3333
* @param segments The segments of the path relative to the root collections.
3434
*/
35-
static ResourcePath create(DatabaseName databaseName, ImmutableList<String> segments) {
35+
static ResourcePath create(DatabaseRootName databaseName, ImmutableList<String> segments) {
3636
return new AutoValue_ResourcePath(segments, databaseName);
3737
}
3838

@@ -41,7 +41,7 @@ static ResourcePath create(DatabaseName databaseName, ImmutableList<String> segm
4141
*
4242
* @param databaseName The Firestore database name.
4343
*/
44-
static ResourcePath create(DatabaseName databaseName) {
44+
static ResourcePath create(DatabaseRootName databaseName) {
4545
return new AutoValue_ResourcePath(ImmutableList.<String>of(), databaseName);
4646
}
4747

@@ -56,19 +56,19 @@ static ResourcePath create(String resourceName) {
5656
if (parts.length >= 6 && parts[0].equals("projects") && parts[2].equals("databases")) {
5757
String[] path = Arrays.copyOfRange(parts, 5, parts.length);
5858
return create(
59-
DatabaseName.create(parts[1], parts[3]),
59+
DatabaseRootName.create(parts[1], parts[3]),
6060
ImmutableList.<String>builder().add(path).build());
6161
}
6262

63-
return create(DatabaseName.parse(resourceName));
63+
return create(DatabaseRootName.parse(resourceName));
6464
}
6565

6666
/**
6767
* Returns the database name.
6868
*
6969
* @return The Firestore database name.
7070
*/
71-
abstract DatabaseName getDatabaseName();
71+
abstract DatabaseRootName getDatabaseName();
7272

7373
/** Returns whether this path points to a document. */
7474
boolean isDocument() {

google-cloud-firestore/src/main/java/com/google/cloud/firestore/spi/v1beta1/GrpcFirestoreRpc.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
import com.google.firestore.v1beta1.BeginTransactionResponse;
4242
import com.google.firestore.v1beta1.CommitRequest;
4343
import com.google.firestore.v1beta1.CommitResponse;
44-
import com.google.firestore.v1beta1.DatabaseName;
44+
import com.google.firestore.v1beta1.DatabaseRootName;
4545
import com.google.firestore.v1beta1.ListCollectionIdsRequest;
4646
import com.google.firestore.v1beta1.RollbackRequest;
4747
import com.google.firestore.v1beta1.RunQueryRequest;
@@ -87,7 +87,7 @@ public GrpcFirestoreRpc(final FirestoreOptions options) throws IOException {
8787
.setTransportContext(GrpcTransport.newBuilder().setChannel(managedChannel).build())
8888
.build();
8989
} else {
90-
DatabaseName databaseName = DatabaseName
90+
DatabaseRootName databaseName = DatabaseRootName
9191
.create(options.getProjectId(), options.getDatabaseId());
9292
Credentials credentials =
9393
GrpcTransportOptions.setUpCredentialsProvider(options).getCredentials();

google-cloud-firestore/src/main/java/com/google/cloud/firestore/v1beta1/package-info.java

Lines changed: 1 addition & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -19,62 +19,7 @@
1919
*
2020
* <p>The interfaces provided are listed below, along with usage samples.
2121
*
22-
* <p>==================== FirestoreAdminClient ====================
23-
*
24-
* <p>Service Description: The Cloud Firestore Admin API.
25-
*
26-
* <p>This API provides several administrative services for Cloud Firestore.
27-
*
28-
* <p># Concepts
29-
*
30-
* <p>Project, Database, Namespace, Collection, and Document are used as defined in the Google Cloud
31-
* Firestore API.
32-
*
33-
* <p>Operation: An Operation represents work being performed in the background.
34-
*
35-
* <p># Services
36-
*
37-
* <p>## Index
38-
*
39-
* <p>The index service manages Cloud Firestore indexes.
40-
*
41-
* <p>Index creation is performed asynchronously. An Operation resource is created for each such
42-
* asynchronous operation. The state of the operation (including any errors encountered) may be
43-
* queried via the Operation resource.
44-
*
45-
* <p>## Metadata
46-
*
47-
* <p>Provides metadata and statistical information about data in Cloud Firestore. The data provided
48-
* as part of this API may be stale.
49-
*
50-
* <p>## Operation
51-
*
52-
* <p>The Operations collection provides a record of actions performed for the specified Project
53-
* (including any Operations in progress). Operations are not created directly but through calls on
54-
* other collections or resources.
55-
*
56-
* <p>An Operation that is not yet done may be cancelled. The request to cancel is asynchronous and
57-
* the Operation may continue to run for some time after the request to cancel is made.
58-
*
59-
* <p>An Operation that is done may be deleted so that it is no longer listed as part of the
60-
* Operation collection.
61-
*
62-
* <p>Operations are created by service `FirestoreAdmin`, but are accessed via service
63-
* `google.longrunning.Operations`.
64-
*
65-
* <p>Sample for FirestoreAdminClient:
66-
*
67-
* <pre>
68-
* <code>
69-
* try (FirestoreAdminClient firestoreAdminClient = FirestoreAdminClient.create()) {
70-
* String formattedParent = FirestoreAdminClient.formatDatabaseName("[PROJECT]", "[DATABASE]");
71-
* Index index = Index.newBuilder().build();
72-
* Operation response = firestoreAdminClient.createIndex(formattedParent, index);
73-
* }
74-
* </code>
75-
* </pre>
76-
*
77-
* =============== FirestoreClient ===============
22+
* <p>=============== FirestoreClient ===============
7823
*
7924
* <p>Service Description: The Cloud Firestore service.
8025
*

google-cloud-firestore/src/test/java/com/google/cloud/firestore/LocalFirestoreHelper.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
import com.google.firestore.v1beta1.CommitRequest;
3232
import com.google.firestore.v1beta1.CommitResponse;
3333
import com.google.firestore.v1beta1.Cursor;
34-
import com.google.firestore.v1beta1.DatabaseName;
34+
import com.google.firestore.v1beta1.DatabaseRootName;
3535
import com.google.firestore.v1beta1.Document;
3636
import com.google.firestore.v1beta1.DocumentMask;
3737
import com.google.firestore.v1beta1.DocumentTransform;
@@ -551,7 +551,7 @@ public boolean equals(Object o) {
551551
null,
552552
new DocumentReference(
553553
null,
554-
ResourcePath.create(DatabaseName.create("", ""), ImmutableList.of("coll", "doc"))),
554+
ResourcePath.create(DatabaseRootName.create("", ""), ImmutableList.of("coll", "doc"))),
555555
SINGLE_FIELD_PROTO,
556556
Instant.ofEpochSecond(5, 6),
557557
Instant.ofEpochSecond(3, 4),

google-cloud-firestore/src/test/java/com/google/cloud/firestore/v1beta1/FirestoreClientTest.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,8 +74,7 @@ public class FirestoreClientTest {
7474
public static void startStaticServer() {
7575
mockFirestore = new MockFirestore();
7676
serviceHelper =
77-
new MockServiceHelper(
78-
"in-process-1", Arrays.<MockGrpcService>asList(mockFirestore));
77+
new MockServiceHelper("in-process-1", Arrays.<MockGrpcService>asList(mockFirestore));
7978
serviceHelper.start();
8079
}
8180

google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceClient.java

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -455,6 +455,73 @@ public final UnaryCallable<AnalyzeSyntaxRequest, AnalyzeSyntaxResponse> analyzeS
455455
return stub.analyzeSyntaxCallable();
456456
}
457457

458+
// AUTO-GENERATED DOCUMENTATION AND METHOD
459+
/**
460+
* Classifies a document into categories.
461+
*
462+
* <p>Sample code:
463+
*
464+
* <pre><code>
465+
* try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
466+
* Document document = Document.newBuilder().build();
467+
* ClassifyTextResponse response = languageServiceClient.classifyText(document);
468+
* }
469+
* </code></pre>
470+
*
471+
* @param document Input document.
472+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
473+
*/
474+
public final ClassifyTextResponse classifyText(Document document) {
475+
476+
ClassifyTextRequest request = ClassifyTextRequest.newBuilder().setDocument(document).build();
477+
return classifyText(request);
478+
}
479+
480+
// AUTO-GENERATED DOCUMENTATION AND METHOD
481+
/**
482+
* Classifies a document into categories.
483+
*
484+
* <p>Sample code:
485+
*
486+
* <pre><code>
487+
* try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
488+
* Document document = Document.newBuilder().build();
489+
* ClassifyTextRequest request = ClassifyTextRequest.newBuilder()
490+
* .setDocument(document)
491+
* .build();
492+
* ClassifyTextResponse response = languageServiceClient.classifyText(request);
493+
* }
494+
* </code></pre>
495+
*
496+
* @param request The request object containing all of the parameters for the API call.
497+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
498+
*/
499+
public final ClassifyTextResponse classifyText(ClassifyTextRequest request) {
500+
return classifyTextCallable().call(request);
501+
}
502+
503+
// AUTO-GENERATED DOCUMENTATION AND METHOD
504+
/**
505+
* Classifies a document into categories.
506+
*
507+
* <p>Sample code:
508+
*
509+
* <pre><code>
510+
* try (LanguageServiceClient languageServiceClient = LanguageServiceClient.create()) {
511+
* Document document = Document.newBuilder().build();
512+
* ClassifyTextRequest request = ClassifyTextRequest.newBuilder()
513+
* .setDocument(document)
514+
* .build();
515+
* ApiFuture&lt;ClassifyTextResponse&gt; future = languageServiceClient.classifyTextCallable().futureCall(request);
516+
* // Do something
517+
* ClassifyTextResponse response = future.get();
518+
* }
519+
* </code></pre>
520+
*/
521+
public final UnaryCallable<ClassifyTextRequest, ClassifyTextResponse> classifyTextCallable() {
522+
return stub.classifyTextCallable();
523+
}
524+
458525
// AUTO-GENERATED DOCUMENTATION AND METHOD
459526
/**
460527
* A convenience method that provides all the features that analyzeSentiment, analyzeEntities, and

google-cloud-language/src/main/java/com/google/cloud/language/v1/LanguageServiceSettings.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ public class LanguageServiceSettings extends ClientSettings {
9494
analyzeEntitySentimentSettings;
9595
private final SimpleCallSettings<AnalyzeSyntaxRequest, AnalyzeSyntaxResponse>
9696
analyzeSyntaxSettings;
97+
private final SimpleCallSettings<ClassifyTextRequest, ClassifyTextResponse> classifyTextSettings;
9798
private final SimpleCallSettings<AnnotateTextRequest, AnnotateTextResponse> annotateTextSettings;
9899

99100
/** Returns the object with the settings used for calls to analyzeSentiment. */
@@ -119,6 +120,11 @@ public SimpleCallSettings<AnalyzeSyntaxRequest, AnalyzeSyntaxResponse> analyzeSy
119120
return analyzeSyntaxSettings;
120121
}
121122

123+
/** Returns the object with the settings used for calls to classifyText. */
124+
public SimpleCallSettings<ClassifyTextRequest, ClassifyTextResponse> classifyTextSettings() {
125+
return classifyTextSettings;
126+
}
127+
122128
/** Returns the object with the settings used for calls to annotateText. */
123129
public SimpleCallSettings<AnnotateTextRequest, AnnotateTextResponse> annotateTextSettings() {
124130
return annotateTextSettings;
@@ -221,6 +227,7 @@ private LanguageServiceSettings(Builder settingsBuilder) throws IOException {
221227
analyzeEntitiesSettings = settingsBuilder.analyzeEntitiesSettings().build();
222228
analyzeEntitySentimentSettings = settingsBuilder.analyzeEntitySentimentSettings().build();
223229
analyzeSyntaxSettings = settingsBuilder.analyzeSyntaxSettings().build();
230+
classifyTextSettings = settingsBuilder.classifyTextSettings().build();
224231
annotateTextSettings = settingsBuilder.annotateTextSettings().build();
225232
}
226233

@@ -237,6 +244,8 @@ public static class Builder extends ClientSettings.Builder {
237244
analyzeEntitySentimentSettings;
238245
private final SimpleCallSettings.Builder<AnalyzeSyntaxRequest, AnalyzeSyntaxResponse>
239246
analyzeSyntaxSettings;
247+
private final SimpleCallSettings.Builder<ClassifyTextRequest, ClassifyTextResponse>
248+
classifyTextSettings;
240249
private final SimpleCallSettings.Builder<AnnotateTextRequest, AnnotateTextResponse>
241250
annotateTextSettings;
242251

@@ -288,6 +297,8 @@ private Builder(ClientContext clientContext) {
288297

289298
analyzeSyntaxSettings = SimpleCallSettings.newBuilder();
290299

300+
classifyTextSettings = SimpleCallSettings.newBuilder();
301+
291302
annotateTextSettings = SimpleCallSettings.newBuilder();
292303

293304
unaryMethodSettingsBuilders =
@@ -296,6 +307,7 @@ private Builder(ClientContext clientContext) {
296307
analyzeEntitiesSettings,
297308
analyzeEntitySentimentSettings,
298309
analyzeSyntaxSettings,
310+
classifyTextSettings,
299311
annotateTextSettings);
300312

301313
initDefaults(this);
@@ -330,6 +342,11 @@ private static Builder initDefaults(Builder builder) {
330342
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
331343
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
332344

345+
builder
346+
.classifyTextSettings()
347+
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
348+
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("default"));
349+
333350
builder
334351
.annotateTextSettings()
335352
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("idempotent"))
@@ -345,6 +362,7 @@ private Builder(LanguageServiceSettings settings) {
345362
analyzeEntitiesSettings = settings.analyzeEntitiesSettings.toBuilder();
346363
analyzeEntitySentimentSettings = settings.analyzeEntitySentimentSettings.toBuilder();
347364
analyzeSyntaxSettings = settings.analyzeSyntaxSettings.toBuilder();
365+
classifyTextSettings = settings.classifyTextSettings.toBuilder();
348366
annotateTextSettings = settings.annotateTextSettings.toBuilder();
349367

350368
unaryMethodSettingsBuilders =
@@ -353,6 +371,7 @@ private Builder(LanguageServiceSettings settings) {
353371
analyzeEntitiesSettings,
354372
analyzeEntitySentimentSettings,
355373
analyzeSyntaxSettings,
374+
classifyTextSettings,
356375
annotateTextSettings);
357376
}
358377

@@ -409,6 +428,12 @@ public Builder applyToAllUnaryMethods(
409428
return analyzeSyntaxSettings;
410429
}
411430

431+
/** Returns the builder for the settings used for calls to classifyText. */
432+
public SimpleCallSettings.Builder<ClassifyTextRequest, ClassifyTextResponse>
433+
classifyTextSettings() {
434+
return classifyTextSettings;
435+
}
436+
412437
/** Returns the builder for the settings used for calls to annotateText. */
413438
public SimpleCallSettings.Builder<AnnotateTextRequest, AnnotateTextResponse>
414439
annotateTextSettings() {

0 commit comments

Comments
 (0)