Esempio n. 1
0
        public async Task <FetchImageResponse> FetchImageAsync(FetchImageRequest model)
        {
            try
            {
                string        json          = JsonConvert.SerializeObject(model);
                StringContent stringContent = new StringContent(json, Encoding.Default, "application/json");

                var result = await client.PostAsync(API_VERSION + "/fetchImage", stringContent);

                if (result.StatusCode == HttpStatusCode.Unauthorized)
                {
                    return(new FetchImageResponse
                    {
                        Success = false,
                        Errors = new List <string> {
                            "Unauthorized. Please check your API Key and API Secret."
                        }
                    });
                }
                var jsonResponse = await result.Content.ReadAsStringAsync();

                var response = JsonConvert.DeserializeObject <FetchImageResponse>(jsonResponse);

                return(response);
            }
            catch (Exception e)
            {
                var ex = new Image4ioException("There is an error while deleting an image", e);
                throw ex;
            }
        }
Esempio n. 2
0
 public Task <IActionResult> FetchImage([FromBody] FetchImageRequest request)
 {
     throw new NotImplementedException(nameof(FetchImage));
 }
Esempio n. 3
0
 public Task <FetchImageResponse> FetchImageAsync(FetchImageRequest model)
 {
     throw new NotImplementedException();
 }
Esempio n. 4
0
 public FetchImageResponse FetchImage(FetchImageRequest model) => FetchImageAsync(model).ConfigureAwait(false).GetAwaiter().GetResult();
Esempio n. 5
0
 public FetchImageResponse FetchImage(FetchImageRequest model)
 {
     throw new NotImplementedException();
 }