export type GetApiWebhooksIdArgs = {id: string}; export type GetApiWebhooksIdOptions = {baseUrl?: string | undefined, APIKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Retrieve a web hook * * GET /webhooks/{id} * * Also accepts auth: OAuth2 */ export const getApiWebhooksId = async (args: GetApiWebhooksIdArgs, options?: GetApiWebhooksIdOptions) => { const {baseUrl = "https://core.sivo.com", fetch: fetchFn = fetch, APIKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (APIKeyAuth !== undefined) headers.set("Authorization", APIKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/webhooks/${encodeURIComponent(String(args.id))}${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 };