export type GetApiV1QaLookupArgs = {scanId?: string | undefined, handlingUnitId?: string | undefined, customerId?: string | undefined, customerSlug?: string | undefined}; export type GetApiV1QaLookupOptions = {baseUrl: string, bearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * GET /v1/qa/lookup */ export const getApiV1QaLookup = async (args: GetApiV1QaLookupArgs, options: GetApiV1QaLookupOptions) => { const {baseUrl, fetch: fetchFn = fetch, bearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.scanId != null) query.append("scanId", String(args.scanId)) if (args.handlingUnitId != null) query.append("handlingUnitId", String(args.handlingUnitId)) if (args.customerId != null) query.append("customerId", String(args.customerId)) if (args.customerSlug != null) query.append("customerSlug", String(args.customerSlug)) if (bearerAuth !== undefined) headers.set('authorization', `Bearer ${bearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v1/qa/lookup${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 };