get movie now has optional url parameters to also include existance and release dates in response

This commit is contained in:
2019-11-25 22:55:34 +01:00
parent ba670d06aa
commit 8d09ba4d07

View File

@@ -18,12 +18,18 @@ const ELASTIC_INDEX = config.ELASTIC_INDEX
* @param {boolean} [credits=false] Include credits
* @returns {object} Tmdb response
*/
const getMovie = (id, credits=false) => {
const getMovie = (id, checkExistance=false, credits=false, release_dates=false) => {
const url = new URL('v2/movie', SEASONED_URL)
url.pathname = path.join(url.pathname, id.toString())
if (checkExistance) {
url.searchParams.append('check_existance', true)
}
if (credits) {
url.searchParams.append('credits', true)
}
if(release_dates) {
url.searchParams.append('release_dates', true)
}
return fetch(url.href)
.then(resp => resp.json())