The Users service provides methods for managing users within your SnackBase account.
Overview
import { SnackBaseClient } from "@snackbase/sdk";
const client = new SnackBaseClient({
baseUrl: "https://api.example.com",
});
// Access the users service
const users = client.users;
List Users
const result = await client.users.list();
console.log(result.items);
Get a User
const user = await client.users.get("user-id");
Create a User
const user = await client.users.create({
email: "[email protected]",
password: "SecurePassword123!",
fullName: "John Doe",
isActive: true,
});
The user will need to verify their email if email verification is enabled
in your SnackBase configuration.
Update a User
const updated = await client.users.update("user-id", {
fullName: "Jane Doe",
});
Deactivate a User
await client.users.deactivate("user-id");
Deactivated users cannot log in but their data is preserved.
User Object
interface User {
id: string;
email: string;
fullName?: string;
avatarUrl?: string;
isActive: boolean;
isEmailVerified: boolean;
roleIds: string[];
account: {
id: string;
name: string;
slug: string;
};
createdAt: string;
updatedAt: string;
}
Next Steps