From 8dc5daf3e0c618531c7beb0ceb2d9afdb6111242 Mon Sep 17 00:00:00 2001 From: Rishi Ghan Date: Sun, 15 Aug 2021 17:41:26 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=8E=20Added=20CV=20search=20endpoint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/comicvine.service.ts | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/services/comicvine.service.ts b/services/comicvine.service.ts index 8b6eef1..19cf712 100644 --- a/services/comicvine.service.ts +++ b/services/comicvine.service.ts @@ -14,7 +14,7 @@ export default class GreeterService extends Service { name: "comicvine", actions: { fetchSeries: { - rest: "/fetchseries", + rest: "/fetchresource", params: { format: { type: "string", optional: false }, sort: { type: "string", optional: true }, @@ -63,6 +63,31 @@ export default class GreeterService extends Service { return data; }, }, + search: { + rest: "/search", + params: {}, + handler: async (ctx: Context<{ + format: string; + sort: string; + query: string; + fieldList: string; + limit: string; + offset: string; + resources: string; + }>) => { + const response = await axios.request({ + url: + CV_BASE_URL + + "search" + + "?api_key=" + + CV_API_KEY, + params: ctx.params, + headers: { Accept: "application/json" }, + }); + const { data } = response; + return data; + }, + }, }, }); }