🔎 Added CV search endpoint

This commit is contained in:
2021-08-15 17:41:26 -07:00
parent 9964076687
commit 8dc5daf3e0

View File

@@ -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;
},
},
},
});
}