diff --git a/GettyImages.Api/ApiRequest.cs b/GettyImages.Api/ApiRequest.cs index 37cbabf..f62b378 100644 --- a/GettyImages.Api/ApiRequest.cs +++ b/GettyImages.Api/ApiRequest.cs @@ -259,6 +259,14 @@ protected void AddComposition(Composition value) } } + protected void AddDownloadProduct(ProductType value) + { + if (QueryParameters.ContainsKey(Constants.DownloadProductKey)) + QueryParameters[Constants.DownloadProductKey] = value; + else + QueryParameters.Add(Constants.DownloadProductKey, value); + } + protected void AddEditorialSegment(EditorialSegment value) { if (QueryParameters.ContainsKey(Constants.EditorialSegmentKey)) diff --git a/GettyImages.Api/Constants.cs b/GettyImages.Api/Constants.cs index 0547751..5bb3355 100644 --- a/GettyImages.Api/Constants.cs +++ b/GettyImages.Api/Constants.cs @@ -18,6 +18,7 @@ internal static class Constants public const string CompositionKey = "compositions"; public const string DateToKey = "date_to"; public const string DateFromKey = "date_from"; + public const string DownloadProductKey = "download_product"; public const string EditorialSegmentKey = "editorial_segments"; public const string EditorialVideoKey = "editorial_video_types"; public const string EmbedContentOnlyKey = "embed_content_only"; diff --git a/GettyImages.Api/Search/SearchImages.cs b/GettyImages.Api/Search/SearchImages.cs index 269d666..79a6e98 100644 --- a/GettyImages.Api/Search/SearchImages.cs +++ b/GettyImages.Api/Search/SearchImages.cs @@ -74,6 +74,12 @@ public SearchImages WithComposition(Composition value) return this; } + public SearchImages WithDownloadProduct(ProductType value) + { + AddDownloadProduct(value); + return this; + } + public SearchImages WithEmbedContentOnly(bool value = true) { AddQueryParameter(Constants.EmbedContentOnlyKey, value); diff --git a/GettyImages.Api/Search/SearchImagesCreative.cs b/GettyImages.Api/Search/SearchImagesCreative.cs index 076af9b..ec6ea6a 100644 --- a/GettyImages.Api/Search/SearchImagesCreative.cs +++ b/GettyImages.Api/Search/SearchImagesCreative.cs @@ -70,6 +70,12 @@ public SearchImagesCreative WithComposition(Composition value) return this; } + public SearchImagesCreative WithDownloadProduct(ProductType value) + { + AddDownloadProduct(value); + return this; + } + public SearchImagesCreative WithEmbedContentOnly(bool value = true) { AddQueryParameter(Constants.EmbedContentOnlyKey, value); diff --git a/GettyImages.Api/Search/SearchImagesEditorial.cs b/GettyImages.Api/Search/SearchImagesEditorial.cs index cc0d289..8dfa1aa 100644 --- a/GettyImages.Api/Search/SearchImagesEditorial.cs +++ b/GettyImages.Api/Search/SearchImagesEditorial.cs @@ -64,6 +64,12 @@ public SearchImagesEditorial WithComposition(Composition value) return this; } + public SearchImagesEditorial WithDownloadProduct(ProductType value) + { + AddDownloadProduct(value); + return this; + } + public SearchImagesEditorial WithEditorialSegment(EditorialSegment value) { AddEditorialSegment(value); diff --git a/GettyImages.Api/Search/SearchVideos.cs b/GettyImages.Api/Search/SearchVideos.cs index 9ed5517..5d37fa1 100644 --- a/GettyImages.Api/Search/SearchVideos.cs +++ b/GettyImages.Api/Search/SearchVideos.cs @@ -53,6 +53,12 @@ public SearchVideos WithCollectionFilterType(CollectionFilter value) return this; } + public SearchVideos WithDownloadProduct(ProductType value) + { + AddDownloadProduct(value); + return this; + } + public SearchVideos WithEditorialVideoType(EditorialVideo value) { AddEditorialVideoType(value); diff --git a/GettyImages.Api/Search/SearchVideosCreative.cs b/GettyImages.Api/Search/SearchVideosCreative.cs index 481dc29..9f3b1a5 100644 --- a/GettyImages.Api/Search/SearchVideosCreative.cs +++ b/GettyImages.Api/Search/SearchVideosCreative.cs @@ -52,6 +52,12 @@ public SearchVideosCreative WithCollectionFilterType(CollectionFilter value) return this; } + public SearchVideosCreative WithDownloadProduct(ProductType value) + { + AddDownloadProduct(value); + return this; + } + public SearchVideosCreative WithExcludeNudity(bool value = true) { AddQueryParameter(Constants.Excludenudity, value); diff --git a/GettyImages.Api/Search/SearchVideosEditorial.cs b/GettyImages.Api/Search/SearchVideosEditorial.cs index f1d7076..6a1c143 100644 --- a/GettyImages.Api/Search/SearchVideosEditorial.cs +++ b/GettyImages.Api/Search/SearchVideosEditorial.cs @@ -52,6 +52,12 @@ public SearchVideosEditorial WithCollectionFilterType(CollectionFilter value) return this; } + public SearchVideosEditorial WithDownloadProduct(ProductType value) + { + AddDownloadProduct(value); + return this; + } + public SearchVideosEditorial WithEditorialVideoType(EditorialVideo value) { AddEditorialVideoType(value); diff --git a/UnitTests/Search/SearchImagesCreativeTests.cs b/UnitTests/Search/SearchImagesCreativeTests.cs index ce6404a..51cea06 100644 --- a/UnitTests/Search/SearchImagesCreativeTests.cs +++ b/UnitTests/Search/SearchImagesCreativeTests.cs @@ -101,6 +101,19 @@ public void SearchForCreativeImagesWithComposition() testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("compositions=abstract%2Cheadshot"); } + [Fact] + public void SearchForCreativeImagesWithDownloadProduct() + { + var testHandler = TestUtil.CreateTestHandler(); + + var response = ApiClient.GetApiClientWithClientCredentials("apiKey", "apiSecret", testHandler).SearchImagesCreative() + .WithPhrase("cat").WithDownloadProduct(ProductType.Easyaccess).ExecuteAsync().Result; + + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("search/images/creative"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("phrase=cat"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("download_product=easyaccess"); + } + [Fact] public void SearchForCreativeImagesWithEmbedContentOnly() { diff --git a/UnitTests/Search/SearchImagesEditorialTests.cs b/UnitTests/Search/SearchImagesEditorialTests.cs index cc9efd2..fbe9b2a 100644 --- a/UnitTests/Search/SearchImagesEditorialTests.cs +++ b/UnitTests/Search/SearchImagesEditorialTests.cs @@ -88,6 +88,19 @@ public void SearchForEditorialImagesWithComposition() testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("compositions=abstract%2Cheadshot"); } + [Fact] + public void SearchForEditorialImagesWithDownloadProduct() + { + var testHandler = TestUtil.CreateTestHandler(); + + var response = ApiClient.GetApiClientWithClientCredentials("apiKey", "apiSecret", testHandler).SearchImagesEditorial() + .WithPhrase("cat").WithDownloadProduct(ProductType.Easyaccess).ExecuteAsync().Result; + + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("search/images/editorial"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("phrase=cat"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("download_product=easyaccess"); + } + [Fact] public void SearchForEditorialImagesWithEditorialSegment() { diff --git a/UnitTests/Search/SearchImagesTests.cs b/UnitTests/Search/SearchImagesTests.cs index fd533f7..e36ef76 100644 --- a/UnitTests/Search/SearchImagesTests.cs +++ b/UnitTests/Search/SearchImagesTests.cs @@ -101,6 +101,19 @@ public void SearchForBlendedImagesWithComposition() testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("compositions=abstract%2Cheadshot"); } + [Fact] + public void SearchForBlendedImagesWithDownloadProduct() + { + var testHandler = TestUtil.CreateTestHandler(); + + var response = ApiClient.GetApiClientWithClientCredentials("apiKey", "apiSecret", testHandler).SearchImages() + .WithPhrase("cat").WithDownloadProduct(ProductType.Easyaccess).ExecuteAsync().Result; + + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("search/images"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("phrase=cat"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("download_product=easyaccess"); + } + [Fact] public void SearchForBlendedImagesWithEmbedContentOnly() { diff --git a/UnitTests/Search/SearchVideosCreativeTests.cs b/UnitTests/Search/SearchVideosCreativeTests.cs index fc5bdbf..021bb96 100644 --- a/UnitTests/Search/SearchVideosCreativeTests.cs +++ b/UnitTests/Search/SearchVideosCreativeTests.cs @@ -60,6 +60,19 @@ public void SearchForCreativeVideosWithCollectionFilterType() testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("collections_filter_type=exclude"); } + [Fact] + public void SearchForCreativeVideosWithDownloadProduct() + { + var testHandler = TestUtil.CreateTestHandler(); + + var response = ApiClient.GetApiClientWithClientCredentials("apiKey", "apiSecret", testHandler).SearchVideosCreative() + .WithPhrase("cat").WithDownloadProduct(ProductType.Easyaccess).ExecuteAsync().Result; + + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("search/videos/creative"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("phrase=cat"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("download_product=easyaccess"); + } + [Fact] public void SearchForCreativeVideosWithExcludeNudity() { diff --git a/UnitTests/Search/SearchVideosEditorialTests.cs b/UnitTests/Search/SearchVideosEditorialTests.cs index d8d2e62..bc0d9cb 100644 --- a/UnitTests/Search/SearchVideosEditorialTests.cs +++ b/UnitTests/Search/SearchVideosEditorialTests.cs @@ -60,6 +60,19 @@ public void SearchForEditorialVideosWithCollectionFilterType() testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("collections_filter_type=exclude"); } + [Fact] + public void SearchForEditorialVideosWithDownloadProduct() + { + var testHandler = TestUtil.CreateTestHandler(); + + var response = ApiClient.GetApiClientWithClientCredentials("apiKey", "apiSecret", testHandler).SearchVideosEditorial() + .WithPhrase("cat").WithDownloadProduct(ProductType.Easyaccess).ExecuteAsync().Result; + + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("search/videos/editorial"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("phrase=cat"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("download_product=easyaccess"); + } + [Fact] public void SearchForEditorialVideosWithEditorialVideoType() { diff --git a/UnitTests/Search/SearchVideosTests.cs b/UnitTests/Search/SearchVideosTests.cs index 3dee0d5..b49a44d 100644 --- a/UnitTests/Search/SearchVideosTests.cs +++ b/UnitTests/Search/SearchVideosTests.cs @@ -60,6 +60,19 @@ public void SearchForBlendedVideosWithCollectionFilterType() testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("collections_filter_type=exclude"); } + [Fact] + public void SearchForBlendedVideosWithDownloadProduct() + { + var testHandler = TestUtil.CreateTestHandler(); + + var response = ApiClient.GetApiClientWithClientCredentials("apiKey", "apiSecret", testHandler).SearchVideos() + .WithPhrase("cat").WithDownloadProduct(ProductType.Easyaccess).ExecuteAsync().Result; + + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("search/videos"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("phrase=cat"); + testHandler.Request.RequestUri.AbsoluteUri.Should().Contain("download_product=easyaccess"); + } + [Fact] public void SearchForBlendedVideosWithEditorialVideoType() {