export type GetApiSecurityScanArgs = {minAge?: string | undefined, maxNodes?: number | undefined}; export type GetApiSecurityScanOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Security Scan * * GET /security-scan */ export const getApiSecurityScan = async (args: GetApiSecurityScanArgs, options?: GetApiSecurityScanOptions) => { const {baseUrl = "https://api.comfy.org", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.minAge != null) query.append("minAge", String(args.minAge)) if (args.maxNodes != null) query.append("maxNodes", String(args.maxNodes)) const url = `${baseUrl.replace(/\/+$/, '')}/security-scan${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 };