md-movie-utils
Version:
The ultimate utility to get any information about a movie
1,371 lines (405 loc) • 20.4 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>Class: MovieDBClient | </title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/bootstrap.min.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-jsdoc.css">
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/tui-doc.css">
<link type="text/css" rel="stylesheet" href=".docs.styles.css">
</head>
<body>
<nav class="lnb" id="lnb">
<div class="logo" style="width: 162px; height: 76px">
<img src="https://github.com/dibosh/md-movie-utils/raw/master/md-movie-utils-icon-invert.png" width="100%" height="100%">
</div>
<div class="title">
<h1><a href="index.html" class="link"> </a></h1>
</div>
<div class="search-container" id="search-container">
<input type="text" placeholder="Search">
<ul></ul>
</div>
<div class="lnb-api hidden"><h3>Classes</h3><ul><li><a href="BaseClient.html">BaseClient</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="BaseClient_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="BaseClient.html#get">get</a></li><li><a href="BaseClient.html#search">search</a></li></ul></div></li><li><a href="MovieDBClient.html">MovieDBClient</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="MovieDBClient_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="MovieDBClient.html#.getInstance">getInstance</a></li><li><a href="MovieDBClient.html#get">get</a></li><li><a href="MovieDBClient.html#getByIMDBId">getByIMDBId</a></li><li><a href="MovieDBClient.html#getByTitleAndYear">getByTitleAndYear</a></li><li><a href="MovieDBClient.html#getDetails">getDetails</a></li><li><a href="MovieDBClient.html#search">search</a></li></ul></div></li><li><a href="OMDBAPIClient.html">OMDBAPIClient</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="OMDBAPIClient_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="OMDBAPIClient.html#.getInstance">getInstance</a></li><li><a href="OMDBAPIClient.html#get">get</a></li><li><a href="OMDBAPIClient.html#getByIMDBId">getByIMDBId</a></li><li><a href="OMDBAPIClient.html#getByTitleAndYear">getByTitleAndYear</a></li><li><a href="OMDBAPIClient.html#search">search</a></li></ul></div></li><li><a href="Parser.html">Parser</a><button type="button" class="hidden toggle-subnav btn btn-link"> <span class="glyphicon glyphicon-plus"></span></button><div class="hidden" id="Parser_sub"><div class="member-type">Methods</div><ul class="inner"><li><a href="Parser.html#parseFromTorrentFileName">parseFromTorrentFileName</a></li><li><a href="Parser.html#parseMovieNameAndYear">parseMovieNameAndYear</a></li></ul></div></li></ul></div><div class="lnb-api hidden"><h3>Global</h3><ul><li><a href="global.html#toCamelCase">toCamelCase</a></li></ul></div>
</nav>
<div id="resizer"></div>
<div class="main" id="main">
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>MovieDBClient<span class="signature">(apiKey, baseUrl)</span><span class="type-signature"></span></h2>
<div class="class-description">The Movie Database API Client.</div>
</header>
<article>
<div class="container-overview">
<dt>
<h4 class="name" id="MovieDBClient">
new <span class="type-signature"></span>MovieDBClient<span class="signature">(apiKey, baseUrl)</span><span class="type-signature"></span>
<div class="container-source members">
<code><a href="clients_moviedb.client.js.html">clients/moviedb.client.js</a></code>,
<code><a href="clients_moviedb.client.js.html#line8">line 8</a></code>
</div>
</h4>
</dt>
<dd>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>apiKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The movie db api key (<a href="https://developers.themoviedb.org/3/getting-started/introduction">Ref</a>)</td>
</tr>
<tr>
<td class="name"><code>baseUrl</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Base url for movie db api</td>
</tr>
</tbody>
</table>
</div>
<dl class="details">
</dl>
</dd>
</div>
<h3 class="subsection-title">Extends</h3>
<ul>
<li><a href="BaseClient.html">BaseClient</a></li>
</ul>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id=".getInstance">
<span class="type-signature"><span class="icon green">static</span> </span>getInstance<span class="signature">(apiKey)</span><span class="type-signature"> → {<a href="MovieDBClient.html">MovieDBClient</a>}</span>
<div class="container-source members">
<code><a href="clients_moviedb.client.js.html">clients/moviedb.client.js</a></code>,
<code><a href="clients_moviedb.client.js.html#line21">line 21</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
Get a movie db client instance.
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>apiKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The movie db api key</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type"><a href="MovieDBClient.html">MovieDBClient</a></span>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="get">
<span class="type-signature"></span>get<span class="signature">(options)</span><span class="type-signature"> → {Promise}</span>
<div class="container-source members">
<code><a href="clients_moviedb.client.js.html">clients/moviedb.client.js</a></code>,
<code><a href="clients_moviedb.client.js.html#line49">line 49</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
Get a media(movie/series) by looking up using different params (e.g. title, imdb id, year etc.)
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The options based on which the movie will be fetched.</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">Promise</span>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="BaseClient.html#get">BaseClient#get</a>
</li></ul></dd>
</dl>
<h5>Examples</h5>
<pre class="prettyprint"><code>get({title: 'Saw', year: 2004, type: 'movie'})</code></pre>
<pre class="prettyprint"><code>get({imdbID: 'tt12444'})</code></pre>
</dd>
<dt>
<h4 class="name" id="getByIMDBId">
<span class="type-signature"></span>getByIMDBId<span class="signature">(imdbID)</span><span class="type-signature"> → {Promise}</span>
<div class="container-source members">
<code><a href="clients_moviedb.client.js.html">clients/moviedb.client.js</a></code>,
<code><a href="clients_moviedb.client.js.html#line170">line 170</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
Get a media(movie/series) by IMDB ID
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>imdbID</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">IMDB ID of the media</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">Promise</span>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="getByTitleAndYear">
<span class="type-signature"></span>getByTitleAndYear<span class="signature">(title, year, type<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span>
<div class="container-source members">
<code><a href="clients_moviedb.client.js.html">clients/moviedb.client.js</a></code>,
<code><a href="clients_moviedb.client.js.html#line159">line 159</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
Get a media(movie/series) by title and year
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Attributes</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>title</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">Title of the media (movie/series)</td>
</tr>
<tr>
<td class="name"><code>year</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The year media type(movie/series) was released (Optional).</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
<optional><br>
</td>
<td class="default">
'movie'
</td>
<td class="description last">Type of the media; movie/series (Optional).</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">Promise</span>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="getDetails">
<span class="type-signature"></span>getDetails<span class="signature">(tmdbID, type)</span><span class="type-signature"> → {Promise}</span>
<div class="container-source members">
<code><a href="clients_moviedb.client.js.html">clients/moviedb.client.js</a></code>,
<code><a href="clients_moviedb.client.js.html#line182">line 182</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
Get details of a movie or series with given tmdb id
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>tmdbID</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The Movie DB ID of the media</td>
</tr>
<tr>
<td class="name"><code>type</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The media type; movie/series</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">Promise</span>
</div>
<dl class="details">
</dl>
</dd>
<dt>
<h4 class="name" id="search">
<span class="type-signature"></span>search<span class="signature">(options)</span><span class="type-signature"> → {Promise}</span>
<div class="container-source members">
<code><a href="clients_moviedb.client.js.html">clients/moviedb.client.js</a></code>,
<code><a href="clients_moviedb.client.js.html#line120">line 120</a></code>
</div>
</h4>
</dt>
<dd>
<div class="description">
Search for a movie/series.
</div>
<div class="container-params">
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>options</code></td>
<td class="type">
<span class="param-type">object</span>
</td>
<td class="description last">The options based on which the search will be conducted.</td>
</tr>
</tbody>
</table>
</div>
<div class="container-returns">
<h5>Returns:</h5>
<span class="param-type">Promise</span>
</div>
<dl class="details">
<dt class="tag-overrides">Overrides:</dt>
<dd class="tag-overrides"><ul class="dummy"><li>
<a href="BaseClient.html#search">BaseClient#search</a>
</li></ul></dd>
</dl>
<h5>Example</h5>
<pre class="prettyprint"><code>search({query: 'Saw', year: 2004, type: 'movie'})</code></pre>
</dd>
</dl>
</article>
</section>
</div>
<footer>
<img class="logo" src="https://github.com/dibosh/md-movie-utils/raw/master/md-movie-utils-icon-invert.png" style="width: 162px; height: 76px">
<div class="footer-text">If you liked the module, don't forget to hit a star on github: https://github.com/dibosh/md-movie-utils</div>
</footer>
<script>prettyPrint();</script>
<script src="scripts/jquery.min.js"></script>
<script src="scripts/tui-doc.js"></script>
<script src="scripts/linenumber.js"></script>
<script>
var id = 'MovieDBClient_sub'.replace(/"/g, '_');
var selectedApi = document.getElementById(id); // do not use jquery selector
var $selectedApi = $(selectedApi);
$selectedApi.removeClass('hidden');
$selectedApi.parent().find('.glyphicon').removeClass('glyphicon-plus').addClass('glyphicon-minus');
showLnbApi();
</script>
</body>
</html>