export type CreateApiTwakeAdminDeactivateUserIdArgs = {id: string}; export type CreateApiTwakeAdminDeactivateUserIdOptions = {baseUrl: string, AccessToken?: string | undefined, fetch?: typeof fetch | undefined}; /** * Deactivate a user * * POST /_twake/admin/deactivate-user/{id} */ export const createApiTwakeAdminDeactivateUserId = async (args: CreateApiTwakeAdminDeactivateUserIdArgs, options: CreateApiTwakeAdminDeactivateUserIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, AccessToken} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (AccessToken !== undefined) headers.set("x-access-token", AccessToken) const url = `${baseUrl.replace(/\/+$/, '')}/_twake/admin/deactivate-user/${encodeURIComponent(String(args.id))}${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 };