Пример #1
0
        internal async Task <T> ExecutePostWithResponseAsync <T>(string url, PutIoPostRequest requestObject)
        {
            var response = await _apiClient.PostAsync(url, requestObject.GenerateRequestBody());

            if (!response.IsSuccessStatusCode)
            {
                await HandleApiError(response);
            }

            var rawResponse = await response.Content.ReadAsStringAsync();

            return(JsonSerializer.Deserialize <T>(rawResponse));
        }
Пример #2
0
        internal async Task ExecutePostAsync(string url, PutIoPostRequest requestObject = null)
        {
            var body = requestObject is null
                ? new StringContent("", Encoding.UTF8, "application/json")
                : requestObject.GenerateRequestBody();

            var response = await _apiClient.PostAsync(url, body);

            if (!response.IsSuccessStatusCode)
            {
                await HandleApiError(response);
            }
        }