/// <summary>
        ///
        /// </summary>
        /// <param name="query"></param>
        /// <param name="method"></param>
        /// <param name="dbName"></param>
        /// <param name="epochFormat"></param>
        /// <param name="chunkSize"></param>
        /// <returns></returns>
        public override async Task <IInfluxDataApiResponse> QueryAsync(string query,
                                                                       HttpMethod method, string dbName = null, string epochFormat = null, long?chunkSize = null)
        {
            var requestParams = RequestParamsBuilder.BuildQueryRequestParams(query, dbName, epochFormat, chunkSize);

            return(await base.RequestAsync(method, RequestPaths.Query, requestParams).ConfigureAwait(false));
        }
Esempio n. 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="query"></param>
        /// <param name="method"></param>
        /// <param name="dbName"></param>
        /// <param name="epochFormat"></param>
        /// <param name="chunkSize"></param>
        /// <returns></returns>
        protected virtual async Task <IInfluxDataApiResponse> QueryFormDataAsync(string query,
                                                                                 HttpMethod method, string dbName = null, string epochFormat = null, long?chunkSize = null)
        {
            var requestParams = RequestParamsBuilder.BuildRequestParams(dbName, epochFormat, chunkSize);
            var httpContent   = query.ToMultipartHttpContent(QueryParams.Query);

            return(await RequestAsync(method, RequestPaths.Query,
                                      requestParams, httpContent).ConfigureAwait(false));
        }
Esempio n. 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="writeRequest"></param>
        /// <returns></returns>
        public virtual async Task <IInfluxDataApiResponse> PostAsync(WriteRequest writeRequest)
        {
            var requestParams = RequestParamsBuilder.BuildRequestParams(
                writeRequest.DbName,
                QueryParams.Precision, writeRequest.Precision,
                QueryParams.RetentionPolicy, writeRequest.RetentionPolicy
                );
            var httpContent = new StringContent(writeRequest.GetLines(), Encoding.UTF8, "text/plain");

            var result = await base.RequestAsync(HttpMethod.Post,
                                                 RequestPaths.Write, requestParams, httpContent).ConfigureAwait(false);

            return(new InfluxDataApiWriteResponse(result.StatusCode, result.Body));
        }