/// <summary> /// Constructs a client wrapper for the Testing service, with the specified gRPC client and settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="TestingSettings"/> used within this client.</param> /// <param name="logger">Optional <see cref="mel::ILogger"/> to use within this client.</param> public TestingClientImpl(Testing.TestingClient grpcClient, TestingSettings settings, mel::ILogger logger) { GrpcClient = grpcClient; TestingSettings effectiveSettings = settings ?? TestingSettings.GetDefault(); gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings, logger); _callCreateSession = clientHelper.BuildApiCall <CreateSessionRequest, Session>("CreateSession", grpcClient.CreateSessionAsync, grpcClient.CreateSession, effectiveSettings.CreateSessionSettings); Modify_ApiCall(ref _callCreateSession); Modify_CreateSessionApiCall(ref _callCreateSession); _callGetSession = clientHelper.BuildApiCall <GetSessionRequest, Session>("GetSession", grpcClient.GetSessionAsync, grpcClient.GetSession, effectiveSettings.GetSessionSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callGetSession); Modify_GetSessionApiCall(ref _callGetSession); _callListSessions = clientHelper.BuildApiCall <ListSessionsRequest, ListSessionsResponse>("ListSessions", grpcClient.ListSessionsAsync, grpcClient.ListSessions, effectiveSettings.ListSessionsSettings); Modify_ApiCall(ref _callListSessions); Modify_ListSessionsApiCall(ref _callListSessions); _callDeleteSession = clientHelper.BuildApiCall <DeleteSessionRequest, wkt::Empty>("DeleteSession", grpcClient.DeleteSessionAsync, grpcClient.DeleteSession, effectiveSettings.DeleteSessionSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callDeleteSession); Modify_DeleteSessionApiCall(ref _callDeleteSession); _callReportSession = clientHelper.BuildApiCall <ReportSessionRequest, ReportSessionResponse>("ReportSession", grpcClient.ReportSessionAsync, grpcClient.ReportSession, effectiveSettings.ReportSessionSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callReportSession); Modify_ReportSessionApiCall(ref _callReportSession); _callListTests = clientHelper.BuildApiCall <ListTestsRequest, ListTestsResponse>("ListTests", grpcClient.ListTestsAsync, grpcClient.ListTests, effectiveSettings.ListTestsSettings).WithGoogleRequestParam("parent", request => request.Parent); Modify_ApiCall(ref _callListTests); Modify_ListTestsApiCall(ref _callListTests); _callDeleteTest = clientHelper.BuildApiCall <DeleteTestRequest, wkt::Empty>("DeleteTest", grpcClient.DeleteTestAsync, grpcClient.DeleteTest, effectiveSettings.DeleteTestSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callDeleteTest); Modify_DeleteTestApiCall(ref _callDeleteTest); _callVerifyTest = clientHelper.BuildApiCall <VerifyTestRequest, VerifyTestResponse>("VerifyTest", grpcClient.VerifyTestAsync, grpcClient.VerifyTest, effectiveSettings.VerifyTestSettings).WithGoogleRequestParam("name", request => request.Name); Modify_ApiCall(ref _callVerifyTest); Modify_VerifyTestApiCall(ref _callVerifyTest); OnConstruction(grpcClient, effectiveSettings, clientHelper); }
/// <summary> /// Creates a <see cref="TestingClient"/> which uses the specified call invoker for remote operations. /// </summary> /// <param name="callInvoker"> /// The <see cref="grpccore::CallInvoker"/> for remote operations. Must not be null. /// </param> /// <param name="settings">Optional <see cref="TestingSettings"/>.</param> /// <param name="logger">Optional <see cref="mel::ILogger"/>.</param> /// <returns>The created <see cref="TestingClient"/>.</returns> internal static TestingClient Create(grpccore::CallInvoker callInvoker, TestingSettings settings = null, mel::ILogger logger = null) { gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); grpcinter::Interceptor interceptor = settings?.Interceptor; if (interceptor != null) { callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor); } Testing.TestingClient grpcClient = new Testing.TestingClient(callInvoker); return(new TestingClientImpl(grpcClient, settings, logger)); }
partial void OnConstruction(Testing.TestingClient grpcClient, TestingSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);