示例#1
0
        public FluxClient(FluxConnectionOptions options) : base(new RestClient(), new FluxResultMapper())
        {
            _loggingHandler = new LoggingHandler(LogLevel.None);

            var version = AssemblyHelper.GetVersion(typeof(FluxClient));

            RestClient.BaseUrl = new Uri(options.Url);
            RestClient.Timeout = options.Timeout.Milliseconds;
            RestClient.AddDefaultHeader("Accept", "application/json");
            if (!string.IsNullOrEmpty(options.Username))
            {
                if (FluxConnectionOptions.AuthenticationType.BasicAuthentication.Equals(options.Authentication))
                {
                    var auth = Encoding.UTF8.GetBytes(options.Username + ":" + new string(options.Password));
                    RestClient.AddDefaultHeader("Authorization", "Basic " + Convert.ToBase64String(auth));
                }
                else
                {
                    RestClient.AddDefaultQueryParameter("u", options.Username);
                    RestClient.AddDefaultQueryParameter("p", new string(options.Password));
                }
            }
            RestClient.UserAgent = $"influxdb-client-csharp/{version}";
            RestClient.Proxy     = options.WebProxy;
        }
示例#2
0
        public FluxClient(FluxConnectionOptions options) : base(new RestClient())
        {
            _loggingHandler = new LoggingHandler(LogLevel.None);

            RestClient.BaseUrl = new Uri(options.Url);
            RestClient.Timeout = options.Timeout.Milliseconds;
            RestClient.AddDefaultHeader("Accept", "application/json");
        }
        public FluxClient(FluxConnectionOptions options) : base(new RestClient())
        {
            _loggingHandler = new LoggingHandler(LogLevel.None);

            var version = AssemblyHelper.GetVersion(typeof(FluxClient));

            RestClient.BaseUrl = new Uri(options.Url);
            RestClient.Timeout = options.Timeout.Milliseconds;
            RestClient.AddDefaultHeader("Accept", "application/json");
            if (!string.IsNullOrEmpty(options.Username))
            {
                RestClient.AddDefaultQueryParameter("u", options.Username);
                RestClient.AddDefaultQueryParameter("p", new string(options.Password));
            }
            RestClient.UserAgent = $"influxdb-client-csharp/{version}";
        }