Esempio n. 1
0
        public static async Task <ApiResponse> GetFile(this HttpClient client, string url)
        {
            var response = await client.GetAsync(url);

            var qr = await QuickFile.FromMessage(response);

            return(qr.ToApiResponse());
        }
Esempio n. 2
0
        public new static async Task <QuickFile> FromMessage(HttpResponseMessage message)
        {
            var response = new QuickFile();

            response.Message      = message;
            response.ResponseBody = await message.Content.ReadAsStringAsync();

            if (message.IsSuccessStatusCode)
            {
                response.Data = await message.Content.ReadAsStreamAsync();
            }
            else
            {
                response.HandleFailedCall();
            }

            return(response);
        }