Skip to content
This repository was archived by the owner on Sep 27, 2023. It is now read-only.

Commit 09e4423

Browse files
docs: generate sample code in the Java microgenerator (#409)
Committer: @miraleung PiperOrigin-RevId: 356341083 Source-Author: Google APIs <noreply@google.com> Source-Date: Mon Feb 8 13:33:28 2021 -0800 Source-Repo: googleapis/googleapis Source-Sha: 8d8c008e56f1af31d57f75561e0f1848ffb29eeb Source-Link: googleapis/googleapis@8d8c008
1 parent 9ea86bb commit 09e4423

15 files changed

+3100
-4
lines changed

google-cloud-talent/src/main/java/com/google/cloud/talent/v4/CompanyServiceClient.java

Lines changed: 248 additions & 0 deletions
Large diffs are not rendered by default.

google-cloud-talent/src/main/java/com/google/cloud/talent/v4/CompletionClient.java

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,20 @@
3232
* <p>This class provides the ability to make remote calls to the backing service through method
3333
* calls that map to API methods. Sample code to get started:
3434
*
35+
* <pre>{@code
36+
* try (CompletionClient completionClient = CompletionClient.create()) {
37+
* CompleteQueryRequest request =
38+
* CompleteQueryRequest.newBuilder()
39+
* .setTenant(TenantName.of("[PROJECT]", "[TENANT]").toString())
40+
* .setQuery("query107944136")
41+
* .addAllLanguageCodes(new ArrayList<String>())
42+
* .setPageSize(883849137)
43+
* .setCompany(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString())
44+
* .build();
45+
* CompleteQueryResponse response = completionClient.completeQuery(request);
46+
* }
47+
* }</pre>
48+
*
3549
* <p>Note: close() needs to be called on the CompletionClient object to clean up resources such as
3650
* threads. In the example above, try-with-resources is used, which automatically calls close().
3751
*
@@ -134,6 +148,22 @@ public CompletionStub getStub() {
134148
* Completes the specified prefix with keyword suggestions. Intended for use by a job search
135149
* auto-complete search box.
136150
*
151+
* <p>Sample code:
152+
*
153+
* <pre>{@code
154+
* try (CompletionClient completionClient = CompletionClient.create()) {
155+
* CompleteQueryRequest request =
156+
* CompleteQueryRequest.newBuilder()
157+
* .setTenant(TenantName.of("[PROJECT]", "[TENANT]").toString())
158+
* .setQuery("query107944136")
159+
* .addAllLanguageCodes(new ArrayList<String>())
160+
* .setPageSize(883849137)
161+
* .setCompany(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString())
162+
* .build();
163+
* CompleteQueryResponse response = completionClient.completeQuery(request);
164+
* }
165+
* }</pre>
166+
*
137167
* @param request The request object containing all of the parameters for the API call.
138168
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
139169
*/
@@ -147,6 +177,23 @@ public final CompleteQueryResponse completeQuery(CompleteQueryRequest request) {
147177
* auto-complete search box.
148178
*
149179
* <p>Sample code:
180+
*
181+
* <pre>{@code
182+
* try (CompletionClient completionClient = CompletionClient.create()) {
183+
* CompleteQueryRequest request =
184+
* CompleteQueryRequest.newBuilder()
185+
* .setTenant(TenantName.of("[PROJECT]", "[TENANT]").toString())
186+
* .setQuery("query107944136")
187+
* .addAllLanguageCodes(new ArrayList<String>())
188+
* .setPageSize(883849137)
189+
* .setCompany(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString())
190+
* .build();
191+
* ApiFuture<CompleteQueryResponse> future =
192+
* completionClient.completeQueryCallable().futureCall(request);
193+
* // Do something.
194+
* CompleteQueryResponse response = future.get();
195+
* }
196+
* }</pre>
150197
*/
151198
public final UnaryCallable<CompleteQueryRequest, CompleteQueryResponse> completeQueryCallable() {
152199
return stub.completeQueryCallable();

google-cloud-talent/src/main/java/com/google/cloud/talent/v4/EventServiceClient.java

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@
3232
* <p>This class provides the ability to make remote calls to the backing service through method
3333
* calls that map to API methods. Sample code to get started:
3434
*
35+
* <pre>{@code
36+
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
37+
* TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
38+
* ClientEvent clientEvent = ClientEvent.newBuilder().build();
39+
* ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent);
40+
* }
41+
* }</pre>
42+
*
3543
* <p>Note: close() needs to be called on the EventServiceClient object to clean up resources such
3644
* as threads. In the example above, try-with-resources is used, which automatically calls close().
3745
*
@@ -137,6 +145,16 @@ public EventServiceStub getStub() {
137145
* tools](https://console.cloud.google.com/talent-solution/overview). [Learn
138146
* more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
139147
*
148+
* <p>Sample code:
149+
*
150+
* <pre>{@code
151+
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
152+
* TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
153+
* ClientEvent clientEvent = ClientEvent.newBuilder().build();
154+
* ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent);
155+
* }
156+
* }</pre>
157+
*
140158
* @param parent Required. Resource name of the tenant under which the event is created.
141159
* <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example,
142160
* "projects/foo/tenants/bar".
@@ -160,6 +178,16 @@ public final ClientEvent createClientEvent(TenantName parent, ClientEvent client
160178
* tools](https://console.cloud.google.com/talent-solution/overview). [Learn
161179
* more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
162180
*
181+
* <p>Sample code:
182+
*
183+
* <pre>{@code
184+
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
185+
* String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
186+
* ClientEvent clientEvent = ClientEvent.newBuilder().build();
187+
* ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent);
188+
* }
189+
* }</pre>
190+
*
163191
* @param parent Required. Resource name of the tenant under which the event is created.
164192
* <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example,
165193
* "projects/foo/tenants/bar".
@@ -180,6 +208,19 @@ public final ClientEvent createClientEvent(String parent, ClientEvent clientEven
180208
* tools](https://console.cloud.google.com/talent-solution/overview). [Learn
181209
* more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
182210
*
211+
* <p>Sample code:
212+
*
213+
* <pre>{@code
214+
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
215+
* CreateClientEventRequest request =
216+
* CreateClientEventRequest.newBuilder()
217+
* .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
218+
* .setClientEvent(ClientEvent.newBuilder().build())
219+
* .build();
220+
* ClientEvent response = eventServiceClient.createClientEvent(request);
221+
* }
222+
* }</pre>
223+
*
183224
* @param request The request object containing all of the parameters for the API call.
184225
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
185226
*/
@@ -195,6 +236,20 @@ public final ClientEvent createClientEvent(CreateClientEventRequest request) {
195236
* more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
196237
*
197238
* <p>Sample code:
239+
*
240+
* <pre>{@code
241+
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
242+
* CreateClientEventRequest request =
243+
* CreateClientEventRequest.newBuilder()
244+
* .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
245+
* .setClientEvent(ClientEvent.newBuilder().build())
246+
* .build();
247+
* ApiFuture<ClientEvent> future =
248+
* eventServiceClient.createClientEventCallable().futureCall(request);
249+
* // Do something.
250+
* ClientEvent response = future.get();
251+
* }
252+
* }</pre>
198253
*/
199254
public final UnaryCallable<CreateClientEventRequest, ClientEvent> createClientEventCallable() {
200255
return stub.createClientEventCallable();

0 commit comments

Comments
 (0)