export type PatchApiUsersPasswordArgs = {body: {user: {password: string, password_confirmation: string, reset_password_token: string}}}; export type PatchApiUsersPasswordOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reset password * * PATCH /users/password */ export const patchApiUsersPassword = async (args: PatchApiUsersPasswordArgs, options?: PatchApiUsersPasswordOptions) => { const {baseUrl = "https://api.kisi.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") const url = `${baseUrl.replace(/\/+$/, '')}/users/password${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 };