diff --git a/java-contact-center-insights/google-cloud-contact-center-insights/pom.xml b/java-contact-center-insights/google-cloud-contact-center-insights/pom.xml index 8215120bcab7..f6f535ff604a 100644 --- a/java-contact-center-insights/google-cloud-contact-center-insights/pom.xml +++ b/java-contact-center-insights/google-cloud-contact-center-insights/pom.xml @@ -58,6 +58,10 @@ com.google.api gax-grpc + + com.google.api + gax-httpjson + org.threeten threetenbp @@ -77,12 +81,24 @@ test + + com.google.api + gax + testlib + test + com.google.api gax-grpc testlib test + + com.google.api + gax-httpjson + testlib + test + diff --git a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsClient.java b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsClient.java index 909a7dec7ea5..38dffd0e1610 100644 --- a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsClient.java +++ b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsClient.java @@ -18,7 +18,9 @@ import com.google.api.core.ApiFuture; 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; @@ -30,7 +32,6 @@ import com.google.cloud.contactcenterinsights.v1.stub.ContactCenterInsightsStubSettings; import com.google.common.util.concurrent.MoreExecutors; import com.google.longrunning.Operation; -import com.google.longrunning.OperationsClient; import com.google.protobuf.Empty; import com.google.protobuf.FieldMask; import java.io.IOException; @@ -109,13 +110,29 @@ * ContactCenterInsightsClient.create(contactCenterInsightsSettings); * } * + *

To use REST (HTTP1.1/JSON) transport (instead of gRPC) for sending and receiving requests over + * the wire: + * + *

{@code
+ * // This snippet has been automatically generated for illustrative purposes only.
+ * // It may require modifications to work in your environment.
+ * ContactCenterInsightsSettings contactCenterInsightsSettings =
+ *     ContactCenterInsightsSettings.newBuilder()
+ *         .setTransportChannelProvider(
+ *             ContactCenterInsightsSettings.defaultHttpJsonTransportProviderBuilder().build())
+ *         .build();
+ * ContactCenterInsightsClient contactCenterInsightsClient =
+ *     ContactCenterInsightsClient.create(contactCenterInsightsSettings);
+ * }
+ * *

Please refer to the GitHub repository's samples for more quickstart code snippets. */ @Generated("by gapic-generator-java") public class ContactCenterInsightsClient implements BackgroundResource { private final ContactCenterInsightsSettings settings; private final ContactCenterInsightsStub stub; - private final OperationsClient operationsClient; + private final OperationsClient httpJsonOperationsClient; + private final com.google.longrunning.OperationsClient operationsClient; /** Constructs an instance of ContactCenterInsightsClient with default settings. */ public static final ContactCenterInsightsClient create() throws IOException { @@ -147,13 +164,17 @@ public static final ContactCenterInsightsClient create(ContactCenterInsightsStub protected ContactCenterInsightsClient(ContactCenterInsightsSettings settings) throws IOException { this.settings = settings; this.stub = ((ContactCenterInsightsStubSettings) settings.getStubSettings()).createStub(); - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } protected ContactCenterInsightsClient(ContactCenterInsightsStub stub) { this.settings = null; this.stub = stub; - this.operationsClient = OperationsClient.create(this.stub.getOperationsStub()); + this.operationsClient = + com.google.longrunning.OperationsClient.create(this.stub.getOperationsStub()); + this.httpJsonOperationsClient = OperationsClient.create(this.stub.getHttpJsonOperationsStub()); } public final ContactCenterInsightsSettings getSettings() { @@ -168,10 +189,19 @@ public ContactCenterInsightsStub getStub() { * Returns the OperationsClient that can be used to query the status of a long-running operation * returned by another API method call. */ - public final OperationsClient getOperationsClient() { + 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. /** * Creates a conversation. diff --git a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsSettings.java b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsSettings.java index b4db4c1c19fd..c780d005edd8 100644 --- a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsSettings.java +++ b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsSettings.java @@ -26,6 +26,7 @@ import com.google.api.gax.core.GoogleCredentialsProvider; import com.google.api.gax.core.InstantiatingExecutorProvider; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.rpc.ApiClientHeaderProvider; import com.google.api.gax.rpc.ClientContext; import com.google.api.gax.rpc.ClientSettings; @@ -330,11 +331,18 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde return ContactCenterInsightsStubSettings.defaultCredentialsProviderBuilder(); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return ContactCenterInsightsStubSettings.defaultGrpcTransportProviderBuilder(); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return ContactCenterInsightsStubSettings.defaultHttpJsonTransportProviderBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return ContactCenterInsightsStubSettings.defaultTransportChannelProvider(); } @@ -344,11 +352,17 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil return ContactCenterInsightsStubSettings.defaultApiClientHeaderProviderBuilder(); } - /** Returns a new builder for this class. */ + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + @BetaApi + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -387,6 +401,11 @@ private static Builder createDefault() { return new Builder(ContactCenterInsightsStubSettings.newBuilder()); } + @BetaApi + private static Builder createHttpJsonDefault() { + return new Builder(ContactCenterInsightsStubSettings.newHttpJsonBuilder()); + } + public ContactCenterInsightsStubSettings.Builder getStubSettingsBuilder() { return ((ContactCenterInsightsStubSettings.Builder) getStubSettings()); } diff --git a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStub.java b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStub.java index 95d13d9aa251..f9ae7f57f1b4 100644 --- a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStub.java +++ b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStub.java @@ -97,7 +97,11 @@ public abstract class ContactCenterInsightsStub implements BackgroundResource { public OperationsStub getOperationsStub() { - throw new UnsupportedOperationException("Not implemented: getOperationsStub()"); + return null; + } + + public com.google.api.gax.httpjson.longrunning.stub.OperationsStub getHttpJsonOperationsStub() { + return null; } public UnaryCallable createConversationCallable() { diff --git a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStubSettings.java b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStubSettings.java index 3cd55e82a43b..16c3b7d8db43 100644 --- a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStubSettings.java +++ b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/ContactCenterInsightsStubSettings.java @@ -31,6 +31,9 @@ import com.google.api.gax.grpc.GrpcTransportChannel; import com.google.api.gax.grpc.InstantiatingGrpcChannelProvider; import com.google.api.gax.grpc.ProtoOperationTransformers; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.HttpJsonTransportChannel; +import com.google.api.gax.httpjson.InstantiatingHttpJsonChannelProvider; import com.google.api.gax.longrunning.OperationSnapshot; import com.google.api.gax.longrunning.OperationTimedPollAlgorithm; import com.google.api.gax.retrying.RetrySettings; @@ -677,6 +680,11 @@ public ContactCenterInsightsStub createStub() throws IOException { .equals(GrpcTransportChannel.getGrpcTransportName())) { return GrpcContactCenterInsightsStub.create(this); } + if (getTransportChannelProvider() + .getTransportName() + .equals(HttpJsonTransportChannel.getHttpJsonTransportName())) { + return HttpJsonContactCenterInsightsStub.create(this); + } throw new UnsupportedOperationException( String.format( "Transport not supported: %s", getTransportChannelProvider().getTransportName())); @@ -709,18 +717,25 @@ public static GoogleCredentialsProvider.Builder defaultCredentialsProviderBuilde .setUseJwtAccessWithScope(true); } - /** Returns a builder for the default ChannelProvider for this service. */ + /** Returns a builder for the default gRPC ChannelProvider for this service. */ public static InstantiatingGrpcChannelProvider.Builder defaultGrpcTransportProviderBuilder() { return InstantiatingGrpcChannelProvider.newBuilder() .setMaxInboundMessageSize(Integer.MAX_VALUE); } + /** Returns a builder for the default REST ChannelProvider for this service. */ + @BetaApi + public static InstantiatingHttpJsonChannelProvider.Builder + defaultHttpJsonTransportProviderBuilder() { + return InstantiatingHttpJsonChannelProvider.newBuilder(); + } + public static TransportChannelProvider defaultTransportChannelProvider() { return defaultGrpcTransportProviderBuilder().build(); } @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") - public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + public static ApiClientHeaderProvider.Builder defaultGrpcApiClientHeaderProviderBuilder() { return ApiClientHeaderProvider.newBuilder() .setGeneratedLibToken( "gapic", GaxProperties.getLibraryVersion(ContactCenterInsightsStubSettings.class)) @@ -728,11 +743,30 @@ public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuil GaxGrpcProperties.getGrpcTokenName(), GaxGrpcProperties.getGrpcVersion()); } - /** Returns a new builder for this class. */ + @BetaApi("The surface for customizing headers is not stable yet and may change in the future.") + public static ApiClientHeaderProvider.Builder defaultHttpJsonApiClientHeaderProviderBuilder() { + return ApiClientHeaderProvider.newBuilder() + .setGeneratedLibToken( + "gapic", GaxProperties.getLibraryVersion(ContactCenterInsightsStubSettings.class)) + .setTransportToken( + GaxHttpJsonProperties.getHttpJsonTokenName(), + GaxHttpJsonProperties.getHttpJsonVersion()); + } + + public static ApiClientHeaderProvider.Builder defaultApiClientHeaderProviderBuilder() { + return ContactCenterInsightsStubSettings.defaultGrpcApiClientHeaderProviderBuilder(); + } + + /** Returns a new gRPC builder for this class. */ public static Builder newBuilder() { return Builder.createDefault(); } + /** Returns a new REST builder for this class. */ + public static Builder newHttpJsonBuilder() { + return Builder.createHttpJsonDefault(); + } + /** Returns a new builder for this class. */ public static Builder newBuilder(ClientContext clientContext) { return new Builder(clientContext); @@ -1089,6 +1123,19 @@ private static Builder createDefault() { return initDefaults(builder); } + private static Builder createHttpJsonDefault() { + Builder builder = new Builder(((ClientContext) null)); + + builder.setTransportChannelProvider(defaultHttpJsonTransportProviderBuilder().build()); + builder.setCredentialsProvider(defaultCredentialsProviderBuilder().build()); + builder.setInternalHeaderProvider(defaultHttpJsonApiClientHeaderProviderBuilder().build()); + builder.setEndpoint(getDefaultEndpoint()); + builder.setMtlsEndpoint(getDefaultMtlsEndpoint()); + builder.setSwitchToMtlsEndpointAllowed(true); + + return initDefaults(builder); + } + private static Builder initDefaults(Builder builder) { builder .createConversationSettings() diff --git a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/HttpJsonContactCenterInsightsCallableFactory.java b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/HttpJsonContactCenterInsightsCallableFactory.java new file mode 100644 index 000000000000..8d4ebbd2ca3b --- /dev/null +++ b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/HttpJsonContactCenterInsightsCallableFactory.java @@ -0,0 +1,105 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.stub; + +import com.google.api.core.BetaApi; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonCallableFactory; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshotCallable; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.longrunning.stub.OperationsStub; +import com.google.api.gax.rpc.BatchingCallSettings; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallSettings; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.PagedCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallSettings; +import com.google.api.gax.rpc.ServerStreamingCallable; +import com.google.api.gax.rpc.UnaryCallSettings; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.longrunning.Operation; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST callable factory implementation for the ContactCenterInsights service API. + * + *

This class is for advanced usage. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonContactCenterInsightsCallableFactory + implements HttpJsonStubCallableFactory { + + @Override + public UnaryCallable createUnaryCallable( + HttpJsonCallSettings httpJsonCallSettings, + UnaryCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createUnaryCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public + UnaryCallable createPagedCallable( + HttpJsonCallSettings httpJsonCallSettings, + PagedCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createPagedCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @Override + public UnaryCallable createBatchingCallable( + HttpJsonCallSettings httpJsonCallSettings, + BatchingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createBatchingCallable( + httpJsonCallSettings, callSettings, clientContext); + } + + @BetaApi( + "The surface for long-running operations is not stable yet and may change in the future.") + @Override + public + OperationCallable createOperationCallable( + HttpJsonCallSettings httpJsonCallSettings, + OperationCallSettings callSettings, + ClientContext clientContext, + OperationsStub operationsStub) { + UnaryCallable innerCallable = + HttpJsonCallableFactory.createBaseUnaryCallable( + httpJsonCallSettings, callSettings.getInitialCallSettings(), clientContext); + HttpJsonOperationSnapshotCallable initialCallable = + new HttpJsonOperationSnapshotCallable( + innerCallable, + httpJsonCallSettings.getMethodDescriptor().getOperationSnapshotFactory()); + return HttpJsonCallableFactory.createOperationCallable( + callSettings, clientContext, operationsStub.longRunningClient(), initialCallable); + } + + @Override + public + ServerStreamingCallable createServerStreamingCallable( + HttpJsonCallSettings httpJsonCallSettings, + ServerStreamingCallSettings callSettings, + ClientContext clientContext) { + return HttpJsonCallableFactory.createServerStreamingCallable( + httpJsonCallSettings, callSettings, clientContext); + } +} diff --git a/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/HttpJsonContactCenterInsightsStub.java b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/HttpJsonContactCenterInsightsStub.java new file mode 100644 index 000000000000..f4342af508b1 --- /dev/null +++ b/java-contact-center-insights/google-cloud-contact-center-insights/src/main/java/com/google/cloud/contactcenterinsights/v1/stub/HttpJsonContactCenterInsightsStub.java @@ -0,0 +1,2149 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.stub; + +import static com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient.ListAnalysesPagedResponse; +import static com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient.ListConversationsPagedResponse; +import static com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient.ListPhraseMatchersPagedResponse; +import static com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient.ListViewsPagedResponse; + +import com.google.api.core.BetaApi; +import com.google.api.core.InternalApi; +import com.google.api.gax.core.BackgroundResource; +import com.google.api.gax.core.BackgroundResourceAggregation; +import com.google.api.gax.httpjson.ApiMethodDescriptor; +import com.google.api.gax.httpjson.HttpJsonCallSettings; +import com.google.api.gax.httpjson.HttpJsonOperationSnapshot; +import com.google.api.gax.httpjson.HttpJsonStubCallableFactory; +import com.google.api.gax.httpjson.ProtoMessageRequestFormatter; +import com.google.api.gax.httpjson.ProtoMessageResponseParser; +import com.google.api.gax.httpjson.ProtoRestSerializer; +import com.google.api.gax.httpjson.longrunning.stub.HttpJsonOperationsStub; +import com.google.api.gax.rpc.ClientContext; +import com.google.api.gax.rpc.OperationCallable; +import com.google.api.gax.rpc.UnaryCallable; +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest; +import com.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse; +import com.google.cloud.contactcenterinsights.v1.CalculateStatsRequest; +import com.google.cloud.contactcenterinsights.v1.CalculateStatsResponse; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.CreateAnalysisOperationMetadata; +import com.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest; +import com.google.cloud.contactcenterinsights.v1.CreateConversationRequest; +import com.google.cloud.contactcenterinsights.v1.CreateIssueModelMetadata; +import com.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.CreateViewRequest; +import com.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest; +import com.google.cloud.contactcenterinsights.v1.DeleteConversationRequest; +import com.google.cloud.contactcenterinsights.v1.DeleteIssueModelMetadata; +import com.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.DeleteViewRequest; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelMetadata; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelResponse; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataMetadata; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataResponse; +import com.google.cloud.contactcenterinsights.v1.GetAnalysisRequest; +import com.google.cloud.contactcenterinsights.v1.GetConversationRequest; +import com.google.cloud.contactcenterinsights.v1.GetIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.GetIssueRequest; +import com.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.GetSettingsRequest; +import com.google.cloud.contactcenterinsights.v1.GetViewRequest; +import com.google.cloud.contactcenterinsights.v1.Issue; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.ListAnalysesRequest; +import com.google.cloud.contactcenterinsights.v1.ListAnalysesResponse; +import com.google.cloud.contactcenterinsights.v1.ListConversationsRequest; +import com.google.cloud.contactcenterinsights.v1.ListConversationsResponse; +import com.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest; +import com.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse; +import com.google.cloud.contactcenterinsights.v1.ListIssuesRequest; +import com.google.cloud.contactcenterinsights.v1.ListIssuesResponse; +import com.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest; +import com.google.cloud.contactcenterinsights.v1.ListPhraseMatchersResponse; +import com.google.cloud.contactcenterinsights.v1.ListViewsRequest; +import com.google.cloud.contactcenterinsights.v1.ListViewsResponse; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.cloud.contactcenterinsights.v1.Settings; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelMetadata; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelResponse; +import com.google.cloud.contactcenterinsights.v1.UpdateConversationRequest; +import com.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.UpdateIssueRequest; +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.View; +import com.google.longrunning.Operation; +import com.google.protobuf.Empty; +import com.google.protobuf.TypeRegistry; +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.concurrent.TimeUnit; +import javax.annotation.Generated; + +// AUTO-GENERATED DOCUMENTATION AND CLASS. +/** + * REST stub implementation for the ContactCenterInsights service API. + * + *

This class is for advanced usage and reflects the underlying API directly. + */ +@Generated("by gapic-generator-java") +@BetaApi +public class HttpJsonContactCenterInsightsStub extends ContactCenterInsightsStub { + private static final TypeRegistry typeRegistry = + TypeRegistry.newBuilder() + .add(DeleteIssueModelMetadata.getDescriptor()) + .add(DeployIssueModelMetadata.getDescriptor()) + .add(CreateAnalysisOperationMetadata.getDescriptor()) + .add(Empty.getDescriptor()) + .add(Analysis.getDescriptor()) + .add(ExportInsightsDataResponse.getDescriptor()) + .add(UndeployIssueModelResponse.getDescriptor()) + .add(CreateIssueModelMetadata.getDescriptor()) + .add(UndeployIssueModelMetadata.getDescriptor()) + .add(ExportInsightsDataMetadata.getDescriptor()) + .add(IssueModel.getDescriptor()) + .add(DeployIssueModelResponse.getDescriptor()) + .build(); + + private static final ApiMethodDescriptor + createConversationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/CreateConversation") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/conversations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam( + fields, "conversationId", request.getConversationId()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("conversation", request.getConversation())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Conversation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateConversationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/UpdateConversation") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{conversation.name=projects/*/locations/*/conversations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "conversation.name", request.getConversation().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("conversation", request.getConversation())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Conversation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getConversationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/GetConversation") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/conversations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "view", request.getView()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Conversation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listConversationsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/ListConversations") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/conversations", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + serializer.putQueryParam(fields, "view", request.getView()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListConversationsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteConversationMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/DeleteConversation") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/conversations/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "force", request.getForce()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createAnalysisMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/CreateAnalysis") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/conversations/*}/analyses", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("analysis", request.getAnalysis())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateAnalysisRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + getAnalysisMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/GetAnalysis") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/conversations/*/analyses/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Analysis.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listAnalysesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/ListAnalyses") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/conversations/*}/analyses", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListAnalysesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteAnalysisMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/DeleteAnalysis") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/conversations/*/analyses/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + exportInsightsDataMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/ExportInsightsData") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/insightsdata:export", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearParent().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (ExportInsightsDataRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + createIssueModelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/CreateIssueModel") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/issueModels", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("issueModel", request.getIssueModel())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (CreateIssueModelRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + updateIssueModelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/UpdateIssueModel") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{issueModel.name=projects/*/locations/*/issueModels/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "issueModel.name", request.getIssueModel().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("issueModel", request.getIssueModel())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(IssueModel.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getIssueModelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/GetIssueModel") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/issueModels/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(IssueModel.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listIssueModelsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/ListIssueModels") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/issueModels", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListIssueModelsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deleteIssueModelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/DeleteIssueModel") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/issueModels/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeleteIssueModelRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + deployIssueModelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/DeployIssueModel") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/issueModels/*}:deploy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (DeployIssueModelRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor + undeployIssueModelMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/UndeployIssueModel") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/issueModels/*}:undeploy", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("*", request.toBuilder().clearName().build())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Operation.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .setOperationSnapshotFactory( + (UndeployIssueModelRequest request, Operation response) -> + HttpJsonOperationSnapshot.create(response)) + .build(); + + private static final ApiMethodDescriptor getIssueMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.contactcenterinsights.v1.ContactCenterInsights/GetIssue") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/issueModels/*/issues/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Issue.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listIssuesMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/ListIssues") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*/issueModels/*}/issues", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListIssuesResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor updateIssueMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/UpdateIssue") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{issue.name=projects/*/locations/*/issueModels/*/issues/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "issue.name", request.getIssue().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> ProtoRestSerializer.create().toBody("issue", request.getIssue())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Issue.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor< + CalculateIssueModelStatsRequest, CalculateIssueModelStatsResponse> + calculateIssueModelStatsMethodDescriptor = + ApiMethodDescriptor + .newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/CalculateIssueModelStats") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{issueModel=projects/*/locations/*/issueModels/*}:calculateIssueModelStats", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "issueModel", request.getIssueModel()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CalculateIssueModelStatsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + createPhraseMatcherMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/CreatePhraseMatcher") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/phraseMatchers", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("phraseMatcher", request.getPhraseMatcher())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PhraseMatcher.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getPhraseMatcherMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/GetPhraseMatcher") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/phraseMatchers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PhraseMatcher.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listPhraseMatchersMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/ListPhraseMatchers") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/phraseMatchers", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListPhraseMatchersResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + deletePhraseMatcherMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/DeletePhraseMatcher") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/phraseMatchers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updatePhraseMatcherMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/UpdatePhraseMatcher") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{phraseMatcher.name=projects/*/locations/*/phraseMatchers/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "phraseMatcher.name", request.getPhraseMatcher().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("phraseMatcher", request.getPhraseMatcher())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(PhraseMatcher.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + calculateStatsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/CalculateStats") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{location=projects/*/locations/*}/conversations:calculateStats", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "location", request.getLocation()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "filter", request.getFilter()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(CalculateStatsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + getSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/GetSettings") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/settings}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Settings.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + updateSettingsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/UpdateSettings") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{settings.name=projects/*/locations/*/settings}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam( + fields, "settings.name", request.getSettings().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> + ProtoRestSerializer.create() + .toBody("settings", request.getSettings())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Settings.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor createViewMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/CreateView") + .setHttpMethod("POST") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/views", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor( + request -> ProtoRestSerializer.create().toBody("view", request.getView())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(View.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor getViewMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName("google.cloud.contactcenterinsights.v1.ContactCenterInsights/GetView") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/views/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(View.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor + listViewsMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/ListViews") + .setHttpMethod("GET") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{parent=projects/*/locations/*}/views", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "parent", request.getParent()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "pageSize", request.getPageSize()); + serializer.putQueryParam(fields, "pageToken", request.getPageToken()); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(ListViewsResponse.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor updateViewMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/UpdateView") + .setHttpMethod("PATCH") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{view.name=projects/*/locations/*/views/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "view.name", request.getView().getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putQueryParam(fields, "updateMask", request.getUpdateMask()); + return fields; + }) + .setRequestBodyExtractor( + request -> ProtoRestSerializer.create().toBody("view", request.getView())) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(View.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private static final ApiMethodDescriptor deleteViewMethodDescriptor = + ApiMethodDescriptor.newBuilder() + .setFullMethodName( + "google.cloud.contactcenterinsights.v1.ContactCenterInsights/DeleteView") + .setHttpMethod("DELETE") + .setType(ApiMethodDescriptor.MethodType.UNARY) + .setRequestFormatter( + ProtoMessageRequestFormatter.newBuilder() + .setPath( + "/v1/{name=projects/*/locations/*/views/*}", + request -> { + Map fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + serializer.putPathParam(fields, "name", request.getName()); + return fields; + }) + .setQueryParamsExtractor( + request -> { + Map> fields = new HashMap<>(); + ProtoRestSerializer serializer = + ProtoRestSerializer.create(); + return fields; + }) + .setRequestBodyExtractor(request -> null) + .build()) + .setResponseParser( + ProtoMessageResponseParser.newBuilder() + .setDefaultInstance(Empty.getDefaultInstance()) + .setDefaultTypeRegistry(typeRegistry) + .build()) + .build(); + + private final UnaryCallable createConversationCallable; + private final UnaryCallable updateConversationCallable; + private final UnaryCallable getConversationCallable; + private final UnaryCallable + listConversationsCallable; + private final UnaryCallable + listConversationsPagedCallable; + private final UnaryCallable deleteConversationCallable; + private final UnaryCallable createAnalysisCallable; + private final OperationCallable + createAnalysisOperationCallable; + private final UnaryCallable getAnalysisCallable; + private final UnaryCallable listAnalysesCallable; + private final UnaryCallable + listAnalysesPagedCallable; + private final UnaryCallable deleteAnalysisCallable; + private final UnaryCallable exportInsightsDataCallable; + private final OperationCallable< + ExportInsightsDataRequest, ExportInsightsDataResponse, ExportInsightsDataMetadata> + exportInsightsDataOperationCallable; + private final UnaryCallable createIssueModelCallable; + private final OperationCallable + createIssueModelOperationCallable; + private final UnaryCallable updateIssueModelCallable; + private final UnaryCallable getIssueModelCallable; + private final UnaryCallable + listIssueModelsCallable; + private final UnaryCallable deleteIssueModelCallable; + private final OperationCallable + deleteIssueModelOperationCallable; + private final UnaryCallable deployIssueModelCallable; + private final OperationCallable< + DeployIssueModelRequest, DeployIssueModelResponse, DeployIssueModelMetadata> + deployIssueModelOperationCallable; + private final UnaryCallable undeployIssueModelCallable; + private final OperationCallable< + UndeployIssueModelRequest, UndeployIssueModelResponse, UndeployIssueModelMetadata> + undeployIssueModelOperationCallable; + private final UnaryCallable getIssueCallable; + private final UnaryCallable listIssuesCallable; + private final UnaryCallable updateIssueCallable; + private final UnaryCallable + calculateIssueModelStatsCallable; + private final UnaryCallable + createPhraseMatcherCallable; + private final UnaryCallable getPhraseMatcherCallable; + private final UnaryCallable + listPhraseMatchersCallable; + private final UnaryCallable + listPhraseMatchersPagedCallable; + private final UnaryCallable deletePhraseMatcherCallable; + private final UnaryCallable + updatePhraseMatcherCallable; + private final UnaryCallable calculateStatsCallable; + private final UnaryCallable getSettingsCallable; + private final UnaryCallable updateSettingsCallable; + private final UnaryCallable createViewCallable; + private final UnaryCallable getViewCallable; + private final UnaryCallable listViewsCallable; + private final UnaryCallable listViewsPagedCallable; + private final UnaryCallable updateViewCallable; + private final UnaryCallable deleteViewCallable; + + private final BackgroundResource backgroundResources; + private final HttpJsonOperationsStub httpJsonOperationsStub; + private final HttpJsonStubCallableFactory callableFactory; + + public static final HttpJsonContactCenterInsightsStub create( + ContactCenterInsightsStubSettings settings) throws IOException { + return new HttpJsonContactCenterInsightsStub(settings, ClientContext.create(settings)); + } + + public static final HttpJsonContactCenterInsightsStub create(ClientContext clientContext) + throws IOException { + return new HttpJsonContactCenterInsightsStub( + ContactCenterInsightsStubSettings.newHttpJsonBuilder().build(), clientContext); + } + + public static final HttpJsonContactCenterInsightsStub create( + ClientContext clientContext, HttpJsonStubCallableFactory callableFactory) throws IOException { + return new HttpJsonContactCenterInsightsStub( + ContactCenterInsightsStubSettings.newHttpJsonBuilder().build(), + clientContext, + callableFactory); + } + + /** + * Constructs an instance of HttpJsonContactCenterInsightsStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonContactCenterInsightsStub( + ContactCenterInsightsStubSettings settings, ClientContext clientContext) throws IOException { + this(settings, clientContext, new HttpJsonContactCenterInsightsCallableFactory()); + } + + /** + * Constructs an instance of HttpJsonContactCenterInsightsStub, using the given settings. This is + * protected so that it is easy to make a subclass, but otherwise, the static factory methods + * should be preferred. + */ + protected HttpJsonContactCenterInsightsStub( + ContactCenterInsightsStubSettings settings, + ClientContext clientContext, + HttpJsonStubCallableFactory callableFactory) + throws IOException { + this.callableFactory = callableFactory; + this.httpJsonOperationsStub = + HttpJsonOperationsStub.create(clientContext, callableFactory, typeRegistry); + + HttpJsonCallSettings + createConversationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createConversationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updateConversationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateConversationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getConversationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getConversationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listConversationsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listConversationsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteConversationTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteConversationMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createAnalysisTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createAnalysisMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getAnalysisTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getAnalysisMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listAnalysesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listAnalysesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteAnalysisTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteAnalysisMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings exportInsightsDataTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(exportInsightsDataMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createIssueModelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createIssueModelMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateIssueModelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateIssueModelMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getIssueModelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getIssueModelMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listIssueModelsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listIssueModelsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteIssueModelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteIssueModelMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deployIssueModelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deployIssueModelMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings undeployIssueModelTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(undeployIssueModelMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getIssueTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getIssueMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listIssuesTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listIssuesMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateIssueTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateIssueMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + calculateIssueModelStatsTransportSettings = + HttpJsonCallSettings + .newBuilder() + .setMethodDescriptor(calculateIssueModelStatsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + createPhraseMatcherTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createPhraseMatcherMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getPhraseMatcherTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getPhraseMatcherMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + listPhraseMatchersTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listPhraseMatchersMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deletePhraseMatcherTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deletePhraseMatcherMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + updatePhraseMatcherTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updatePhraseMatcherMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings + calculateStatsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(calculateStatsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateSettingsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateSettingsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings createViewTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(createViewMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings getViewTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(getViewMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings listViewsTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(listViewsMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings updateViewTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(updateViewMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + HttpJsonCallSettings deleteViewTransportSettings = + HttpJsonCallSettings.newBuilder() + .setMethodDescriptor(deleteViewMethodDescriptor) + .setTypeRegistry(typeRegistry) + .build(); + + this.createConversationCallable = + callableFactory.createUnaryCallable( + createConversationTransportSettings, + settings.createConversationSettings(), + clientContext); + this.updateConversationCallable = + callableFactory.createUnaryCallable( + updateConversationTransportSettings, + settings.updateConversationSettings(), + clientContext); + this.getConversationCallable = + callableFactory.createUnaryCallable( + getConversationTransportSettings, settings.getConversationSettings(), clientContext); + this.listConversationsCallable = + callableFactory.createUnaryCallable( + listConversationsTransportSettings, + settings.listConversationsSettings(), + clientContext); + this.listConversationsPagedCallable = + callableFactory.createPagedCallable( + listConversationsTransportSettings, + settings.listConversationsSettings(), + clientContext); + this.deleteConversationCallable = + callableFactory.createUnaryCallable( + deleteConversationTransportSettings, + settings.deleteConversationSettings(), + clientContext); + this.createAnalysisCallable = + callableFactory.createUnaryCallable( + createAnalysisTransportSettings, settings.createAnalysisSettings(), clientContext); + this.createAnalysisOperationCallable = + callableFactory.createOperationCallable( + createAnalysisTransportSettings, + settings.createAnalysisOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getAnalysisCallable = + callableFactory.createUnaryCallable( + getAnalysisTransportSettings, settings.getAnalysisSettings(), clientContext); + this.listAnalysesCallable = + callableFactory.createUnaryCallable( + listAnalysesTransportSettings, settings.listAnalysesSettings(), clientContext); + this.listAnalysesPagedCallable = + callableFactory.createPagedCallable( + listAnalysesTransportSettings, settings.listAnalysesSettings(), clientContext); + this.deleteAnalysisCallable = + callableFactory.createUnaryCallable( + deleteAnalysisTransportSettings, settings.deleteAnalysisSettings(), clientContext); + this.exportInsightsDataCallable = + callableFactory.createUnaryCallable( + exportInsightsDataTransportSettings, + settings.exportInsightsDataSettings(), + clientContext); + this.exportInsightsDataOperationCallable = + callableFactory.createOperationCallable( + exportInsightsDataTransportSettings, + settings.exportInsightsDataOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.createIssueModelCallable = + callableFactory.createUnaryCallable( + createIssueModelTransportSettings, settings.createIssueModelSettings(), clientContext); + this.createIssueModelOperationCallable = + callableFactory.createOperationCallable( + createIssueModelTransportSettings, + settings.createIssueModelOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.updateIssueModelCallable = + callableFactory.createUnaryCallable( + updateIssueModelTransportSettings, settings.updateIssueModelSettings(), clientContext); + this.getIssueModelCallable = + callableFactory.createUnaryCallable( + getIssueModelTransportSettings, settings.getIssueModelSettings(), clientContext); + this.listIssueModelsCallable = + callableFactory.createUnaryCallable( + listIssueModelsTransportSettings, settings.listIssueModelsSettings(), clientContext); + this.deleteIssueModelCallable = + callableFactory.createUnaryCallable( + deleteIssueModelTransportSettings, settings.deleteIssueModelSettings(), clientContext); + this.deleteIssueModelOperationCallable = + callableFactory.createOperationCallable( + deleteIssueModelTransportSettings, + settings.deleteIssueModelOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.deployIssueModelCallable = + callableFactory.createUnaryCallable( + deployIssueModelTransportSettings, settings.deployIssueModelSettings(), clientContext); + this.deployIssueModelOperationCallable = + callableFactory.createOperationCallable( + deployIssueModelTransportSettings, + settings.deployIssueModelOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.undeployIssueModelCallable = + callableFactory.createUnaryCallable( + undeployIssueModelTransportSettings, + settings.undeployIssueModelSettings(), + clientContext); + this.undeployIssueModelOperationCallable = + callableFactory.createOperationCallable( + undeployIssueModelTransportSettings, + settings.undeployIssueModelOperationSettings(), + clientContext, + httpJsonOperationsStub); + this.getIssueCallable = + callableFactory.createUnaryCallable( + getIssueTransportSettings, settings.getIssueSettings(), clientContext); + this.listIssuesCallable = + callableFactory.createUnaryCallable( + listIssuesTransportSettings, settings.listIssuesSettings(), clientContext); + this.updateIssueCallable = + callableFactory.createUnaryCallable( + updateIssueTransportSettings, settings.updateIssueSettings(), clientContext); + this.calculateIssueModelStatsCallable = + callableFactory.createUnaryCallable( + calculateIssueModelStatsTransportSettings, + settings.calculateIssueModelStatsSettings(), + clientContext); + this.createPhraseMatcherCallable = + callableFactory.createUnaryCallable( + createPhraseMatcherTransportSettings, + settings.createPhraseMatcherSettings(), + clientContext); + this.getPhraseMatcherCallable = + callableFactory.createUnaryCallable( + getPhraseMatcherTransportSettings, settings.getPhraseMatcherSettings(), clientContext); + this.listPhraseMatchersCallable = + callableFactory.createUnaryCallable( + listPhraseMatchersTransportSettings, + settings.listPhraseMatchersSettings(), + clientContext); + this.listPhraseMatchersPagedCallable = + callableFactory.createPagedCallable( + listPhraseMatchersTransportSettings, + settings.listPhraseMatchersSettings(), + clientContext); + this.deletePhraseMatcherCallable = + callableFactory.createUnaryCallable( + deletePhraseMatcherTransportSettings, + settings.deletePhraseMatcherSettings(), + clientContext); + this.updatePhraseMatcherCallable = + callableFactory.createUnaryCallable( + updatePhraseMatcherTransportSettings, + settings.updatePhraseMatcherSettings(), + clientContext); + this.calculateStatsCallable = + callableFactory.createUnaryCallable( + calculateStatsTransportSettings, settings.calculateStatsSettings(), clientContext); + this.getSettingsCallable = + callableFactory.createUnaryCallable( + getSettingsTransportSettings, settings.getSettingsSettings(), clientContext); + this.updateSettingsCallable = + callableFactory.createUnaryCallable( + updateSettingsTransportSettings, settings.updateSettingsSettings(), clientContext); + this.createViewCallable = + callableFactory.createUnaryCallable( + createViewTransportSettings, settings.createViewSettings(), clientContext); + this.getViewCallable = + callableFactory.createUnaryCallable( + getViewTransportSettings, settings.getViewSettings(), clientContext); + this.listViewsCallable = + callableFactory.createUnaryCallable( + listViewsTransportSettings, settings.listViewsSettings(), clientContext); + this.listViewsPagedCallable = + callableFactory.createPagedCallable( + listViewsTransportSettings, settings.listViewsSettings(), clientContext); + this.updateViewCallable = + callableFactory.createUnaryCallable( + updateViewTransportSettings, settings.updateViewSettings(), clientContext); + this.deleteViewCallable = + callableFactory.createUnaryCallable( + deleteViewTransportSettings, settings.deleteViewSettings(), clientContext); + + this.backgroundResources = + new BackgroundResourceAggregation(clientContext.getBackgroundResources()); + } + + @InternalApi + public static List getMethodDescriptors() { + List methodDescriptors = new ArrayList<>(); + methodDescriptors.add(createConversationMethodDescriptor); + methodDescriptors.add(updateConversationMethodDescriptor); + methodDescriptors.add(getConversationMethodDescriptor); + methodDescriptors.add(listConversationsMethodDescriptor); + methodDescriptors.add(deleteConversationMethodDescriptor); + methodDescriptors.add(createAnalysisMethodDescriptor); + methodDescriptors.add(getAnalysisMethodDescriptor); + methodDescriptors.add(listAnalysesMethodDescriptor); + methodDescriptors.add(deleteAnalysisMethodDescriptor); + methodDescriptors.add(exportInsightsDataMethodDescriptor); + methodDescriptors.add(createIssueModelMethodDescriptor); + methodDescriptors.add(updateIssueModelMethodDescriptor); + methodDescriptors.add(getIssueModelMethodDescriptor); + methodDescriptors.add(listIssueModelsMethodDescriptor); + methodDescriptors.add(deleteIssueModelMethodDescriptor); + methodDescriptors.add(deployIssueModelMethodDescriptor); + methodDescriptors.add(undeployIssueModelMethodDescriptor); + methodDescriptors.add(getIssueMethodDescriptor); + methodDescriptors.add(listIssuesMethodDescriptor); + methodDescriptors.add(updateIssueMethodDescriptor); + methodDescriptors.add(calculateIssueModelStatsMethodDescriptor); + methodDescriptors.add(createPhraseMatcherMethodDescriptor); + methodDescriptors.add(getPhraseMatcherMethodDescriptor); + methodDescriptors.add(listPhraseMatchersMethodDescriptor); + methodDescriptors.add(deletePhraseMatcherMethodDescriptor); + methodDescriptors.add(updatePhraseMatcherMethodDescriptor); + methodDescriptors.add(calculateStatsMethodDescriptor); + methodDescriptors.add(getSettingsMethodDescriptor); + methodDescriptors.add(updateSettingsMethodDescriptor); + methodDescriptors.add(createViewMethodDescriptor); + methodDescriptors.add(getViewMethodDescriptor); + methodDescriptors.add(listViewsMethodDescriptor); + methodDescriptors.add(updateViewMethodDescriptor); + methodDescriptors.add(deleteViewMethodDescriptor); + return methodDescriptors; + } + + public HttpJsonOperationsStub getHttpJsonOperationsStub() { + return httpJsonOperationsStub; + } + + @Override + public UnaryCallable createConversationCallable() { + return createConversationCallable; + } + + @Override + public UnaryCallable updateConversationCallable() { + return updateConversationCallable; + } + + @Override + public UnaryCallable getConversationCallable() { + return getConversationCallable; + } + + @Override + public UnaryCallable + listConversationsCallable() { + return listConversationsCallable; + } + + @Override + public UnaryCallable + listConversationsPagedCallable() { + return listConversationsPagedCallable; + } + + @Override + public UnaryCallable deleteConversationCallable() { + return deleteConversationCallable; + } + + @Override + public UnaryCallable createAnalysisCallable() { + return createAnalysisCallable; + } + + @Override + public OperationCallable + createAnalysisOperationCallable() { + return createAnalysisOperationCallable; + } + + @Override + public UnaryCallable getAnalysisCallable() { + return getAnalysisCallable; + } + + @Override + public UnaryCallable listAnalysesCallable() { + return listAnalysesCallable; + } + + @Override + public UnaryCallable listAnalysesPagedCallable() { + return listAnalysesPagedCallable; + } + + @Override + public UnaryCallable deleteAnalysisCallable() { + return deleteAnalysisCallable; + } + + @Override + public UnaryCallable exportInsightsDataCallable() { + return exportInsightsDataCallable; + } + + @Override + public OperationCallable< + ExportInsightsDataRequest, ExportInsightsDataResponse, ExportInsightsDataMetadata> + exportInsightsDataOperationCallable() { + return exportInsightsDataOperationCallable; + } + + @Override + public UnaryCallable createIssueModelCallable() { + return createIssueModelCallable; + } + + @Override + public OperationCallable + createIssueModelOperationCallable() { + return createIssueModelOperationCallable; + } + + @Override + public UnaryCallable updateIssueModelCallable() { + return updateIssueModelCallable; + } + + @Override + public UnaryCallable getIssueModelCallable() { + return getIssueModelCallable; + } + + @Override + public UnaryCallable listIssueModelsCallable() { + return listIssueModelsCallable; + } + + @Override + public UnaryCallable deleteIssueModelCallable() { + return deleteIssueModelCallable; + } + + @Override + public OperationCallable + deleteIssueModelOperationCallable() { + return deleteIssueModelOperationCallable; + } + + @Override + public UnaryCallable deployIssueModelCallable() { + return deployIssueModelCallable; + } + + @Override + public OperationCallable< + DeployIssueModelRequest, DeployIssueModelResponse, DeployIssueModelMetadata> + deployIssueModelOperationCallable() { + return deployIssueModelOperationCallable; + } + + @Override + public UnaryCallable undeployIssueModelCallable() { + return undeployIssueModelCallable; + } + + @Override + public OperationCallable< + UndeployIssueModelRequest, UndeployIssueModelResponse, UndeployIssueModelMetadata> + undeployIssueModelOperationCallable() { + return undeployIssueModelOperationCallable; + } + + @Override + public UnaryCallable getIssueCallable() { + return getIssueCallable; + } + + @Override + public UnaryCallable listIssuesCallable() { + return listIssuesCallable; + } + + @Override + public UnaryCallable updateIssueCallable() { + return updateIssueCallable; + } + + @Override + public UnaryCallable + calculateIssueModelStatsCallable() { + return calculateIssueModelStatsCallable; + } + + @Override + public UnaryCallable createPhraseMatcherCallable() { + return createPhraseMatcherCallable; + } + + @Override + public UnaryCallable getPhraseMatcherCallable() { + return getPhraseMatcherCallable; + } + + @Override + public UnaryCallable + listPhraseMatchersCallable() { + return listPhraseMatchersCallable; + } + + @Override + public UnaryCallable + listPhraseMatchersPagedCallable() { + return listPhraseMatchersPagedCallable; + } + + @Override + public UnaryCallable deletePhraseMatcherCallable() { + return deletePhraseMatcherCallable; + } + + @Override + public UnaryCallable updatePhraseMatcherCallable() { + return updatePhraseMatcherCallable; + } + + @Override + public UnaryCallable calculateStatsCallable() { + return calculateStatsCallable; + } + + @Override + public UnaryCallable getSettingsCallable() { + return getSettingsCallable; + } + + @Override + public UnaryCallable updateSettingsCallable() { + return updateSettingsCallable; + } + + @Override + public UnaryCallable createViewCallable() { + return createViewCallable; + } + + @Override + public UnaryCallable getViewCallable() { + return getViewCallable; + } + + @Override + public UnaryCallable listViewsCallable() { + return listViewsCallable; + } + + @Override + public UnaryCallable listViewsPagedCallable() { + return listViewsPagedCallable; + } + + @Override + public UnaryCallable updateViewCallable() { + return updateViewCallable; + } + + @Override + public UnaryCallable deleteViewCallable() { + return deleteViewCallable; + } + + @Override + public final void close() { + try { + backgroundResources.close(); + } catch (RuntimeException e) { + throw e; + } catch (Exception e) { + throw new IllegalStateException("Failed to close resource", e); + } + } + + @Override + public void shutdown() { + backgroundResources.shutdown(); + } + + @Override + public boolean isShutdown() { + return backgroundResources.isShutdown(); + } + + @Override + public boolean isTerminated() { + return backgroundResources.isTerminated(); + } + + @Override + public void shutdownNow() { + backgroundResources.shutdownNow(); + } + + @Override + public boolean awaitTermination(long duration, TimeUnit unit) throws InterruptedException { + return backgroundResources.awaitTermination(duration, unit); + } +} diff --git a/java-contact-center-insights/google-cloud-contact-center-insights/src/test/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsClientHttpJsonTest.java b/java-contact-center-insights/google-cloud-contact-center-insights/src/test/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsClientHttpJsonTest.java new file mode 100644 index 000000000000..973ce84fd554 --- /dev/null +++ b/java-contact-center-insights/google-cloud-contact-center-insights/src/test/java/com/google/cloud/contactcenterinsights/v1/ContactCenterInsightsClientHttpJsonTest.java @@ -0,0 +1,3242 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1; + +import static com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient.ListAnalysesPagedResponse; +import static com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient.ListConversationsPagedResponse; +import static com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient.ListPhraseMatchersPagedResponse; +import static com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient.ListViewsPagedResponse; + +import com.google.api.gax.core.NoCredentialsProvider; +import com.google.api.gax.httpjson.GaxHttpJsonProperties; +import com.google.api.gax.httpjson.testing.MockHttpService; +import com.google.api.gax.rpc.ApiClientHeaderProvider; +import com.google.api.gax.rpc.ApiException; +import com.google.api.gax.rpc.ApiExceptionFactory; +import com.google.api.gax.rpc.InvalidArgumentException; +import com.google.api.gax.rpc.StatusCode; +import com.google.api.gax.rpc.testing.FakeStatusCode; +import com.google.cloud.contactcenterinsights.v1.stub.HttpJsonContactCenterInsightsStub; +import com.google.common.collect.Lists; +import com.google.longrunning.Operation; +import com.google.protobuf.Any; +import com.google.protobuf.Duration; +import com.google.protobuf.Empty; +import com.google.protobuf.FieldMask; +import com.google.protobuf.Timestamp; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.concurrent.ExecutionException; +import javax.annotation.Generated; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Test; + +@Generated("by gapic-generator-java") +public class ContactCenterInsightsClientHttpJsonTest { + private static MockHttpService mockService; + private static ContactCenterInsightsClient client; + + @BeforeClass + public static void startStaticServer() throws IOException { + mockService = + new MockHttpService( + HttpJsonContactCenterInsightsStub.getMethodDescriptors(), + ContactCenterInsightsSettings.getDefaultEndpoint()); + ContactCenterInsightsSettings settings = + ContactCenterInsightsSettings.newHttpJsonBuilder() + .setTransportChannelProvider( + ContactCenterInsightsSettings.defaultHttpJsonTransportProviderBuilder() + .setHttpTransport(mockService) + .build()) + .setCredentialsProvider(NoCredentialsProvider.create()) + .build(); + client = ContactCenterInsightsClient.create(settings); + } + + @AfterClass + public static void stopServer() { + client.close(); + } + + @Before + public void setUp() {} + + @After + public void tearDown() throws Exception { + mockService.reset(); + } + + @Test + public void createConversationTest() throws Exception { + Conversation expectedResponse = + Conversation.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setDataSource(ConversationDataSource.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setAgentId("agentId-1060987136") + .putAllLabels(new HashMap()) + .setTranscript(Conversation.Transcript.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setTurnCount(428155597) + .setLatestAnalysis(Analysis.newBuilder().build()) + .addAllRuntimeAnnotations(new ArrayList()) + .putAllDialogflowIntents(new HashMap()) + .setObfuscatedUserId("obfuscatedUserId971552298") + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Conversation conversation = Conversation.newBuilder().build(); + String conversationId = "conversationId-1676095234"; + + Conversation actualResponse = client.createConversation(parent, conversation, conversationId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createConversationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Conversation conversation = Conversation.newBuilder().build(); + String conversationId = "conversationId-1676095234"; + client.createConversation(parent, conversation, conversationId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createConversationTest2() throws Exception { + Conversation expectedResponse = + Conversation.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setDataSource(ConversationDataSource.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setAgentId("agentId-1060987136") + .putAllLabels(new HashMap()) + .setTranscript(Conversation.Transcript.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setTurnCount(428155597) + .setLatestAnalysis(Analysis.newBuilder().build()) + .addAllRuntimeAnnotations(new ArrayList()) + .putAllDialogflowIntents(new HashMap()) + .setObfuscatedUserId("obfuscatedUserId971552298") + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + Conversation conversation = Conversation.newBuilder().build(); + String conversationId = "conversationId-1676095234"; + + Conversation actualResponse = client.createConversation(parent, conversation, conversationId); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createConversationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + Conversation conversation = Conversation.newBuilder().build(); + String conversationId = "conversationId-1676095234"; + client.createConversation(parent, conversation, conversationId); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateConversationTest() throws Exception { + Conversation expectedResponse = + Conversation.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setDataSource(ConversationDataSource.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setAgentId("agentId-1060987136") + .putAllLabels(new HashMap()) + .setTranscript(Conversation.Transcript.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setTurnCount(428155597) + .setLatestAnalysis(Analysis.newBuilder().build()) + .addAllRuntimeAnnotations(new ArrayList()) + .putAllDialogflowIntents(new HashMap()) + .setObfuscatedUserId("obfuscatedUserId971552298") + .build(); + mockService.addResponse(expectedResponse); + + Conversation conversation = + Conversation.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setDataSource(ConversationDataSource.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setAgentId("agentId-1060987136") + .putAllLabels(new HashMap()) + .setTranscript(Conversation.Transcript.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setTurnCount(428155597) + .setLatestAnalysis(Analysis.newBuilder().build()) + .addAllRuntimeAnnotations(new ArrayList()) + .putAllDialogflowIntents(new HashMap()) + .setObfuscatedUserId("obfuscatedUserId971552298") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Conversation actualResponse = client.updateConversation(conversation, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateConversationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Conversation conversation = + Conversation.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setDataSource(ConversationDataSource.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setAgentId("agentId-1060987136") + .putAllLabels(new HashMap()) + .setTranscript(Conversation.Transcript.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setTurnCount(428155597) + .setLatestAnalysis(Analysis.newBuilder().build()) + .addAllRuntimeAnnotations(new ArrayList()) + .putAllDialogflowIntents(new HashMap()) + .setObfuscatedUserId("obfuscatedUserId971552298") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateConversation(conversation, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConversationTest() throws Exception { + Conversation expectedResponse = + Conversation.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setDataSource(ConversationDataSource.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setAgentId("agentId-1060987136") + .putAllLabels(new HashMap()) + .setTranscript(Conversation.Transcript.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setTurnCount(428155597) + .setLatestAnalysis(Analysis.newBuilder().build()) + .addAllRuntimeAnnotations(new ArrayList()) + .putAllDialogflowIntents(new HashMap()) + .setObfuscatedUserId("obfuscatedUserId971552298") + .build(); + mockService.addResponse(expectedResponse); + + ConversationName name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + + Conversation actualResponse = client.getConversation(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConversationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConversationName name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + client.getConversation(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getConversationTest2() throws Exception { + Conversation expectedResponse = + Conversation.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setDataSource(ConversationDataSource.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setStartTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setAgentId("agentId-1060987136") + .putAllLabels(new HashMap()) + .setTranscript(Conversation.Transcript.newBuilder().build()) + .setDuration(Duration.newBuilder().build()) + .setTurnCount(428155597) + .setLatestAnalysis(Analysis.newBuilder().build()) + .addAllRuntimeAnnotations(new ArrayList()) + .putAllDialogflowIntents(new HashMap()) + .setObfuscatedUserId("obfuscatedUserId971552298") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3338/locations/location-3338/conversations/conversation-3338"; + + Conversation actualResponse = client.getConversation(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getConversationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3338/locations/location-3338/conversations/conversation-3338"; + client.getConversation(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listConversationsTest() throws Exception { + Conversation responsesElement = Conversation.newBuilder().build(); + ListConversationsResponse expectedResponse = + ListConversationsResponse.newBuilder() + .setNextPageToken("") + .addAllConversations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListConversationsPagedResponse pagedListResponse = client.listConversations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConversationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listConversationsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listConversations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listConversationsTest2() throws Exception { + Conversation responsesElement = Conversation.newBuilder().build(); + ListConversationsResponse expectedResponse = + ListConversationsResponse.newBuilder() + .setNextPageToken("") + .addAllConversations(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListConversationsPagedResponse pagedListResponse = client.listConversations(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getConversationsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listConversationsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listConversations(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteConversationTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ConversationName name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + + client.deleteConversation(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteConversationExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConversationName name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + client.deleteConversation(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteConversationTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-3338/locations/location-3338/conversations/conversation-3338"; + + client.deleteConversation(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteConversationExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-3338/locations/location-3338/conversations/conversation-3338"; + client.deleteConversation(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createAnalysisTest() throws Exception { + Analysis expectedResponse = + Analysis.newBuilder() + .setName( + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]") + .toString()) + .setRequestTime(Timestamp.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setAnalysisResult(AnalysisResult.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAnalysisTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + ConversationName parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + Analysis analysis = Analysis.newBuilder().build(); + + Analysis actualResponse = client.createAnalysisAsync(parent, analysis).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAnalysisExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConversationName parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + Analysis analysis = Analysis.newBuilder().build(); + client.createAnalysisAsync(parent, analysis).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createAnalysisTest2() throws Exception { + Analysis expectedResponse = + Analysis.newBuilder() + .setName( + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]") + .toString()) + .setRequestTime(Timestamp.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setAnalysisResult(AnalysisResult.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createAnalysisTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-8053/locations/location-8053/conversations/conversation-8053"; + Analysis analysis = Analysis.newBuilder().build(); + + Analysis actualResponse = client.createAnalysisAsync(parent, analysis).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createAnalysisExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-8053/locations/location-8053/conversations/conversation-8053"; + Analysis analysis = Analysis.newBuilder().build(); + client.createAnalysisAsync(parent, analysis).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getAnalysisTest() throws Exception { + Analysis expectedResponse = + Analysis.newBuilder() + .setName( + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]") + .toString()) + .setRequestTime(Timestamp.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setAnalysisResult(AnalysisResult.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + AnalysisName name = AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]"); + + Analysis actualResponse = client.getAnalysis(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAnalysisExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AnalysisName name = + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]"); + client.getAnalysis(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getAnalysisTest2() throws Exception { + Analysis expectedResponse = + Analysis.newBuilder() + .setName( + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]") + .toString()) + .setRequestTime(Timestamp.newBuilder().build()) + .setCreateTime(Timestamp.newBuilder().build()) + .setAnalysisResult(AnalysisResult.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-3940/locations/location-3940/conversations/conversation-3940/analyses/analyse-3940"; + + Analysis actualResponse = client.getAnalysis(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getAnalysisExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-3940/locations/location-3940/conversations/conversation-3940/analyses/analyse-3940"; + client.getAnalysis(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAnalysesTest() throws Exception { + Analysis responsesElement = Analysis.newBuilder().build(); + ListAnalysesResponse expectedResponse = + ListAnalysesResponse.newBuilder() + .setNextPageToken("") + .addAllAnalyses(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + ConversationName parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + + ListAnalysesPagedResponse pagedListResponse = client.listAnalyses(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAnalysesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAnalysesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ConversationName parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + client.listAnalyses(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listAnalysesTest2() throws Exception { + Analysis responsesElement = Analysis.newBuilder().build(); + ListAnalysesResponse expectedResponse = + ListAnalysesResponse.newBuilder() + .setNextPageToken("") + .addAllAnalyses(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-8053/locations/location-8053/conversations/conversation-8053"; + + ListAnalysesPagedResponse pagedListResponse = client.listAnalyses(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getAnalysesList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listAnalysesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = + "projects/project-8053/locations/location-8053/conversations/conversation-8053"; + client.listAnalyses(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAnalysisTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + AnalysisName name = AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]"); + + client.deleteAnalysis(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAnalysisExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + AnalysisName name = + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]"); + client.deleteAnalysis(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteAnalysisTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-3940/locations/location-3940/conversations/conversation-3940/analyses/analyse-3940"; + + client.deleteAnalysis(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteAnalysisExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-3940/locations/location-3940/conversations/conversation-3940/analyses/analyse-3940"; + client.deleteAnalysis(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void exportInsightsDataTest() throws Exception { + ExportInsightsDataResponse expectedResponse = ExportInsightsDataResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportInsightsDataTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ExportInsightsDataResponse actualResponse = client.exportInsightsDataAsync(parent).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void exportInsightsDataExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.exportInsightsDataAsync(parent).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void exportInsightsDataTest2() throws Exception { + ExportInsightsDataResponse expectedResponse = ExportInsightsDataResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("exportInsightsDataTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + + ExportInsightsDataResponse actualResponse = client.exportInsightsDataAsync(parent).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void exportInsightsDataExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.exportInsightsDataAsync(parent).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createIssueModelTest() throws Exception { + IssueModel expectedResponse = + IssueModel.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInputDataConfig(IssueModel.InputDataConfig.newBuilder().build()) + .setTrainingStats(IssueModelLabelStats.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createIssueModelTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + IssueModel issueModel = IssueModel.newBuilder().build(); + + IssueModel actualResponse = client.createIssueModelAsync(parent, issueModel).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createIssueModelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + IssueModel issueModel = IssueModel.newBuilder().build(); + client.createIssueModelAsync(parent, issueModel).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void createIssueModelTest2() throws Exception { + IssueModel expectedResponse = + IssueModel.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInputDataConfig(IssueModel.InputDataConfig.newBuilder().build()) + .setTrainingStats(IssueModelLabelStats.newBuilder().build()) + .build(); + Operation resultOperation = + Operation.newBuilder() + .setName("createIssueModelTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String parent = "projects/project-5833/locations/location-5833"; + IssueModel issueModel = IssueModel.newBuilder().build(); + + IssueModel actualResponse = client.createIssueModelAsync(parent, issueModel).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createIssueModelExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + IssueModel issueModel = IssueModel.newBuilder().build(); + client.createIssueModelAsync(parent, issueModel).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void updateIssueModelTest() throws Exception { + IssueModel expectedResponse = + IssueModel.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInputDataConfig(IssueModel.InputDataConfig.newBuilder().build()) + .setTrainingStats(IssueModelLabelStats.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + IssueModel issueModel = + IssueModel.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInputDataConfig(IssueModel.InputDataConfig.newBuilder().build()) + .setTrainingStats(IssueModelLabelStats.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + IssueModel actualResponse = client.updateIssueModel(issueModel, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateIssueModelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + IssueModel issueModel = + IssueModel.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInputDataConfig(IssueModel.InputDataConfig.newBuilder().build()) + .setTrainingStats(IssueModelLabelStats.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateIssueModel(issueModel, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIssueModelTest() throws Exception { + IssueModel expectedResponse = + IssueModel.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInputDataConfig(IssueModel.InputDataConfig.newBuilder().build()) + .setTrainingStats(IssueModelLabelStats.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + + IssueModel actualResponse = client.getIssueModel(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getIssueModelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + client.getIssueModel(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIssueModelTest2() throws Exception { + IssueModel expectedResponse = + IssueModel.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setInputDataConfig(IssueModel.InputDataConfig.newBuilder().build()) + .setTrainingStats(IssueModelLabelStats.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-9415/locations/location-9415/issueModels/issueModel-9415"; + + IssueModel actualResponse = client.getIssueModel(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getIssueModelExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9415/locations/location-9415/issueModels/issueModel-9415"; + client.getIssueModel(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listIssueModelsTest() throws Exception { + ListIssueModelsResponse expectedResponse = + ListIssueModelsResponse.newBuilder().addAllIssueModels(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListIssueModelsResponse actualResponse = client.listIssueModels(parent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listIssueModelsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listIssueModels(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listIssueModelsTest2() throws Exception { + ListIssueModelsResponse expectedResponse = + ListIssueModelsResponse.newBuilder().addAllIssueModels(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListIssueModelsResponse actualResponse = client.listIssueModels(parent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listIssueModelsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listIssueModels(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteIssueModelTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteIssueModelTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + + client.deleteIssueModelAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteIssueModelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + client.deleteIssueModelAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deleteIssueModelTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deleteIssueModelTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-9415/locations/location-9415/issueModels/issueModel-9415"; + + client.deleteIssueModelAsync(name).get(); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteIssueModelExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9415/locations/location-9415/issueModels/issueModel-9415"; + client.deleteIssueModelAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deployIssueModelTest() throws Exception { + DeployIssueModelResponse expectedResponse = DeployIssueModelResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deployIssueModelTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + + DeployIssueModelResponse actualResponse = client.deployIssueModelAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deployIssueModelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + client.deployIssueModelAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void deployIssueModelTest2() throws Exception { + DeployIssueModelResponse expectedResponse = DeployIssueModelResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("deployIssueModelTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-9415/locations/location-9415/issueModels/issueModel-9415"; + + DeployIssueModelResponse actualResponse = client.deployIssueModelAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deployIssueModelExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9415/locations/location-9415/issueModels/issueModel-9415"; + client.deployIssueModelAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeployIssueModelTest() throws Exception { + UndeployIssueModelResponse expectedResponse = UndeployIssueModelResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeployIssueModelTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + + UndeployIssueModelResponse actualResponse = client.undeployIssueModelAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeployIssueModelExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + client.undeployIssueModelAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void undeployIssueModelTest2() throws Exception { + UndeployIssueModelResponse expectedResponse = UndeployIssueModelResponse.newBuilder().build(); + Operation resultOperation = + Operation.newBuilder() + .setName("undeployIssueModelTest") + .setDone(true) + .setResponse(Any.pack(expectedResponse)) + .build(); + mockService.addResponse(resultOperation); + + String name = "projects/project-9415/locations/location-9415/issueModels/issueModel-9415"; + + UndeployIssueModelResponse actualResponse = client.undeployIssueModelAsync(name).get(); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void undeployIssueModelExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-9415/locations/location-9415/issueModels/issueModel-9415"; + client.undeployIssueModelAsync(name).get(); + Assert.fail("No exception raised"); + } catch (ExecutionException e) { + } + } + + @Test + public void getIssueTest() throws Exception { + Issue expectedResponse = + Issue.newBuilder() + .setName(IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + IssueName name = IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]"); + + Issue actualResponse = client.getIssue(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getIssueExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + IssueName name = IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]"); + client.getIssue(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getIssueTest2() throws Exception { + Issue expectedResponse = + Issue.newBuilder() + .setName(IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = + "projects/project-9867/locations/location-9867/issueModels/issueModel-9867/issues/issue-9867"; + + Issue actualResponse = client.getIssue(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getIssueExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-9867/locations/location-9867/issueModels/issueModel-9867/issues/issue-9867"; + client.getIssue(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listIssuesTest() throws Exception { + ListIssuesResponse expectedResponse = + ListIssuesResponse.newBuilder().addAllIssues(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + IssueModelName parent = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + + ListIssuesResponse actualResponse = client.listIssues(parent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listIssuesExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + IssueModelName parent = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + client.listIssues(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listIssuesTest2() throws Exception { + ListIssuesResponse expectedResponse = + ListIssuesResponse.newBuilder().addAllIssues(new ArrayList()).build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-7032/locations/location-7032/issueModels/issueModel-7032"; + + ListIssuesResponse actualResponse = client.listIssues(parent); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listIssuesExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-7032/locations/location-7032/issueModels/issueModel-7032"; + client.listIssues(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateIssueTest() throws Exception { + Issue expectedResponse = + Issue.newBuilder() + .setName(IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + Issue issue = + Issue.newBuilder() + .setName(IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Issue actualResponse = client.updateIssue(issue, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateIssueExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Issue issue = + Issue.newBuilder() + .setName( + IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateIssue(issue, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void calculateIssueModelStatsTest() throws Exception { + CalculateIssueModelStatsResponse expectedResponse = + CalculateIssueModelStatsResponse.newBuilder() + .setCurrentStats(IssueModelLabelStats.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + IssueModelName issueModel = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + + CalculateIssueModelStatsResponse actualResponse = client.calculateIssueModelStats(issueModel); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void calculateIssueModelStatsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + IssueModelName issueModel = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + client.calculateIssueModelStats(issueModel); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void calculateIssueModelStatsTest2() throws Exception { + CalculateIssueModelStatsResponse expectedResponse = + CalculateIssueModelStatsResponse.newBuilder() + .setCurrentStats(IssueModelLabelStats.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String issueModel = "projects/project-2174/locations/location-2174/issueModels/issueModel-2174"; + + CalculateIssueModelStatsResponse actualResponse = client.calculateIssueModelStats(issueModel); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void calculateIssueModelStatsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String issueModel = + "projects/project-2174/locations/location-2174/issueModels/issueModel-2174"; + client.calculateIssueModelStats(issueModel); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPhraseMatcherTest() throws Exception { + PhraseMatcher expectedResponse = + PhraseMatcher.newBuilder() + .setName(PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .setRevisionId("revisionId-1507445162") + .setVersionTag("versionTag-670508126") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setActive(true) + .addAllPhraseMatchRuleGroups(new ArrayList()) + .setActivationUpdateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PhraseMatcher phraseMatcher = PhraseMatcher.newBuilder().build(); + + PhraseMatcher actualResponse = client.createPhraseMatcher(parent, phraseMatcher); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPhraseMatcherExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PhraseMatcher phraseMatcher = PhraseMatcher.newBuilder().build(); + client.createPhraseMatcher(parent, phraseMatcher); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createPhraseMatcherTest2() throws Exception { + PhraseMatcher expectedResponse = + PhraseMatcher.newBuilder() + .setName(PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .setRevisionId("revisionId-1507445162") + .setVersionTag("versionTag-670508126") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setActive(true) + .addAllPhraseMatchRuleGroups(new ArrayList()) + .setActivationUpdateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + PhraseMatcher phraseMatcher = PhraseMatcher.newBuilder().build(); + + PhraseMatcher actualResponse = client.createPhraseMatcher(parent, phraseMatcher); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createPhraseMatcherExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + PhraseMatcher phraseMatcher = PhraseMatcher.newBuilder().build(); + client.createPhraseMatcher(parent, phraseMatcher); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPhraseMatcherTest() throws Exception { + PhraseMatcher expectedResponse = + PhraseMatcher.newBuilder() + .setName(PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .setRevisionId("revisionId-1507445162") + .setVersionTag("versionTag-670508126") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setActive(true) + .addAllPhraseMatchRuleGroups(new ArrayList()) + .setActivationUpdateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PhraseMatcherName name = PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]"); + + PhraseMatcher actualResponse = client.getPhraseMatcher(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPhraseMatcherExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PhraseMatcherName name = PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]"); + client.getPhraseMatcher(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getPhraseMatcherTest2() throws Exception { + PhraseMatcher expectedResponse = + PhraseMatcher.newBuilder() + .setName(PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .setRevisionId("revisionId-1507445162") + .setVersionTag("versionTag-670508126") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setActive(true) + .addAllPhraseMatchRuleGroups(new ArrayList()) + .setActivationUpdateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-8010/locations/location-8010/phraseMatchers/phraseMatcher-8010"; + + PhraseMatcher actualResponse = client.getPhraseMatcher(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getPhraseMatcherExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-8010/locations/location-8010/phraseMatchers/phraseMatcher-8010"; + client.getPhraseMatcher(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPhraseMatchersTest() throws Exception { + PhraseMatcher responsesElement = PhraseMatcher.newBuilder().build(); + ListPhraseMatchersResponse expectedResponse = + ListPhraseMatchersResponse.newBuilder() + .setNextPageToken("") + .addAllPhraseMatchers(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListPhraseMatchersPagedResponse pagedListResponse = client.listPhraseMatchers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPhraseMatchersList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPhraseMatchersExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listPhraseMatchers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listPhraseMatchersTest2() throws Exception { + PhraseMatcher responsesElement = PhraseMatcher.newBuilder().build(); + ListPhraseMatchersResponse expectedResponse = + ListPhraseMatchersResponse.newBuilder() + .setNextPageToken("") + .addAllPhraseMatchers(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListPhraseMatchersPagedResponse pagedListResponse = client.listPhraseMatchers(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getPhraseMatchersList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listPhraseMatchersExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listPhraseMatchers(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePhraseMatcherTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + PhraseMatcherName name = PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]"); + + client.deletePhraseMatcher(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePhraseMatcherExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PhraseMatcherName name = PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]"); + client.deletePhraseMatcher(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deletePhraseMatcherTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-8010/locations/location-8010/phraseMatchers/phraseMatcher-8010"; + + client.deletePhraseMatcher(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deletePhraseMatcherExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = + "projects/project-8010/locations/location-8010/phraseMatchers/phraseMatcher-8010"; + client.deletePhraseMatcher(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updatePhraseMatcherTest() throws Exception { + PhraseMatcher expectedResponse = + PhraseMatcher.newBuilder() + .setName(PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .setRevisionId("revisionId-1507445162") + .setVersionTag("versionTag-670508126") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setActive(true) + .addAllPhraseMatchRuleGroups(new ArrayList()) + .setActivationUpdateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + PhraseMatcher phraseMatcher = + PhraseMatcher.newBuilder() + .setName(PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .setRevisionId("revisionId-1507445162") + .setVersionTag("versionTag-670508126") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setActive(true) + .addAllPhraseMatchRuleGroups(new ArrayList()) + .setActivationUpdateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + PhraseMatcher actualResponse = client.updatePhraseMatcher(phraseMatcher, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updatePhraseMatcherExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + PhraseMatcher phraseMatcher = + PhraseMatcher.newBuilder() + .setName( + PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .setRevisionId("revisionId-1507445162") + .setVersionTag("versionTag-670508126") + .setRevisionCreateTime(Timestamp.newBuilder().build()) + .setDisplayName("displayName1714148973") + .setActive(true) + .addAllPhraseMatchRuleGroups(new ArrayList()) + .setActivationUpdateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updatePhraseMatcher(phraseMatcher, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void calculateStatsTest() throws Exception { + CalculateStatsResponse expectedResponse = + CalculateStatsResponse.newBuilder() + .setAverageDuration(Duration.newBuilder().build()) + .setAverageTurnCount(-1693477329) + .setConversationCount(1994187347) + .putAllSmartHighlighterMatches(new HashMap()) + .putAllCustomHighlighterMatches(new HashMap()) + .putAllIssueMatches(new HashMap()) + .putAllIssueMatchesStats(new HashMap()) + .setConversationCountTimeSeries(CalculateStatsResponse.TimeSeries.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + + CalculateStatsResponse actualResponse = client.calculateStats(location); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void calculateStatsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + client.calculateStats(location); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void calculateStatsTest2() throws Exception { + CalculateStatsResponse expectedResponse = + CalculateStatsResponse.newBuilder() + .setAverageDuration(Duration.newBuilder().build()) + .setAverageTurnCount(-1693477329) + .setConversationCount(1994187347) + .putAllSmartHighlighterMatches(new HashMap()) + .putAllCustomHighlighterMatches(new HashMap()) + .putAllIssueMatches(new HashMap()) + .putAllIssueMatchesStats(new HashMap()) + .setConversationCountTimeSeries(CalculateStatsResponse.TimeSeries.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String location = "projects/project-7132/locations/location-7132"; + + CalculateStatsResponse actualResponse = client.calculateStats(location); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void calculateStatsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String location = "projects/project-7132/locations/location-7132"; + client.calculateStats(location); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSettingsTest() throws Exception { + Settings expectedResponse = + Settings.newBuilder() + .setName(SettingsName.of("[PROJECT]", "[LOCATION]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setConversationTtl(Duration.newBuilder().build()) + .putAllPubsubNotificationSettings(new HashMap()) + .setAnalysisConfig(Settings.AnalysisConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + SettingsName name = SettingsName.of("[PROJECT]", "[LOCATION]"); + + Settings actualResponse = client.getSettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + SettingsName name = SettingsName.of("[PROJECT]", "[LOCATION]"); + client.getSettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getSettingsTest2() throws Exception { + Settings expectedResponse = + Settings.newBuilder() + .setName(SettingsName.of("[PROJECT]", "[LOCATION]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setConversationTtl(Duration.newBuilder().build()) + .putAllPubsubNotificationSettings(new HashMap()) + .setAnalysisConfig(Settings.AnalysisConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-7640/locations/location-7640/settings"; + + Settings actualResponse = client.getSettings(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getSettingsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-7640/locations/location-7640/settings"; + client.getSettings(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateSettingsTest() throws Exception { + Settings expectedResponse = + Settings.newBuilder() + .setName(SettingsName.of("[PROJECT]", "[LOCATION]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setConversationTtl(Duration.newBuilder().build()) + .putAllPubsubNotificationSettings(new HashMap()) + .setAnalysisConfig(Settings.AnalysisConfig.newBuilder().build()) + .build(); + mockService.addResponse(expectedResponse); + + Settings settings = + Settings.newBuilder() + .setName(SettingsName.of("[PROJECT]", "[LOCATION]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setConversationTtl(Duration.newBuilder().build()) + .putAllPubsubNotificationSettings(new HashMap()) + .setAnalysisConfig(Settings.AnalysisConfig.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + Settings actualResponse = client.updateSettings(settings, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateSettingsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + Settings settings = + Settings.newBuilder() + .setName(SettingsName.of("[PROJECT]", "[LOCATION]").toString()) + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setLanguageCode("languageCode-2092349083") + .setConversationTtl(Duration.newBuilder().build()) + .putAllPubsubNotificationSettings(new HashMap()) + .setAnalysisConfig(Settings.AnalysisConfig.newBuilder().build()) + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateSettings(settings, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createViewTest() throws Exception { + View expectedResponse = + View.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setValue("value111972721") + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + View view = View.newBuilder().build(); + + View actualResponse = client.createView(parent, view); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createViewExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + View view = View.newBuilder().build(); + client.createView(parent, view); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void createViewTest2() throws Exception { + View expectedResponse = + View.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setValue("value111972721") + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + View view = View.newBuilder().build(); + + View actualResponse = client.createView(parent, view); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void createViewExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + View view = View.newBuilder().build(); + client.createView(parent, view); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getViewTest() throws Exception { + View expectedResponse = + View.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setValue("value111972721") + .build(); + mockService.addResponse(expectedResponse); + + ViewName name = ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]"); + + View actualResponse = client.getView(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getViewExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ViewName name = ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]"); + client.getView(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void getViewTest2() throws Exception { + View expectedResponse = + View.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setValue("value111972721") + .build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2284/locations/location-2284/views/view-2284"; + + View actualResponse = client.getView(name); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void getViewExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2284/locations/location-2284/views/view-2284"; + client.getView(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listViewsTest() throws Exception { + View responsesElement = View.newBuilder().build(); + ListViewsResponse expectedResponse = + ListViewsResponse.newBuilder() + .setNextPageToken("") + .addAllViews(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + + ListViewsPagedResponse pagedListResponse = client.listViews(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getViewsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listViewsExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + client.listViews(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void listViewsTest2() throws Exception { + View responsesElement = View.newBuilder().build(); + ListViewsResponse expectedResponse = + ListViewsResponse.newBuilder() + .setNextPageToken("") + .addAllViews(Arrays.asList(responsesElement)) + .build(); + mockService.addResponse(expectedResponse); + + String parent = "projects/project-5833/locations/location-5833"; + + ListViewsPagedResponse pagedListResponse = client.listViews(parent); + + List resources = Lists.newArrayList(pagedListResponse.iterateAll()); + + Assert.assertEquals(1, resources.size()); + Assert.assertEquals(expectedResponse.getViewsList().get(0), resources.get(0)); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void listViewsExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String parent = "projects/project-5833/locations/location-5833"; + client.listViews(parent); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void updateViewTest() throws Exception { + View expectedResponse = + View.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setValue("value111972721") + .build(); + mockService.addResponse(expectedResponse); + + View view = + View.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setValue("value111972721") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + + View actualResponse = client.updateView(view, updateMask); + Assert.assertEquals(expectedResponse, actualResponse); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void updateViewExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + View view = + View.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .setDisplayName("displayName1714148973") + .setCreateTime(Timestamp.newBuilder().build()) + .setUpdateTime(Timestamp.newBuilder().build()) + .setValue("value111972721") + .build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + client.updateView(view, updateMask); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteViewTest() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + ViewName name = ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]"); + + client.deleteView(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteViewExceptionTest() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + ViewName name = ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]"); + client.deleteView(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } + + @Test + public void deleteViewTest2() throws Exception { + Empty expectedResponse = Empty.newBuilder().build(); + mockService.addResponse(expectedResponse); + + String name = "projects/project-2284/locations/location-2284/views/view-2284"; + + client.deleteView(name); + + List actualRequests = mockService.getRequestPaths(); + Assert.assertEquals(1, actualRequests.size()); + + String apiClientHeaderKey = + mockService + .getRequestHeaders() + .get(ApiClientHeaderProvider.getDefaultApiClientHeaderKey()) + .iterator() + .next(); + Assert.assertTrue( + GaxHttpJsonProperties.getDefaultApiClientHeaderPattern() + .matcher(apiClientHeaderKey) + .matches()); + } + + @Test + public void deleteViewExceptionTest2() throws Exception { + ApiException exception = + ApiExceptionFactory.createException( + new Exception(), FakeStatusCode.of(StatusCode.Code.INVALID_ARGUMENT), false); + mockService.addException(exception); + + try { + String name = "projects/project-2284/locations/location-2284/views/view-2284"; + client.deleteView(name); + Assert.fail("No exception raised"); + } catch (InvalidArgumentException e) { + // Expected exception. + } + } +} diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/AsyncCalculateIssueModelStats.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/AsyncCalculateIssueModelStats.java new file mode 100644 index 000000000000..2853f3a7ca38 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/AsyncCalculateIssueModelStats.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculateissuemodelstats_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest; +import com.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class AsyncCalculateIssueModelStats { + + public static void main(String[] args) throws Exception { + asyncCalculateIssueModelStats(); + } + + public static void asyncCalculateIssueModelStats() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CalculateIssueModelStatsRequest request = + CalculateIssueModelStatsRequest.newBuilder() + .setIssueModel( + IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.calculateIssueModelStatsCallable().futureCall(request); + // Do something. + CalculateIssueModelStatsResponse response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculateissuemodelstats_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStats.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStats.java new file mode 100644 index 000000000000..bb2679218dc0 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStats.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculateissuemodelstats_sync] +import com.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest; +import com.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncCalculateIssueModelStats { + + public static void main(String[] args) throws Exception { + syncCalculateIssueModelStats(); + } + + public static void syncCalculateIssueModelStats() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CalculateIssueModelStatsRequest request = + CalculateIssueModelStatsRequest.newBuilder() + .setIssueModel( + IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + CalculateIssueModelStatsResponse response = + contactCenterInsightsClient.calculateIssueModelStats(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculateissuemodelstats_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStatsIssuemodelname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStatsIssuemodelname.java new file mode 100644 index 000000000000..f006b83c9f97 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStatsIssuemodelname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculateissuemodelstats_issuemodelname_sync] +import com.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncCalculateIssueModelStatsIssuemodelname { + + public static void main(String[] args) throws Exception { + syncCalculateIssueModelStatsIssuemodelname(); + } + + public static void syncCalculateIssueModelStatsIssuemodelname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + IssueModelName issueModel = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + CalculateIssueModelStatsResponse response = + contactCenterInsightsClient.calculateIssueModelStats(issueModel); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculateissuemodelstats_issuemodelname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStatsString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStatsString.java new file mode 100644 index 000000000000..23af4c8401e8 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculateissuemodelstats/SyncCalculateIssueModelStatsString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculateissuemodelstats_string_sync] +import com.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncCalculateIssueModelStatsString { + + public static void main(String[] args) throws Exception { + syncCalculateIssueModelStatsString(); + } + + public static void syncCalculateIssueModelStatsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String issueModel = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString(); + CalculateIssueModelStatsResponse response = + contactCenterInsightsClient.calculateIssueModelStats(issueModel); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculateissuemodelstats_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/AsyncCalculateStats.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/AsyncCalculateStats.java new file mode 100644 index 000000000000..888ec7685daa --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/AsyncCalculateStats.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.CalculateStatsRequest; +import com.google.cloud.contactcenterinsights.v1.CalculateStatsResponse; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class AsyncCalculateStats { + + public static void main(String[] args) throws Exception { + asyncCalculateStats(); + } + + public static void asyncCalculateStats() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CalculateStatsRequest request = + CalculateStatsRequest.newBuilder() + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + contactCenterInsightsClient.calculateStatsCallable().futureCall(request); + // Do something. + CalculateStatsResponse response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStats.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStats.java new file mode 100644 index 000000000000..e41d6a1a9a50 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStats.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_sync] +import com.google.cloud.contactcenterinsights.v1.CalculateStatsRequest; +import com.google.cloud.contactcenterinsights.v1.CalculateStatsResponse; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCalculateStats { + + public static void main(String[] args) throws Exception { + syncCalculateStats(); + } + + public static void syncCalculateStats() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CalculateStatsRequest request = + CalculateStatsRequest.newBuilder() + .setLocation(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .build(); + CalculateStatsResponse response = contactCenterInsightsClient.calculateStats(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStatsLocationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStatsLocationname.java new file mode 100644 index 000000000000..aa98d003d1cc --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStatsLocationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_locationname_sync] +import com.google.cloud.contactcenterinsights.v1.CalculateStatsResponse; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCalculateStatsLocationname { + + public static void main(String[] args) throws Exception { + syncCalculateStatsLocationname(); + } + + public static void syncCalculateStatsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName location = LocationName.of("[PROJECT]", "[LOCATION]"); + CalculateStatsResponse response = contactCenterInsightsClient.calculateStats(location); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_locationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStatsString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStatsString.java new file mode 100644 index 000000000000..826e749916d8 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/calculatestats/SyncCalculateStatsString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_string_sync] +import com.google.cloud.contactcenterinsights.v1.CalculateStatsResponse; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCalculateStatsString { + + public static void main(String[] args) throws Exception { + syncCalculateStatsString(); + } + + public static void syncCalculateStatsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String location = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + CalculateStatsResponse response = contactCenterInsightsClient.calculateStats(location); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_calculatestats_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetCredentialsProvider.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetCredentialsProvider.java new file mode 100644 index 000000000000..dde92bb6d055 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetCredentialsProvider.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_create_setcredentialsprovider_sync] +import com.google.api.gax.core.FixedCredentialsProvider; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsSettings; +import com.google.cloud.contactcenterinsights.v1.myCredentials; + +public class SyncCreateSetCredentialsProvider { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider(); + } + + public static void syncCreateSetCredentialsProvider() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ContactCenterInsightsSettings contactCenterInsightsSettings = + ContactCenterInsightsSettings.newBuilder() + .setCredentialsProvider(FixedCredentialsProvider.create(myCredentials)) + .build(); + ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create(contactCenterInsightsSettings); + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_create_setcredentialsprovider_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetCredentialsProvider1.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetCredentialsProvider1.java new file mode 100644 index 000000000000..cab85cfe75f8 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetCredentialsProvider1.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_create_setcredentialsprovider1_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsSettings; + +public class SyncCreateSetCredentialsProvider1 { + + public static void main(String[] args) throws Exception { + syncCreateSetCredentialsProvider1(); + } + + public static void syncCreateSetCredentialsProvider1() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ContactCenterInsightsSettings contactCenterInsightsSettings = + ContactCenterInsightsSettings.newBuilder() + .setTransportChannelProvider( + ContactCenterInsightsSettings.defaultHttpJsonTransportProviderBuilder().build()) + .build(); + ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create(contactCenterInsightsSettings); + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_create_setcredentialsprovider1_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetEndpoint.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetEndpoint.java new file mode 100644 index 000000000000..74e02d22c863 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/create/SyncCreateSetEndpoint.java @@ -0,0 +1,39 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_create_setendpoint_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsSettings; +import com.google.cloud.contactcenterinsights.v1.myEndpoint; + +public class SyncCreateSetEndpoint { + + public static void main(String[] args) throws Exception { + syncCreateSetEndpoint(); + } + + public static void syncCreateSetEndpoint() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ContactCenterInsightsSettings contactCenterInsightsSettings = + ContactCenterInsightsSettings.newBuilder().setEndpoint(myEndpoint).build(); + ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create(contactCenterInsightsSettings); + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_create_setendpoint_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/AsyncCreateAnalysis.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/AsyncCreateAnalysis.java new file mode 100644 index 000000000000..4cc6ef5f6f73 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/AsyncCreateAnalysis.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest; +import com.google.longrunning.Operation; + +public class AsyncCreateAnalysis { + + public static void main(String[] args) throws Exception { + asyncCreateAnalysis(); + } + + public static void asyncCreateAnalysis() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateAnalysisRequest request = + CreateAnalysisRequest.newBuilder() + .setParent( + ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setAnalysis(Analysis.newBuilder().build()) + .build(); + ApiFuture future = + contactCenterInsightsClient.createAnalysisCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/AsyncCreateAnalysisLRO.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/AsyncCreateAnalysisLRO.java new file mode 100644 index 000000000000..d72b00ac4f25 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/AsyncCreateAnalysisLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.CreateAnalysisOperationMetadata; +import com.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest; + +public class AsyncCreateAnalysisLRO { + + public static void main(String[] args) throws Exception { + asyncCreateAnalysisLRO(); + } + + public static void asyncCreateAnalysisLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateAnalysisRequest request = + CreateAnalysisRequest.newBuilder() + .setParent( + ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setAnalysis(Analysis.newBuilder().build()) + .build(); + OperationFuture future = + contactCenterInsightsClient.createAnalysisOperationCallable().futureCall(request); + // Do something. + Analysis response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_lro_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysis.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysis.java new file mode 100644 index 000000000000..4003372fa6b9 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysis.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest; + +public class SyncCreateAnalysis { + + public static void main(String[] args) throws Exception { + syncCreateAnalysis(); + } + + public static void syncCreateAnalysis() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateAnalysisRequest request = + CreateAnalysisRequest.newBuilder() + .setParent( + ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setAnalysis(Analysis.newBuilder().build()) + .build(); + Analysis response = contactCenterInsightsClient.createAnalysisAsync(request).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysisConversationnameAnalysis.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysisConversationnameAnalysis.java new file mode 100644 index 000000000000..9e9a073bef62 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysisConversationnameAnalysis.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_conversationnameanalysis_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; + +public class SyncCreateAnalysisConversationnameAnalysis { + + public static void main(String[] args) throws Exception { + syncCreateAnalysisConversationnameAnalysis(); + } + + public static void syncCreateAnalysisConversationnameAnalysis() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ConversationName parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + Analysis analysis = Analysis.newBuilder().build(); + Analysis response = contactCenterInsightsClient.createAnalysisAsync(parent, analysis).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_conversationnameanalysis_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysisStringAnalysis.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysisStringAnalysis.java new file mode 100644 index 000000000000..20065f19f795 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createanalysis/SyncCreateAnalysisStringAnalysis.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_stringanalysis_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; + +public class SyncCreateAnalysisStringAnalysis { + + public static void main(String[] args) throws Exception { + syncCreateAnalysisStringAnalysis(); + } + + public static void syncCreateAnalysisStringAnalysis() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString(); + Analysis analysis = Analysis.newBuilder().build(); + Analysis response = contactCenterInsightsClient.createAnalysisAsync(parent, analysis).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createanalysis_stringanalysis_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/AsyncCreateConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/AsyncCreateConversation.java new file mode 100644 index 000000000000..99f61c8eb8ef --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/AsyncCreateConversation.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createconversation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.CreateConversationRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class AsyncCreateConversation { + + public static void main(String[] args) throws Exception { + asyncCreateConversation(); + } + + public static void asyncCreateConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateConversationRequest request = + CreateConversationRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setConversation(Conversation.newBuilder().build()) + .setConversationId("conversationId-1676095234") + .build(); + ApiFuture future = + contactCenterInsightsClient.createConversationCallable().futureCall(request); + // Do something. + Conversation response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createconversation_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversation.java new file mode 100644 index 000000000000..221e0bb75c5b --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createconversation_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.CreateConversationRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCreateConversation { + + public static void main(String[] args) throws Exception { + syncCreateConversation(); + } + + public static void syncCreateConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateConversationRequest request = + CreateConversationRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setConversation(Conversation.newBuilder().build()) + .setConversationId("conversationId-1676095234") + .build(); + Conversation response = contactCenterInsightsClient.createConversation(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createconversation_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversationLocationnameConversationString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversationLocationnameConversationString.java new file mode 100644 index 000000000000..708d87201c86 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversationLocationnameConversationString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createconversation_locationnameconversationstring_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCreateConversationLocationnameConversationString { + + public static void main(String[] args) throws Exception { + syncCreateConversationLocationnameConversationString(); + } + + public static void syncCreateConversationLocationnameConversationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + Conversation conversation = Conversation.newBuilder().build(); + String conversationId = "conversationId-1676095234"; + Conversation response = + contactCenterInsightsClient.createConversation(parent, conversation, conversationId); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createconversation_locationnameconversationstring_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversationStringConversationString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversationStringConversationString.java new file mode 100644 index 000000000000..b18ed304346a --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createconversation/SyncCreateConversationStringConversationString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createconversation_stringconversationstring_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCreateConversationStringConversationString { + + public static void main(String[] args) throws Exception { + syncCreateConversationStringConversationString(); + } + + public static void syncCreateConversationStringConversationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + Conversation conversation = Conversation.newBuilder().build(); + String conversationId = "conversationId-1676095234"; + Conversation response = + contactCenterInsightsClient.createConversation(parent, conversation, conversationId); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createconversation_stringconversationstring_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/AsyncCreateIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/AsyncCreateIssueModel.java new file mode 100644 index 000000000000..e3fe202ef935 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/AsyncCreateIssueModel.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncCreateIssueModel { + + public static void main(String[] args) throws Exception { + asyncCreateIssueModel(); + } + + public static void asyncCreateIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateIssueModelRequest request = + CreateIssueModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIssueModel(IssueModel.newBuilder().build()) + .build(); + ApiFuture future = + contactCenterInsightsClient.createIssueModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/AsyncCreateIssueModelLRO.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/AsyncCreateIssueModelLRO.java new file mode 100644 index 000000000000..f335c7e38746 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/AsyncCreateIssueModelLRO.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.CreateIssueModelMetadata; +import com.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class AsyncCreateIssueModelLRO { + + public static void main(String[] args) throws Exception { + asyncCreateIssueModelLRO(); + } + + public static void asyncCreateIssueModelLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateIssueModelRequest request = + CreateIssueModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIssueModel(IssueModel.newBuilder().build()) + .build(); + OperationFuture future = + contactCenterInsightsClient.createIssueModelOperationCallable().futureCall(request); + // Do something. + IssueModel response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_lro_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModel.java new file mode 100644 index 000000000000..e583f05b562c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModel.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCreateIssueModel { + + public static void main(String[] args) throws Exception { + syncCreateIssueModel(); + } + + public static void syncCreateIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateIssueModelRequest request = + CreateIssueModelRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setIssueModel(IssueModel.newBuilder().build()) + .build(); + IssueModel response = contactCenterInsightsClient.createIssueModelAsync(request).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModelLocationnameIssuemodel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModelLocationnameIssuemodel.java new file mode 100644 index 000000000000..9f1afc3e3e12 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModelLocationnameIssuemodel.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_locationnameissuemodel_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCreateIssueModelLocationnameIssuemodel { + + public static void main(String[] args) throws Exception { + syncCreateIssueModelLocationnameIssuemodel(); + } + + public static void syncCreateIssueModelLocationnameIssuemodel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + IssueModel issueModel = IssueModel.newBuilder().build(); + IssueModel response = + contactCenterInsightsClient.createIssueModelAsync(parent, issueModel).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_locationnameissuemodel_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModelStringIssuemodel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModelStringIssuemodel.java new file mode 100644 index 000000000000..98b013f6b8e0 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createissuemodel/SyncCreateIssueModelStringIssuemodel.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_stringissuemodel_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncCreateIssueModelStringIssuemodel { + + public static void main(String[] args) throws Exception { + syncCreateIssueModelStringIssuemodel(); + } + + public static void syncCreateIssueModelStringIssuemodel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + IssueModel issueModel = IssueModel.newBuilder().build(); + IssueModel response = + contactCenterInsightsClient.createIssueModelAsync(parent, issueModel).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createissuemodel_stringissuemodel_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/AsyncCreatePhraseMatcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/AsyncCreatePhraseMatcher.java new file mode 100644 index 000000000000..967539eb9a22 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/AsyncCreatePhraseMatcher.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createphrasematcher_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; + +public class AsyncCreatePhraseMatcher { + + public static void main(String[] args) throws Exception { + asyncCreatePhraseMatcher(); + } + + public static void asyncCreatePhraseMatcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreatePhraseMatcherRequest request = + CreatePhraseMatcherRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPhraseMatcher(PhraseMatcher.newBuilder().build()) + .build(); + ApiFuture future = + contactCenterInsightsClient.createPhraseMatcherCallable().futureCall(request); + // Do something. + PhraseMatcher response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createphrasematcher_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcher.java new file mode 100644 index 000000000000..665c1abbdf8d --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcher.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createphrasematcher_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; + +public class SyncCreatePhraseMatcher { + + public static void main(String[] args) throws Exception { + syncCreatePhraseMatcher(); + } + + public static void syncCreatePhraseMatcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreatePhraseMatcherRequest request = + CreatePhraseMatcherRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPhraseMatcher(PhraseMatcher.newBuilder().build()) + .build(); + PhraseMatcher response = contactCenterInsightsClient.createPhraseMatcher(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createphrasematcher_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcherLocationnamePhrasematcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcherLocationnamePhrasematcher.java new file mode 100644 index 000000000000..6afbdeaaf357 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcherLocationnamePhrasematcher.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createphrasematcher_locationnamephrasematcher_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; + +public class SyncCreatePhraseMatcherLocationnamePhrasematcher { + + public static void main(String[] args) throws Exception { + syncCreatePhraseMatcherLocationnamePhrasematcher(); + } + + public static void syncCreatePhraseMatcherLocationnamePhrasematcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + PhraseMatcher phraseMatcher = PhraseMatcher.newBuilder().build(); + PhraseMatcher response = + contactCenterInsightsClient.createPhraseMatcher(parent, phraseMatcher); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createphrasematcher_locationnamephrasematcher_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcherStringPhrasematcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcherStringPhrasematcher.java new file mode 100644 index 000000000000..410ae93f36b6 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createphrasematcher/SyncCreatePhraseMatcherStringPhrasematcher.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createphrasematcher_stringphrasematcher_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; + +public class SyncCreatePhraseMatcherStringPhrasematcher { + + public static void main(String[] args) throws Exception { + syncCreatePhraseMatcherStringPhrasematcher(); + } + + public static void syncCreatePhraseMatcherStringPhrasematcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + PhraseMatcher phraseMatcher = PhraseMatcher.newBuilder().build(); + PhraseMatcher response = + contactCenterInsightsClient.createPhraseMatcher(parent, phraseMatcher); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createphrasematcher_stringphrasematcher_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/AsyncCreateView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/AsyncCreateView.java new file mode 100644 index 000000000000..c9c5758cbba9 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/AsyncCreateView.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createview_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.CreateViewRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; + +public class AsyncCreateView { + + public static void main(String[] args) throws Exception { + asyncCreateView(); + } + + public static void asyncCreateView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateViewRequest request = + CreateViewRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setView(View.newBuilder().build()) + .build(); + ApiFuture future = contactCenterInsightsClient.createViewCallable().futureCall(request); + // Do something. + View response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createview_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateView.java new file mode 100644 index 000000000000..2f7553367818 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateView.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createview_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.CreateViewRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; + +public class SyncCreateView { + + public static void main(String[] args) throws Exception { + syncCreateView(); + } + + public static void syncCreateView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + CreateViewRequest request = + CreateViewRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setView(View.newBuilder().build()) + .build(); + View response = contactCenterInsightsClient.createView(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createview_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateViewLocationnameView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateViewLocationnameView.java new file mode 100644 index 000000000000..ae0ac857821a --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateViewLocationnameView.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createview_locationnameview_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; + +public class SyncCreateViewLocationnameView { + + public static void main(String[] args) throws Exception { + syncCreateViewLocationnameView(); + } + + public static void syncCreateViewLocationnameView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + View view = View.newBuilder().build(); + View response = contactCenterInsightsClient.createView(parent, view); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createview_locationnameview_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateViewStringView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateViewStringView.java new file mode 100644 index 000000000000..93ea15b1f844 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/createview/SyncCreateViewStringView.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_createview_stringview_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; + +public class SyncCreateViewStringView { + + public static void main(String[] args) throws Exception { + syncCreateViewStringView(); + } + + public static void syncCreateViewStringView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + View view = View.newBuilder().build(); + View response = contactCenterInsightsClient.createView(parent, view); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_createview_stringview_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/AsyncDeleteAnalysis.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/AsyncDeleteAnalysis.java new file mode 100644 index 000000000000..d0e06d2d3185 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/AsyncDeleteAnalysis.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteanalysis_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.AnalysisName; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteAnalysis { + + public static void main(String[] args) throws Exception { + asyncDeleteAnalysis(); + } + + public static void asyncDeleteAnalysis() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteAnalysisRequest request = + DeleteAnalysisRequest.newBuilder() + .setName( + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]") + .toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.deleteAnalysisCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteanalysis_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysis.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysis.java new file mode 100644 index 000000000000..ff47696f9b8c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysis.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteanalysis_sync] +import com.google.cloud.contactcenterinsights.v1.AnalysisName; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteAnalysis { + + public static void main(String[] args) throws Exception { + syncDeleteAnalysis(); + } + + public static void syncDeleteAnalysis() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteAnalysisRequest request = + DeleteAnalysisRequest.newBuilder() + .setName( + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]") + .toString()) + .build(); + contactCenterInsightsClient.deleteAnalysis(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteanalysis_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysisAnalysisname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysisAnalysisname.java new file mode 100644 index 000000000000..d8917acf9e4f --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysisAnalysisname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteanalysis_analysisname_sync] +import com.google.cloud.contactcenterinsights.v1.AnalysisName; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.protobuf.Empty; + +public class SyncDeleteAnalysisAnalysisname { + + public static void main(String[] args) throws Exception { + syncDeleteAnalysisAnalysisname(); + } + + public static void syncDeleteAnalysisAnalysisname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + AnalysisName name = + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]"); + contactCenterInsightsClient.deleteAnalysis(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteanalysis_analysisname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysisString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysisString.java new file mode 100644 index 000000000000..f09890ee42c3 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteanalysis/SyncDeleteAnalysisString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteanalysis_string_sync] +import com.google.cloud.contactcenterinsights.v1.AnalysisName; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.protobuf.Empty; + +public class SyncDeleteAnalysisString { + + public static void main(String[] args) throws Exception { + syncDeleteAnalysisString(); + } + + public static void syncDeleteAnalysisString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]").toString(); + contactCenterInsightsClient.deleteAnalysis(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteanalysis_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/AsyncDeleteConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/AsyncDeleteConversation.java new file mode 100644 index 000000000000..204f720fc4db --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/AsyncDeleteConversation.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteconversation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.DeleteConversationRequest; +import com.google.protobuf.Empty; + +public class AsyncDeleteConversation { + + public static void main(String[] args) throws Exception { + asyncDeleteConversation(); + } + + public static void asyncDeleteConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteConversationRequest request = + DeleteConversationRequest.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setForce(true) + .build(); + ApiFuture future = + contactCenterInsightsClient.deleteConversationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteconversation_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversation.java new file mode 100644 index 000000000000..ab18c6e72f99 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteconversation_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.DeleteConversationRequest; +import com.google.protobuf.Empty; + +public class SyncDeleteConversation { + + public static void main(String[] args) throws Exception { + syncDeleteConversation(); + } + + public static void syncDeleteConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteConversationRequest request = + DeleteConversationRequest.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setForce(true) + .build(); + contactCenterInsightsClient.deleteConversation(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteconversation_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversationConversationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversationConversationname.java new file mode 100644 index 000000000000..889e2db51fc5 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversationConversationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteconversation_conversationname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.protobuf.Empty; + +public class SyncDeleteConversationConversationname { + + public static void main(String[] args) throws Exception { + syncDeleteConversationConversationname(); + } + + public static void syncDeleteConversationConversationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ConversationName name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + contactCenterInsightsClient.deleteConversation(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteconversation_conversationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversationString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversationString.java new file mode 100644 index 000000000000..e3cdc99bd8ea --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteconversation/SyncDeleteConversationString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteconversation_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.protobuf.Empty; + +public class SyncDeleteConversationString { + + public static void main(String[] args) throws Exception { + syncDeleteConversationString(); + } + + public static void syncDeleteConversationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString(); + contactCenterInsightsClient.deleteConversation(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteconversation_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/AsyncDeleteIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/AsyncDeleteIssueModel.java new file mode 100644 index 000000000000..9fca7eda0cf6 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/AsyncDeleteIssueModel.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.longrunning.Operation; + +public class AsyncDeleteIssueModel { + + public static void main(String[] args) throws Exception { + asyncDeleteIssueModel(); + } + + public static void asyncDeleteIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteIssueModelRequest request = + DeleteIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.deleteIssueModelCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/AsyncDeleteIssueModelLRO.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/AsyncDeleteIssueModelLRO.java new file mode 100644 index 000000000000..063df5e1e886 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/AsyncDeleteIssueModelLRO.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeleteIssueModelMetadata; +import com.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.protobuf.Empty; + +public class AsyncDeleteIssueModelLRO { + + public static void main(String[] args) throws Exception { + asyncDeleteIssueModelLRO(); + } + + public static void asyncDeleteIssueModelLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteIssueModelRequest request = + DeleteIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + OperationFuture future = + contactCenterInsightsClient.deleteIssueModelOperationCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_lro_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModel.java new file mode 100644 index 000000000000..79111892193d --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModel.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.protobuf.Empty; + +public class SyncDeleteIssueModel { + + public static void main(String[] args) throws Exception { + syncDeleteIssueModel(); + } + + public static void syncDeleteIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteIssueModelRequest request = + DeleteIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + contactCenterInsightsClient.deleteIssueModelAsync(request).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModelIssuemodelname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModelIssuemodelname.java new file mode 100644 index 000000000000..5a840260a4c1 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModelIssuemodelname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_issuemodelname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.protobuf.Empty; + +public class SyncDeleteIssueModelIssuemodelname { + + public static void main(String[] args) throws Exception { + syncDeleteIssueModelIssuemodelname(); + } + + public static void syncDeleteIssueModelIssuemodelname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + contactCenterInsightsClient.deleteIssueModelAsync(name).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_issuemodelname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModelString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModelString.java new file mode 100644 index 000000000000..9b91ca2b74b7 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteissuemodel/SyncDeleteIssueModelString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.protobuf.Empty; + +public class SyncDeleteIssueModelString { + + public static void main(String[] args) throws Exception { + syncDeleteIssueModelString(); + } + + public static void syncDeleteIssueModelString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString(); + contactCenterInsightsClient.deleteIssueModelAsync(name).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteissuemodel_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/AsyncDeletePhraseMatcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/AsyncDeletePhraseMatcher.java new file mode 100644 index 000000000000..832a508aa204 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/AsyncDeletePhraseMatcher.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deletephrasematcher_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcherName; +import com.google.protobuf.Empty; + +public class AsyncDeletePhraseMatcher { + + public static void main(String[] args) throws Exception { + asyncDeletePhraseMatcher(); + } + + public static void asyncDeletePhraseMatcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeletePhraseMatcherRequest request = + DeletePhraseMatcherRequest.newBuilder() + .setName( + PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.deletePhraseMatcherCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deletephrasematcher_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcher.java new file mode 100644 index 000000000000..cc30efb0293c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcher.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deletephrasematcher_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcherName; +import com.google.protobuf.Empty; + +public class SyncDeletePhraseMatcher { + + public static void main(String[] args) throws Exception { + syncDeletePhraseMatcher(); + } + + public static void syncDeletePhraseMatcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeletePhraseMatcherRequest request = + DeletePhraseMatcherRequest.newBuilder() + .setName( + PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .build(); + contactCenterInsightsClient.deletePhraseMatcher(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deletephrasematcher_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcherPhrasematchername.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcherPhrasematchername.java new file mode 100644 index 000000000000..9f5a9d8a87ce --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcherPhrasematchername.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deletephrasematcher_phrasematchername_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcherName; +import com.google.protobuf.Empty; + +public class SyncDeletePhraseMatcherPhrasematchername { + + public static void main(String[] args) throws Exception { + syncDeletePhraseMatcherPhrasematchername(); + } + + public static void syncDeletePhraseMatcherPhrasematchername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + PhraseMatcherName name = PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]"); + contactCenterInsightsClient.deletePhraseMatcher(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deletephrasematcher_phrasematchername_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcherString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcherString.java new file mode 100644 index 000000000000..23026b574f84 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deletephrasematcher/SyncDeletePhraseMatcherString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deletephrasematcher_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcherName; +import com.google.protobuf.Empty; + +public class SyncDeletePhraseMatcherString { + + public static void main(String[] args) throws Exception { + syncDeletePhraseMatcherString(); + } + + public static void syncDeletePhraseMatcherString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString(); + contactCenterInsightsClient.deletePhraseMatcher(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deletephrasematcher_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/AsyncDeleteView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/AsyncDeleteView.java new file mode 100644 index 000000000000..6657d5d87071 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/AsyncDeleteView.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteview_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeleteViewRequest; +import com.google.cloud.contactcenterinsights.v1.ViewName; +import com.google.protobuf.Empty; + +public class AsyncDeleteView { + + public static void main(String[] args) throws Exception { + asyncDeleteView(); + } + + public static void asyncDeleteView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteViewRequest request = + DeleteViewRequest.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.deleteViewCallable().futureCall(request); + // Do something. + future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteview_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteView.java new file mode 100644 index 000000000000..3194ff183bcf --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteView.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteview_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeleteViewRequest; +import com.google.cloud.contactcenterinsights.v1.ViewName; +import com.google.protobuf.Empty; + +public class SyncDeleteView { + + public static void main(String[] args) throws Exception { + syncDeleteView(); + } + + public static void syncDeleteView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeleteViewRequest request = + DeleteViewRequest.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .build(); + contactCenterInsightsClient.deleteView(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteview_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteViewString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteViewString.java new file mode 100644 index 000000000000..5c21247457ef --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteViewString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteview_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ViewName; +import com.google.protobuf.Empty; + +public class SyncDeleteViewString { + + public static void main(String[] args) throws Exception { + syncDeleteViewString(); + } + + public static void syncDeleteViewString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString(); + contactCenterInsightsClient.deleteView(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteview_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteViewViewname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteViewViewname.java new file mode 100644 index 000000000000..b7ddd46f607b --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deleteview/SyncDeleteViewViewname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteview_viewname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ViewName; +import com.google.protobuf.Empty; + +public class SyncDeleteViewViewname { + + public static void main(String[] args) throws Exception { + syncDeleteViewViewname(); + } + + public static void syncDeleteViewViewname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ViewName name = ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]"); + contactCenterInsightsClient.deleteView(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deleteview_viewname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/AsyncDeployIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/AsyncDeployIssueModel.java new file mode 100644 index 000000000000..21c10d747fc0 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/AsyncDeployIssueModel.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.longrunning.Operation; + +public class AsyncDeployIssueModel { + + public static void main(String[] args) throws Exception { + asyncDeployIssueModel(); + } + + public static void asyncDeployIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeployIssueModelRequest request = + DeployIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.deployIssueModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/AsyncDeployIssueModelLRO.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/AsyncDeployIssueModelLRO.java new file mode 100644 index 000000000000..529e2a030c3e --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/AsyncDeployIssueModelLRO.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelMetadata; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelResponse; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class AsyncDeployIssueModelLRO { + + public static void main(String[] args) throws Exception { + asyncDeployIssueModelLRO(); + } + + public static void asyncDeployIssueModelLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeployIssueModelRequest request = + DeployIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + OperationFuture future = + contactCenterInsightsClient.deployIssueModelOperationCallable().futureCall(request); + // Do something. + DeployIssueModelResponse response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_lro_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModel.java new file mode 100644 index 000000000000..4110d0f91851 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModel.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelResponse; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncDeployIssueModel { + + public static void main(String[] args) throws Exception { + syncDeployIssueModel(); + } + + public static void syncDeployIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + DeployIssueModelRequest request = + DeployIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + DeployIssueModelResponse response = + contactCenterInsightsClient.deployIssueModelAsync(request).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModelIssuemodelname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModelIssuemodelname.java new file mode 100644 index 000000000000..55199671076f --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModelIssuemodelname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_issuemodelname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelResponse; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncDeployIssueModelIssuemodelname { + + public static void main(String[] args) throws Exception { + syncDeployIssueModelIssuemodelname(); + } + + public static void syncDeployIssueModelIssuemodelname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + DeployIssueModelResponse response = + contactCenterInsightsClient.deployIssueModelAsync(name).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_issuemodelname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModelString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModelString.java new file mode 100644 index 000000000000..2de860e675cd --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/deployissuemodel/SyncDeployIssueModelString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.DeployIssueModelResponse; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncDeployIssueModelString { + + public static void main(String[] args) throws Exception { + syncDeployIssueModelString(); + } + + public static void syncDeployIssueModelString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString(); + DeployIssueModelResponse response = + contactCenterInsightsClient.deployIssueModelAsync(name).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_deployissuemodel_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/AsyncExportInsightsData.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/AsyncExportInsightsData.java new file mode 100644 index 000000000000..7b7f49334ccb --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/AsyncExportInsightsData.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.longrunning.Operation; + +public class AsyncExportInsightsData { + + public static void main(String[] args) throws Exception { + asyncExportInsightsData(); + } + + public static void asyncExportInsightsData() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ExportInsightsDataRequest request = + ExportInsightsDataRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setKmsKey("kmsKey-1127483058") + .build(); + ApiFuture future = + contactCenterInsightsClient.exportInsightsDataCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/AsyncExportInsightsDataLRO.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/AsyncExportInsightsDataLRO.java new file mode 100644 index 000000000000..24000d0135d5 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/AsyncExportInsightsDataLRO.java @@ -0,0 +1,51 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataMetadata; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class AsyncExportInsightsDataLRO { + + public static void main(String[] args) throws Exception { + asyncExportInsightsDataLRO(); + } + + public static void asyncExportInsightsDataLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ExportInsightsDataRequest request = + ExportInsightsDataRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setKmsKey("kmsKey-1127483058") + .build(); + OperationFuture future = + contactCenterInsightsClient.exportInsightsDataOperationCallable().futureCall(request); + // Do something. + ExportInsightsDataResponse response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_lro_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsData.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsData.java new file mode 100644 index 000000000000..dfa7d6436f0d --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsData.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncExportInsightsData { + + public static void main(String[] args) throws Exception { + syncExportInsightsData(); + } + + public static void syncExportInsightsData() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ExportInsightsDataRequest request = + ExportInsightsDataRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setFilter("filter-1274492040") + .setKmsKey("kmsKey-1127483058") + .build(); + ExportInsightsDataResponse response = + contactCenterInsightsClient.exportInsightsDataAsync(request).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsDataLocationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsDataLocationname.java new file mode 100644 index 000000000000..a2965ffa882a --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsDataLocationname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_locationname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncExportInsightsDataLocationname { + + public static void main(String[] args) throws Exception { + syncExportInsightsDataLocationname(); + } + + public static void syncExportInsightsDataLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ExportInsightsDataResponse response = + contactCenterInsightsClient.exportInsightsDataAsync(parent).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_locationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsDataString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsDataString.java new file mode 100644 index 000000000000..295a86f0115e --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/exportinsightsdata/SyncExportInsightsDataString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ExportInsightsDataResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncExportInsightsDataString { + + public static void main(String[] args) throws Exception { + syncExportInsightsDataString(); + } + + public static void syncExportInsightsDataString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + ExportInsightsDataResponse response = + contactCenterInsightsClient.exportInsightsDataAsync(parent).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_exportinsightsdata_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/AsyncGetAnalysis.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/AsyncGetAnalysis.java new file mode 100644 index 000000000000..27e86acc1300 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/AsyncGetAnalysis.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getanalysis_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.AnalysisName; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetAnalysisRequest; + +public class AsyncGetAnalysis { + + public static void main(String[] args) throws Exception { + asyncGetAnalysis(); + } + + public static void asyncGetAnalysis() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetAnalysisRequest request = + GetAnalysisRequest.newBuilder() + .setName( + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]") + .toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.getAnalysisCallable().futureCall(request); + // Do something. + Analysis response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getanalysis_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysis.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysis.java new file mode 100644 index 000000000000..74618ef79928 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysis.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getanalysis_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.AnalysisName; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetAnalysisRequest; + +public class SyncGetAnalysis { + + public static void main(String[] args) throws Exception { + syncGetAnalysis(); + } + + public static void syncGetAnalysis() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetAnalysisRequest request = + GetAnalysisRequest.newBuilder() + .setName( + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]") + .toString()) + .build(); + Analysis response = contactCenterInsightsClient.getAnalysis(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getanalysis_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysisAnalysisname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysisAnalysisname.java new file mode 100644 index 000000000000..7e07d5bc426e --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysisAnalysisname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getanalysis_analysisname_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.AnalysisName; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; + +public class SyncGetAnalysisAnalysisname { + + public static void main(String[] args) throws Exception { + syncGetAnalysisAnalysisname(); + } + + public static void syncGetAnalysisAnalysisname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + AnalysisName name = + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]"); + Analysis response = contactCenterInsightsClient.getAnalysis(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getanalysis_analysisname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysisString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysisString.java new file mode 100644 index 000000000000..ec9993de5249 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getanalysis/SyncGetAnalysisString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getanalysis_string_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.AnalysisName; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; + +public class SyncGetAnalysisString { + + public static void main(String[] args) throws Exception { + syncGetAnalysisString(); + } + + public static void syncGetAnalysisString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = + AnalysisName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]", "[ANALYSIS]").toString(); + Analysis response = contactCenterInsightsClient.getAnalysis(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getanalysis_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/AsyncGetConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/AsyncGetConversation.java new file mode 100644 index 000000000000..5e8a030bf8bc --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/AsyncGetConversation.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getconversation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.ConversationView; +import com.google.cloud.contactcenterinsights.v1.GetConversationRequest; + +public class AsyncGetConversation { + + public static void main(String[] args) throws Exception { + asyncGetConversation(); + } + + public static void asyncGetConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetConversationRequest request = + GetConversationRequest.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setView(ConversationView.forNumber(0)) + .build(); + ApiFuture future = + contactCenterInsightsClient.getConversationCallable().futureCall(request); + // Do something. + Conversation response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getconversation_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversation.java new file mode 100644 index 000000000000..3f6adfbba68e --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversation.java @@ -0,0 +1,46 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getconversation_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.ConversationView; +import com.google.cloud.contactcenterinsights.v1.GetConversationRequest; + +public class SyncGetConversation { + + public static void main(String[] args) throws Exception { + syncGetConversation(); + } + + public static void syncGetConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetConversationRequest request = + GetConversationRequest.newBuilder() + .setName(ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setView(ConversationView.forNumber(0)) + .build(); + Conversation response = contactCenterInsightsClient.getConversation(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getconversation_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversationConversationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversationConversationname.java new file mode 100644 index 000000000000..ebe724e7c3db --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversationConversationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getconversation_conversationname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.ConversationName; + +public class SyncGetConversationConversationname { + + public static void main(String[] args) throws Exception { + syncGetConversationConversationname(); + } + + public static void syncGetConversationConversationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ConversationName name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + Conversation response = contactCenterInsightsClient.getConversation(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getconversation_conversationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversationString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversationString.java new file mode 100644 index 000000000000..30333dc015db --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getconversation/SyncGetConversationString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getconversation_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.ConversationName; + +public class SyncGetConversationString { + + public static void main(String[] args) throws Exception { + syncGetConversationString(); + } + + public static void syncGetConversationString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString(); + Conversation response = contactCenterInsightsClient.getConversation(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getconversation_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/AsyncGetIssue.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/AsyncGetIssue.java new file mode 100644 index 000000000000..a4216efa7eed --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/AsyncGetIssue.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getissue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetIssueRequest; +import com.google.cloud.contactcenterinsights.v1.Issue; +import com.google.cloud.contactcenterinsights.v1.IssueName; + +public class AsyncGetIssue { + + public static void main(String[] args) throws Exception { + asyncGetIssue(); + } + + public static void asyncGetIssue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetIssueRequest request = + GetIssueRequest.newBuilder() + .setName( + IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]").toString()) + .build(); + ApiFuture future = contactCenterInsightsClient.getIssueCallable().futureCall(request); + // Do something. + Issue response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getissue_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssue.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssue.java new file mode 100644 index 000000000000..8942fd7d995c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getissue_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetIssueRequest; +import com.google.cloud.contactcenterinsights.v1.Issue; +import com.google.cloud.contactcenterinsights.v1.IssueName; + +public class SyncGetIssue { + + public static void main(String[] args) throws Exception { + syncGetIssue(); + } + + public static void syncGetIssue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetIssueRequest request = + GetIssueRequest.newBuilder() + .setName( + IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]").toString()) + .build(); + Issue response = contactCenterInsightsClient.getIssue(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getissue_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssueIssuename.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssueIssuename.java new file mode 100644 index 000000000000..effbb1ab2e42 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssueIssuename.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getissue_issuename_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Issue; +import com.google.cloud.contactcenterinsights.v1.IssueName; + +public class SyncGetIssueIssuename { + + public static void main(String[] args) throws Exception { + syncGetIssueIssuename(); + } + + public static void syncGetIssueIssuename() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + IssueName name = IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]"); + Issue response = contactCenterInsightsClient.getIssue(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getissue_issuename_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssueString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssueString.java new file mode 100644 index 000000000000..6467c72b9c10 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissue/SyncGetIssueString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getissue_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Issue; +import com.google.cloud.contactcenterinsights.v1.IssueName; + +public class SyncGetIssueString { + + public static void main(String[] args) throws Exception { + syncGetIssueString(); + } + + public static void syncGetIssueString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = IssueName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]", "[ISSUE]").toString(); + Issue response = contactCenterInsightsClient.getIssue(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getissue_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/AsyncGetIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/AsyncGetIssueModel.java new file mode 100644 index 000000000000..7ba53f303cfc --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/AsyncGetIssueModel.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getissuemodel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class AsyncGetIssueModel { + + public static void main(String[] args) throws Exception { + asyncGetIssueModel(); + } + + public static void asyncGetIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetIssueModelRequest request = + GetIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.getIssueModelCallable().futureCall(request); + // Do something. + IssueModel response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getissuemodel_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModel.java new file mode 100644 index 000000000000..6d9250e7cc2e --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModel.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getissuemodel_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncGetIssueModel { + + public static void main(String[] args) throws Exception { + syncGetIssueModel(); + } + + public static void syncGetIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetIssueModelRequest request = + GetIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + IssueModel response = contactCenterInsightsClient.getIssueModel(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getissuemodel_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModelIssuemodelname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModelIssuemodelname.java new file mode 100644 index 000000000000..d56b76a80355 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModelIssuemodelname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getissuemodel_issuemodelname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncGetIssueModelIssuemodelname { + + public static void main(String[] args) throws Exception { + syncGetIssueModelIssuemodelname(); + } + + public static void syncGetIssueModelIssuemodelname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + IssueModel response = contactCenterInsightsClient.getIssueModel(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getissuemodel_issuemodelname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModelString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModelString.java new file mode 100644 index 000000000000..d7d59db229cb --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getissuemodel/SyncGetIssueModelString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getissuemodel_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; + +public class SyncGetIssueModelString { + + public static void main(String[] args) throws Exception { + syncGetIssueModelString(); + } + + public static void syncGetIssueModelString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString(); + IssueModel response = contactCenterInsightsClient.getIssueModel(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getissuemodel_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/AsyncGetPhraseMatcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/AsyncGetPhraseMatcher.java new file mode 100644 index 000000000000..d68e87cb3985 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/AsyncGetPhraseMatcher.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getphrasematcher_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcherName; + +public class AsyncGetPhraseMatcher { + + public static void main(String[] args) throws Exception { + asyncGetPhraseMatcher(); + } + + public static void asyncGetPhraseMatcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetPhraseMatcherRequest request = + GetPhraseMatcherRequest.newBuilder() + .setName( + PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.getPhraseMatcherCallable().futureCall(request); + // Do something. + PhraseMatcher response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getphrasematcher_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcher.java new file mode 100644 index 000000000000..35e71f2263b8 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcher.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getphrasematcher_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcherName; + +public class SyncGetPhraseMatcher { + + public static void main(String[] args) throws Exception { + syncGetPhraseMatcher(); + } + + public static void syncGetPhraseMatcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetPhraseMatcherRequest request = + GetPhraseMatcherRequest.newBuilder() + .setName( + PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString()) + .build(); + PhraseMatcher response = contactCenterInsightsClient.getPhraseMatcher(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getphrasematcher_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcherPhrasematchername.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcherPhrasematchername.java new file mode 100644 index 000000000000..771045db3a53 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcherPhrasematchername.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getphrasematcher_phrasematchername_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcherName; + +public class SyncGetPhraseMatcherPhrasematchername { + + public static void main(String[] args) throws Exception { + syncGetPhraseMatcherPhrasematchername(); + } + + public static void syncGetPhraseMatcherPhrasematchername() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + PhraseMatcherName name = PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]"); + PhraseMatcher response = contactCenterInsightsClient.getPhraseMatcher(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getphrasematcher_phrasematchername_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcherString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcherString.java new file mode 100644 index 000000000000..fcc379ef4849 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getphrasematcher/SyncGetPhraseMatcherString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getphrasematcher_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcherName; + +public class SyncGetPhraseMatcherString { + + public static void main(String[] args) throws Exception { + syncGetPhraseMatcherString(); + } + + public static void syncGetPhraseMatcherString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = PhraseMatcherName.of("[PROJECT]", "[LOCATION]", "[PHRASE_MATCHER]").toString(); + PhraseMatcher response = contactCenterInsightsClient.getPhraseMatcher(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getphrasematcher_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/AsyncGetSettings.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/AsyncGetSettings.java new file mode 100644 index 000000000000..165a0f482ec0 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/AsyncGetSettings.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getsettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetSettingsRequest; +import com.google.cloud.contactcenterinsights.v1.Settings; +import com.google.cloud.contactcenterinsights.v1.SettingsName; + +public class AsyncGetSettings { + + public static void main(String[] args) throws Exception { + asyncGetSettings(); + } + + public static void asyncGetSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetSettingsRequest request = + GetSettingsRequest.newBuilder() + .setName(SettingsName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.getSettingsCallable().futureCall(request); + // Do something. + Settings response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getsettings_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettings.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettings.java new file mode 100644 index 000000000000..80752b00eecf --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettings.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getsettings_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetSettingsRequest; +import com.google.cloud.contactcenterinsights.v1.Settings; +import com.google.cloud.contactcenterinsights.v1.SettingsName; + +public class SyncGetSettings { + + public static void main(String[] args) throws Exception { + syncGetSettings(); + } + + public static void syncGetSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetSettingsRequest request = + GetSettingsRequest.newBuilder() + .setName(SettingsName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + Settings response = contactCenterInsightsClient.getSettings(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getsettings_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettingsSettingsname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettingsSettingsname.java new file mode 100644 index 000000000000..a9ac49ee0523 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettingsSettingsname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getsettings_settingsname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Settings; +import com.google.cloud.contactcenterinsights.v1.SettingsName; + +public class SyncGetSettingsSettingsname { + + public static void main(String[] args) throws Exception { + syncGetSettingsSettingsname(); + } + + public static void syncGetSettingsSettingsname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + SettingsName name = SettingsName.of("[PROJECT]", "[LOCATION]"); + Settings response = contactCenterInsightsClient.getSettings(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getsettings_settingsname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettingsString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettingsString.java new file mode 100644 index 000000000000..3d85c6ee5140 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getsettings/SyncGetSettingsString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getsettings_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Settings; +import com.google.cloud.contactcenterinsights.v1.SettingsName; + +public class SyncGetSettingsString { + + public static void main(String[] args) throws Exception { + syncGetSettingsString(); + } + + public static void syncGetSettingsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = SettingsName.of("[PROJECT]", "[LOCATION]").toString(); + Settings response = contactCenterInsightsClient.getSettings(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getsettings_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/AsyncGetView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/AsyncGetView.java new file mode 100644 index 000000000000..823f353eba11 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/AsyncGetView.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getview_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetViewRequest; +import com.google.cloud.contactcenterinsights.v1.View; +import com.google.cloud.contactcenterinsights.v1.ViewName; + +public class AsyncGetView { + + public static void main(String[] args) throws Exception { + asyncGetView(); + } + + public static void asyncGetView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetViewRequest request = + GetViewRequest.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .build(); + ApiFuture future = contactCenterInsightsClient.getViewCallable().futureCall(request); + // Do something. + View response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getview_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetView.java new file mode 100644 index 000000000000..7382b76b11d3 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetView.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getview_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.GetViewRequest; +import com.google.cloud.contactcenterinsights.v1.View; +import com.google.cloud.contactcenterinsights.v1.ViewName; + +public class SyncGetView { + + public static void main(String[] args) throws Exception { + syncGetView(); + } + + public static void syncGetView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + GetViewRequest request = + GetViewRequest.newBuilder() + .setName(ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString()) + .build(); + View response = contactCenterInsightsClient.getView(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getview_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetViewString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetViewString.java new file mode 100644 index 000000000000..7e4135e62beb --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetViewString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getview_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.View; +import com.google.cloud.contactcenterinsights.v1.ViewName; + +public class SyncGetViewString { + + public static void main(String[] args) throws Exception { + syncGetViewString(); + } + + public static void syncGetViewString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]").toString(); + View response = contactCenterInsightsClient.getView(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getview_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetViewViewname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetViewViewname.java new file mode 100644 index 000000000000..8cdfe476a54c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/getview/SyncGetViewViewname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_getview_viewname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.View; +import com.google.cloud.contactcenterinsights.v1.ViewName; + +public class SyncGetViewViewname { + + public static void main(String[] args) throws Exception { + syncGetViewViewname(); + } + + public static void syncGetViewViewname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ViewName name = ViewName.of("[PROJECT]", "[LOCATION]", "[VIEW]"); + View response = contactCenterInsightsClient.getView(name); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_getview_viewname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/AsyncListAnalyses.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/AsyncListAnalyses.java new file mode 100644 index 000000000000..d585a551b71b --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/AsyncListAnalyses.java @@ -0,0 +1,54 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.ListAnalysesRequest; + +public class AsyncListAnalyses { + + public static void main(String[] args) throws Exception { + asyncListAnalyses(); + } + + public static void asyncListAnalyses() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListAnalysesRequest request = + ListAnalysesRequest.newBuilder() + .setParent( + ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + contactCenterInsightsClient.listAnalysesPagedCallable().futureCall(request); + // Do something. + for (Analysis element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/AsyncListAnalysesPaged.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/AsyncListAnalysesPaged.java new file mode 100644 index 000000000000..15c5ab0f672c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/AsyncListAnalysesPaged.java @@ -0,0 +1,62 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_paged_async] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.ListAnalysesRequest; +import com.google.cloud.contactcenterinsights.v1.ListAnalysesResponse; +import com.google.common.base.Strings; + +public class AsyncListAnalysesPaged { + + public static void main(String[] args) throws Exception { + asyncListAnalysesPaged(); + } + + public static void asyncListAnalysesPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListAnalysesRequest request = + ListAnalysesRequest.newBuilder() + .setParent( + ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListAnalysesResponse response = + contactCenterInsightsClient.listAnalysesCallable().call(request); + for (Analysis element : response.getAnalysesList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_paged_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalyses.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalyses.java new file mode 100644 index 000000000000..a98b015ea852 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalyses.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; +import com.google.cloud.contactcenterinsights.v1.ListAnalysesRequest; + +public class SyncListAnalyses { + + public static void main(String[] args) throws Exception { + syncListAnalyses(); + } + + public static void syncListAnalyses() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListAnalysesRequest request = + ListAnalysesRequest.newBuilder() + .setParent( + ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (Analysis element : contactCenterInsightsClient.listAnalyses(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalysesConversationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalysesConversationname.java new file mode 100644 index 000000000000..fd5e75ef55f5 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalysesConversationname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_conversationname_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; + +public class SyncListAnalysesConversationname { + + public static void main(String[] args) throws Exception { + syncListAnalysesConversationname(); + } + + public static void syncListAnalysesConversationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ConversationName parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); + for (Analysis element : contactCenterInsightsClient.listAnalyses(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_conversationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalysesString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalysesString.java new file mode 100644 index 000000000000..a34dd93b5484 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listanalyses/SyncListAnalysesString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_string_sync] +import com.google.cloud.contactcenterinsights.v1.Analysis; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ConversationName; + +public class SyncListAnalysesString { + + public static void main(String[] args) throws Exception { + syncListAnalysesString(); + } + + public static void syncListAnalysesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = ConversationName.of("[PROJECT]", "[LOCATION]", "[CONVERSATION]").toString(); + for (Analysis element : contactCenterInsightsClient.listAnalyses(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listanalyses_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/AsyncListConversations.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/AsyncListConversations.java new file mode 100644 index 000000000000..c55a5c141fe9 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/AsyncListConversations.java @@ -0,0 +1,55 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.ConversationView; +import com.google.cloud.contactcenterinsights.v1.ListConversationsRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class AsyncListConversations { + + public static void main(String[] args) throws Exception { + asyncListConversations(); + } + + public static void asyncListConversations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListConversationsRequest request = + ListConversationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setView(ConversationView.forNumber(0)) + .build(); + ApiFuture future = + contactCenterInsightsClient.listConversationsPagedCallable().futureCall(request); + // Do something. + for (Conversation element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/AsyncListConversationsPaged.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/AsyncListConversationsPaged.java new file mode 100644 index 000000000000..690a3a58328b --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/AsyncListConversationsPaged.java @@ -0,0 +1,63 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_paged_async] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.ConversationView; +import com.google.cloud.contactcenterinsights.v1.ListConversationsRequest; +import com.google.cloud.contactcenterinsights.v1.ListConversationsResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.common.base.Strings; + +public class AsyncListConversationsPaged { + + public static void main(String[] args) throws Exception { + asyncListConversationsPaged(); + } + + public static void asyncListConversationsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListConversationsRequest request = + ListConversationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setView(ConversationView.forNumber(0)) + .build(); + while (true) { + ListConversationsResponse response = + contactCenterInsightsClient.listConversationsCallable().call(request); + for (Conversation element : response.getConversationsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_paged_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversations.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversations.java new file mode 100644 index 000000000000..6a55fcd0cd09 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversations.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.ConversationView; +import com.google.cloud.contactcenterinsights.v1.ListConversationsRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncListConversations { + + public static void main(String[] args) throws Exception { + syncListConversations(); + } + + public static void syncListConversations() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListConversationsRequest request = + ListConversationsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .setView(ConversationView.forNumber(0)) + .build(); + for (Conversation element : + contactCenterInsightsClient.listConversations(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversationsLocationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversationsLocationname.java new file mode 100644 index 000000000000..51dfa05a5647 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversationsLocationname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_locationname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncListConversationsLocationname { + + public static void main(String[] args) throws Exception { + syncListConversationsLocationname(); + } + + public static void syncListConversationsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (Conversation element : + contactCenterInsightsClient.listConversations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_locationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversationsString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversationsString.java new file mode 100644 index 000000000000..fd662f4d8f2c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listconversations/SyncListConversationsString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncListConversationsString { + + public static void main(String[] args) throws Exception { + syncListConversationsString(); + } + + public static void syncListConversationsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (Conversation element : + contactCenterInsightsClient.listConversations(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listconversations_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/AsyncListIssueModels.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/AsyncListIssueModels.java new file mode 100644 index 000000000000..2611f64dcaaa --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/AsyncListIssueModels.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listissuemodels_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest; +import com.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class AsyncListIssueModels { + + public static void main(String[] args) throws Exception { + asyncListIssueModels(); + } + + public static void asyncListIssueModels() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListIssueModelsRequest request = + ListIssueModelsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.listIssueModelsCallable().futureCall(request); + // Do something. + ListIssueModelsResponse response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listissuemodels_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModels.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModels.java new file mode 100644 index 000000000000..227d5666cd65 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModels.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listissuemodels_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest; +import com.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncListIssueModels { + + public static void main(String[] args) throws Exception { + syncListIssueModels(); + } + + public static void syncListIssueModels() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListIssueModelsRequest request = + ListIssueModelsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .build(); + ListIssueModelsResponse response = contactCenterInsightsClient.listIssueModels(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listissuemodels_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModelsLocationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModelsLocationname.java new file mode 100644 index 000000000000..786fc871abdb --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModelsLocationname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listissuemodels_locationname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncListIssueModelsLocationname { + + public static void main(String[] args) throws Exception { + syncListIssueModelsLocationname(); + } + + public static void syncListIssueModelsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + ListIssueModelsResponse response = contactCenterInsightsClient.listIssueModels(parent); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listissuemodels_locationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModelsString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModelsString.java new file mode 100644 index 000000000000..5f1448746a1e --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissuemodels/SyncListIssueModelsString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listissuemodels_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; + +public class SyncListIssueModelsString { + + public static void main(String[] args) throws Exception { + syncListIssueModelsString(); + } + + public static void syncListIssueModelsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + ListIssueModelsResponse response = contactCenterInsightsClient.listIssueModels(parent); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listissuemodels_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/AsyncListIssues.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/AsyncListIssues.java new file mode 100644 index 000000000000..94df676e8cf5 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/AsyncListIssues.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listissues_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.ListIssuesRequest; +import com.google.cloud.contactcenterinsights.v1.ListIssuesResponse; + +public class AsyncListIssues { + + public static void main(String[] args) throws Exception { + asyncListIssues(); + } + + public static void asyncListIssues() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListIssuesRequest request = + ListIssuesRequest.newBuilder() + .setParent(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.listIssuesCallable().futureCall(request); + // Do something. + ListIssuesResponse response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listissues_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssues.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssues.java new file mode 100644 index 000000000000..0e050f3bc6e1 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssues.java @@ -0,0 +1,44 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listissues_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.ListIssuesRequest; +import com.google.cloud.contactcenterinsights.v1.ListIssuesResponse; + +public class SyncListIssues { + + public static void main(String[] args) throws Exception { + syncListIssues(); + } + + public static void syncListIssues() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListIssuesRequest request = + ListIssuesRequest.newBuilder() + .setParent(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + ListIssuesResponse response = contactCenterInsightsClient.listIssues(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listissues_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssuesIssuemodelname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssuesIssuemodelname.java new file mode 100644 index 000000000000..e7ebab64db31 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssuesIssuemodelname.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listissues_issuemodelname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.ListIssuesResponse; + +public class SyncListIssuesIssuemodelname { + + public static void main(String[] args) throws Exception { + syncListIssuesIssuemodelname(); + } + + public static void syncListIssuesIssuemodelname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + IssueModelName parent = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + ListIssuesResponse response = contactCenterInsightsClient.listIssues(parent); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listissues_issuemodelname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssuesString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssuesString.java new file mode 100644 index 000000000000..aff28bcc56a5 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listissues/SyncListIssuesString.java @@ -0,0 +1,40 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listissues_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.ListIssuesResponse; + +public class SyncListIssuesString { + + public static void main(String[] args) throws Exception { + syncListIssuesString(); + } + + public static void syncListIssuesString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString(); + ListIssuesResponse response = contactCenterInsightsClient.listIssues(parent); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listissues_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/AsyncListPhraseMatchers.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/AsyncListPhraseMatchers.java new file mode 100644 index 000000000000..f177cd78068c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/AsyncListPhraseMatchers.java @@ -0,0 +1,53 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; + +public class AsyncListPhraseMatchers { + + public static void main(String[] args) throws Exception { + asyncListPhraseMatchers(); + } + + public static void asyncListPhraseMatchers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListPhraseMatchersRequest request = + ListPhraseMatchersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + ApiFuture future = + contactCenterInsightsClient.listPhraseMatchersPagedCallable().futureCall(request); + // Do something. + for (PhraseMatcher element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/AsyncListPhraseMatchersPaged.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/AsyncListPhraseMatchersPaged.java new file mode 100644 index 000000000000..295830f01d96 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/AsyncListPhraseMatchersPaged.java @@ -0,0 +1,61 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_paged_async] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest; +import com.google.cloud.contactcenterinsights.v1.ListPhraseMatchersResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.common.base.Strings; + +public class AsyncListPhraseMatchersPaged { + + public static void main(String[] args) throws Exception { + asyncListPhraseMatchersPaged(); + } + + public static void asyncListPhraseMatchersPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListPhraseMatchersRequest request = + ListPhraseMatchersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + while (true) { + ListPhraseMatchersResponse response = + contactCenterInsightsClient.listPhraseMatchersCallable().call(request); + for (PhraseMatcher element : response.getPhraseMatchersList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_paged_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchers.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchers.java new file mode 100644 index 000000000000..513fc40e6da5 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchers.java @@ -0,0 +1,50 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; + +public class SyncListPhraseMatchers { + + public static void main(String[] args) throws Exception { + syncListPhraseMatchers(); + } + + public static void syncListPhraseMatchers() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListPhraseMatchersRequest request = + ListPhraseMatchersRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .setFilter("filter-1274492040") + .build(); + for (PhraseMatcher element : + contactCenterInsightsClient.listPhraseMatchers(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchersLocationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchersLocationname.java new file mode 100644 index 000000000000..0c812f8c9141 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchersLocationname.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_locationname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; + +public class SyncListPhraseMatchersLocationname { + + public static void main(String[] args) throws Exception { + syncListPhraseMatchersLocationname(); + } + + public static void syncListPhraseMatchersLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (PhraseMatcher element : + contactCenterInsightsClient.listPhraseMatchers(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_locationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchersString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchersString.java new file mode 100644 index 000000000000..30b418ce23d1 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listphrasematchers/SyncListPhraseMatchersString.java @@ -0,0 +1,43 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; + +public class SyncListPhraseMatchersString { + + public static void main(String[] args) throws Exception { + syncListPhraseMatchersString(); + } + + public static void syncListPhraseMatchersString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (PhraseMatcher element : + contactCenterInsightsClient.listPhraseMatchers(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listphrasematchers_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/AsyncListViews.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/AsyncListViews.java new file mode 100644 index 000000000000..b942fbb622cb --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/AsyncListViews.java @@ -0,0 +1,52 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListViewsRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; + +public class AsyncListViews { + + public static void main(String[] args) throws Exception { + asyncListViews(); + } + + public static void asyncListViews() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListViewsRequest request = + ListViewsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + ApiFuture future = + contactCenterInsightsClient.listViewsPagedCallable().futureCall(request); + // Do something. + for (View element : future.get().iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/AsyncListViewsPaged.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/AsyncListViewsPaged.java new file mode 100644 index 000000000000..c93e749fcd69 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/AsyncListViewsPaged.java @@ -0,0 +1,59 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_paged_async] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListViewsRequest; +import com.google.cloud.contactcenterinsights.v1.ListViewsResponse; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; +import com.google.common.base.Strings; + +public class AsyncListViewsPaged { + + public static void main(String[] args) throws Exception { + asyncListViewsPaged(); + } + + public static void asyncListViewsPaged() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListViewsRequest request = + ListViewsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + while (true) { + ListViewsResponse response = contactCenterInsightsClient.listViewsCallable().call(request); + for (View element : response.getViewsList()) { + // doThingsWith(element); + } + String nextPageToken = response.getNextPageToken(); + if (!Strings.isNullOrEmpty(nextPageToken)) { + request = request.toBuilder().setPageToken(nextPageToken).build(); + } else { + break; + } + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_paged_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViews.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViews.java new file mode 100644 index 000000000000..2b3351bd4f8a --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViews.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.ListViewsRequest; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; + +public class SyncListViews { + + public static void main(String[] args) throws Exception { + syncListViews(); + } + + public static void syncListViews() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + ListViewsRequest request = + ListViewsRequest.newBuilder() + .setParent(LocationName.of("[PROJECT]", "[LOCATION]").toString()) + .setPageSize(883849137) + .setPageToken("pageToken873572522") + .build(); + for (View element : contactCenterInsightsClient.listViews(request).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViewsLocationname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViewsLocationname.java new file mode 100644 index 000000000000..f0909adaf160 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViewsLocationname.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_locationname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; + +public class SyncListViewsLocationname { + + public static void main(String[] args) throws Exception { + syncListViewsLocationname(); + } + + public static void syncListViewsLocationname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + LocationName parent = LocationName.of("[PROJECT]", "[LOCATION]"); + for (View element : contactCenterInsightsClient.listViews(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_locationname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViewsString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViewsString.java new file mode 100644 index 000000000000..6cf32cb8bf20 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/listviews/SyncListViewsString.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.LocationName; +import com.google.cloud.contactcenterinsights.v1.View; + +public class SyncListViewsString { + + public static void main(String[] args) throws Exception { + syncListViewsString(); + } + + public static void syncListViewsString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String parent = LocationName.of("[PROJECT]", "[LOCATION]").toString(); + for (View element : contactCenterInsightsClient.listViews(parent).iterateAll()) { + // doThingsWith(element); + } + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_listviews_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/AsyncUndeployIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/AsyncUndeployIssueModel.java new file mode 100644 index 000000000000..0ae3db002908 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/AsyncUndeployIssueModel.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest; +import com.google.longrunning.Operation; + +public class AsyncUndeployIssueModel { + + public static void main(String[] args) throws Exception { + asyncUndeployIssueModel(); + } + + public static void asyncUndeployIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UndeployIssueModelRequest request = + UndeployIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + ApiFuture future = + contactCenterInsightsClient.undeployIssueModelCallable().futureCall(request); + // Do something. + Operation response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/AsyncUndeployIssueModelLRO.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/AsyncUndeployIssueModelLRO.java new file mode 100644 index 000000000000..e94830631b17 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/AsyncUndeployIssueModelLRO.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_lro_async] +import com.google.api.gax.longrunning.OperationFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelMetadata; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelResponse; + +public class AsyncUndeployIssueModelLRO { + + public static void main(String[] args) throws Exception { + asyncUndeployIssueModelLRO(); + } + + public static void asyncUndeployIssueModelLRO() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UndeployIssueModelRequest request = + UndeployIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + OperationFuture future = + contactCenterInsightsClient.undeployIssueModelOperationCallable().futureCall(request); + // Do something. + UndeployIssueModelResponse response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_lro_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModel.java new file mode 100644 index 000000000000..538ff0536508 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModel.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelResponse; + +public class SyncUndeployIssueModel { + + public static void main(String[] args) throws Exception { + syncUndeployIssueModel(); + } + + public static void syncUndeployIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UndeployIssueModelRequest request = + UndeployIssueModelRequest.newBuilder() + .setName(IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString()) + .build(); + UndeployIssueModelResponse response = + contactCenterInsightsClient.undeployIssueModelAsync(request).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModelIssuemodelname.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModelIssuemodelname.java new file mode 100644 index 000000000000..96f76a0a450b --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModelIssuemodelname.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_issuemodelname_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelResponse; + +public class SyncUndeployIssueModelIssuemodelname { + + public static void main(String[] args) throws Exception { + syncUndeployIssueModelIssuemodelname(); + } + + public static void syncUndeployIssueModelIssuemodelname() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + IssueModelName name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]"); + UndeployIssueModelResponse response = + contactCenterInsightsClient.undeployIssueModelAsync(name).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_issuemodelname_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModelString.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModelString.java new file mode 100644 index 000000000000..e6b6ccc2ea2c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/undeployissuemodel/SyncUndeployIssueModelString.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_string_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModelName; +import com.google.cloud.contactcenterinsights.v1.UndeployIssueModelResponse; + +public class SyncUndeployIssueModelString { + + public static void main(String[] args) throws Exception { + syncUndeployIssueModelString(); + } + + public static void syncUndeployIssueModelString() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + String name = IssueModelName.of("[PROJECT]", "[LOCATION]", "[ISSUE_MODEL]").toString(); + UndeployIssueModelResponse response = + contactCenterInsightsClient.undeployIssueModelAsync(name).get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_undeployissuemodel_string_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/AsyncUpdateConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/AsyncUpdateConversation.java new file mode 100644 index 000000000000..3e58ef6da7cd --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/AsyncUpdateConversation.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateconversation_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.UpdateConversationRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateConversation { + + public static void main(String[] args) throws Exception { + asyncUpdateConversation(); + } + + public static void asyncUpdateConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateConversationRequest request = + UpdateConversationRequest.newBuilder() + .setConversation(Conversation.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + contactCenterInsightsClient.updateConversationCallable().futureCall(request); + // Do something. + Conversation response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateconversation_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/SyncUpdateConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/SyncUpdateConversation.java new file mode 100644 index 000000000000..ec264ef27c43 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/SyncUpdateConversation.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateconversation_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.cloud.contactcenterinsights.v1.UpdateConversationRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateConversation { + + public static void main(String[] args) throws Exception { + syncUpdateConversation(); + } + + public static void syncUpdateConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateConversationRequest request = + UpdateConversationRequest.newBuilder() + .setConversation(Conversation.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Conversation response = contactCenterInsightsClient.updateConversation(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateconversation_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/SyncUpdateConversationConversationFieldmask.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/SyncUpdateConversationConversationFieldmask.java new file mode 100644 index 000000000000..b6b447b3ef3c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateconversation/SyncUpdateConversationConversationFieldmask.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateconversation_conversationfieldmask_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Conversation; +import com.google.protobuf.FieldMask; + +public class SyncUpdateConversationConversationFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateConversationConversationFieldmask(); + } + + public static void syncUpdateConversationConversationFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + Conversation conversation = Conversation.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Conversation response = + contactCenterInsightsClient.updateConversation(conversation, updateMask); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateconversation_conversationfieldmask_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/AsyncUpdateIssue.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/AsyncUpdateIssue.java new file mode 100644 index 000000000000..7c094dffd5aa --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/AsyncUpdateIssue.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissue_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Issue; +import com.google.cloud.contactcenterinsights.v1.UpdateIssueRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateIssue { + + public static void main(String[] args) throws Exception { + asyncUpdateIssue(); + } + + public static void asyncUpdateIssue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateIssueRequest request = + UpdateIssueRequest.newBuilder() + .setIssue(Issue.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + contactCenterInsightsClient.updateIssueCallable().futureCall(request); + // Do something. + Issue response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissue_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/SyncUpdateIssue.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/SyncUpdateIssue.java new file mode 100644 index 000000000000..68ce20df8586 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/SyncUpdateIssue.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissue_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Issue; +import com.google.cloud.contactcenterinsights.v1.UpdateIssueRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIssue { + + public static void main(String[] args) throws Exception { + syncUpdateIssue(); + } + + public static void syncUpdateIssue() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateIssueRequest request = + UpdateIssueRequest.newBuilder() + .setIssue(Issue.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Issue response = contactCenterInsightsClient.updateIssue(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissue_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/SyncUpdateIssueIssueFieldmask.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/SyncUpdateIssueIssueFieldmask.java new file mode 100644 index 000000000000..493ca404629a --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissue/SyncUpdateIssueIssueFieldmask.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissue_issuefieldmask_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Issue; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIssueIssueFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateIssueIssueFieldmask(); + } + + public static void syncUpdateIssueIssueFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + Issue issue = Issue.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Issue response = contactCenterInsightsClient.updateIssue(issue, updateMask); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissue_issuefieldmask_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/AsyncUpdateIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/AsyncUpdateIssueModel.java new file mode 100644 index 000000000000..d9007ca18d3c --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/AsyncUpdateIssueModel.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissuemodel_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateIssueModel { + + public static void main(String[] args) throws Exception { + asyncUpdateIssueModel(); + } + + public static void asyncUpdateIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateIssueModelRequest request = + UpdateIssueModelRequest.newBuilder() + .setIssueModel(IssueModel.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + contactCenterInsightsClient.updateIssueModelCallable().futureCall(request); + // Do something. + IssueModel response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissuemodel_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/SyncUpdateIssueModel.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/SyncUpdateIssueModel.java new file mode 100644 index 000000000000..cbec3d5bf035 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/SyncUpdateIssueModel.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissuemodel_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIssueModel { + + public static void main(String[] args) throws Exception { + syncUpdateIssueModel(); + } + + public static void syncUpdateIssueModel() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateIssueModelRequest request = + UpdateIssueModelRequest.newBuilder() + .setIssueModel(IssueModel.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + IssueModel response = contactCenterInsightsClient.updateIssueModel(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissuemodel_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/SyncUpdateIssueModelIssuemodelFieldmask.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/SyncUpdateIssueModelIssuemodelFieldmask.java new file mode 100644 index 000000000000..1352fd03c67d --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateissuemodel/SyncUpdateIssueModelIssuemodelFieldmask.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissuemodel_issuemodelfieldmask_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.IssueModel; +import com.google.protobuf.FieldMask; + +public class SyncUpdateIssueModelIssuemodelFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateIssueModelIssuemodelFieldmask(); + } + + public static void syncUpdateIssueModelIssuemodelFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + IssueModel issueModel = IssueModel.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + IssueModel response = contactCenterInsightsClient.updateIssueModel(issueModel, updateMask); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateissuemodel_issuemodelfieldmask_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/AsyncUpdatePhraseMatcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/AsyncUpdatePhraseMatcher.java new file mode 100644 index 000000000000..2e85c761de9e --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/AsyncUpdatePhraseMatcher.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updatephrasematcher_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdatePhraseMatcher { + + public static void main(String[] args) throws Exception { + asyncUpdatePhraseMatcher(); + } + + public static void asyncUpdatePhraseMatcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdatePhraseMatcherRequest request = + UpdatePhraseMatcherRequest.newBuilder() + .setPhraseMatcher(PhraseMatcher.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + contactCenterInsightsClient.updatePhraseMatcherCallable().futureCall(request); + // Do something. + PhraseMatcher response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updatephrasematcher_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/SyncUpdatePhraseMatcher.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/SyncUpdatePhraseMatcher.java new file mode 100644 index 000000000000..6148c7330db3 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/SyncUpdatePhraseMatcher.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updatephrasematcher_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdatePhraseMatcher { + + public static void main(String[] args) throws Exception { + syncUpdatePhraseMatcher(); + } + + public static void syncUpdatePhraseMatcher() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdatePhraseMatcherRequest request = + UpdatePhraseMatcherRequest.newBuilder() + .setPhraseMatcher(PhraseMatcher.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + PhraseMatcher response = contactCenterInsightsClient.updatePhraseMatcher(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updatephrasematcher_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/SyncUpdatePhraseMatcherPhrasematcherFieldmask.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/SyncUpdatePhraseMatcherPhrasematcherFieldmask.java new file mode 100644 index 000000000000..e6d99ffef4a2 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatephrasematcher/SyncUpdatePhraseMatcherPhrasematcherFieldmask.java @@ -0,0 +1,42 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updatephrasematcher_phrasematcherfieldmask_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.PhraseMatcher; +import com.google.protobuf.FieldMask; + +public class SyncUpdatePhraseMatcherPhrasematcherFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdatePhraseMatcherPhrasematcherFieldmask(); + } + + public static void syncUpdatePhraseMatcherPhrasematcherFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + PhraseMatcher phraseMatcher = PhraseMatcher.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + PhraseMatcher response = + contactCenterInsightsClient.updatePhraseMatcher(phraseMatcher, updateMask); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updatephrasematcher_phrasematcherfieldmask_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/AsyncUpdateSettings.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/AsyncUpdateSettings.java new file mode 100644 index 000000000000..eaafbbf79e76 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/AsyncUpdateSettings.java @@ -0,0 +1,49 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updatesettings_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Settings; +import com.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateSettings { + + public static void main(String[] args) throws Exception { + asyncUpdateSettings(); + } + + public static void asyncUpdateSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateSettingsRequest request = + UpdateSettingsRequest.newBuilder() + .setSettings(Settings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = + contactCenterInsightsClient.updateSettingsCallable().futureCall(request); + // Do something. + Settings response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updatesettings_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/SyncUpdateSettings.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/SyncUpdateSettings.java new file mode 100644 index 000000000000..75a294c86e95 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/SyncUpdateSettings.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updatesettings_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Settings; +import com.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSettings { + + public static void main(String[] args) throws Exception { + syncUpdateSettings(); + } + + public static void syncUpdateSettings() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateSettingsRequest request = + UpdateSettingsRequest.newBuilder() + .setSettings(Settings.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + Settings response = contactCenterInsightsClient.updateSettings(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updatesettings_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/SyncUpdateSettingsSettingsFieldmask.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/SyncUpdateSettingsSettingsFieldmask.java new file mode 100644 index 000000000000..3d8a1c625264 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updatesettings/SyncUpdateSettingsSettingsFieldmask.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updatesettings_settingsfieldmask_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.Settings; +import com.google.protobuf.FieldMask; + +public class SyncUpdateSettingsSettingsFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateSettingsSettingsFieldmask(); + } + + public static void syncUpdateSettingsSettingsFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + Settings settings = Settings.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + Settings response = contactCenterInsightsClient.updateSettings(settings, updateMask); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updatesettings_settingsfieldmask_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/AsyncUpdateView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/AsyncUpdateView.java new file mode 100644 index 000000000000..70683b6ea0e2 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/AsyncUpdateView.java @@ -0,0 +1,48 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateview_async] +import com.google.api.core.ApiFuture; +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.UpdateViewRequest; +import com.google.cloud.contactcenterinsights.v1.View; +import com.google.protobuf.FieldMask; + +public class AsyncUpdateView { + + public static void main(String[] args) throws Exception { + asyncUpdateView(); + } + + public static void asyncUpdateView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateViewRequest request = + UpdateViewRequest.newBuilder() + .setView(View.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + ApiFuture future = contactCenterInsightsClient.updateViewCallable().futureCall(request); + // Do something. + View response = future.get(); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateview_async] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/SyncUpdateView.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/SyncUpdateView.java new file mode 100644 index 000000000000..5d42d717a0fc --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/SyncUpdateView.java @@ -0,0 +1,45 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateview_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.UpdateViewRequest; +import com.google.cloud.contactcenterinsights.v1.View; +import com.google.protobuf.FieldMask; + +public class SyncUpdateView { + + public static void main(String[] args) throws Exception { + syncUpdateView(); + } + + public static void syncUpdateView() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + UpdateViewRequest request = + UpdateViewRequest.newBuilder() + .setView(View.newBuilder().build()) + .setUpdateMask(FieldMask.newBuilder().build()) + .build(); + View response = contactCenterInsightsClient.updateView(request); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateview_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/SyncUpdateViewViewFieldmask.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/SyncUpdateViewViewFieldmask.java new file mode 100644 index 000000000000..8a5a8036d4a3 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightsclient/updateview/SyncUpdateViewViewFieldmask.java @@ -0,0 +1,41 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsclient_updateview_viewfieldmask_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsClient; +import com.google.cloud.contactcenterinsights.v1.View; +import com.google.protobuf.FieldMask; + +public class SyncUpdateViewViewFieldmask { + + public static void main(String[] args) throws Exception { + syncUpdateViewViewFieldmask(); + } + + public static void syncUpdateViewViewFieldmask() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + try (ContactCenterInsightsClient contactCenterInsightsClient = + ContactCenterInsightsClient.create()) { + View view = View.newBuilder().build(); + FieldMask updateMask = FieldMask.newBuilder().build(); + View response = contactCenterInsightsClient.updateView(view, updateMask); + } + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsclient_updateview_viewfieldmask_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightssettings/createconversation/SyncCreateConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightssettings/createconversation/SyncCreateConversation.java new file mode 100644 index 000000000000..ff83e77d0917 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/contactcenterinsightssettings/createconversation/SyncCreateConversation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightssettings_createconversation_sync] +import com.google.cloud.contactcenterinsights.v1.ContactCenterInsightsSettings; +import java.time.Duration; + +public class SyncCreateConversation { + + public static void main(String[] args) throws Exception { + syncCreateConversation(); + } + + public static void syncCreateConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ContactCenterInsightsSettings.Builder contactCenterInsightsSettingsBuilder = + ContactCenterInsightsSettings.newBuilder(); + contactCenterInsightsSettingsBuilder + .createConversationSettings() + .setRetrySettings( + contactCenterInsightsSettingsBuilder + .createConversationSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ContactCenterInsightsSettings contactCenterInsightsSettings = + contactCenterInsightsSettingsBuilder.build(); + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightssettings_createconversation_sync] diff --git a/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/stub/contactcenterinsightsstubsettings/createconversation/SyncCreateConversation.java b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/stub/contactcenterinsightsstubsettings/createconversation/SyncCreateConversation.java new file mode 100644 index 000000000000..2ad5bfe83bc8 --- /dev/null +++ b/java-contact-center-insights/samples/snippets/generated/com/google/cloud/contactcenterinsights/v1/stub/contactcenterinsightsstubsettings/createconversation/SyncCreateConversation.java @@ -0,0 +1,47 @@ +/* + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.google.cloud.contactcenterinsights.v1.stub.samples; + +// [START contactcenterinsights_v1_generated_contactcenterinsightsstubsettings_createconversation_sync] +import com.google.cloud.contactcenterinsights.v1.stub.ContactCenterInsightsStubSettings; +import java.time.Duration; + +public class SyncCreateConversation { + + public static void main(String[] args) throws Exception { + syncCreateConversation(); + } + + public static void syncCreateConversation() throws Exception { + // This snippet has been automatically generated for illustrative purposes only. + // It may require modifications to work in your environment. + ContactCenterInsightsStubSettings.Builder contactCenterInsightsSettingsBuilder = + ContactCenterInsightsStubSettings.newBuilder(); + contactCenterInsightsSettingsBuilder + .createConversationSettings() + .setRetrySettings( + contactCenterInsightsSettingsBuilder + .createConversationSettings() + .getRetrySettings() + .toBuilder() + .setTotalTimeout(Duration.ofSeconds(30)) + .build()); + ContactCenterInsightsStubSettings contactCenterInsightsSettings = + contactCenterInsightsSettingsBuilder.build(); + } +} +// [END contactcenterinsights_v1_generated_contactcenterinsightsstubsettings_createconversation_sync]