Call methods with placeholders
mainWhen a method's endpoint contains placeholders (e.g., tv/:id), you can provide the required parameters in two ways:
- Object Syntax: Pass an object where the keys match the placeholder names. This is recommended for clarity.
- Single Parameter Syntax: If the method has exactly one placeholder, you can pass the value directly as a single argument.
Note that for methods without placeholders (like searchMovie), you must pass a configuration object containing the valid query parameters defined by the TMDB API (e.g., query, language, page).
// Using object key matching for 'tv/:id'
moviedb.tvInfo({ id: 61888 }).then(...)
// Using single parameter for 'tv/:id'
moviedb.tvInfo(61888).then(...)
// Using query parameters for 'search/movie'
const parameters = {
query: 'Kindergarten Cop',
language: 'fr' // ISO 639-1 code
}
moviedb.searchMovie(parameters).then(...)