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

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

            _callCreateBudget = clientHelper.BuildApiCall <CreateBudgetRequest, Budget>(grpcClient.CreateBudgetAsync, grpcClient.CreateBudget, effectiveSettings.CreateBudgetSettings).WithGoogleRequestParam("parent", request => request.Parent);
            Modify_ApiCall(ref _callCreateBudget);
            Modify_CreateBudgetApiCall(ref _callCreateBudget);
            _callUpdateBudget = clientHelper.BuildApiCall <UpdateBudgetRequest, Budget>(grpcClient.UpdateBudgetAsync, grpcClient.UpdateBudget, effectiveSettings.UpdateBudgetSettings).WithGoogleRequestParam("budget.name", request => request.Budget?.Name);
            Modify_ApiCall(ref _callUpdateBudget);
            Modify_UpdateBudgetApiCall(ref _callUpdateBudget);
            _callGetBudget = clientHelper.BuildApiCall <GetBudgetRequest, Budget>(grpcClient.GetBudgetAsync, grpcClient.GetBudget, effectiveSettings.GetBudgetSettings).WithGoogleRequestParam("name", request => request.Name);
            Modify_ApiCall(ref _callGetBudget);
            Modify_GetBudgetApiCall(ref _callGetBudget);
            _callListBudgets = clientHelper.BuildApiCall <ListBudgetsRequest, ListBudgetsResponse>(grpcClient.ListBudgetsAsync, grpcClient.ListBudgets, effectiveSettings.ListBudgetsSettings).WithGoogleRequestParam("parent", request => request.Parent);
            Modify_ApiCall(ref _callListBudgets);
            Modify_ListBudgetsApiCall(ref _callListBudgets);
            _callDeleteBudget = clientHelper.BuildApiCall <DeleteBudgetRequest, wkt::Empty>(grpcClient.DeleteBudgetAsync, grpcClient.DeleteBudget, effectiveSettings.DeleteBudgetSettings).WithGoogleRequestParam("name", request => request.Name);
            Modify_ApiCall(ref _callDeleteBudget);
            Modify_DeleteBudgetApiCall(ref _callDeleteBudget);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
Exemple #3
0
 partial void OnConstruction(BudgetService.BudgetServiceClient grpcClient, BudgetServiceSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);