Skip to content

Commit

Permalink
Merge pull request jellyfin#426 from LordMike/feature/422-discovermov…
Browse files Browse the repository at this point in the history
…ie-missing-with_release_t

422 DiscoverMovie missing 'with_release_type' parameter
  • Loading branch information
LordMike authored Jan 9, 2023
2 parents 5119be4 + 5637232 commit 6420364
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 1 deletion.
21 changes: 20 additions & 1 deletion TMDbLib/Objects/Discover/DiscoverMovie.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
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
{
Expand Down Expand Up @@ -437,5 +438,23 @@ public DiscoverMovie WhereOriginalLanguageIs(string language)
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;
}
}
}
10 changes: 10 additions & 0 deletions TMDbLibTests/ClientDiscoverTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using TMDbLibTests.JsonHelpers;
using System;
using System.Threading.Tasks;
using TMDbLib.Objects.Movies;

namespace TMDbLibTests
{
Expand Down Expand Up @@ -53,6 +54,15 @@ public async Task TestDiscoverMoviesRegionAsync()
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()
{
Expand Down

0 comments on commit 6420364

Please sign in to comment.