export type CreateApiBroadcastsBroadcastIdSendArgs = {broadcastId: string}; export type CreateApiBroadcastsBroadcastIdSendOptions = {baseUrl?: string | undefined, ApiKeyAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send a broadcast by ID * * POST /broadcasts/{broadcastId}/send */ export const createApiBroadcastsBroadcastIdSend = async (args: CreateApiBroadcastsBroadcastIdSendArgs, options?: CreateApiBroadcastsBroadcastIdSendOptions) => { 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))}/send${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 };