export type CreateApiBroadcastsBroadcastIdPauseArgs = {broadcastId: string}; export type CreateApiBroadcastsBroadcastIdPauseOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Pause a sending broadcast * * POST /broadcasts/{broadcastId}/pause */ export const createApiBroadcastsBroadcastIdPause = async (args: CreateApiBroadcastsBroadcastIdPauseArgs, options?: CreateApiBroadcastsBroadcastIdPauseOptions) => { const {baseUrl = "https://messenger-public-api.cogfy.com", fetch: fetchFn = fetch, ApiKeyAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (ApiKeyAuth !== undefined) headers.set("api-key", ApiKeyAuth) const url = `${baseUrl.replace(/\/+$/, '')}/broadcasts/${encodeURIComponent(String(args.broadcastId))}/pause${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 };