export type CreateApiV1RegistrationsProviderIdGympassArgs = {provider_id?: string | undefined, body: {provider_registration_id?: string | undefined, account_name?: string | undefined, center_id?: string | undefined, schedule_id?: string | undefined, user?: Record | undefined}}; export type CreateApiV1RegistrationsProviderIdGympassOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Register a guest on Gympass * * POST /v1/registrations?provider_id=Gympass */ export const createApiV1RegistrationsProviderIdGympass = async (args: CreateApiV1RegistrationsProviderIdGympassArgs, options?: CreateApiV1RegistrationsProviderIdGympassOptions) => { const {baseUrl = "https://api.zenoti.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.provider_id != null) query.append("provider_id", String(args.provider_id)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/registrations?provider_id=Gympass${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 (await res.json()) as unknown };