export type CreateApiLauncherIdHeartbeatArgs = {'x-api-key': string, id: string}; export type CreateApiLauncherIdHeartbeatOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Heartbeat * * POST /launcher/{id}/heartbeat */ export const createApiLauncherIdHeartbeat = async (args: CreateApiLauncherIdHeartbeatArgs, options?: CreateApiLauncherIdHeartbeatOptions) => { const {baseUrl = "https://api.openpage.fun/v1", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['x-api-key'] != null) headers.set("x-api-key", String(args['x-api-key'])) const url = `${baseUrl.replace(/\/+$/, '')}/launcher/${encodeURIComponent(String(args.id))}/heartbeat${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };