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

feat: generate sample code in the Java microgenerator #409

Merged
merged 1 commit into from Feb 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view

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