Exemplo n.º 1
0
        private FluxQueryBuilder GetHourDataQuery(DataSourceIdentification dataSourceIdentification, int hour)
        {
            if (dataSourceIdentification is null)
            {
                throw new ArgumentException(ParameterErrorMessage, nameof(dataSourceIdentification));
            }

            FluxQueryBuilder queryBuilder = new FluxQueryBuilder();

            return(queryBuilder.From(dataSourceIdentification.Bucket)
                   .RangePastDays(hour)
                   .AddMeasurementFilter(this.measurementName));
        }
Exemplo n.º 2
0
        public async Task <List <TModel> > GetPastDaysData(DataSourceIdentification dataSourceIdentification, int days)
        {
            if (dataSourceIdentification is null)
            {
                throw new ArgumentException(ParameterErrorMessage, nameof(dataSourceIdentification));
            }

            FluxQueryBuilder queryBuilder = new FluxQueryBuilder();
            string           query        = queryBuilder.From(dataSourceIdentification.Bucket)
                                            .RangePastDays(days)
                                            .AddMeasurementFilter(this.measurementName)
                                            .CreateQuery();

            List <FluxTable> data = await this.context.Client.GetQueryApi().QueryAsync(query, dataSourceIdentification.Organization);

            return(this.ParseData(data));
        }