Ejemplo n.º 1
0
        public async Task <InfluxQueryResponse> QueryAsync(InfluxQuery query)
        {
            using (var response = await http.GetAsync(endpoint + "/query" + query.ToQueryString()))
            {
                var responseText = await response.Content.ReadAsStringAsync();

                var json = JsonObject.Parse(responseText);

                if (json.TryGetValue("error", out var errorNode))
                {
                    throw new Exception(errorNode.ToString());
                }

                try
                {
                    return(InfluxQueryResponse.FromJson(json));
                }
                catch (Exception ex)
                {
                    throw new Exception(responseText, ex);
                }
            }
        }
Ejemplo n.º 2
0
        public Task <InfluxQueryResponse> QueryAsync(string command)
        {
            var query = new InfluxQuery(name, command);

            return(client.QueryAsync(query));
        }