export type GetApiTriggersIdViewArgs = {id: string}; export type GetApiTriggersIdViewOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * View a trigger interactively * * GET /triggers/{id}/view */ export const getApiTriggersIdView = async (args: GetApiTriggersIdViewArgs, options?: GetApiTriggersIdViewOptions) => { const {baseUrl = "https://api.pocketflows.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "text/html") const url = `${baseUrl.replace(/\/+$/, '')}/triggers/${encodeURIComponent(String(args.id))}/view${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 res.text() };