export type RfidDTO = {rfid: string, tagFormat?: ('HITAG1' | 'MIFARE' | 'LEGIC' | null) | undefined}; export type RfidListDTO = {rfids: Array}; export type UpdateApiApiV2AccountsAccountIdRfidsArgs = {accountId: string, body: RfidListDTO}; export type UpdateApiApiV2AccountsAccountIdRfidsOptions = {baseUrl?: string | undefined, mms?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update RFIDs of a user * * PUT /api/v2/accounts/{accountId}/rfids */ export const updateApiApiV2AccountsAccountIdRfids = async (args: UpdateApiApiV2AccountsAccountIdRfidsArgs, options?: UpdateApiApiV2AccountsAccountIdRfidsOptions) => { const {baseUrl = "https://mms.api.ed.ts.egym.coffee", fetch: fetchFn = fetch, mms} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (mms !== undefined) headers.set("x-api-key", mms) const url = `${baseUrl.replace(/\/+$/, '')}/api/v2/accounts/${encodeURIComponent(String(args.accountId))}/rfids${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 undefined };