Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RequestProcessor"/> class.
        /// </summary>
        /// <param name="httpClient">An implementation of the <see cref="HttpClient"/> class.</param>
        /// <param name="httpRequestMessageFactory">The <see cref="IHttpRequestMessageFactory"/>.</param>
        /// <param name="responseHeaderMapper">The <see cref="IResponseHeaderMapper"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="httpClient"/>', '<paramref name="httpRequestMessageFactory"/>' and '<paramref name="responseHeaderMapper"/>' cannot be null. </exception>
        public RequestProcessor([NotNull] HttpClient httpClient, [NotNull] IHttpRequestMessageFactory httpRequestMessageFactory, [NotNull] IResponseHeaderMapper responseHeaderMapper)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }

            if (httpRequestMessageFactory == null)
            {
                throw new ArgumentNullException(nameof(httpRequestMessageFactory));
            }

            if (responseHeaderMapper == null)
            {
                throw new ArgumentNullException(nameof(responseHeaderMapper));
            }

            this.HttpClient = httpClient;
            this.httpRequestMessageFactory = httpRequestMessageFactory;
            this.responseHeaderMapper      = responseHeaderMapper;
        }
Пример #2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GoogleRequestProcessor"/> class.
        /// </summary>
        /// <param name="httpClient">The <see cref="HttpClient"/>.</param>
        /// <param name="authorizationContextConfiguration">The <see cref="IAuthorizationContextConfiguration"/>.</param>
        /// <param name="requestMessageFactory">The <see cref="IHttpRequestMessageFactory"/> that creates <see cref="HttpRequestMessage"/> instances from an <see cref="object"/>.</param>
        /// <param name="responseHeaderMapper">The <see cref="IResponseHeaderMapper"/>.</param>
        /// <exception cref="ArgumentNullException">The value of '<paramref name="authorizationContextConfiguration"/>', '<paramref name="httpClient"/>', '<paramref name="requestMessageFactory"/>' and '<paramref name="responseHeaderMapper"/>' cannot be null. </exception>
        public GoogleRequestProcessor([NotNull] HttpClient httpClient, [NotNull] IAuthorizationContextConfiguration authorizationContextConfiguration, [NotNull] IHttpRequestMessageFactory requestMessageFactory, [NotNull] IResponseHeaderMapper responseHeaderMapper)
            : base(httpClient, requestMessageFactory, responseHeaderMapper)
        {
            if (authorizationContextConfiguration == null)
            {
                throw new ArgumentNullException(nameof(authorizationContextConfiguration));
            }

            this.HttpClient.BaseAddress = authorizationContextConfiguration.BaseUrl;
        }