import qs from 'querystringify' import {Base, NevoboResponse, Pagination} from "../base"; import {SearchType} from "./types"; export class Searching extends Base { getSearchResult(type: SearchType, query: string, pagination:Pagination = {page:1, limit:50}): Promise> { if (type as SearchType == null) { return this.getArgumentErrorPromise(`Argument ${type} is invalid`); } if(query === "") { return this.getArgumentErrorPromise("Query cannot be empty") } const endpoint = `zoeken` + qs.stringify({ ...pagination, include: type, q: query }, '?'); return this.request(endpoint, true); } }