private List <FluxTable> ParseFluxResponse(string data)
        {
            var consumer = new FluxCsvParser.FluxResponseConsumerTable();

            _parser.ParseFluxResponse(data, new DefaultCancellable(), consumer);

            return(consumer.Tables);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Executes the Flux query against the InfluxDB and asynchronously map whole response to <see cref="List{FluxTable}"/>.
        /// </summary>
        /// <para>
        /// NOTE: This method is not intended for large query results.
        /// Use <see cref="QueryAsync(string,System.Action{InfluxDB.Client.Core.ICancellable,InfluxDB.Client.Core.Flux.Domain.FluxRecord},System.Action{System.Exception},System.Action)"/> for large data streaming.
        /// </para>
        /// <param name="query">the flux query to execute</param>
        /// <returns><see cref="List{FluxTable}"/> which are matched the query</returns>
        public async Task <List <FluxTable> > QueryAsync(string query)
        {
            Arguments.CheckNonEmptyString(query, "query");

            var consumer = new FluxCsvParser.FluxResponseConsumerTable();

            await QueryAsync(query, GetDefaultDialect(), consumer, ErrorConsumer, EmptyAction).ConfigureAwait(false);

            return(consumer.Tables);
        }
        /// <summary>
        /// Executes the Flux query against the InfluxDB 2.0 and synchronously map whole response
        /// to <see cref="FluxTable"/>s.
        ///
        /// <para>
        /// NOTE: This method is not intended for large query results.
        /// </para>
        /// </summary>
        /// <param name="query">the flux query to execute</param>
        /// <param name="org">specifies the source organization</param>
        /// <returns>FluxTables that are matched the query</returns>
        public List <FluxTable> QuerySync(Query query, string org)
        {
            Arguments.CheckNotNull(query, nameof(query));
            Arguments.CheckNonEmptyString(org, nameof(org));

            var consumer = new FluxCsvParser.FluxResponseConsumerTable();

            var requestMessage = _service.PostQueryWithRestRequest(null, "application/json", null, org, null, query);

            QuerySync(requestMessage, consumer, ErrorConsumer, EmptyAction);

            return(consumer.Tables);
        }