export type ClubSpecCreateCommand = {amount: number, clubCode: number, groupId?: string | undefined, rewardType: 'VOUCHER' | 'SCORE', specType: 'MEMBERSHIP' | 'BIRTHDAY' | 'INVITE_FRIEND' | 'NEW_PURCHASE' | 'MONTHLY'}; export type CreateApiApiClubSpecCreateArgs = {body: ClubSpecCreateCommand}; export type CreateApiApiClubSpecCreateOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * createClubSpec * * POST /api/club-spec/create */ export const createApiApiClubSpecCreate = async (args: CreateApiApiClubSpecCreateArgs, options: CreateApiApiClubSpecCreateOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/api/club-spec/create${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 res.blob() };