public void WhenInvalidApKey_ThenThrowExceptionForbidden()
            {
                var request = new TrendingRequest(ApiKeys.Invalid);

                var ex = Assert.ThrowsAsync <GiphyApiClientException>(() => _sut.GetTrendingAsync(request));

                Assert.That(ex.HttpStatusCode, Is.EqualTo(ApiStatusCodes.Forbidden));
            }
            public async Task WhenQueryIsSuccessful_ThenReturnResults()
            {
                var request = new TrendingRequest(ApiKeys.Valid)
                {
                    Limit = 1
                };

                var response = await _sut.GetTrendingAsync(request);

                Assert.That(response.Gifs.Count(), Is.EqualTo(1));
            }
示例#3
0
    // Search Trending GIFs
    public void TrendingTenorGIF()
    {
        // Initialize SDK
        TenorAPI.Initialize("LIVDSRZULELA");

        // Prepare Request data
        TrendingRequest request = new TrendingRequest();

        request.pos   = "";
        request.limit = "5";

        // Call Coroutine to not freeze
        StartCoroutine(TenorAPI.Trending(request, ProcessAnswers));
    }
示例#4
0
 // Method to call API End Point: Trending https://tenor.com/gifapi#trending
 public static IEnumerator Trending(TrendingRequest request, DelegateResponseAnswer delegateTrending)
 {
     return(_apiCallResponse(request.getQueryString(key), delegateTrending));
 }
 public virtual Task <TrendingResponse> GetAsync(TrendingRequest request) =>
 Client.SendAsync <TrendingResponse>(request);
示例#6
0
 public Uri Create(TrendingRequest request)
 {
     return(request.AddUriParams(new Uri(_settings.BaseUrl).SetPath(@"v1/gifs/trending")));
 }
示例#7
0
        /// <summary>
        /// Returns a list of the top trending GIFs on the internet, consistently updated throughout each day.
        /// The data returned mirrors the GIFs showcased on the GIPHY homepage. Returns 25 results by default.
        /// </summary>
        /// <param name="request">Request object.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>The task object representing the asynchronous operation.</returns>
        public async Task <TrendingResponse> GetTrendingAsync(TrendingRequest request, CancellationToken cancellationToken = default(CancellationToken))
        {
            var uri = _uriFactory.Create(request);

            return(await GetAsync <TrendingResponse>(uri, cancellationToken));
        }