Exemple #1
0
        /// <summary>
        /// Constructs a client wrapper for the Contexts service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="ContextsSettings"/> used within this client.</param>
        public ContextsClientImpl(Contexts.ContextsClient grpcClient, ContextsSettings settings)
        {
            GrpcClient = grpcClient;
            ContextsSettings      effectiveSettings = settings ?? ContextsSettings.GetDefault();
            gaxgrpc::ClientHelper clientHelper      = new gaxgrpc::ClientHelper(effectiveSettings);

            _callListContexts = clientHelper.BuildApiCall <ListContextsRequest, ListContextsResponse>(grpcClient.ListContextsAsync, grpcClient.ListContexts, effectiveSettings.ListContextsSettings).WithGoogleRequestParam("parent", request => request.Parent);
            Modify_ApiCall(ref _callListContexts);
            Modify_ListContextsApiCall(ref _callListContexts);
            _callGetContext = clientHelper.BuildApiCall <GetContextRequest, Context>(grpcClient.GetContextAsync, grpcClient.GetContext, effectiveSettings.GetContextSettings).WithGoogleRequestParam("name", request => request.Name);
            Modify_ApiCall(ref _callGetContext);
            Modify_GetContextApiCall(ref _callGetContext);
            _callCreateContext = clientHelper.BuildApiCall <CreateContextRequest, Context>(grpcClient.CreateContextAsync, grpcClient.CreateContext, effectiveSettings.CreateContextSettings).WithGoogleRequestParam("parent", request => request.Parent);
            Modify_ApiCall(ref _callCreateContext);
            Modify_CreateContextApiCall(ref _callCreateContext);
            _callUpdateContext = clientHelper.BuildApiCall <UpdateContextRequest, Context>(grpcClient.UpdateContextAsync, grpcClient.UpdateContext, effectiveSettings.UpdateContextSettings).WithGoogleRequestParam("context.name", request => request.Context?.Name);
            Modify_ApiCall(ref _callUpdateContext);
            Modify_UpdateContextApiCall(ref _callUpdateContext);
            _callDeleteContext = clientHelper.BuildApiCall <DeleteContextRequest, wkt::Empty>(grpcClient.DeleteContextAsync, grpcClient.DeleteContext, effectiveSettings.DeleteContextSettings).WithGoogleRequestParam("name", request => request.Name);
            Modify_ApiCall(ref _callDeleteContext);
            Modify_DeleteContextApiCall(ref _callDeleteContext);
            _callDeleteAllContexts = clientHelper.BuildApiCall <DeleteAllContextsRequest, wkt::Empty>(grpcClient.DeleteAllContextsAsync, grpcClient.DeleteAllContexts, effectiveSettings.DeleteAllContextsSettings).WithGoogleRequestParam("parent", request => request.Parent);
            Modify_ApiCall(ref _callDeleteAllContexts);
            Modify_DeleteAllContextsApiCall(ref _callDeleteAllContexts);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
Exemple #2
0
 private ContextsSettings(ContextsSettings existing) : base(existing)
 {
     gax::GaxPreconditions.CheckNotNull(existing, nameof(existing));
     ListContextsSettings      = existing.ListContextsSettings;
     GetContextSettings        = existing.GetContextSettings;
     CreateContextSettings     = existing.CreateContextSettings;
     UpdateContextSettings     = existing.UpdateContextSettings;
     DeleteContextSettings     = existing.DeleteContextSettings;
     DeleteAllContextsSettings = existing.DeleteAllContextsSettings;
     OnCopy(existing);
 }
Exemple #3
0
        /// <summary>
        /// Creates a <see cref="ContextsClient"/> 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="ContextsSettings"/>.</param>
        /// <returns>The created <see cref="ContextsClient"/>.</returns>
        internal static ContextsClient Create(grpccore::CallInvoker callInvoker, ContextsSettings settings = null)
        {
            gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker));
            grpcinter::Interceptor interceptor = settings?.Interceptor;

            if (interceptor != null)
            {
                callInvoker = grpcinter::CallInvokerExtensions.Intercept(callInvoker, interceptor);
            }
            Contexts.ContextsClient grpcClient = new Contexts.ContextsClient(callInvoker);
            return(new ContextsClientImpl(grpcClient, settings));
        }
Exemple #4
0
 partial void OnCopy(ContextsSettings existing);
Exemple #5
0
 partial void OnConstruction(Contexts.ContextsClient grpcClient, ContextsSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);