Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="points"></param>
        /// <param name="dbName"></param>
        /// <param name="retentionPolicy"></param>
        /// <param name="precision"></param>
        /// <returns></returns>
        public virtual async Task <IInfluxDataApiResponse> WriteAsync(IEnumerable <Point> points, string dbName = null, string retentionPolicy = null, string precision = TimeUnit.Milliseconds)
        {
            var request = new WriteRequest(base.RequestClient.GetPointFormatter())
            {
                DbName          = dbName,
                Points          = points,
                RetentionPolicy = retentionPolicy,
                Precision       = precision
            };

            var response = await base.RequestClient.PostAsync(request).ConfigureAwait(false);

            return(response);
        }
Ejemplo n.º 2
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));
        }