export type DeleteApiComputeScriptIdArgs = {id: number, deleteLinkedPullZones?: boolean | undefined}; export type DeleteApiComputeScriptIdOptions = {baseUrl?: string | undefined, AccessKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Edge Script * * DELETE /compute/script/{id} * * Also accepts auth: bearer */ export const deleteApiComputeScriptId = async (args: DeleteApiComputeScriptIdArgs, options?: DeleteApiComputeScriptIdOptions) => { const {baseUrl = "https://api.bunny.net", fetch: fetchFn = fetch, AccessKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.deleteLinkedPullZones != null) query.append("deleteLinkedPullZones", String(args.deleteLinkedPullZones)) if (AccessKey !== undefined) headers.set("AccessKey", AccessKey) const url = `${baseUrl.replace(/\/+$/, '')}/compute/script/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };