export type CreateApiApi3ScanEnginesSharedSecretOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Scan Engine Shared Secret * * POST /api/3/scan_engines/shared_secret */ export const createApiApi3ScanEnginesSharedSecret = async (options?: CreateApiApi3ScanEnginesSharedSecretOptions) => { const {baseUrl = "https://:", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/plain") const url = `${baseUrl.replace(/\/+$/, '')}/api/3/scan_engines/shared_secret${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.text() };