Skip to content
Permalink
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
  • Loading branch information
yoshi-automation committed Feb 16, 2021
1 parent 9ea86bb commit 09e44234121af299286afa597632c772fd66f8d0

Large diffs are not rendered by default.

@@ -32,6 +32,20 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (CompletionClient completionClient = CompletionClient.create()) {
* CompleteQueryRequest request =
* CompleteQueryRequest.newBuilder()
* .setTenant(TenantName.of("[PROJECT]", "[TENANT]").toString())
* .setQuery("query107944136")
* .addAllLanguageCodes(new ArrayList<String>())
* .setPageSize(883849137)
* .setCompany(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString())
* .build();
* CompleteQueryResponse response = completionClient.completeQuery(request);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the CompletionClient object to clean up resources such as
* threads. In the example above, try-with-resources is used, which automatically calls close().
*
@@ -134,6 +148,22 @@ public CompletionStub getStub() {
* Completes the specified prefix with keyword suggestions. Intended for use by a job search
* auto-complete search box.
*
* <p>Sample code:
*
* <pre>{@code
* try (CompletionClient completionClient = CompletionClient.create()) {
* CompleteQueryRequest request =
* CompleteQueryRequest.newBuilder()
* .setTenant(TenantName.of("[PROJECT]", "[TENANT]").toString())
* .setQuery("query107944136")
* .addAllLanguageCodes(new ArrayList<String>())
* .setPageSize(883849137)
* .setCompany(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString())
* .build();
* CompleteQueryResponse response = completionClient.completeQuery(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -147,6 +177,23 @@ public final CompleteQueryResponse completeQuery(CompleteQueryRequest request) {
* auto-complete search box.
*
* <p>Sample code:
*
* <pre>{@code
* try (CompletionClient completionClient = CompletionClient.create()) {
* CompleteQueryRequest request =
* CompleteQueryRequest.newBuilder()
* .setTenant(TenantName.of("[PROJECT]", "[TENANT]").toString())
* .setQuery("query107944136")
* .addAllLanguageCodes(new ArrayList<String>())
* .setPageSize(883849137)
* .setCompany(CompanyName.of("[PROJECT]", "[TENANT]", "[COMPANY]").toString())
* .build();
* ApiFuture<CompleteQueryResponse> future =
* completionClient.completeQueryCallable().futureCall(request);
* // Do something.
* CompleteQueryResponse response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CompleteQueryRequest, CompleteQueryResponse> completeQueryCallable() {
return stub.completeQueryCallable();
@@ -32,6 +32,14 @@
* <p>This class provides the ability to make remote calls to the backing service through method
* calls that map to API methods. Sample code to get started:
*
* <pre>{@code
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
* TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
* ClientEvent clientEvent = ClientEvent.newBuilder().build();
* ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent);
* }
* }</pre>
*
* <p>Note: close() needs to be called on the EventServiceClient object to clean up resources such
* as threads. In the example above, try-with-resources is used, which automatically calls close().
*
@@ -137,6 +145,16 @@ public EventServiceStub getStub() {
* tools](https://console.cloud.google.com/talent-solution/overview). [Learn
* more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
*
* <p>Sample code:
*
* <pre>{@code
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
* TenantName parent = TenantName.of("[PROJECT]", "[TENANT]");
* ClientEvent clientEvent = ClientEvent.newBuilder().build();
* ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent);
* }
* }</pre>
*
* @param parent Required. Resource name of the tenant under which the event is created.
* <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example,
* "projects/foo/tenants/bar".
@@ -160,6 +178,16 @@ public final ClientEvent createClientEvent(TenantName parent, ClientEvent client
* tools](https://console.cloud.google.com/talent-solution/overview). [Learn
* more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
*
* <p>Sample code:
*
* <pre>{@code
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
* String parent = TenantName.of("[PROJECT]", "[TENANT]").toString();
* ClientEvent clientEvent = ClientEvent.newBuilder().build();
* ClientEvent response = eventServiceClient.createClientEvent(parent, clientEvent);
* }
* }</pre>
*
* @param parent Required. Resource name of the tenant under which the event is created.
* <p>The format is "projects/{project_id}/tenants/{tenant_id}", for example,
* "projects/foo/tenants/bar".
@@ -180,6 +208,19 @@ public final ClientEvent createClientEvent(String parent, ClientEvent clientEven
* tools](https://console.cloud.google.com/talent-solution/overview). [Learn
* more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
*
* <p>Sample code:
*
* <pre>{@code
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
* CreateClientEventRequest request =
* CreateClientEventRequest.newBuilder()
* .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
* .setClientEvent(ClientEvent.newBuilder().build())
* .build();
* ClientEvent response = eventServiceClient.createClientEvent(request);
* }
* }</pre>
*
* @param request The request object containing all of the parameters for the API call.
* @throws com.google.api.gax.rpc.ApiException if the remote call fails
*/
@@ -195,6 +236,20 @@ public final ClientEvent createClientEvent(CreateClientEventRequest request) {
* more](https://cloud.google.com/talent-solution/docs/management-tools) about self service tools.
*
* <p>Sample code:
*
* <pre>{@code
* try (EventServiceClient eventServiceClient = EventServiceClient.create()) {
* CreateClientEventRequest request =
* CreateClientEventRequest.newBuilder()
* .setParent(TenantName.of("[PROJECT]", "[TENANT]").toString())
* .setClientEvent(ClientEvent.newBuilder().build())
* .build();
* ApiFuture<ClientEvent> future =
* eventServiceClient.createClientEventCallable().futureCall(request);
* // Do something.
* ClientEvent response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<CreateClientEventRequest, ClientEvent> createClientEventCallable() {
return stub.createClientEventCallable();

0 comments on commit 09e4423

Please sign in to comment.