/// <summary>Snippet for CreateAnalysisAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task CreateAnalysisRequestObjectAsync() { // Create client ContactCenterInsightsClient contactCenterInsightsClient = await ContactCenterInsightsClient.CreateAsync(); // Initialize request argument(s) CreateAnalysisRequest request = new CreateAnalysisRequest { ParentAsConversationName = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"), Analysis = new Analysis(), }; // Make the request Operation <Analysis, CreateAnalysisOperationMetadata> response = await contactCenterInsightsClient.CreateAnalysisAsync(request); // Poll until the returned long-running operation is complete Operation <Analysis, CreateAnalysisOperationMetadata> completedResponse = await response.PollUntilCompletedAsync(); // Retrieve the operation result Analysis result = completedResponse.Result; // Or get the name of the operation string operationName = response.Name; // This name can be stored, then the long-running operation retrieved later by name Operation <Analysis, CreateAnalysisOperationMetadata> retrievedResponse = await contactCenterInsightsClient.PollOnceCreateAnalysisAsync(operationName); // Check if the retrieved long-running operation has completed if (retrievedResponse.IsCompleted) { // If it has completed, then access the result Analysis retrievedResult = retrievedResponse.Result; } }
public async stt::Task CreateConversationRequestObjectAsync() { moq::Mock <Conversations.ConversationsClient> mockGrpcClient = new moq::Mock <Conversations.ConversationsClient>(moq::MockBehavior.Strict); CreateConversationRequest request = new CreateConversationRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Conversation = new Conversation(), ConversationId = "conversation_id32c22ad5", }; Conversation expectedResponse = new Conversation { ConversationName = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"), LifecycleState = Conversation.Types.LifecycleState.Unspecified, ConversationProfileAsConversationProfileName = ConversationProfileName.FromProjectConversationProfile("[PROJECT]", "[CONVERSATION_PROFILE]"), PhoneNumber = new ConversationPhoneNumber(), StartTime = new wkt::Timestamp(), EndTime = new wkt::Timestamp(), ConversationStage = Conversation.Types.ConversationStage.HumanAssistStage, }; mockGrpcClient.Setup(x => x.CreateConversationAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <Conversation>(stt::Task.FromResult(expectedResponse), null, null, null, null)); ConversationsClient client = new ConversationsClientImpl(mockGrpcClient.Object, null); Conversation responseCallSettings = await client.CreateConversationAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); Conversation responseCancellationToken = await client.CreateConversationAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
public void CreateConversation() { moq::Mock <Conversations.ConversationsClient> mockGrpcClient = new moq::Mock <Conversations.ConversationsClient>(moq::MockBehavior.Strict); CreateConversationRequest request = new CreateConversationRequest { ParentAsProjectName = gagr::ProjectName.FromProject("[PROJECT]"), Conversation = new Conversation(), }; Conversation expectedResponse = new Conversation { ConversationName = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"), LifecycleState = Conversation.Types.LifecycleState.Unspecified, ConversationProfileAsConversationProfileName = ConversationProfileName.FromProjectConversationProfile("[PROJECT]", "[CONVERSATION_PROFILE]"), PhoneNumber = new ConversationPhoneNumber(), StartTime = new wkt::Timestamp(), EndTime = new wkt::Timestamp(), ConversationStage = Conversation.Types.ConversationStage.HumanAssistStage, }; mockGrpcClient.Setup(x => x.CreateConversation(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); ConversationsClient client = new ConversationsClientImpl(mockGrpcClient.Object, null); Conversation response = client.CreateConversation(request.Parent, request.Conversation); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for GetConversation</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetConversationResourceNames() { // Create client ContactCenterInsightsClient contactCenterInsightsClient = ContactCenterInsightsClient.Create(); // Initialize request argument(s) ConversationName name = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); // Make the request Conversation response = contactCenterInsightsClient.GetConversation(name); }
/// <summary>Snippet for DeleteConversationAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task DeleteConversationResourceNamesAsync() { // Create client ContactCenterInsightsClient contactCenterInsightsClient = await ContactCenterInsightsClient.CreateAsync(); // Initialize request argument(s) ConversationName name = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); // Make the request await contactCenterInsightsClient.DeleteConversationAsync(name); }
/// <summary>Snippet for CompleteConversation</summary> public void CompleteConversationResourceNames() { // Snippet: CompleteConversation(ConversationName, CallSettings) // Create client ConversationsClient conversationsClient = ConversationsClient.Create(); // Initialize request argument(s) ConversationName name = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"); // Make the request Conversation response = conversationsClient.CompleteConversation(name); // End snippet }
/// <summary>Snippet for CreateParticipant</summary> public void CreateParticipantResourceNames() { // Snippet: CreateParticipant(ConversationName, Participant, CallSettings) // Create client ParticipantsClient participantsClient = ParticipantsClient.Create(); // Initialize request argument(s) ConversationName parent = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"); Participant participant = new Participant(); // Make the request Participant response = participantsClient.CreateParticipant(parent, participant); // End snippet }
/// <summary>Snippet for GetConversation</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public void GetConversationRequestObject() { // Create client ContactCenterInsightsClient contactCenterInsightsClient = ContactCenterInsightsClient.Create(); // Initialize request argument(s) GetConversationRequest request = new GetConversationRequest { ConversationName = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"), View = ConversationView.Unspecified, }; // Make the request Conversation response = contactCenterInsightsClient.GetConversation(request); }
/// <summary>Snippet for DeleteConversationAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task DeleteConversationRequestObjectAsync() { // Create client ContactCenterInsightsClient contactCenterInsightsClient = await ContactCenterInsightsClient.CreateAsync(); // Initialize request argument(s) DeleteConversationRequest request = new DeleteConversationRequest { ConversationName = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"), Force = false, }; // Make the request await contactCenterInsightsClient.DeleteConversationAsync(request); }
/// <summary>Snippet for CompleteConversationAsync</summary> public async Task CompleteConversationResourceNamesAsync() { // Snippet: CompleteConversationAsync(ConversationName, CallSettings) // Additional: CompleteConversationAsync(ConversationName, CancellationToken) // Create client ConversationsClient conversationsClient = await ConversationsClient.CreateAsync(); // Initialize request argument(s) ConversationName name = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"); // Make the request Conversation response = await conversationsClient.CompleteConversationAsync(name); // End snippet }
/// <summary>Snippet for GetConversation</summary> public void GetConversationRequestObject() { // Snippet: GetConversation(GetConversationRequest, CallSettings) // Create client ConversationsClient conversationsClient = ConversationsClient.Create(); // Initialize request argument(s) GetConversationRequest request = new GetConversationRequest { ConversationName = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"), }; // Make the request Conversation response = conversationsClient.GetConversation(request); // End snippet }
/// <summary>Snippet for ListMessagesAsync</summary> public async Task ListMessagesRequestObjectAsync() { // Snippet: ListMessagesAsync(ListMessagesRequest, CallSettings) // Create client ConversationsClient conversationsClient = await ConversationsClient.CreateAsync(); // Initialize request argument(s) ListMessagesRequest request = new ListMessagesRequest { ParentAsConversationName = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"), Filter = "", }; // Make the request PagedAsyncEnumerable <ListMessagesResponse, Message> response = conversationsClient.ListMessagesAsync(request); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Message item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListMessagesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Message item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Message> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Message item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for CreateParticipant</summary> public void CreateParticipantRequestObject() { // Snippet: CreateParticipant(CreateParticipantRequest, CallSettings) // Create client ParticipantsClient participantsClient = ParticipantsClient.Create(); // Initialize request argument(s) CreateParticipantRequest request = new CreateParticipantRequest { ParentAsConversationName = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"), Participant = new Participant(), }; // Make the request Participant response = participantsClient.CreateParticipant(request); // End snippet }
/// <summary>Snippet for CreateParticipantAsync</summary> public async Task CreateParticipantResourceNamesAsync() { // Snippet: CreateParticipantAsync(ConversationName, Participant, CallSettings) // Additional: CreateParticipantAsync(ConversationName, Participant, CancellationToken) // Create client ParticipantsClient participantsClient = await ParticipantsClient.CreateAsync(); // Initialize request argument(s) ConversationName parent = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"); Participant participant = new Participant(); // Make the request Participant response = await participantsClient.CreateParticipantAsync(parent, participant); // End snippet }
/// <summary>Snippet for ListParticipants</summary> public void ListParticipantsRequestObject() { // Snippet: ListParticipants(ListParticipantsRequest, CallSettings) // Create client ParticipantsClient participantsClient = ParticipantsClient.Create(); // Initialize request argument(s) ListParticipantsRequest request = new ListParticipantsRequest { ParentAsConversationName = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"), }; // Make the request PagedEnumerable <ListParticipantsResponse, Participant> response = participantsClient.ListParticipants(request); // Iterate over all response items, lazily performing RPCs as required foreach (Participant item in response) { // Do something with each item Console.WriteLine(item); } // Or iterate over pages (of server-defined size), performing one RPC per page foreach (ListParticipantsResponse page in response.AsRawResponses()) { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Participant item in page) { // Do something with each item Console.WriteLine(item); } } // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Participant> singlePage = response.ReadPage(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Participant item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; // End snippet }
/// <summary>Snippet for GetConversationAsync</summary> public async Task GetConversationRequestObjectAsync() { // Snippet: GetConversationAsync(GetConversationRequest, CallSettings) // Additional: GetConversationAsync(GetConversationRequest, CancellationToken) // Create client ConversationsClient conversationsClient = await ConversationsClient.CreateAsync(); // Initialize request argument(s) GetConversationRequest request = new GetConversationRequest { ConversationName = ConversationName.FromProjectConversation("[PROJECT]", "[CONVERSATION]"), }; // Make the request Conversation response = await conversationsClient.GetConversationAsync(request); // End snippet }
/// <summary>Snippet for ListAnalysesAsync</summary> /// <remarks> /// This snippet has been automatically generated for illustrative purposes only. /// It may require modifications to work in your environment. /// </remarks> public async Task ListAnalysesResourceNamesAsync() { // Create client ContactCenterInsightsClient contactCenterInsightsClient = await ContactCenterInsightsClient.CreateAsync(); // Initialize request argument(s) ConversationName parent = ConversationName.FromProjectLocationConversation("[PROJECT]", "[LOCATION]", "[CONVERSATION]"); // Make the request PagedAsyncEnumerable <ListAnalysesResponse, Analysis> response = contactCenterInsightsClient.ListAnalysesAsync(parent); // Iterate over all response items, lazily performing RPCs as required await response.ForEachAsync((Analysis item) => { // Do something with each item Console.WriteLine(item); }); // Or iterate over pages (of server-defined size), performing one RPC per page await response.AsRawResponses().ForEachAsync((ListAnalysesResponse page) => { // Do something with each page of items Console.WriteLine("A page of results:"); foreach (Analysis item in page) { // Do something with each item Console.WriteLine(item); } }); // Or retrieve a single page of known size (unless it's the final page), performing as many RPCs as required int pageSize = 10; Page <Analysis> singlePage = await response.ReadPageAsync(pageSize); // Do something with the page of items Console.WriteLine($"A page of {pageSize} results (unless it's the final page):"); foreach (Analysis item in singlePage) { // Do something with each item Console.WriteLine(item); } // Store the pageToken, for when the next page is required. string nextPageToken = singlePage.NextPageToken; }
/// <summary> /// This starts the selected talking event. It also copies the talking events into the currently playing events and resets the main control vairable. /// /// Alex Reiss /// </summary> /// <param name="numberOfEvent">This is the index of the selected event.</param> public void StartTalkingEventChain(ConversationName conversationID) { if (conversationID == ConversationName.None) return; currentTalkingEventChain.Clear(); currentTalkingEvent = 0; //I have both the shallow copy and deep copy, because I am not sure which one I need. currentTalkingEventChain = talkingEventChainDictionary [conversationID].talkingEvents; // for (int index = 0; index < talkingEventChain[numberOfEvent].talkingEvents.Count; index++) // { // currentTalkingEventChain[index].name = talkingEventChain[numberOfEvent].talkingEvents[index].name; // currentTalkingEventChain[index].annoyText = talkingEventChain[numberOfEvent].talkingEvents[index].annoyText; // currentTalkingEventChain[index].normalText = talkingEventChain[numberOfEvent].talkingEvents[index].normalText; // currentTalkingEventChain[index].selectedPanel = talkingEventChain[numberOfEvent].talkingEvents[index].selectedPanel; // currentTalkingEventChain[index].theTalker = talkingEventChain[numberOfEvent].talkingEvents[index].theTalker; // } }