AdysTech.InfluxDB.Client.Net.InfluxDBClient.GetAsync C# (CSharp) Метод

GetAsync() приватный Метод

private GetAsync ( string>.Dictionary Query ) : Task
Query string>.Dictionary
Результат Task
        private async Task<HttpResponseMessage> GetAsync (Dictionary<string, string> Query)
        {
            var querybaseUrl = new Uri ($"{InfluxUrl}/query?");
            var builder = new UriBuilder (querybaseUrl);

            if (InfluxDBUserName != null && !Query.ContainsKey ("u"))
                Query.Add ("u", InfluxDBUserName);
            if (InfluxDBPassword != null && !Query.ContainsKey ("p"))
                Query.Add ("p", InfluxDBPassword);
            builder.Query = await new FormUrlEncodedContent (Query).ReadAsStringAsync ();

            try
            {
                HttpResponseMessage response = await _client.GetAsync (builder.Uri);

                if (response.StatusCode == HttpStatusCode.OK)
                {
                    return response;
                }
                else if (response.StatusCode == HttpStatusCode.Unauthorized || response.StatusCode == HttpStatusCode.BadGateway || (response.StatusCode == HttpStatusCode.InternalServerError && response.ReasonPhrase == "INKApi Error")) //502 Connection refused
                    throw new UnauthorizedAccessException ("InfluxDB needs authentication. Check uname, pwd parameters");
                else if (response.StatusCode == HttpStatusCode.BadRequest)
                {
                    throw InfluxDBException.ProcessInfluxDBError (await response.Content.ReadAsStringAsync ());
                }

            }
            catch (HttpRequestException e)
            {
                if (e.InnerException.Message == "Unable to connect to the remote server" || e.InnerException.Message == "A connection with the server could not be established")
                    throw new ServiceUnavailableException ();
            }
            return null;
        }