ASPC.Marvel.CrimeAPI.PredictML.InvokeRequestResponseService C# (CSharp) Метод

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

private InvokeRequestResponseService ( double latitude, double longitude, int year ) : Task
latitude double
longitude double
year int
Результат Task
        internal async Task<string> InvokeRequestResponseService(double latitude, double longitude, int year)
        {
            using (var client = new HttpClient())
            {
                var scoreRequest = new
                {

                    Inputs = new Dictionary<string, StringTable>() {
                    {
                        "input1",
                        new StringTable()
                        {
                            ColumnNames = new string[] {"lat", "long", "N", "Y"},
                            Values = new string[,] {  { latitude.ToString(), longitude.ToString(), "0", year.ToString() }  }
                        }
                    },
                },
                    GlobalParameters = new Dictionary<string, string>()
                    {
                    }
                };
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", apiKey);
                client.BaseAddress = new Uri(ServiceUri);
                HttpResponseMessage response = await client.PostAsJsonAsync("", scoreRequest);

                if (response.IsSuccessStatusCode)
                {
                    string result = await response.Content.ReadAsStringAsync();
                    return result;
                }
                else
                {
                    string responseContent = await response.Content.ReadAsStringAsync();
                    return responseContent;
                }
            }
        }