public async Task <TrendingGif> GetTrendingGifsAsync() { try { var response = await MakeRequestAsync(ServiceConfig.TRENDING, HttpMethod.Get); if (response.ResultStatusCode != System.Net.HttpStatusCode.OK) { throw new Exception(response.Data?.ToString()); } return(TrendingGif.FromJson(response.Data.ToString())); } catch (Exception) { throw; } }
public async Task <TrendingGif> SearchGifsAsync(string searchWord) { try { string url = string.Format(ServiceConfig.SEARCH, searchWord); var response = await MakeRequestAsync(url, HttpMethod.Get); if (response.ResultStatusCode != System.Net.HttpStatusCode.OK) { throw new Exception(response.Data?.ToString()); } return(TrendingGif.FromJson(response.Data.ToString())); } catch (Exception) { throw; } }
public static string ToJson(this TrendingGif self) => JsonConvert.SerializeObject(self, GifProjectXF.Core.Converter.Settings);