export type GetApiApiWebhooksArgs = {includeDeleted?: boolean | undefined}; export type GetApiApiWebhooksOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get all webhooks for the authenticated user * * GET /api/webhooks */ export const getApiApiWebhooks = async (args: GetApiApiWebhooksArgs, options?: GetApiApiWebhooksOptions) => { const {baseUrl = "https://api.vambe.me", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.includeDeleted != null) query.append("includeDeleted", String(args.includeDeleted)) const url = `${baseUrl.replace(/\/+$/, '')}/api/webhooks${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 };