Beispiel #1
0
        private JsonRestClient(Uri baseUri, JsonRestClientSettings settings)
        {
            _baseUri  = baseUri ?? throw new ArgumentNullException(nameof(baseUri));
            _settings = settings ?? throw new ArgumentNullException(nameof(settings));

            ThrowIfInvalidSettings();
        }
Beispiel #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;
        }
Beispiel #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;
        }