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

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

            _callListLocations = clientHelper.BuildApiCall <ListLocationsRequest, ListLocationsResponse>(grpcClient.ListLocationsAsync, grpcClient.ListLocations, effectiveSettings.ListLocationsSettings).WithGoogleRequestParam("name", request => request.Name);
            Modify_ApiCall(ref _callListLocations);
            Modify_ListLocationsApiCall(ref _callListLocations);
            _callGetLocation = clientHelper.BuildApiCall <GetLocationRequest, Location>(grpcClient.GetLocationAsync, grpcClient.GetLocation, effectiveSettings.GetLocationSettings).WithGoogleRequestParam("name", request => request.Name);
            Modify_ApiCall(ref _callGetLocation);
            Modify_GetLocationApiCall(ref _callGetLocation);
            OnConstruction(grpcClient, effectiveSettings, clientHelper);
        }
Exemplo n.º 3
0
 partial void OnConstruction(Locations.LocationsClient grpcClient, LocationsSettings effectiveSettings, gaxgrpc::ClientHelper clientHelper);