export type PatchApiReadersIdArgs = {id: number, body: {reader: {buzzer_enabled?: boolean | undefined, checkout?: boolean | undefined, description?: (string | null) | undefined, device_unlock_restriction_enabled?: boolean | undefined, elevator_id?: (number | null) | undefined, lock_id?: (number | null) | undefined, name?: string | undefined, tamper_enabled?: boolean | undefined, wave_to_unlock_enabled?: boolean | undefined, zone_id?: (number | null) | undefined, terminal_id?: (number | null) | undefined}}}; export type PatchApiReadersIdOptions = {baseUrl?: string | undefined, KisiLogin?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update reader * * PATCH /readers/{id} * * Also accepts auth: OAuth2 */ export const patchApiReadersId = async (args: PatchApiReadersIdArgs, options?: PatchApiReadersIdOptions) => { const {baseUrl = "https://api.kisi.io", fetch: fetchFn = fetch, KisiLogin} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (KisiLogin !== undefined) headers.set("Authorization", KisiLogin) const url = `${baseUrl.replace(/\/+$/, '')}/readers/${encodeURIComponent(String(args.id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PATCH", 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 };