export type ClubRegisterCommand = {acceptorCode?: string | undefined, description?: string | undefined, discount: number, name?: string | undefined, ownerMobile?: string | undefined, voucher: number}; export type CreateApiApiUserClubRegisterArgs = {body: ClubRegisterCommand}; export type CreateApiApiUserClubRegisterOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * register * * POST /api/user/club/register */ export const createApiApiUserClubRegister = async (args: CreateApiApiUserClubRegisterArgs, options: CreateApiApiUserClubRegisterOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/api/user/club/register${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 };