Ejemplo n.º 1
0
        private JsonRestClient(Uri baseUri, JsonRestClientSettings settings)
        {
            _baseUri  = baseUri ?? throw new ArgumentNullException(nameof(baseUri));
            _settings = settings ?? throw new ArgumentNullException(nameof(settings));

            ThrowIfInvalidSettings();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initializes the instance of <see cref="JsonRestClient"/> type with specified settings.
        /// </summary>
        public JsonRestClient(IHttpClientFactory httpClientFactory, Uri baseUri, JsonRestClientSettings settings)
            : this(baseUri, settings)
        {
            if (httpClientFactory == null)
            {
                throw new ArgumentNullException(nameof(httpClientFactory));
            }

            _getHttpClient = httpClientFactory.CreateClient;
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Initializes the instance of <see cref="JsonRestClient"/> type with specified settings.
        /// </summary>
        public JsonRestClient(HttpClient httpClient, Uri baseUri, JsonRestClientSettings settings)
            : this(baseUri, settings)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }

            _getHttpClient = () => httpClient;
        }