export type MindbodyRestApiDtoModelsLiveStreamLiveStreamStatusChangedRequest = {StudioId?: string | undefined, ClassInstanceId?: string | undefined, MeetingId?: string | undefined, Status?: string | undefined}; export type CreateApiLiveStreamWebhooksStatusChangedArgs = {body: MindbodyRestApiDtoModelsLiveStreamLiveStreamStatusChangedRequest}; export type CreateApiLiveStreamWebhooksStatusChangedOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Callback registered with the live_stream API to ensure that a user is eligible join a live stream session * * POST /live_stream_webhooks/status_changed */ export const createApiLiveStreamWebhooksStatusChanged = async (args: CreateApiLiveStreamWebhooksStatusChangedArgs, options?: CreateApiLiveStreamWebhooksStatusChangedOptions) => { const {baseUrl = "https://api.mindbodyonline.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/live_stream_webhooks/status_changed${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };