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: [contactcenterinsights] Launch UploadConversation endpoint #9319

Merged
merged 2 commits into from
Apr 12, 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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion java-contact-center-insights/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ If you are using Maven with [BOM][libraries-bom], add this to your pom.xml file:
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>libraries-bom</artifactId>
<version>26.11.0</version>
<version>26.12.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,108 @@ public final UnaryCallable<CreateConversationRequest, Conversation> createConver
return stub.createConversationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a longrunning conversation upload operation. This method differs from CreateConversation
* by allowing audio transcription and optional DLP redaction.
*
* <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 (ContactCenterInsightsClient contactCenterInsightsClient =
* ContactCenterInsightsClient.create()) {
* UploadConversationRequest request =
* UploadConversationRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setConversation(Conversation.newBuilder().build())
* .setConversationId("conversationId-1676095234")
* .setRedactionConfig(RedactionConfig.newBuilder().build())
* .build();
* Conversation response = contactCenterInsightsClient.uploadConversationAsync(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<Conversation, UploadConversationMetadata> uploadConversationAsync(
UploadConversationRequest request) {
return uploadConversationOperationCallable().futureCall(request);
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a longrunning conversation upload operation. This method differs from CreateConversation
* by allowing audio transcription and optional DLP redaction.
*
* <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 (ContactCenterInsightsClient contactCenterInsightsClient =
* ContactCenterInsightsClient.create()) {
* UploadConversationRequest request =
* UploadConversationRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setConversation(Conversation.newBuilder().build())
* .setConversationId("conversationId-1676095234")
* .setRedactionConfig(RedactionConfig.newBuilder().build())
* .build();
* OperationFuture<Conversation, UploadConversationMetadata> future =
* contactCenterInsightsClient.uploadConversationOperationCallable().futureCall(request);
* // Do something.
* Conversation response = future.get();
* }
* }</pre>
*/
public final OperationCallable<
UploadConversationRequest, Conversation, UploadConversationMetadata>
uploadConversationOperationCallable() {
return stub.uploadConversationOperationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Create a longrunning conversation upload operation. This method differs from CreateConversation
* by allowing audio transcription and optional DLP redaction.
*
* <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 (ContactCenterInsightsClient contactCenterInsightsClient =
* ContactCenterInsightsClient.create()) {
* UploadConversationRequest request =
* UploadConversationRequest.newBuilder()
* .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString())
* .setConversation(Conversation.newBuilder().build())
* .setConversationId("conversationId-1676095234")
* .setRedactionConfig(RedactionConfig.newBuilder().build())
* .build();
* ApiFuture<Operation> future =
* contactCenterInsightsClient.uploadConversationCallable().futureCall(request);
* // Do something.
* Operation response = future.get();
* }
* }</pre>
*/
public final UnaryCallable<UploadConversationRequest, Operation> uploadConversationCallable() {
return stub.uploadConversationCallable();
}

// AUTO-GENERATED DOCUMENTATION AND METHOD.
/**
* Updates a conversation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,18 @@ public UnaryCallSettings<CreateConversationRequest, Conversation> createConversa
return ((ContactCenterInsightsStubSettings) getStubSettings()).createConversationSettings();
}

/** Returns the object with the settings used for calls to uploadConversation. */
public UnaryCallSettings<UploadConversationRequest, Operation> uploadConversationSettings() {
return ((ContactCenterInsightsStubSettings) getStubSettings()).uploadConversationSettings();
}

/** Returns the object with the settings used for calls to uploadConversation. */
public OperationCallSettings<UploadConversationRequest, Conversation, UploadConversationMetadata>
uploadConversationOperationSettings() {
return ((ContactCenterInsightsStubSettings) getStubSettings())
.uploadConversationOperationSettings();
}

/** Returns the object with the settings used for calls to updateConversation. */
public UnaryCallSettings<UpdateConversationRequest, Conversation> updateConversationSettings() {
return ((ContactCenterInsightsStubSettings) getStubSettings()).updateConversationSettings();
Expand Down Expand Up @@ -466,6 +478,19 @@ public Builder applyToAllUnaryMethods(
return getStubSettingsBuilder().createConversationSettings();
}

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

/** Returns the builder for the settings used for calls to uploadConversation. */
public OperationCallSettings.Builder<
UploadConversationRequest, Conversation, UploadConversationMetadata>
uploadConversationOperationSettings() {
return getStubSettingsBuilder().uploadConversationOperationSettings();
}

/** Returns the builder for the settings used for calls to updateConversation. */
public UnaryCallSettings.Builder<UpdateConversationRequest, Conversation>
updateConversationSettings() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,9 @@
},
"UpdateView": {
"methods": ["updateView", "updateView", "updateViewCallable"]
},
"UploadConversation": {
"methods": ["uploadConversationAsync", "uploadConversationOperationCallable", "uploadConversationCallable"]
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
import com.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest;
import com.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest;
import com.google.cloud.contactcenterinsights.v1.UpdateViewRequest;
import com.google.cloud.contactcenterinsights.v1.UploadConversationMetadata;
import com.google.cloud.contactcenterinsights.v1.UploadConversationRequest;
import com.google.cloud.contactcenterinsights.v1.View;
import com.google.longrunning.Operation;
import com.google.longrunning.stub.OperationsStub;
Expand Down Expand Up @@ -115,6 +117,16 @@ public UnaryCallable<CreateConversationRequest, Conversation> createConversation
throw new UnsupportedOperationException("Not implemented: createConversationCallable()");
}

public OperationCallable<UploadConversationRequest, Conversation, UploadConversationMetadata>
uploadConversationOperationCallable() {
throw new UnsupportedOperationException(
"Not implemented: uploadConversationOperationCallable()");
}

public UnaryCallable<UploadConversationRequest, Operation> uploadConversationCallable() {
throw new UnsupportedOperationException("Not implemented: uploadConversationCallable()");
}

public UnaryCallable<UpdateConversationRequest, Conversation> updateConversationCallable() {
throw new UnsupportedOperationException("Not implemented: updateConversationCallable()");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,8 @@
import com.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest;
import com.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest;
import com.google.cloud.contactcenterinsights.v1.UpdateViewRequest;
import com.google.cloud.contactcenterinsights.v1.UploadConversationMetadata;
import com.google.cloud.contactcenterinsights.v1.UploadConversationRequest;
import com.google.cloud.contactcenterinsights.v1.View;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
Expand Down Expand Up @@ -174,6 +176,10 @@ public class ContactCenterInsightsStubSettings

private final UnaryCallSettings<CreateConversationRequest, Conversation>
createConversationSettings;
private final UnaryCallSettings<UploadConversationRequest, Operation> uploadConversationSettings;
private final OperationCallSettings<
UploadConversationRequest, Conversation, UploadConversationMetadata>
uploadConversationOperationSettings;
private final UnaryCallSettings<UpdateConversationRequest, Conversation>
updateConversationSettings;
private final UnaryCallSettings<GetConversationRequest, Conversation> getConversationSettings;
Expand Down Expand Up @@ -483,6 +489,17 @@ public UnaryCallSettings<CreateConversationRequest, Conversation> createConversa
return createConversationSettings;
}

/** Returns the object with the settings used for calls to uploadConversation. */
public UnaryCallSettings<UploadConversationRequest, Operation> uploadConversationSettings() {
return uploadConversationSettings;
}

/** Returns the object with the settings used for calls to uploadConversation. */
public OperationCallSettings<UploadConversationRequest, Conversation, UploadConversationMetadata>
uploadConversationOperationSettings() {
return uploadConversationOperationSettings;
}

/** Returns the object with the settings used for calls to updateConversation. */
public UnaryCallSettings<UpdateConversationRequest, Conversation> updateConversationSettings() {
return updateConversationSettings;
Expand Down Expand Up @@ -836,6 +853,9 @@ protected ContactCenterInsightsStubSettings(Builder settingsBuilder) throws IOEx
super(settingsBuilder);

createConversationSettings = settingsBuilder.createConversationSettings().build();
uploadConversationSettings = settingsBuilder.uploadConversationSettings().build();
uploadConversationOperationSettings =
settingsBuilder.uploadConversationOperationSettings().build();
updateConversationSettings = settingsBuilder.updateConversationSettings().build();
getConversationSettings = settingsBuilder.getConversationSettings().build();
listConversationsSettings = settingsBuilder.listConversationsSettings().build();
Expand Down Expand Up @@ -892,6 +912,11 @@ public static class Builder
private final ImmutableList<UnaryCallSettings.Builder<?, ?>> unaryMethodSettingsBuilders;
private final UnaryCallSettings.Builder<CreateConversationRequest, Conversation>
createConversationSettings;
private final UnaryCallSettings.Builder<UploadConversationRequest, Operation>
uploadConversationSettings;
private final OperationCallSettings.Builder<
UploadConversationRequest, Conversation, UploadConversationMetadata>
uploadConversationOperationSettings;
private final UnaryCallSettings.Builder<UpdateConversationRequest, Conversation>
updateConversationSettings;
private final UnaryCallSettings.Builder<GetConversationRequest, Conversation>
Expand Down Expand Up @@ -1022,6 +1047,8 @@ protected Builder(ClientContext clientContext) {
super(clientContext);

createConversationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
uploadConversationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
uploadConversationOperationSettings = OperationCallSettings.newBuilder();
updateConversationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
getConversationSettings = UnaryCallSettings.newUnaryCallSettingsBuilder();
listConversationsSettings = PagedCallSettings.newBuilder(LIST_CONVERSATIONS_PAGE_STR_FACT);
Expand Down Expand Up @@ -1070,6 +1097,7 @@ protected Builder(ClientContext clientContext) {
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
createConversationSettings,
uploadConversationSettings,
updateConversationSettings,
getConversationSettings,
listConversationsSettings,
Expand Down Expand Up @@ -1113,6 +1141,9 @@ protected Builder(ContactCenterInsightsStubSettings settings) {
super(settings);

createConversationSettings = settings.createConversationSettings.toBuilder();
uploadConversationSettings = settings.uploadConversationSettings.toBuilder();
uploadConversationOperationSettings =
settings.uploadConversationOperationSettings.toBuilder();
updateConversationSettings = settings.updateConversationSettings.toBuilder();
getConversationSettings = settings.getConversationSettings.toBuilder();
listConversationsSettings = settings.listConversationsSettings.toBuilder();
Expand Down Expand Up @@ -1165,6 +1196,7 @@ protected Builder(ContactCenterInsightsStubSettings settings) {
unaryMethodSettingsBuilders =
ImmutableList.<UnaryCallSettings.Builder<?, ?>>of(
createConversationSettings,
uploadConversationSettings,
updateConversationSettings,
getConversationSettings,
listConversationsSettings,
Expand Down Expand Up @@ -1235,6 +1267,11 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.uploadConversationSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.updateConversationSettings()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
Expand Down Expand Up @@ -1415,6 +1452,31 @@ private static Builder initDefaults(Builder builder) {
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"));

builder
.uploadConversationOperationSettings()
.setInitialCallSettings(
UnaryCallSettings
.<UploadConversationRequest, OperationSnapshot>newUnaryCallSettingsBuilder()
.setRetryableCodes(RETRYABLE_CODE_DEFINITIONS.get("retry_policy_0_codes"))
.setRetrySettings(RETRY_PARAM_DEFINITIONS.get("retry_policy_0_params"))
.build())
.setResponseTransformer(
ProtoOperationTransformers.ResponseTransformer.create(Conversation.class))
.setMetadataTransformer(
ProtoOperationTransformers.MetadataTransformer.create(
UploadConversationMetadata.class))
.setPollingAlgorithm(
OperationTimedPollAlgorithm.create(
RetrySettings.newBuilder()
.setInitialRetryDelay(Duration.ofMillis(5000L))
.setRetryDelayMultiplier(1.5)
.setMaxRetryDelay(Duration.ofMillis(45000L))
.setInitialRpcTimeout(Duration.ZERO)
.setRpcTimeoutMultiplier(1.0)
.setMaxRpcTimeout(Duration.ZERO)
.setTotalTimeout(Duration.ofMillis(300000L))
.build()));

builder
.createAnalysisOperationSettings()
.setInitialCallSettings(
Expand Down Expand Up @@ -1640,6 +1702,21 @@ public Builder applyToAllUnaryMethods(
return createConversationSettings;
}

/** Returns the builder for the settings used for calls to uploadConversation. */
public UnaryCallSettings.Builder<UploadConversationRequest, Operation>
uploadConversationSettings() {
return uploadConversationSettings;
}

/** Returns the builder for the settings used for calls to uploadConversation. */
@BetaApi(
"The surface for use by generated code is not stable yet and may change in the future.")
public OperationCallSettings.Builder<
UploadConversationRequest, Conversation, UploadConversationMetadata>
uploadConversationOperationSettings() {
return uploadConversationOperationSettings;
}

/** Returns the builder for the settings used for calls to updateConversation. */
public UnaryCallSettings.Builder<UpdateConversationRequest, Conversation>
updateConversationSettings() {
Expand Down
Loading