mirror of
https://github.com/jellyfin/TMDbLib.git
synced 2024-11-26 23:30:23 +00:00
Merge pull request #345 from cvium/add_language_find
Add language option to Find
This commit is contained in:
commit
a147072e52
@ -11,7 +11,7 @@ namespace TMDbLib.Client
|
|||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// FindAsync movies, people and tv shows by an external id.
|
/// FindAsync movies, people and tv shows by an external id.
|
||||||
/// The following trypes can be found based on the specified external id's
|
/// The following types can be found based on the specified external id's
|
||||||
/// - Movies: Imdb
|
/// - Movies: Imdb
|
||||||
/// - People: Imdb, FreeBaseMid, FreeBaseId, TvRage
|
/// - People: Imdb, FreeBaseMid, FreeBaseId, TvRage
|
||||||
/// - TV Series: Imdb, FreeBaseMid, FreeBaseId, TvRage, TvDb
|
/// - TV Series: Imdb, FreeBaseMid, FreeBaseId, TvRage, TvDb
|
||||||
@ -20,7 +20,24 @@ namespace TMDbLib.Client
|
|||||||
/// <param name="id">The id of the object you wish to located</param>
|
/// <param name="id">The id of the object you wish to located</param>
|
||||||
/// <returns>A list of all objects in TMDb that matched your id</returns>
|
/// <returns>A list of all objects in TMDb that matched your id</returns>
|
||||||
/// <param name="cancellationToken">A cancellation token</param>
|
/// <param name="cancellationToken">A cancellation token</param>
|
||||||
public async Task<FindContainer> FindAsync(FindExternalSource source, string id, CancellationToken cancellationToken = default(CancellationToken))
|
public Task<FindContainer> FindAsync(FindExternalSource source, string id, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
|
{
|
||||||
|
return FindAsync(source, id, null, cancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// FindAsync movies, people and tv shows by an external id.
|
||||||
|
/// The following types can be found based on the specified external id's
|
||||||
|
/// - Movies: Imdb
|
||||||
|
/// - People: Imdb, FreeBaseMid, FreeBaseId, TvRage
|
||||||
|
/// - TV Series: Imdb, FreeBaseMid, FreeBaseId, TvRage, TvDb
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="source">The source the specified id belongs to</param>
|
||||||
|
/// <param name="id">The id of the object you wish to located</param>
|
||||||
|
/// <returns>A list of all objects in TMDb that matched your id</returns>
|
||||||
|
/// <param name="language">If specified the api will attempt to return a localized result. ex: en,it,es.</param>
|
||||||
|
/// <param name="cancellationToken">A cancellation token</param>
|
||||||
|
public async Task<FindContainer> FindAsync(FindExternalSource source, string id, string language, CancellationToken cancellationToken = default(CancellationToken))
|
||||||
{
|
{
|
||||||
RestRequest req = _client.Create("find/{id}");
|
RestRequest req = _client.Create("find/{id}");
|
||||||
|
|
||||||
@ -28,6 +45,10 @@ namespace TMDbLib.Client
|
|||||||
|
|
||||||
req.AddParameter("external_source", source.GetDescription());
|
req.AddParameter("external_source", source.GetDescription());
|
||||||
|
|
||||||
|
language = language ?? DefaultLanguage;
|
||||||
|
if (!string.IsNullOrEmpty(language))
|
||||||
|
req.AddParameter("language", language);
|
||||||
|
|
||||||
RestResponse<FindContainer> resp = await req.ExecuteGet<FindContainer>(cancellationToken).ConfigureAwait(false);
|
RestResponse<FindContainer> resp = await req.ExecuteGet<FindContainer>(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
|
Loading…
Reference in New Issue
Block a user