export type CreateApiSiteIdAccountPasswordArgs = {site_id: string, email: string}; export type CreateApiSiteIdAccountPasswordOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Reset User Password * * POST /{site_id}/account/password */ export const createApiSiteIdAccountPassword = async (args: CreateApiSiteIdAccountPasswordArgs, options?: CreateApiSiteIdAccountPasswordOptions) => { const {baseUrl = "https://api.viafoura.co/v2", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.email != null) query.append("email", String(args.email)) const url = `${baseUrl.replace(/\/+$/, '')}/${encodeURIComponent(String(args.site_id))}/account/password${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 };