export type CreateApiV2StudentsIdSendPasswordResetArgs = {id: string, domain: string}; export type CreateApiV2StudentsIdSendPasswordResetOptions = {baseUrl: string, JWTAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Send password reset * * POST /v2/students/{id}/send-password-reset/ */ export const createApiV2StudentsIdSendPasswordReset = async (args: CreateApiV2StudentsIdSendPasswordResetArgs, options: CreateApiV2StudentsIdSendPasswordResetOptions) => { const {baseUrl, fetch: fetchFn = fetch, JWTAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.domain != null) query.append("domain", String(args.domain)) if (JWTAuth !== undefined) headers.set('authorization', `Bearer ${JWTAuth}`) const url = `${baseUrl.replace(/\/+$/, '')}/v2/students/${encodeURIComponent(String(args.id))}/send-password-reset/${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 };