コード例 #1
0
            public void WhenInvalidApKey_ThenThrowExceptionForbidden()
            {
                var request = new StickerPackListingRequest(ApiKeys.Invalid);

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

                Assert.That(ex.HttpStatusCode, Is.EqualTo(ApiStatusCodes.Forbidden));
            }
コード例 #2
0
            public async Task WhenQueryIsSuccessful_ThenReturnResults()
            {
                var request = new StickerPackListingRequest(ApiKeys.Valid);

                var response = await _sut.GetStickerPackListAsync(request);

                Assert.That(response.ChildPacks.Count(), Is.GreaterThan(0));
            }
コード例 #3
0
 public Uri Create(StickerPackListingRequest request)
 {
     return(request.AddUriParams(new Uri(_settings.BaseUrl).SetPath(@"v1/stickers/packs")));
 }
コード例 #4
0
        /// <summary>
        /// Returns a list of all sticker packs available.
        /// List is hand-curated by the GIPHY editorial team.
        /// </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 <StickerPackListResponse> GetStickerPackListAsync(StickerPackListingRequest request, CancellationToken cancellationToken = default)
        {
            var uri = _uriFactory.Create(request);

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