Пример #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="BaseClient"/> class.
        /// </summary>
        /// <param name="httpClient">An optional HTTP client which may me injected in order to facilitate testing.</param>
        /// <param name="options">A <see cref="BaseClientOptions"/> instance that defines the configuration settings to use with the client.</param>
        /// <returns>Interface to the Twilio SendGrid REST API.</returns>
        protected BaseClient(HttpClient httpClient, BaseClientOptions options)
        {
            this.options = options ?? throw new ArgumentNullException(nameof(options));

            this.client = httpClient ?? CreateHttpClientWithRetryHandler(options);
            if (this.options.RequestHeaders != null && this.options.RequestHeaders.TryGetValue(ContentType, out var contentType))
            {
                this.MediaType = contentType;
            }
        }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseClient"/> class.
 /// </summary>
 /// <param name="webProxy">Web proxy.</param>
 /// <param name="options">A <see cref="BaseClientOptions"/> instance that defines the configuration settings to use with the client.</param>
 /// <returns>Interface to the Twilio SendGrid REST API.</returns>
 protected BaseClient(IWebProxy webProxy, BaseClientOptions options)
     : this(CreateHttpClientWithWebProxy(webProxy, options), options)
 {
 }
Пример #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseClient"/> class.
 /// </summary>
 /// <param name="webProxy">Web proxy.</param>
 /// <param name="options">A <see cref="BaseClientOptions"/> instance that defines the configuration settings to use with the client.</param>
 /// <returns>Interface to the Twilio SendGrid REST API.</returns>
 public BaseClient(IWebProxy webProxy, BaseClientOptions options)
     : this(CreateHttpClientWithWebProxy(webProxy), options)
 {
 }
Пример #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseClient"/> class.
 /// </summary>
 /// <param name="options">A <see cref="BaseClientOptions"/> instance that defines the configuration settings to use with the client.</param>
 /// <returns>Interface to the Twilio SendGrid REST API.</returns>
 protected BaseClient(BaseClientOptions options)
     : this(httpClient : null, options)
 {
 }
Пример #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="BaseClient"/> class.
 /// </summary>
 /// <param name="options">A <see cref="BaseClientOptions"/> instance that defines the configuration settings to use with the client.</param>
 /// <returns>Interface to the Twilio SendGrid REST API.</returns>
 public BaseClient(BaseClientOptions options)
     : this(httpClient : null, options)
 {
 }