コード例 #1
0
 private ImageAnnotatorSettings(ImageAnnotatorSettings existing) : base(existing)
 {
     GaxPreconditions.CheckNotNull(existing, nameof(existing));
     BatchAnnotateImagesSettings               = existing.BatchAnnotateImagesSettings;
     AsyncBatchAnnotateFilesSettings           = existing.AsyncBatchAnnotateFilesSettings;
     AsyncBatchAnnotateFilesOperationsSettings = existing.AsyncBatchAnnotateFilesOperationsSettings?.Clone();
     OnCopy(existing);
 }
コード例 #2
0
 /// <summary>
 /// Creates a <see cref="ImageAnnotatorClient"/> 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="ImageAnnotatorSettings"/>.</param>
 /// <returns>The created <see cref="ImageAnnotatorClient"/>.</returns>
 public static ImageAnnotatorClient Create(grpccore::CallInvoker callInvoker, ImageAnnotatorSettings settings = null)
 {
     gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker));
     grpccore::Interceptors.Interceptor interceptor = settings?.Interceptor;
     if (interceptor != null)
     {
         callInvoker = grpccore::Interceptors.CallInvokerExtensions.Intercept(callInvoker, interceptor);
     }
     ImageAnnotator.ImageAnnotatorClient grpcClient = new ImageAnnotator.ImageAnnotatorClient(callInvoker);
     return(new ImageAnnotatorClientImpl(grpcClient, settings));
 }
コード例 #3
0
        /// <summary>
        /// Constructs a client wrapper for the ImageAnnotator service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="ImageAnnotatorSettings"/> used within this client </param>
        public ImageAnnotatorClientImpl(ImageAnnotator.ImageAnnotatorClient grpcClient, ImageAnnotatorSettings settings)
        {
            GrpcClient = grpcClient;
            ImageAnnotatorSettings effectiveSettings = settings ?? ImageAnnotatorSettings.GetDefault();
            ClientHelper           clientHelper      = new ClientHelper(effectiveSettings);

            AsyncBatchAnnotateFilesOperationsClient = new OperationsClientImpl(
                grpcClient.CreateOperationsClient(), effectiveSettings.AsyncBatchAnnotateFilesOperationsSettings);
            _callBatchAnnotateImages = clientHelper.BuildApiCall <BatchAnnotateImagesRequest, BatchAnnotateImagesResponse>(
                GrpcClient.BatchAnnotateImagesAsync, GrpcClient.BatchAnnotateImages, effectiveSettings.BatchAnnotateImagesSettings);
            _callAsyncBatchAnnotateFiles = clientHelper.BuildApiCall <AsyncBatchAnnotateFilesRequest, Operation>(
                GrpcClient.AsyncBatchAnnotateFilesAsync, GrpcClient.AsyncBatchAnnotateFiles, effectiveSettings.AsyncBatchAnnotateFilesSettings);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
コード例 #4
0
 partial void OnConstruction(ImageAnnotator.ImageAnnotatorClient grpcClient, ImageAnnotatorSettings effectiveSettings, ClientHelper clientHelper);
コード例 #5
0
 partial void OnCopy(ImageAnnotatorSettings existing);
コード例 #6
0
 /// <summary>
 /// Creates a <see cref="ImageAnnotatorClient"/> which uses the specified channel for remote operations.
 /// </summary>
 /// <param name="channel">The <see cref="Channel"/> for remote operations. Must not be null.</param>
 /// <param name="settings">Optional <see cref="ImageAnnotatorSettings"/>.</param>
 /// <returns>The created <see cref="ImageAnnotatorClient"/>.</returns>
 public static ImageAnnotatorClient Create(Channel channel, ImageAnnotatorSettings settings = null)
 {
     GaxPreconditions.CheckNotNull(channel, nameof(channel));
     ImageAnnotator.ImageAnnotatorClient grpcClient = new ImageAnnotator.ImageAnnotatorClient(channel);
     return(new ImageAnnotatorClientImpl(grpcClient, settings));
 }
コード例 #7
0
        /// <summary>
        /// Synchronously creates a <see cref="ImageAnnotatorClient"/>, applying defaults for all unspecified settings,
        /// and creating a channel connecting to the given endpoint with application default credentials where
        /// necessary.
        /// </summary>
        /// <param name="endpoint">Optional <see cref="ServiceEndpoint"/>.</param>
        /// <param name="settings">Optional <see cref="ImageAnnotatorSettings"/>.</param>
        /// <returns>The created <see cref="ImageAnnotatorClient"/>.</returns>
        public static ImageAnnotatorClient Create(ServiceEndpoint endpoint = null, ImageAnnotatorSettings settings = null)
        {
            Channel channel = s_channelPool.GetChannel(endpoint ?? DefaultEndpoint);

            return(Create(channel, settings));
        }
コード例 #8
0
        // Note: we could have parameterless overloads of Create and CreateAsync,
        // documented to just use the default endpoint, settings and credentials.
        // Pros:
        // - Might be more reassuring on first use
        // - Allows method group conversions
        // Con: overloads!

        /// <summary>
        /// Asynchronously creates a <see cref="ImageAnnotatorClient"/>, applying defaults for all unspecified settings,
        /// and creating a channel connecting to the given endpoint with application default credentials where
        /// necessary.
        /// </summary>
        /// <param name="endpoint">Optional <see cref="ServiceEndpoint"/>.</param>
        /// <param name="settings">Optional <see cref="ImageAnnotatorSettings"/>.</param>
        /// <returns>The task representing the created <see cref="ImageAnnotatorClient"/>.</returns>
        public static async Task <ImageAnnotatorClient> CreateAsync(ServiceEndpoint endpoint = null, ImageAnnotatorSettings settings = null)
        {
            Channel channel = await s_channelPool.GetChannelAsync(endpoint ?? DefaultEndpoint).ConfigureAwait(false);

            return(Create(channel, settings));
        }
コード例 #9
0
 /// <summary>
 /// Creates a <see cref="ImageAnnotatorClient"/> which uses the specified channel for remote operations.
 /// </summary>
 /// <param name="channel">The <see cref="grpccore::Channel"/> for remote operations. Must not be null.</param>
 /// <param name="settings">Optional <see cref="ImageAnnotatorSettings"/>.</param>
 /// <returns>The created <see cref="ImageAnnotatorClient"/>.</returns>
 public static ImageAnnotatorClient Create(grpccore::Channel channel, ImageAnnotatorSettings settings = null)
 {
     gax::GaxPreconditions.CheckNotNull(channel, nameof(channel));
     return(Create(new grpccore::DefaultCallInvoker(channel), settings));
 }
コード例 #10
0
 /// <summary>
 /// Creates a <see cref="ImageAnnotatorClient"/> 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="ImageAnnotatorSettings"/>.</param>
 /// <returns>The created <see cref="ImageAnnotatorClient"/>.</returns>
 public static ImageAnnotatorClient Create(grpccore::CallInvoker callInvoker, ImageAnnotatorSettings settings = null)
 {
     gax::GaxPreconditions.CheckNotNull(callInvoker, nameof(callInvoker));
     ImageAnnotator.ImageAnnotatorClient grpcClient = new ImageAnnotator.ImageAnnotatorClient(callInvoker);
     return(new ImageAnnotatorClientImpl(grpcClient, settings));
 }