export type GetApiValidationsArgs = {args?: string | undefined, contains_args?: string | undefined, status?: string | undefined, validator?: string | undefined, order_by?: string | undefined, limit?: number | undefined, offset?: number | undefined}; export type GetApiValidationsOptions = {baseUrl: string, Bearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Returns a list of validations in the system. The data returned is a public-facing subset of the internal data. * * GET /validations * * Also accepts auth: API-Key */ export const getApiValidations = async (args: GetApiValidationsArgs, options: GetApiValidationsOptions) => { const {baseUrl, fetch: fetchFn = fetch, Bearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.args != null) query.append("args", String(args.args)) if (args.contains_args != null) query.append("contains_args", String(args.contains_args)) if (args.status != null) query.append("status", String(args.status)) if (args.validator != null) query.append("validator", String(args.validator)) if (args.order_by != null) query.append("order_by", String(args.order_by)) if (args.limit != null) query.append("limit", String(args.limit)) if (args.offset != null) query.append("offset", String(args.offset)) if (Bearer !== undefined) headers.set("Authorization", Bearer) const url = `${baseUrl.replace(/\/+$/, '')}/validations${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 };