Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: [dialogflow-cx] add support for AdvancedSettings #9918

Merged
merged 4 commits into from
Sep 28, 2023
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
6 changes: 3 additions & 3 deletions java-dialogflow-cx/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,20 @@ If you are using Maven without the BOM, add this to your dependencies:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-dialogflow-cx</artifactId>
<version>0.37.0</version>
<version>0.35.0</version>
</dependency>
```

If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-dialogflow-cx:0.37.0'
implementation 'com.google.cloud:google-cloud-dialogflow-cx:0.35.0'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-dialogflow-cx" % "0.37.0"
libraryDependencies += "com.google.cloud" % "google-cloud-dialogflow-cx" % "0.35.0"
```
<!-- {x-version-update-end} -->

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,12 @@
import com.google.api.core.ApiFutures;
import com.google.api.core.BetaApi;
import com.google.api.gax.core.BackgroundResource;
import com.google.api.gax.httpjson.longrunning.OperationsClient;
import com.google.api.gax.longrunning.OperationFuture;
import com.google.api.gax.paging.AbstractFixedSizeCollection;
import com.google.api.gax.paging.AbstractPage;
import com.google.api.gax.paging.AbstractPagedListResponse;
import com.google.api.gax.rpc.OperationCallable;
import com.google.api.gax.rpc.PageContext;
import com.google.api.gax.rpc.UnaryCallable;
import com.google.cloud.dialogflow.cx.v3beta1.stub.IntentsStub;
Expand All @@ -32,6 +35,7 @@
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import com.google.protobuf.FieldMask;
import java.io.IOException;
Expand Down Expand Up @@ -131,6 +135,8 @@
public class IntentsClient implements BackgroundResource {
private final IntentsSettings settings;
private final IntentsStub stub;
private final OperationsClient httpJsonOperationsClient;
private final com.google.longrunning.OperationsClient operationsClient;

/** Constructs an instance of IntentsClient with default settings. */
public static final IntentsClient create() throws IOException {
Expand Down Expand Up @@ -160,11 +166,17 @@ public static final IntentsClient create(IntentsStub stub) {
protected IntentsClient(IntentsSettings settings) throws IOException {
this.settings = settings;
this.stub = ((IntentsStubSettings) settings.getStubSettings()).createStub();
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

protected IntentsClient(IntentsStub stub) {
this.settings = null;
this.stub = stub;
this.operationsClient =
com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub());
this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub());
}

public final IntentsSettings getSettings() {
Expand All @@ -175,6 +187,23 @@ public IntentsStub getStub() {
return stub;
}

/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
public final com.google.longrunning.OperationsClient getOperationsClient() {
return operationsClient;
}

/**
* Returns the OperationsClient that can be used to query the status of a long-running operation
* returned by another API method call.
*/
@BetaApi
public final OperationsClient getHttpJsonOperationsClient() {
return httpJsonOperationsClient;
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Returns the list of all intents in the specified agent.
Expand Down Expand Up @@ -810,6 +839,227 @@ public final UnaryCallable<DeleteIntentRequest, Empty> deleteIntentCallable() {
return stub.deleteIntentCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Imports the specified intents into the agent.
*
* <p>This method is a [long-running
* operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
* returned `Operation` type has the following method-specific fields:
*
* <p>- `metadata`:
* [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`:
* [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ImportIntentsResponse]
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ImportIntentsRequest request =
* ImportIntentsRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .build();
* ImportIntentsResponse response = intentsClient.importIntentsAsync(request).get();
* }
* }</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
*/
public final OperationFuture<ImportIntentsResponse, ImportIntentsMetadata> importIntentsAsync(
ImportIntentsRequest request) {
return importIntentsOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Imports the specified intents into the agent.
*
* <p>This method is a [long-running
* operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
* returned `Operation` type has the following method-specific fields:
*
* <p>- `metadata`:
* [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`:
* [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ImportIntentsResponse]
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ImportIntentsRequest request =
* ImportIntentsRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .build();
* OperationFuture<ImportIntentsResponse, ImportIntentsMetadata> future =
* intentsClient.importIntentsOperationCallable().futureCall(request);
* // Do something.
* ImportIntentsResponse response = future.get();
* }
* }</pre>
*/
public final OperationCallable<ImportIntentsRequest, ImportIntentsResponse, ImportIntentsMetadata>
importIntentsOperationCallable() {
return stub.importIntentsOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Imports the specified intents into the agent.
*
* <p>This method is a [long-running
* operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
* returned `Operation` type has the following method-specific fields:
*
* <p>- `metadata`:
* [ImportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ImportIntentsMetadata] - `response`:
* [ImportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ImportIntentsResponse]
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ImportIntentsRequest request =
* ImportIntentsRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .build();
* ApiFuture<Operation> future = intentsClient.importIntentsCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<ImportIntentsRequest, Operation> importIntentsCallable() {
return stub.importIntentsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Exports the selected intents.
*
* <p>This method is a [long-running
* operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
* returned `Operation` type has the following method-specific fields:
*
* <p>- `metadata`:
* [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`:
* [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ExportIntentsResponse]
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ExportIntentsRequest request =
* ExportIntentsRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .addAllIntents(new ArrayList<String>())
* .build();
* ExportIntentsResponse response = intentsClient.exportIntentsAsync(request).get();
* }
* }</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
*/
public final OperationFuture<ExportIntentsResponse, ExportIntentsMetadata> exportIntentsAsync(
ExportIntentsRequest request) {
return exportIntentsOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Exports the selected intents.
*
* <p>This method is a [long-running
* operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
* returned `Operation` type has the following method-specific fields:
*
* <p>- `metadata`:
* [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`:
* [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ExportIntentsResponse]
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ExportIntentsRequest request =
* ExportIntentsRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .addAllIntents(new ArrayList<String>())
* .build();
* OperationFuture<ExportIntentsResponse, ExportIntentsMetadata> future =
* intentsClient.exportIntentsOperationCallable().futureCall(request);
* // Do something.
* ExportIntentsResponse response = future.get();
* }
* }</pre>
*/
public final OperationCallable<ExportIntentsRequest, ExportIntentsResponse, ExportIntentsMetadata>
exportIntentsOperationCallable() {
return stub.exportIntentsOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Exports the selected intents.
*
* <p>This method is a [long-running
* operation](https://cloud.google.com/dialogflow/cx/docs/how/long-running-operation). The
* returned `Operation` type has the following method-specific fields:
*
* <p>- `metadata`:
* [ExportIntentsMetadata][google.cloud.dialogflow.cx.v3beta1.ExportIntentsMetadata] - `response`:
* [ExportIntentsResponse][google.cloud.dialogflow.cx.v3beta1.ExportIntentsResponse]
*
* <p>Sample code:
*
* <pre>{@code
* // This snippet has been automatically generated and should be regarded as a code template only.
* // It will require modifications to work:
* // - It may require correct/in-range values for request initialization.
* // - It may require specifying regional endpoints when creating the service client as shown in
* // https://cloud.google.com/java/docs/setup#configure_endpoints_for_the_client_library
* try (IntentsClient intentsClient = IntentsClient.create()) {
* ExportIntentsRequest request =
* ExportIntentsRequest.newBuilder()
* .setParent(AgentName.of("[PROJECT]", "[LOCATION]", "[AGENT]").toString())
* .addAllIntents(new ArrayList<String>())
* .build();
* ApiFuture<Operation> future = intentsClient.exportIntentsCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<ExportIntentsRequest, Operation> exportIntentsCallable() {
return stub.exportIntentsCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Lists information about the supported locations for this service.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import com.google.api.gax.rpc.ApiClientHeaderProvider;
import com.google.api.gax.rpc.ClientContext;
import com.google.api.gax.rpc.ClientSettings;
import com.google.api.gax.rpc.OperationCallSettings;
import com.google.api.gax.rpc.PagedCallSettings;
import com.google.api.gax.rpc.TransportChannelProvider;
import com.google.api.gax.rpc.UnaryCallSettings;
Expand All @@ -36,6 +37,7 @@
import com.google.cloud.location.ListLocationsRequest;
import com.google.cloud.location.ListLocationsResponse;
import com.google.cloud.location.Location;
import com.google.longrunning.Operation;
import com.google.protobuf.Empty;
import java.io.IOException;
import java.util.List;
Expand Down Expand Up @@ -107,6 +109,28 @@ public UnaryCallSettings<DeleteIntentRequest, Empty> deleteIntentSettings() {
return ((IntentsStubSettings) getStubSettings()).deleteIntentSettings();
}

/** Returns the object with the settings used for calls to importIntents. */
public UnaryCallSettings<ImportIntentsRequest, Operation> importIntentsSettings() {
return ((IntentsStubSettings) getStubSettings()).importIntentsSettings();
}

/** Returns the object with the settings used for calls to importIntents. */
public OperationCallSettings<ImportIntentsRequest, ImportIntentsResponse, ImportIntentsMetadata>
importIntentsOperationSettings() {
return ((IntentsStubSettings) getStubSettings()).importIntentsOperationSettings();
}

/** Returns the object with the settings used for calls to exportIntents. */
public UnaryCallSettings<ExportIntentsRequest, Operation> exportIntentsSettings() {
return ((IntentsStubSettings) getStubSettings()).exportIntentsSettings();
}

/** Returns the object with the settings used for calls to exportIntents. */
public OperationCallSettings<ExportIntentsRequest, ExportIntentsResponse, ExportIntentsMetadata>
exportIntentsOperationSettings() {
return ((IntentsStubSettings) getStubSettings()).exportIntentsOperationSettings();
}

/** Returns the object with the settings used for calls to listLocations. */
public PagedCallSettings<ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
listLocationsSettings() {
Expand Down Expand Up @@ -259,6 +283,30 @@ public UnaryCallSettings.Builder<DeleteIntentRequest, Empty> deleteIntentSetting
return getStubSettingsBuilder().deleteIntentSettings();
}

/** Returns the builder for the settings used for calls to importIntents. */
public UnaryCallSettings.Builder<ImportIntentsRequest, Operation> importIntentsSettings() {
return getStubSettingsBuilder().importIntentsSettings();
}

/** Returns the builder for the settings used for calls to importIntents. */
public OperationCallSettings.Builder<
ImportIntentsRequest, ImportIntentsResponse, ImportIntentsMetadata>
importIntentsOperationSettings() {
return getStubSettingsBuilder().importIntentsOperationSettings();
}

/** Returns the builder for the settings used for calls to exportIntents. */
public UnaryCallSettings.Builder<ExportIntentsRequest, Operation> exportIntentsSettings() {
return getStubSettingsBuilder().exportIntentsSettings();
}

/** Returns the builder for the settings used for calls to exportIntents. */
public OperationCallSettings.Builder<
ExportIntentsRequest, ExportIntentsResponse, ExportIntentsMetadata>
exportIntentsOperationSettings() {
return getStubSettingsBuilder().exportIntentsOperationSettings();
}

/** Returns the builder for the settings used for calls to listLocations. */
public PagedCallSettings.Builder<
ListLocationsRequest, ListLocationsResponse, ListLocationsPagedResponse>
Expand Down