From 8d09ba4d076360f337d313ed5f4642ac714f6c6a Mon Sep 17 00:00:00 2001 From: KevinMidboe Date: Mon, 25 Nov 2019 22:55:34 +0100 Subject: [PATCH] get movie now has optional url parameters to also include existance and release dates in response --- src/api.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/api.js b/src/api.js index 1d0533b..1023e4d 100644 --- a/src/api.js +++ b/src/api.js @@ -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())