Skip to content

Commit f4b2dda

Browse files
feat: [discoveryengine] add v1alpha public library for discoveryengine (#9953)
- [ ] Regenerate this pull request now. PiperOrigin-RevId: 572280880 Source-Link: https://togithub.com/googleapis/googleapis/commit/f5cacaf0364606541f64c26e87370214f1199907 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/036171b68de5829f5cfa92949484cfcb7f00af28 Copy-Tag: eyJwIjoiamF2YS1kaXNjb3ZlcnllbmdpbmUvLk93bEJvdC55YW1sIiwiaCI6IjAzNjE3MWI2OGRlNTgyOWY1Y2ZhOTI5NDk0ODRjZmNiN2YwMGFmMjgifQ==
1 parent d1a4b77 commit f4b2dda

File tree

424 files changed

+205175
-2
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

424 files changed

+205175
-2
lines changed

java-discoveryengine/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
2323
<dependency>
2424
<groupId>com.google.cloud</groupId>
2525
<artifactId>libraries-bom</artifactId>
26-
<version>26.23.0</version>
26+
<version>26.25.0</version>
2727
<type>pom</type>
2828
<scope>import</scope>
2929
</dependency>
@@ -201,7 +201,7 @@ Java is a registered trademark of Oracle and/or its affiliates.
201201
[kokoro-badge-link-5]: http://storage.googleapis.com/cloud-devrel-public/java/badges/google-cloud-java/java11.html
202202
[stability-image]: https://img.shields.io/badge/stability-preview-yellow
203203
[maven-version-image]: https://img.shields.io/maven-central/v/com.google.cloud/google-cloud-discoveryengine.svg
204-
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-discoveryengine/0.20.0
204+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-discoveryengine/0.24.0
205205
[authentication]: https://github.com/googleapis/google-cloud-java#authentication
206206
[auth-scopes]: https://developers.google.com/identity/protocols/oauth2/scopes
207207
[predefined-iam-roles]: https://cloud.google.com/iam/docs/understanding-roles#predefined_roles

java-discoveryengine/google-cloud-discoveryengine-bom/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
<artifactId>grpc-google-cloud-discoveryengine-v1</artifactId>
4040
<version>0.24.0</version><!-- {x-version-update:grpc-google-cloud-discoveryengine-v1:current} -->
4141
</dependency>
42+
<dependency>
43+
<groupId>com.google.api.grpc</groupId>
44+
<artifactId>grpc-google-cloud-discoveryengine-v1alpha</artifactId>
45+
<version>0.24.0</version><!-- {x-version-update:grpc-google-cloud-discoveryengine-v1alpha:current} -->
46+
</dependency>
4247
<dependency>
4348
<groupId>com.google.api.grpc</groupId>
4449
<artifactId>proto-google-cloud-discoveryengine-v1beta</artifactId>
@@ -49,6 +54,11 @@
4954
<artifactId>proto-google-cloud-discoveryengine-v1</artifactId>
5055
<version>0.24.0</version><!-- {x-version-update:proto-google-cloud-discoveryengine-v1:current} -->
5156
</dependency>
57+
<dependency>
58+
<groupId>com.google.api.grpc</groupId>
59+
<artifactId>proto-google-cloud-discoveryengine-v1alpha</artifactId>
60+
<version>0.24.0</version><!-- {x-version-update:proto-google-cloud-discoveryengine-v1alpha:current} -->
61+
</dependency>
5262
</dependencies>
5363
</dependencyManagement>
5464
</project>

java-discoveryengine/google-cloud-discoveryengine/pom.xml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@
4141
<artifactId>proto-google-common-protos</artifactId>
4242
</dependency>
4343

44+
<dependency>
45+
<groupId>com.google.api.grpc</groupId>
46+
<artifactId>proto-google-cloud-discoveryengine-v1alpha</artifactId>
47+
</dependency>
4448
<dependency>
4549
<groupId>com.google.api.grpc</groupId>
4650
<artifactId>proto-google-cloud-discoveryengine-v1</artifactId>
@@ -69,6 +73,11 @@
6973
<groupId>com.google.api.grpc</groupId>
7074
<artifactId>grpc-google-common-protos</artifactId>
7175
</dependency>
76+
<dependency>
77+
<groupId>com.google.api.grpc</groupId>
78+
<artifactId>grpc-google-cloud-discoveryengine-v1alpha</artifactId>
79+
<scope>test</scope>
80+
</dependency>
7281
<dependency>
7382
<groupId>com.google.api.grpc</groupId>
7483
<artifactId>grpc-google-cloud-discoveryengine-v1</artifactId>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
1+
/*
2+
* Copyright 2023 Google LLC
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.google.cloud.discoveryengine.v1alpha;
18+
19+
import com.google.api.core.BetaApi;
20+
import com.google.api.gax.core.BackgroundResource;
21+
import com.google.api.gax.rpc.UnaryCallable;
22+
import com.google.cloud.discoveryengine.v1alpha.stub.CompletionServiceStub;
23+
import com.google.cloud.discoveryengine.v1alpha.stub.CompletionServiceStubSettings;
24+
import java.io.IOException;
25+
import java.util.concurrent.TimeUnit;
26+
import javax.annotation.Generated;
27+
28+
// AUTO-GENERATED DOCUMENTATION AND CLASS.
29+
/**
30+
* Service Description: Service for Auto-Completion.
31+
*
32+
* <p>This class provides the ability to make remote calls to the backing service through method
33+
* calls that map to API methods. Sample code to get started:
34+
*
35+
* <pre>{@code
36+
* // This snippet has been automatically generated and should be regarded as a code template only.
37+
* // It will require modifications to work:
38+
* // - It may require correct/in-range values for request initialization.
39+
* // - It may require specifying regional endpoints when creating the service client as shown in
40+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
41+
* try (CompletionServiceClient completionServiceClient = CompletionServiceClient.create()) {
42+
* CompleteQueryRequest request =
43+
* CompleteQueryRequest.newBuilder()
44+
* .setDataStore(
45+
* DataStoreName.ofProjectLocationDataStoreName(
46+
* "[PROJECT]", "[LOCATION]", "[DATA_STORE]")
47+
* .toString())
48+
* .setQuery("query107944136")
49+
* .setQueryModel("queryModel-184930495")
50+
* .setUserPseudoId("userPseudoId-1155274652")
51+
* .setIncludeTailSuggestions(true)
52+
* .build();
53+
* CompleteQueryResponse response = completionServiceClient.completeQuery(request);
54+
* }
55+
* }</pre>
56+
*
57+
* <p>Note: close() needs to be called on the CompletionServiceClient object to clean up resources
58+
* such as threads. In the example above, try-with-resources is used, which automatically calls
59+
* close().
60+
*
61+
* <p>The surface of this class includes several types of Java methods for each of the API's
62+
* methods:
63+
*
64+
* <ol>
65+
* <li>A "flattened" method. With this type of method, the fields of the request type have been
66+
* converted into function parameters. It may be the case that not all fields are available as
67+
* parameters, and not every API method will have a flattened method entry point.
68+
* <li>A "request object" method. This type of method only takes one parameter, a request object,
69+
* which must be constructed before the call. Not every API method will have a request object
70+
* method.
71+
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
72+
* callable object, which can be used to initiate calls to the service.
73+
* </ol>
74+
*
75+
* <p>See the individual methods for example code.
76+
*
77+
* <p>Many parameters require resource names to be formatted in a particular way. To assist with
78+
* these names, this class includes a format method for each type of name, and additionally a parse
79+
* method to extract the individual identifiers contained within names that are returned.
80+
*
81+
* <p>This class can be customized by passing in a custom instance of CompletionServiceSettings to
82+
* create(). For example:
83+
*
84+
* <p>To customize credentials:
85+
*
86+
* <pre>{@code
87+
* // This snippet has been automatically generated and should be regarded as a code template only.
88+
* // It will require modifications to work:
89+
* // - It may require correct/in-range values for request initialization.
90+
* // - It may require specifying regional endpoints when creating the service client as shown in
91+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
92+
* CompletionServiceSettings completionServiceSettings =
93+
* CompletionServiceSettings.newBuilder()
94+
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
95+
* .build();
96+
* CompletionServiceClient completionServiceClient =
97+
* CompletionServiceClient.create(completionServiceSettings);
98+
* }</pre>
99+
*
100+
* <p>To customize the endpoint:
101+
*
102+
* <pre>{@code
103+
* // This snippet has been automatically generated and should be regarded as a code template only.
104+
* // It will require modifications to work:
105+
* // - It may require correct/in-range values for request initialization.
106+
* // - It may require specifying regional endpoints when creating the service client as shown in
107+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
108+
* CompletionServiceSettings completionServiceSettings =
109+
* CompletionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
110+
* CompletionServiceClient completionServiceClient =
111+
* CompletionServiceClient.create(completionServiceSettings);
112+
* }</pre>
113+
*
114+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
115+
* the wire:
116+
*
117+
* <pre>{@code
118+
* // This snippet has been automatically generated and should be regarded as a code template only.
119+
* // It will require modifications to work:
120+
* // - It may require correct/in-range values for request initialization.
121+
* // - It may require specifying regional endpoints when creating the service client as shown in
122+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
123+
* CompletionServiceSettings completionServiceSettings =
124+
* CompletionServiceSettings.newHttpJsonBuilder().build();
125+
* CompletionServiceClient completionServiceClient =
126+
* CompletionServiceClient.create(completionServiceSettings);
127+
* }</pre>
128+
*
129+
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
130+
*/
131+
@BetaApi
132+
@Generated("by gapic-generator-java")
133+
public class CompletionServiceClient implements BackgroundResource {
134+
private final CompletionServiceSettings settings;
135+
private final CompletionServiceStub stub;
136+
137+
/** Constructs an instance of CompletionServiceClient with default settings. */
138+
public static final CompletionServiceClient create() throws IOException {
139+
return create(CompletionServiceSettings.newBuilder().build());
140+
}
141+
142+
/**
143+
* Constructs an instance of CompletionServiceClient, using the given settings. The channels are
144+
* created based on the settings passed in, or defaults for any settings that are not set.
145+
*/
146+
public static final CompletionServiceClient create(CompletionServiceSettings settings)
147+
throws IOException {
148+
return new CompletionServiceClient(settings);
149+
}
150+
151+
/**
152+
* Constructs an instance of CompletionServiceClient, using the given stub for making calls. This
153+
* is for advanced usage - prefer using create(CompletionServiceSettings).
154+
*/
155+
public static final CompletionServiceClient create(CompletionServiceStub stub) {
156+
return new CompletionServiceClient(stub);
157+
}
158+
159+
/**
160+
* Constructs an instance of CompletionServiceClient, using the given settings. This is protected
161+
* so that it is easy to make a subclass, but otherwise, the static factory methods should be
162+
* preferred.
163+
*/
164+
protected CompletionServiceClient(CompletionServiceSettings settings) throws IOException {
165+
this.settings = settings;
166+
this.stub = ((CompletionServiceStubSettings) settings.getStubSettings()).createStub();
167+
}
168+
169+
protected CompletionServiceClient(CompletionServiceStub stub) {
170+
this.settings = null;
171+
this.stub = stub;
172+
}
173+
174+
public final CompletionServiceSettings getSettings() {
175+
return settings;
176+
}
177+
178+
public CompletionServiceStub getStub() {
179+
return stub;
180+
}
181+
182+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
183+
/**
184+
* Completes the specified user input with keyword suggestions.
185+
*
186+
* <p>Sample code:
187+
*
188+
* <pre>{@code
189+
* // This snippet has been automatically generated and should be regarded as a code template only.
190+
* // It will require modifications to work:
191+
* // - It may require correct/in-range values for request initialization.
192+
* // - It may require specifying regional endpoints when creating the service client as shown in
193+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
194+
* try (CompletionServiceClient completionServiceClient = CompletionServiceClient.create()) {
195+
* CompleteQueryRequest request =
196+
* CompleteQueryRequest.newBuilder()
197+
* .setDataStore(
198+
* DataStoreName.ofProjectLocationDataStoreName(
199+
* "[PROJECT]", "[LOCATION]", "[DATA_STORE]")
200+
* .toString())
201+
* .setQuery("query107944136")
202+
* .setQueryModel("queryModel-184930495")
203+
* .setUserPseudoId("userPseudoId-1155274652")
204+
* .setIncludeTailSuggestions(true)
205+
* .build();
206+
* CompleteQueryResponse response = completionServiceClient.completeQuery(request);
207+
* }
208+
* }</pre>
209+
*
210+
* @param request The request object containing all of the parameters for the API call.
211+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
212+
*/
213+
public final CompleteQueryResponse completeQuery(CompleteQueryRequest request) {
214+
return completeQueryCallable().call(request);
215+
}
216+
217+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
218+
/**
219+
* Completes the specified user input with keyword suggestions.
220+
*
221+
* <p>Sample code:
222+
*
223+
* <pre>{@code
224+
* // This snippet has been automatically generated and should be regarded as a code template only.
225+
* // It will require modifications to work:
226+
* // - It may require correct/in-range values for request initialization.
227+
* // - It may require specifying regional endpoints when creating the service client as shown in
228+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
229+
* try (CompletionServiceClient completionServiceClient = CompletionServiceClient.create()) {
230+
* CompleteQueryRequest request =
231+
* CompleteQueryRequest.newBuilder()
232+
* .setDataStore(
233+
* DataStoreName.ofProjectLocationDataStoreName(
234+
* "[PROJECT]", "[LOCATION]", "[DATA_STORE]")
235+
* .toString())
236+
* .setQuery("query107944136")
237+
* .setQueryModel("queryModel-184930495")
238+
* .setUserPseudoId("userPseudoId-1155274652")
239+
* .setIncludeTailSuggestions(true)
240+
* .build();
241+
* ApiFuture<CompleteQueryResponse> future =
242+
* completionServiceClient.completeQueryCallable().futureCall(request);
243+
* // Do something.
244+
* CompleteQueryResponse response = future.get();
245+
* }
246+
* }</pre>
247+
*/
248+
public final UnaryCallable<CompleteQueryRequest, CompleteQueryResponse> completeQueryCallable() {
249+
return stub.completeQueryCallable();
250+
}
251+
252+
@Override
253+
public final void close() {
254+
stub.close();
255+
}
256+
257+
@Override
258+
public void shutdown() {
259+
stub.shutdown();
260+
}
261+
262+
@Override
263+
public boolean isShutdown() {
264+
return stub.isShutdown();
265+
}
266+
267+
@Override
268+
public boolean isTerminated() {
269+
return stub.isTerminated();
270+
}
271+
272+
@Override
273+
public void shutdownNow() {
274+
stub.shutdownNow();
275+
}
276+
277+
@Override
278+
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
279+
return stub.awaitTermination(duration, unit);
280+
}
281+
}

0 commit comments

Comments
 (0)