Exemple #1
0
        /// <summary>
        /// Creates a <see cref="RecommendationServiceClient"/> 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="RecommendationServiceSettings"/>.</param>
        /// <returns>The created <see cref="RecommendationServiceClient"/>.</returns>
        internal static RecommendationServiceClient Create(grpccore::CallInvoker callInvoker, RecommendationServiceSettings settings = null)
        {
            gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker));
            grpcinter::Interceptor interceptor = settings?.Interceptor;

            if (interceptor != null)
            {
                callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor);
            }
            RecommendationService.RecommendationServiceClient grpcClient = new RecommendationService.RecommendationServiceClient(callInvoker);
            return(new RecommendationServiceClientImpl(grpcClient, settings));
        }
Exemple #2
0
        /// <summary>
        /// Constructs a client wrapper for the RecommendationService service, with the specified gRPC client and
        /// settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="RecommendationServiceSettings"/> used within this client.</param>
        public RecommendationServiceClientImpl(RecommendationService.RecommendationServiceClient grpcClient, RecommendationServiceSettings settings)
        {
            GrpcClient = grpcClient;
            RecommendationServiceSettings effectiveSettings = settings ?? RecommendationServiceSettings.GetDefault();
            gaxgrpc::ClientHelper         clientHelper      = new gaxgrpc::ClientHelper(effectiveSettings);

            _callGetRecommendation = clientHelper.BuildApiCall <GetRecommendationRequest, gagvr::Recommendation>(grpcClient.GetRecommendationAsync, grpcClient.GetRecommendation, effectiveSettings.GetRecommendationSettings).WithGoogleRequestParam("resource_name", request => request.ResourceName);
            Modify_ApiCall(ref _callGetRecommendation);
            Modify_GetRecommendationApiCall(ref _callGetRecommendation);
            _callApplyRecommendation = clientHelper.BuildApiCall <ApplyRecommendationRequest, ApplyRecommendationResponse>(grpcClient.ApplyRecommendationAsync, grpcClient.ApplyRecommendation, effectiveSettings.ApplyRecommendationSettings).WithGoogleRequestParam("customer_id", request => request.CustomerId);
            Modify_ApiCall(ref _callApplyRecommendation);
            Modify_ApplyRecommendationApiCall(ref _callApplyRecommendation);
            _callDismissRecommendation = clientHelper.BuildApiCall <DismissRecommendationRequest, DismissRecommendationResponse>(grpcClient.DismissRecommendationAsync, grpcClient.DismissRecommendation, effectiveSettings.DismissRecommendationSettings).WithGoogleRequestParam("customer_id", request => request.CustomerId);
            Modify_ApiCall(ref _callDismissRecommendation);
            Modify_DismissRecommendationApiCall(ref _callDismissRecommendation);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
Exemple #3
0
 partial void OnConstruction(RecommendationService.RecommendationServiceClient grpcClient, RecommendationServiceSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);