export type GetApiApiWebhooksCallsArgs = {includeDeleted?: boolean | undefined, webhookId?: string | undefined, contactId?: string | undefined, cursor?: number | undefined, limit?: number | undefined}; export type GetApiApiWebhooksCallsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get webhook call history * * GET /api/webhooks/calls */ export const getApiApiWebhooksCalls = async (args: GetApiApiWebhooksCallsArgs, options?: GetApiApiWebhooksCallsOptions) => { 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)) if (args.webhookId != null) query.append("webhookId", String(args.webhookId)) if (args.contactId != null) query.append("contactId", String(args.contactId)) if (args.cursor != null) query.append("cursor", String(args.cursor)) if (args.limit != null) query.append("limit", String(args.limit)) const url = `${baseUrl.replace(/\/+$/, '')}/api/webhooks/calls${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 };