public void WhenInvalidApKey_ThenThrowExceptionForbidden() { var request = new StickerPackStickersRequest(ApiKeys.Invalid); var ex = Assert.ThrowsAsync <GiphyApiClientException>(() => _sut.GetStickerPackStickersAsync(request)); Assert.That(ex.HttpStatusCode, Is.EqualTo(ApiStatusCodes.Forbidden)); }
public async Task WhenStickerPackExists_ThenReturnStickers() { var request = new StickerPackStickersRequest(ApiKeys.Valid) { PackId = ExistingStickerPackId, Limit = 1 }; var response = await _sut.GetStickerPackStickersAsync(request); Assert.That(response.Stickers.Count(), Is.EqualTo(1)); }
public Uri Create(StickerPackStickersRequest request) { return(request.AddUriParams(new Uri(_settings.BaseUrl).SetPath(@"v1/stickers/packs/" + request.PackId + "/stickers"))); }
/// <summary> /// Returns the stickers within an individual sticker pack. /// </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 <StickerPackStickersResponse> GetStickerPackStickersAsync(StickerPackStickersRequest request, CancellationToken cancellationToken = default) { var uri = _uriFactory.Create(request); return(await GetAsync <StickerPackStickersResponse>(uri, cancellationToken)); }