export type CreateApiInvitationsArgs = {body: {invitation?: ({recipient_email?: string | undefined, recipient_password?: string | undefined, recipient_name?: string | undefined, invitation_for?: string | undefined, assistant_patient_access?: boolean | undefined, send_email?: boolean | undefined, configuration?: ({access_to_clinical?: boolean | undefined, access_to_charges?: boolean | undefined, custom_roles?: ({administrator?: boolean | undefined, restricted_medic?: boolean | undefined, all_agendas?: boolean | undefined, access_control?: boolean | undefined}) | undefined}) | undefined, create_user?: boolean | undefined, organization_id?: string | undefined, location_id?: string | undefined, physician_specialty_id?: string | undefined}) | undefined}}; export type CreateApiInvitationsOptions = {baseUrl?: string | undefined, BearerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * POST /invitations * * POST /invitations */ export const createApiInvitations = async (args: CreateApiInvitationsArgs, options?: CreateApiInvitationsOptions) => { const {baseUrl = "https://api.example.test", fetch: fetchFn = fetch, BearerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (BearerAuth !== undefined) headers.set('authorization', `Bearer ${BearerAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/invitations${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 };