export type GetApiAiToolsNsfwCheckerArgs = {url: string}; export type GetApiAiToolsNsfwCheckerOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * AI Image NSFW Checker * * GET /ai-tools/nsfw-checker */ export const getApiAiToolsNsfwChecker = async (args: GetApiAiToolsNsfwCheckerArgs, options?: GetApiAiToolsNsfwCheckerOptions) => { const {baseUrl = "https://api.paxsenix.org", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.url != null) query.append("url", String(args.url)) const url = `${baseUrl.replace(/\/+$/, '')}/ai-tools/nsfw-checker${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 };