export type CreateApiApiUserUserIdUserCredentialsEnabledArgs = {userId: string, userCredentialsEnabled?: string | undefined}; export type CreateApiApiUserUserIdUserCredentialsEnabledOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Enable/Disable User credentials (setUserCredentialsEnabled) * * POST /api/user/{userId}/userCredentialsEnabled */ export const createApiApiUserUserIdUserCredentialsEnabled = async (args: CreateApiApiUserUserIdUserCredentialsEnabledArgs, options?: CreateApiApiUserUserIdUserCredentialsEnabledOptions) => { const {baseUrl = "https://demo.thingsboard.io", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.userCredentialsEnabled != null) query.append("userCredentialsEnabled", String(args.userCredentialsEnabled)) const url = `${baseUrl.replace(/\/+$/, '')}/api/user/${encodeURIComponent(String(args.userId))}/userCredentialsEnabled${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 };