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

Commit

Permalink
docs: generate sample code in the Java microgenerator (#409)
Browse files Browse the repository at this point in the history
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 09e4423
Show file tree
Hide file tree
Showing 15 changed files with 3,100 additions and 4 deletions.

Large diffs are not rendered by default.

Expand Up @@ -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().
*
Expand Down Expand Up @@ -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
*/
Expand All @@ -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();
Expand Down
Expand Up @@ -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().
*
Expand Down Expand Up @@ -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".
Expand All @@ -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".
Expand All @@ -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
*/
Expand All @@ -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();
Expand Down

0 comments on commit 09e4423

Please sign in to comment.