Skip to content

Commit 73e9031

Browse files
feat: [discoveryengine] add search, autocomplete and schema services (#9374)
- [ ] Regenerate this pull request now. feat: add unstructured document support (PDF/HTML) docs: keep the API doc up-to-date with recent changes PiperOrigin-RevId: 526041628 Source-Link: https://togithub.com/googleapis/googleapis/commit/cb802d9a404595943a080378a02f7eabdb111109 Source-Link: https://togithub.com/googleapis/googleapis-gen/commit/ce94886f16aedfea80d5cfb49f3eac8bbeddef66 Copy-Tag: eyJwIjoiamF2YS1kaXNjb3ZlcnllbmdpbmUvLk93bEJvdC55YW1sIiwiaCI6ImNlOTQ4ODZmMTZhZWRmZWE4MGQ1Y2ZiNDlmM2VhYzhiYmVkZGVmNjYifQ==
1 parent 3aeb0df commit 73e9031

File tree

162 files changed

+59362
-762
lines changed

Some content is hidden

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

162 files changed

+59362
-762
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.11.0</version>
26+
<version>26.13.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.10.0
204+
[maven-version-link]: https://central.sonatype.com/artifact/com.google.cloud/google-cloud-discoveryengine/0.11.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
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,278 @@
1+
/*
2+
* Copyright 2022 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.v1beta;
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.v1beta.stub.CompletionServiceStub;
23+
import com.google.cloud.discoveryengine.v1beta.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+
* .build();
52+
* CompleteQueryResponse response = completionServiceClient.completeQuery(request);
53+
* }
54+
* }</pre>
55+
*
56+
* <p>Note: close() needs to be called on the CompletionServiceClient object to clean up resources
57+
* such as threads. In the example above, try-with-resources is used, which automatically calls
58+
* close().
59+
*
60+
* <p>The surface of this class includes several types of Java methods for each of the API's
61+
* methods:
62+
*
63+
* <ol>
64+
* <li>A "flattened" method. With this type of method, the fields of the request type have been
65+
* converted into function parameters. It may be the case that not all fields are available as
66+
* parameters, and not every API method will have a flattened method entry point.
67+
* <li>A "request object" method. This type of method only takes one parameter, a request object,
68+
* which must be constructed before the call. Not every API method will have a request object
69+
* method.
70+
* <li>A "callable" method. This type of method takes no parameters and returns an immutable API
71+
* callable object, which can be used to initiate calls to the service.
72+
* </ol>
73+
*
74+
* <p>See the individual methods for example code.
75+
*
76+
* <p>Many parameters require resource names to be formatted in a particular way. To assist with
77+
* these names, this class includes a format method for each type of name, and additionally a parse
78+
* method to extract the individual identifiers contained within names that are returned.
79+
*
80+
* <p>This class can be customized by passing in a custom instance of CompletionServiceSettings to
81+
* create(). For example:
82+
*
83+
* <p>To customize credentials:
84+
*
85+
* <pre>{@code
86+
* // This snippet has been automatically generated and should be regarded as a code template only.
87+
* // It will require modifications to work:
88+
* // - It may require correct/in-range values for request initialization.
89+
* // - It may require specifying regional endpoints when creating the service client as shown in
90+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
91+
* CompletionServiceSettings completionServiceSettings =
92+
* CompletionServiceSettings.newBuilder()
93+
* .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
94+
* .build();
95+
* CompletionServiceClient completionServiceClient =
96+
* CompletionServiceClient.create(completionServiceSettings);
97+
* }</pre>
98+
*
99+
* <p>To customize the endpoint:
100+
*
101+
* <pre>{@code
102+
* // This snippet has been automatically generated and should be regarded as a code template only.
103+
* // It will require modifications to work:
104+
* // - It may require correct/in-range values for request initialization.
105+
* // - It may require specifying regional endpoints when creating the service client as shown in
106+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
107+
* CompletionServiceSettings completionServiceSettings =
108+
* CompletionServiceSettings.newBuilder().setEndpoint(myEndpoint).build();
109+
* CompletionServiceClient completionServiceClient =
110+
* CompletionServiceClient.create(completionServiceSettings);
111+
* }</pre>
112+
*
113+
* <p>To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over
114+
* the wire:
115+
*
116+
* <pre>{@code
117+
* // This snippet has been automatically generated and should be regarded as a code template only.
118+
* // It will require modifications to work:
119+
* // - It may require correct/in-range values for request initialization.
120+
* // - It may require specifying regional endpoints when creating the service client as shown in
121+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
122+
* CompletionServiceSettings completionServiceSettings =
123+
* CompletionServiceSettings.newHttpJsonBuilder().build();
124+
* CompletionServiceClient completionServiceClient =
125+
* CompletionServiceClient.create(completionServiceSettings);
126+
* }</pre>
127+
*
128+
* <p>Please refer to the GitHub repository's samples for more quickstart code snippets.
129+
*/
130+
@BetaApi
131+
@Generated("by gapic-generator-java")
132+
public class CompletionServiceClient implements BackgroundResource {
133+
private final CompletionServiceSettings settings;
134+
private final CompletionServiceStub stub;
135+
136+
/** Constructs an instance of CompletionServiceClient with default settings. */
137+
public static final CompletionServiceClient create() throws IOException {
138+
return create(CompletionServiceSettings.newBuilder().build());
139+
}
140+
141+
/**
142+
* Constructs an instance of CompletionServiceClient, using the given settings. The channels are
143+
* created based on the settings passed in, or defaults for any settings that are not set.
144+
*/
145+
public static final CompletionServiceClient create(CompletionServiceSettings settings)
146+
throws IOException {
147+
return new CompletionServiceClient(settings);
148+
}
149+
150+
/**
151+
* Constructs an instance of CompletionServiceClient, using the given stub for making calls. This
152+
* is for advanced usage - prefer using create(CompletionServiceSettings).
153+
*/
154+
public static final CompletionServiceClient create(CompletionServiceStub stub) {
155+
return new CompletionServiceClient(stub);
156+
}
157+
158+
/**
159+
* Constructs an instance of CompletionServiceClient, using the given settings. This is protected
160+
* so that it is easy to make a subclass, but otherwise, the static factory methods should be
161+
* preferred.
162+
*/
163+
protected CompletionServiceClient(CompletionServiceSettings settings) throws IOException {
164+
this.settings = settings;
165+
this.stub = ((CompletionServiceStubSettings) settings.getStubSettings()).createStub();
166+
}
167+
168+
protected CompletionServiceClient(CompletionServiceStub stub) {
169+
this.settings = null;
170+
this.stub = stub;
171+
}
172+
173+
public final CompletionServiceSettings getSettings() {
174+
return settings;
175+
}
176+
177+
public CompletionServiceStub getStub() {
178+
return stub;
179+
}
180+
181+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
182+
/**
183+
* Completes the specified user input with keyword suggestions.
184+
*
185+
* <p>Sample code:
186+
*
187+
* <pre>{@code
188+
* // This snippet has been automatically generated and should be regarded as a code template only.
189+
* // It will require modifications to work:
190+
* // - It may require correct/in-range values for request initialization.
191+
* // - It may require specifying regional endpoints when creating the service client as shown in
192+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
193+
* try (CompletionServiceClient completionServiceClient = CompletionServiceClient.create()) {
194+
* CompleteQueryRequest request =
195+
* CompleteQueryRequest.newBuilder()
196+
* .setDataStore(
197+
* DataStoreName.ofProjectLocationDataStoreName(
198+
* "[PROJECT]", "[LOCATION]", "[DATA_STORE]")
199+
* .toString())
200+
* .setQuery("query107944136")
201+
* .setQueryModel("queryModel-184930495")
202+
* .setUserPseudoId("userPseudoId-1155274652")
203+
* .build();
204+
* CompleteQueryResponse response = completionServiceClient.completeQuery(request);
205+
* }
206+
* }</pre>
207+
*
208+
* @param request The request object containing all of the parameters for the API call.
209+
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
210+
*/
211+
public final CompleteQueryResponse completeQuery(CompleteQueryRequest request) {
212+
return completeQueryCallable().call(request);
213+
}
214+
215+
// AUTO-GENERATED DOCUMENTATION AND METHOD.
216+
/**
217+
* Completes the specified user input with keyword suggestions.
218+
*
219+
* <p>Sample code:
220+
*
221+
* <pre>{@code
222+
* // This snippet has been automatically generated and should be regarded as a code template only.
223+
* // It will require modifications to work:
224+
* // - It may require correct/in-range values for request initialization.
225+
* // - It may require specifying regional endpoints when creating the service client as shown in
226+
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
227+
* try (CompletionServiceClient completionServiceClient = CompletionServiceClient.create()) {
228+
* CompleteQueryRequest request =
229+
* CompleteQueryRequest.newBuilder()
230+
* .setDataStore(
231+
* DataStoreName.ofProjectLocationDataStoreName(
232+
* "[PROJECT]", "[LOCATION]", "[DATA_STORE]")
233+
* .toString())
234+
* .setQuery("query107944136")
235+
* .setQueryModel("queryModel-184930495")
236+
* .setUserPseudoId("userPseudoId-1155274652")
237+
* .build();
238+
* ApiFuture<CompleteQueryResponse> future =
239+
* completionServiceClient.completeQueryCallable().futureCall(request);
240+
* // Do something.
241+
* CompleteQueryResponse response = future.get();
242+
* }
243+
* }</pre>
244+
*/
245+
public final UnaryCallable<CompleteQueryRequest, CompleteQueryResponse> completeQueryCallable() {
246+
return stub.completeQueryCallable();
247+
}
248+
249+
@Override
250+
public final void close() {
251+
stub.close();
252+
}
253+
254+
@Override
255+
public void shutdown() {
256+
stub.shutdown();
257+
}
258+
259+
@Override
260+
public boolean isShutdown() {
261+
return stub.isShutdown();
262+
}
263+
264+
@Override
265+
public boolean isTerminated() {
266+
return stub.isTerminated();
267+
}
268+
269+
@Override
270+
public void shutdownNow() {
271+
stub.shutdownNow();
272+
}
273+
274+
@Override
275+
public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException {
276+
return stub.awaitTermination(duration, unit);
277+
}
278+
}

0 commit comments

Comments
 (0)