export type DeactivateUserRequest = {email: string}; export type CreateApiV1UsersDeactivateArgs = {body: DeactivateUserRequest}; export type CreateApiV1UsersDeactivateOptions = {baseUrl?: string | undefined, managerAuth?: string | undefined, fetch?: typeof fetch | undefined}; /** * Disable user by email address * * POST /v1/users/deactivate * * Also accepts auth: management_key */ export const createApiV1UsersDeactivate = async (args: CreateApiV1UsersDeactivateArgs, options?: CreateApiV1UsersDeactivateOptions) => { const {baseUrl = "https://yourbaseurl.talon.one", fetch: fetchFn = fetch, managerAuth} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (managerAuth !== undefined) headers.set("Authorization", managerAuth) const url = `${baseUrl.replace(/\/+$/, '')}/v1/users/deactivate${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", 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 };