export type CreateApiLocksIdLastToLeaveArgs = {id: number}; export type CreateApiLocksIdLastToLeaveOptions = {baseUrl?: string | undefined, KisiLogin?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reset first to arrive and disable scheduled unlock side effects * * POST /locks/{id}/last_to_leave * * Also accepts auth: OAuth2, Kisi-Group-Link, Kisi-Access-Key */ export const createApiLocksIdLastToLeave = async (args: CreateApiLocksIdLastToLeaveArgs, options?: CreateApiLocksIdLastToLeaveOptions) => { const {baseUrl = "https://api.kisi.io", fetch: fetchFn = fetch, KisiLogin} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (KisiLogin !== undefined) headers.set("Authorization", KisiLogin) const url = `${baseUrl.replace(/\/+$/, '')}/locks/${encodeURIComponent(String(args.id))}/last_to_leave${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };