export type GetApiApiTasksSearchArgs = {start?: number | undefined, size?: number | undefined, sort?: string | undefined, freeText?: string | undefined, query?: string | undefined}; export type GetApiApiTasksSearchOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Search for tasks based in payload and other parameters * * GET /api/tasks/search */ export const getApiApiTasksSearch = async (args: GetApiApiTasksSearchArgs, options?: GetApiApiTasksSearchOptions) => { const {baseUrl = "https://developer.orkescloud.com", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "*/*") if (args.start != null) query.append("start", String(args.start)) if (args.size != null) query.append("size", String(args.size)) if (args.sort != null) query.append("sort", String(args.sort)) if (args.freeText != null) query.append("freeText", String(args.freeText)) if (args.query != null) query.append("query", String(args.query)) if (apiKey !== undefined) headers.set("X-Authorization", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/tasks/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() };