Merge pull request #426 from LordMike/feature/422-discovermovie-missing-with_release_t

422 DiscoverMovie missing 'with_release_type' parameter
This commit is contained in:
Michael Bisbjerg 2023-01-09 23:14:18 +01:00 committed by GitHub
commit 6420364178
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 30 additions and 1 deletions

View File

@ -4,9 +4,10 @@ using System.Linq;
using TMDbLib.Objects.Companies;
using TMDbLib.Objects.General;
using TMDbLib.Client;
using TMDbLib.Objects.Movies;
using TMDbLib.Objects.Search;
using TMDbLib.Objects.TvShows;
using TMDbLib.Utilities;
using Cast = TMDbLib.Objects.TvShows.Cast;
namespace TMDbLib.Objects.Discover
{
@ -437,5 +438,23 @@ namespace TMDbLib.Objects.Discover
Parameters["with_original_language"] = language;
return this;
}
/// <summary>
/// Specifies that only movies with all the given release types will be returned.
/// </summary>
public DiscoverMovie WithAllOfReleaseTypes(params ReleaseDateType[] releaseTypes)
{
Parameters["with_release_type"] = string.Join(",", releaseTypes.Select(s => ((int)s).ToString()));
return this;
}
/// <summary>
/// Specifies that only movies with the given release types will be returned.
/// </summary>
public DiscoverMovie WithAnyOfReleaseTypes(params ReleaseDateType[] releaseTypes)
{
Parameters["with_release_type"] = string.Join("|", releaseTypes.Select(s => ((int)s).ToString()));
return this;
}
}
}

View File

@ -6,6 +6,7 @@ using TMDbLibTests.Helpers;
using TMDbLibTests.JsonHelpers;
using System;
using System.Threading.Tasks;
using TMDbLib.Objects.Movies;
namespace TMDbLibTests
{
@ -53,6 +54,15 @@ namespace TMDbLibTests
await TestHelpers.SearchPagesAsync(i => query.Query(i));
}
[Fact]
public async Task TestDiscoverMoviesReleaseTypeAsync()
{
DiscoverMovie query = TMDbClient.DiscoverMoviesAsync()
.WithAnyOfReleaseTypes(ReleaseDateType.Premiere);
await TestHelpers.SearchPagesAsync(i => query.Query(i));
}
[Fact]
public async Task TestDiscoverMoviesLanguageAsync()
{