public void MatchIntentRequestObject() { moq::Mock <Sessions.SessionsClient> mockGrpcClient = new moq::Mock <Sessions.SessionsClient>(moq::MockBehavior.Strict); MatchIntentRequest request = new MatchIntentRequest { SessionAsSessionName = SessionName.FromProjectLocationAgentSession("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"), QueryParams = new QueryParameters(), QueryInput = new QueryInput(), }; MatchIntentResponse expectedResponse = new MatchIntentResponse { Text = "textec51b21c", TriggerIntentAsIntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), Transcript = "transcript20c5b28b", Matches = { new Match(), }, CurrentPage = new Page(), TriggerEvent = "trigger_eventff063b42", }; mockGrpcClient.Setup(x => x.MatchIntent(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(expectedResponse); SessionsClient client = new SessionsClientImpl(mockGrpcClient.Object, null); MatchIntentResponse response = client.MatchIntent(request); xunit::Assert.Same(expectedResponse, response); mockGrpcClient.VerifyAll(); }
public async stt::Task MatchIntentRequestObjectAsync() { moq::Mock <Sessions.SessionsClient> mockGrpcClient = new moq::Mock <Sessions.SessionsClient>(moq::MockBehavior.Strict); MatchIntentRequest request = new MatchIntentRequest { SessionAsSessionName = SessionName.FromProjectLocationAgentSession("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"), QueryParams = new QueryParameters(), QueryInput = new QueryInput(), }; MatchIntentResponse expectedResponse = new MatchIntentResponse { Text = "textec51b21c", TriggerIntentAsIntentName = IntentName.FromProjectLocationAgentIntent("[PROJECT]", "[LOCATION]", "[AGENT]", "[INTENT]"), Transcript = "transcript20c5b28b", Matches = { new Match(), }, CurrentPage = new Page(), TriggerEvent = "trigger_eventff063b42", }; mockGrpcClient.Setup(x => x.MatchIntentAsync(request, moq::It.IsAny <grpccore::CallOptions>())).Returns(new grpccore::AsyncUnaryCall <MatchIntentResponse>(stt::Task.FromResult(expectedResponse), null, null, null, null)); SessionsClient client = new SessionsClientImpl(mockGrpcClient.Object, null); MatchIntentResponse responseCallSettings = await client.MatchIntentAsync(request, gaxgrpc::CallSettings.FromCancellationToken(st::CancellationToken.None)); xunit::Assert.Same(expectedResponse, responseCallSettings); MatchIntentResponse responseCancellationToken = await client.MatchIntentAsync(request, st::CancellationToken.None); xunit::Assert.Same(expectedResponse, responseCancellationToken); mockGrpcClient.VerifyAll(); }
/// <summary>Snippet for MatchIntent</summary> public void MatchIntentRequestObject() { // Snippet: MatchIntent(MatchIntentRequest, CallSettings) // Create client SessionsClient sessionsClient = SessionsClient.Create(); // Initialize request argument(s) MatchIntentRequest request = new MatchIntentRequest { SessionAsSessionName = SessionName.FromProjectLocationAgentSession("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"), QueryParams = new QueryParameters(), QueryInput = new QueryInput(), }; // Make the request MatchIntentResponse response = sessionsClient.MatchIntent(request); // End snippet }
/// <summary>Snippet for MatchIntentAsync</summary> public async Task MatchIntentRequestObjectAsync() { // Snippet: MatchIntentAsync(MatchIntentRequest, CallSettings) // Additional: MatchIntentAsync(MatchIntentRequest, CancellationToken) // Create client SessionsClient sessionsClient = await SessionsClient.CreateAsync(); // Initialize request argument(s) MatchIntentRequest request = new MatchIntentRequest { SessionAsSessionName = SessionName.FromProjectLocationAgentSession("[PROJECT]", "[LOCATION]", "[AGENT]", "[SESSION]"), QueryParams = new QueryParameters(), QueryInput = new QueryInput(), }; // Make the request MatchIntentResponse response = await sessionsClient.MatchIntentAsync(request); // End snippet }
/// <summary> /// Returns preliminary intent match results, doesn't change the session /// status. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public override stt::Task <MatchIntentResponse> MatchIntentAsync(MatchIntentRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_MatchIntentRequest(ref request, ref callSettings); return(_callMatchIntent.Async(request, callSettings)); }
/// <summary> /// Returns preliminary intent match results, doesn't change the session /// status. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public override MatchIntentResponse MatchIntent(MatchIntentRequest request, gaxgrpc::CallSettings callSettings = null) { Modify_MatchIntentRequest(ref request, ref callSettings); return(_callMatchIntent.Sync(request, callSettings)); }
partial void Modify_MatchIntentRequest(ref MatchIntentRequest request, ref gaxgrpc::CallSettings settings);
/// <summary> /// Returns preliminary intent match results, doesn't change the session /// status. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="cancellationToken">A <see cref="st::CancellationToken"/> to use for this RPC.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <MatchIntentResponse> MatchIntentAsync(MatchIntentRequest request, st::CancellationToken cancellationToken) => MatchIntentAsync(request, gaxgrpc::CallSettings.FromCancellationToken(cancellationToken));
/// <summary> /// Returns preliminary intent match results, doesn't change the session /// status. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>A Task containing the RPC response.</returns> public virtual stt::Task <MatchIntentResponse> MatchIntentAsync(MatchIntentRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();
/// <summary> /// Returns preliminary intent match results, doesn't change the session /// status. /// </summary> /// <param name="request">The request object containing all of the parameters for the API call.</param> /// <param name="callSettings">If not null, applies overrides to this RPC call.</param> /// <returns>The RPC response.</returns> public virtual MatchIntentResponse MatchIntent(MatchIntentRequest request, gaxgrpc::CallSettings callSettings = null) => throw new sys::NotImplementedException();