Exemplo n.º 1
0
        /// <summary>
        /// Constructs a client wrapper for the LanguageService service, with the specified gRPC client and settings.
        /// </summary>
        /// <param name="grpcClient">The underlying gRPC client.</param>
        /// <param name="settings">The base <see cref="LanguageServiceSettings"/> used within this client </param>
        public LanguageServiceClientImpl(LanguageService.LanguageServiceClient grpcClient, LanguageServiceSettings settings)
        {
            this.GrpcClient = grpcClient;
            LanguageServiceSettings effectiveSettings = settings ?? LanguageServiceSettings.GetDefault();

            _clientHelper         = new ClientHelper(effectiveSettings);
            _callAnalyzeSentiment = _clientHelper.BuildApiCall <AnalyzeSentimentRequest, AnalyzeSentimentResponse>(
                GrpcClient.AnalyzeSentimentAsync, GrpcClient.AnalyzeSentiment, effectiveSettings.AnalyzeSentimentSettings);
            _callAnalyzeEntities = _clientHelper.BuildApiCall <AnalyzeEntitiesRequest, AnalyzeEntitiesResponse>(
                GrpcClient.AnalyzeEntitiesAsync, GrpcClient.AnalyzeEntities, effectiveSettings.AnalyzeEntitiesSettings);
            _callAnalyzeSyntax = _clientHelper.BuildApiCall <AnalyzeSyntaxRequest, AnalyzeSyntaxResponse>(
                GrpcClient.AnalyzeSyntaxAsync, GrpcClient.AnalyzeSyntax, effectiveSettings.AnalyzeSyntaxSettings);
            _callAnnotateText = _clientHelper.BuildApiCall <AnnotateTextRequest, AnnotateTextResponse>(
                GrpcClient.AnnotateTextAsync, GrpcClient.AnnotateText, effectiveSettings.AnnotateTextSettings);
        }
Exemplo n.º 2
0
 partial void OnConstruction(LanguageService.LanguageServiceClient grpcClient, LanguageServiceSettings effectiveSettings, ClientHelper clientHelper);
Exemplo n.º 3
0
 /// <summary>
 /// Creates a <see cref="LanguageServiceClient"/> 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="LanguageServiceSettings"/>.</param>
 /// <returns>The created <see cref="LanguageServiceClient"/>.</returns>
 public static LanguageServiceClient Create(Channel channel, LanguageServiceSettings settings = null)
 {
     GaxPreconditions.CheckNotNull(channel, nameof(channel));
     LanguageService.LanguageServiceClient grpcClient = new LanguageService.LanguageServiceClient(channel);
     return(new LanguageServiceClientImpl(grpcClient, settings));
 }