export type GetApiApplicationSearchArgs = {Authorization: string, merchantBranches: Array, statuses?: (Array<'IN_PROGRESS' | 'CANCEL' | 'SUCCESS'>) | undefined, startFrom?: number | undefined, totalCount?: number | undefined, terms?: Array | undefined}; export type GetApiApplicationSearchOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /application/search */ export const getApiApplicationSearch = async (args: GetApiApplicationSearchArgs, options?: GetApiApplicationSearchOptions) => { const {baseUrl = "https://api.velox.am", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.Authorization != null) headers.set("Authorization", String(args.Authorization)) for (const item of args.merchantBranches ?? []) query.append("merchantBranches", String(item)) for (const item of args.statuses ?? []) query.append("statuses", String(item)) if (args.startFrom != null) query.append("startFrom", String(args.startFrom)) if (args.totalCount != null) query.append("totalCount", String(args.totalCount)) for (const item of args.terms ?? []) query.append("terms", String(item)) if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/application/search${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };