export type User = {activated: boolean, clubCardNumber?: number | undefined, clubCode?: number | undefined, clubType?: ('AYRIA' | 'PERSEPOLIS' | 'KARAFARIN' | 'BIMEHKHAVARMIYANE') | undefined, email?: string | undefined, firstName?: string | undefined, fullname?: string | undefined, gender?: ('MALE' | 'FEMALE') | undefined, id?: number | undefined, imageUrl?: string | undefined, langKey?: string | undefined, lastName?: string | undefined, locked?: boolean | undefined, login: string, mobile?: string | undefined, nickname?: string | undefined, notSystem?: boolean | undefined, originClubCode?: number | undefined, persepolisi?: boolean | undefined, plan?: ('BASIC' | 'GOLD' | 'STAR' | 'GALAXY') | undefined, system?: boolean | undefined}; export type Card = {activated?: boolean | undefined, bank?: string | undefined, cardShebaNumber?: string | undefined, deleted?: boolean | undefined, id?: number | undefined, mask: string, nbr?: number | undefined, owner: User}; export type UpdateApiApiCardsArgs = {body: Card}; export type UpdateApiApiCardsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * updateCard * * PUT /api/cards */ export const updateApiApiCards = async (args: UpdateApiApiCardsArgs, options: UpdateApiApiCardsOptions) => { 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/cards${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", 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() };