TheMovieDbWrapper 1.0.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package TheMovieDbWrapper --version 1.0.0
NuGet\Install-Package TheMovieDbWrapper -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TheMovieDbWrapper" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TheMovieDbWrapper --version 1.0.0
#r "nuget: TheMovieDbWrapper, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install TheMovieDbWrapper as a Cake Addin
#addin nuget:?package=TheMovieDbWrapper&version=1.0.0

// Install TheMovieDbWrapper as a Cake Tool
#tool nuget:?package=TheMovieDbWrapper&version=1.0.0

TheMovieDb.org Wrapper

TheMovieDbWrapper is a C# wrapper for TheMovieDb.org API providing cross-platform support for Xamarin, iOS, Android, and all flavors of .NET.

A nuget package is available directly through Visual Studio: https://www.nuget.org/packages/TheMovieDbWrapper/

v1.0 Breaking Changes 🤮

The v1.0 release on 2021-10-27 introduces a minor breaking change when 
registering your TheMovieDb.org credentials with our MovieDbFactory.
  • IMovieDbSettings has been completely eliminated and simplifies the process of registering your credentials.
    • You no longer need to create a concrete implementation of the interface when registering your credentials.
    • You no longer need to provide TheMovieDb.org api url.
  • Your TheMovieDb.org credentials now use their updated authentication using a Bearer Token.
    • Your Bearer token is found in your TheMovieDb.org account page, under the API section: "API Read Access Token (v4 auth)".
    • Note: This token IS NOT the same as the old "API Key (v3 auth)".

Common API Requests

The current release supports common requests for movie, tv, and other information, such as:

  • TheMovieDb.org configuration
  • Movies 🎥
  • Movie Ratings
  • TV Shows 📺
  • Movie and TV Genres
  • Movie/TV Industry Specific Professions
  • Production Companies
  • People such as Actors, Actresses, Directors, etc...

Basic Usage

The MovieDbFactory class is the single entry point for retrieving information from TheMovieDb.org API. Before making any requests, you simply need to register your TheMovieDb.org Bearer Token with our MovieDbFactory class:

// your bearer token can be found on TheMovieDb.org's website under your account settings
// https://www.themoviedb.org/settings/api
string bearerToken = "your-bearer-token-from-TheMovieDb.org";

// RegisterSettings only needs to be called one time when your application starts-up.
MovieDbFactory.RegisterSettings( bearerToken );

Once your Bearer Token has been registered, you will then use the .Create<T>() method to get a specific API request type. The full signature of the method is:

Lazy<T> MovieDbFactory.Create<T>() where T : IApiRequest

The IApiRequest is simply an Interface providing a constraint for all our request interfaces/classes used in the factory. For example, to retrieve the API about movies:

// as the factory returns a Lazy<T> instance, simply grab the Value out of the Lazy<T>
// and assign to a local variable.
var movieApi = MovieDbFactory.Create<IApiMovieRequest>().Value;

API Interfaces

The following interfaces are used with the MovieDbFactory.Create<T>() method:

IApiRequest Description
IApiConfigurationRequest Provides access for retrieving TheMovieDb.org configuration information.
IApiMovieRequest Provides access for retrieving information about Movies.
IApiMovieRatingRequest Provides access for retrieving movie rating information.
IApiTVShowRequest Provides access for retrieving information about TV shows.
IApiGenreRequest Provides access for retrieving Movie and TV genres.
IApiCompanyRequest Provides access for retrieving production company information.
IApiProfessionRequest Provides access for retrieving information about Movie/TV industry specific professions.
IApiPeopleRequest Provides access for retrieving information about People.

More Examples

Search by Movie Title

string bearerToken = "your-bearer-token-from-TheMovieDb.org";

// RegisterSettings only needs to be called one time when your application starts-up.
MovieDbFactory.RegisterSettings( bearerToken );

var movieApi = MovieDbFactory.Create<IApiMovieRequest>().Value;

ApiSearchResponse<MovieInfo> response = await movieApi.SearchByTitleAsync( "Star Trek" );

foreach( MovieInfo info in response.Results )
{
    Console.WriteLine( $"{info.Title} ({info.ReleaseDate}): {info.Overview}" );
}

The above example returns an ApiSearchResponse<T> which provides rich information about the results of your search:

Member Description
IReadOnlyList<T> Results The list of results from the search.
int PageNumber The current page number of the search result.
int TotalPages The total number of pages found from the search result.
int TotalResults The total number of results from the search.
ToString() returns "Page x of y (z total results)".
ApiError Error Contains specific error information if an error was encountered during the API call to TheMovieDb.org.
ApiRateLimit RateLimit Contains the current rate limits from your most recent API call to TheMovieDb.org. Note: TheMovieDb.org has removed all rate limits as of December of 2019.
nevermind_this_sad_little_nobr nothing to see here

Find Movie By Id

string bearerToken = "your-bearer-token-from-TheMovieDb.org";

// RegisterSettings only needs to be called one time when your application starts-up.
MovieDbFactory.RegisterSettings( bearerToken );

var movieApi = MovieDbFactory.Create<IApiMovieRequest>().Value;

ApiQueryResponse<Movie> response = await movieApi.FindByIdAsync( 140607 );

Movie movie = response.Item;

Console.WriteLine( movie.Id );
Console.WriteLine( movie.Title );
Console.WriteLine( movie.Tagline );
Console.WriteLine( movie.ReleaseDate );
Console.WriteLine( movie.Budget );

The above query returns an ApiQueryResponse<T> which returns a single result as well as some common information seen in the ApiSearchResponse in the prior example:

Member Description
T Item The item returned from the API call, where T is the specific query such as MovieInfo, Movie, MovieCredit, etc..
ToString() Typically returns a well formatted string of T.
ApiError Error If an error was encountered, this will provide specific error information from the API call to TheMovieDb.org.
ApiRateLimit RateLimit Contains the current rate limits from your most recent API call to TheMovieDb.org. Note: TheMovieDb.org has removed all rate limits as of December of 2019.
nevermind_this_sad_little_nobr nothing to see here

Paging a search result

string bearerToken = "your-bearer-token-from-TheMovieDb.org";

// RegisterSettings only needs to be called one time when your application starts-up.
MovieDbFactory.RegisterSettings( bearerToken );

var movieApi = MovieDbFactory.Create<IApiMovieRequest>().Value;

int pageNumber = 1;
int totalPages;
do
{
    ApiSearchResponse<MovieInfo> response = await movieApi.SearchByTitleAsync( "Harry", pageNumber );

    // alternatively, just call response.ToString() which will provide the same paged information format as below:
    Console.WriteLine( $"Page {response.PageNumber} of {response.TotalPages} ({response.TotalResults} total results)" );

    foreach( MovieInfo info in response.Results )
    {
        Console.WriteLine( $"{info.Title} ({info.ReleaseDate}): {info.Overview}" );
    }

    totalPages = response.TotalPages;
} while( pageNumber++ < totalPages );

Do you have a comprehensive list of examples?

  • The API we've exposed should be fairly straight forward. All interfaces, classes, methods, properties, etc... have full intellisense support. If you need more detailed examples, just ask!
  • You may also browse the suite of integration tests covering all usages of the API.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.3.1 1,230 8/17/2022
1.3.0 858 8/16/2022
1.2.0 914 6/27/2022
1.1.0 854 12/9/2021
1.0.1 887 10/28/2021
1.0.0 763 10/27/2021
0.9.0 1,086 10/28/2020
0.8.2 2,135 2/26/2017
0.8.1 1,571 12/11/2016
0.8.0 1,556 11/27/2016
0.7.2 1,399 11/26/2016
0.7.1 1,581 7/10/2016
0.7.0 1,519 7/10/2016
0.6.0 1,474 7/6/2016
0.5.1 1,720 6/16/2016
0.5.0 1,492 6/1/2016
0.4.0 1,561 5/30/2016
0.3.0 1,617 4/9/2016
0.2.0 1,460 4/6/2016
0.1.0 1,501 3/27/2016

v1.0.0 is a full upgrade to net5.0. This release now uses TheMovieDb.org's Bearer Token for authentication; this change introduces a minor breaking change from the prior releases. See the github ReadMe for full details as you will need to update your implmentation to provide the new Bearer Token with the RegisterSettings method.