export type UpdateApiV3AccountArgs = {id: string, body: {id?: string | undefined, username?: string | undefined, email?: string | undefined, firstName?: string | undefined, lastName?: string | undefined, active?: boolean | undefined, merchants?: (Array<{id: string, dba?: string | undefined, xmid?: string | undefined}>) | undefined, selectedMerchantId: number, saleLimit?: number | undefined, refundLimit?: number | undefined, role: string, timeRestriction?: ({sunday?: boolean | undefined, monday?: boolean | undefined, tuesday?: boolean | undefined, wednesday?: boolean | undefined, thursday?: boolean | undefined, friday?: boolean | undefined, saturday?: boolean | undefined, startTimeMinute?: string | undefined, endTimeMinute?: string | undefined}) | undefined, mobile?: string | undefined, password?: string | undefined}}; export type UpdateApiV3AccountOptions = {baseUrl?: string | undefined, sec0?: {username: string, password: string} | undefined, fetch?: typeof fetch | undefined}; /** * Update Account (Team Member) * * PUT /v3/account */ export const updateApiV3Account = async (args: UpdateApiV3AccountArgs, options?: UpdateApiV3AccountOptions) => { const {baseUrl = "https://sandbox.api.mxmerchant.com/checkout", fetch: fetchFn = fetch, sec0} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") headers.set('accept', "application/json") if (args.id != null) query.append("id", String(args.id)) if (sec0 !== undefined) headers.set('authorization', `Basic ${btoa(`${sec0.username}:${sec0.password}`)}`) const url = `${baseUrl.replace(/\/+$/, '')}/v3/account${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 (await res.json()) as unknown };