private CustomerServiceSettings(CustomerServiceSettings existing) : base(existing) { gax::GaxPreconditions.CheckNotNull(existing, nameof(existing)); GetCustomerSettings = existing.GetCustomerSettings; MutateCustomerSettings = existing.MutateCustomerSettings; ListAccessibleCustomersSettings = existing.ListAccessibleCustomersSettings; CreateCustomerClientSettings = existing.CreateCustomerClientSettings; OnCopy(existing); }
/// <summary> /// Constructs a client wrapper for the CustomerService service, with the specified gRPC client and settings. /// </summary> /// <param name="grpcClient">The underlying gRPC client.</param> /// <param name="settings">The base <see cref="CustomerServiceSettings"/> used within this client.</param> public CustomerServiceClientImpl(CustomerService.CustomerServiceClient grpcClient, CustomerServiceSettings settings) { GrpcClient = grpcClient; CustomerServiceSettings effectiveSettings = settings ?? CustomerServiceSettings.GetDefault(); gaxgrpc::ClientHelper clientHelper = new gaxgrpc::ClientHelper(effectiveSettings); _callGetCustomer = clientHelper.BuildApiCall <GetCustomerRequest, gagvr::Customer>(grpcClient.GetCustomerAsync, grpcClient.GetCustomer, effectiveSettings.GetCustomerSettings).WithGoogleRequestParam("resource_name", request => request.ResourceName); Modify_ApiCall(ref _callGetCustomer); Modify_GetCustomerApiCall(ref _callGetCustomer); _callMutateCustomer = clientHelper.BuildApiCall <MutateCustomerRequest, MutateCustomerResponse>(grpcClient.MutateCustomerAsync, grpcClient.MutateCustomer, effectiveSettings.MutateCustomerSettings).WithGoogleRequestParam("customer_id", request => request.CustomerId); Modify_ApiCall(ref _callMutateCustomer); Modify_MutateCustomerApiCall(ref _callMutateCustomer); _callListAccessibleCustomers = clientHelper.BuildApiCall <ListAccessibleCustomersRequest, ListAccessibleCustomersResponse>(grpcClient.ListAccessibleCustomersAsync, grpcClient.ListAccessibleCustomers, effectiveSettings.ListAccessibleCustomersSettings); Modify_ApiCall(ref _callListAccessibleCustomers); Modify_ListAccessibleCustomersApiCall(ref _callListAccessibleCustomers); _callCreateCustomerClient = clientHelper.BuildApiCall <CreateCustomerClientRequest, CreateCustomerClientResponse>(grpcClient.CreateCustomerClientAsync, grpcClient.CreateCustomerClient, effectiveSettings.CreateCustomerClientSettings).WithGoogleRequestParam("customer_id", request => request.CustomerId); Modify_ApiCall(ref _callCreateCustomerClient); Modify_CreateCustomerClientApiCall(ref _callCreateCustomerClient); OnConstruction(grpcClient, effectiveSettings, clientHelper); }
partial void OnConstruction(CustomerService.CustomerServiceClient grpcClient, CustomerServiceSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);
partial void OnCopy(CustomerServiceSettings existing);
/// <summary> /// Creates a <see cref="CustomerServiceClient"/> 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="CustomerServiceSettings"/>.</param> /// <returns>The created <see cref="CustomerServiceClient"/>.</returns> internal static CustomerServiceClient Create(grpccore::CallInvoker callInvoker, CustomerServiceSettings settings = null) { gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker)); grpcinter::Interceptor interceptor = settings?.Interceptor; if (interceptor != null) { callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor); } CustomerService.CustomerServiceClient grpcClient = new CustomerService.CustomerServiceClient(callInvoker); return(new CustomerServiceClientImpl(grpcClient, settings)); }