export type GetApiApiV1ApplicationsCompanyCompanyIdArgs = {companyId: string, search?: string | undefined, limit?: number | undefined}; export type GetApiApiV1ApplicationsCompanyCompanyIdOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Gets applications for a company, optionally filtered by search term * * GET /api/v1/applications/company/{companyId} */ export const getApiApiV1ApplicationsCompanyCompanyId = async (args: GetApiApiV1ApplicationsCompanyCompanyIdArgs, options: GetApiApiV1ApplicationsCompanyCompanyIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.search != null) query.append("search", String(args.search)) if (args.limit != null) query.append("limit", String(args.limit)) if (Bearer !== undefined) headers.set('authorization', `Bearer ${Bearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/applications/company/${encodeURIComponent(String(args.companyId))}${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 undefined };