Exemplo n.º 1
0
        /// <summary>Initializes a new instance of <see cref="JSendClient"/>.</summary>
        /// <param name="settings">The settings to configure this client.</param>
        /// <param name="httpClient">A client to send HTTP requests and receive HTTP responses.</param>
        public JSendClient(JSendClientSettings settings, HttpClient httpClient)
        {
            if (httpClient == null)
            {
                throw new ArgumentNullException(nameof(httpClient));
            }

            if (settings == null)
            {
                settings = new JSendClientSettings();
            }

            Parser             = settings.Parser ?? DefaultJSendParser.Instance;
            MessageInterceptor = settings.MessageInterceptor ?? NullMessageInterceptor.Instance;
            Encoding           = settings.Encoding;
            SerializerSettings = settings.SerializerSettings;

            HttpClient = httpClient;
        }
Exemplo n.º 2
0
 public JSendClient(JSendClientSettings settings)
     : this(settings, new HttpClient())
 {
 }