v2 endpoints added for clearer intent in endpoints. Two new controller categories; info and search.

This commit is contained in:
2018-10-28 12:21:47 +01:00
parent b2bd7b6a1f
commit 41d6bba743
9 changed files with 232 additions and 1 deletions

View File

@@ -68,6 +68,17 @@ class TMDB {
.then(response => this.mapResults(response));
}
multiSearch(search_query, page=1) {
const query = { query: search_query, page: page };
const cacheKey = `${this.cacheTags.multiSeach}:${page}:${search_query}`;
return Promise.resolve()
.then(() => this.cache.get(cacheKey))
.catch(() => this.tmdb('searchMulti', query))
.catch(() => { throw new Error('Could not complete search to tmdb'); })
.then(response => this.cache.set(cacheKey, response))
.then(response => this.mapResults(response));
}
/**
* Fetches a given list from tmdb.
* @param {String} listName Name of list
@@ -122,7 +133,7 @@ class TMDB {
if (error) {
return reject(error);
}
return resolve(reponse);
resolve(reponse);
};
if (!argument) {