Exemplo n.º 1
0
        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;
            }
        }
Exemplo n.º 2
0
        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;
            }
        }