Skip to main content
Module

x/appwrite/mod.ts>Users

[READ-ONLY] Official Appwrite Deno SDK 🦕
Go to Latest
class Users
extends Service
Re-export
import { Users } from "https://deno.land/x/appwrite@6.0.0-RC1/mod.ts";

Constructors

new
Users(client: Client)

Methods

create<Preferences extends Models.Preferences>(
userId: string,
email?: string,
phone?: string,
password?: string,
name?: string,
): Promise<Models.User<Preferences>>

Create User

Create a new user.

createArgon2User<Preferences extends Models.Preferences>(
userId: string,
email: string,
password: string,
name?: string,
): Promise<Models.User<Preferences>>

Create User with Argon2 Password

Create a new user. Password provided must be hashed with the Argon2 algorithm. Use the POST /users endpoint to create users with a plain text password.

createBcryptUser<Preferences extends Models.Preferences>(
userId: string,
email: string,
password: string,
name?: string,
): Promise<Models.User<Preferences>>

Create User with Bcrypt Password

Create a new user. Password provided must be hashed with the Bcrypt algorithm. Use the POST /users endpoint to create users with a plain text password.

createMD5User<Preferences extends Models.Preferences>(
userId: string,
email: string,
password: string,
name?: string,
): Promise<Models.User<Preferences>>

Create User with MD5 Password

Create a new user. Password provided must be hashed with the MD5 algorithm. Use the POST /users endpoint to create users with a plain text password.

createPHPassUser<Preferences extends Models.Preferences>(
userId: string,
email: string,
password: string,
name?: string,
): Promise<Models.User<Preferences>>

Create User with PHPass Password

Create a new user. Password provided must be hashed with the PHPass algorithm. Use the POST /users endpoint to create users with a plain text password.

createScryptModifiedUser<Preferences extends Models.Preferences>(
userId: string,
email: string,
password: string,
passwordSalt: string,
passwordSaltSeparator: string,
passwordSignerKey: string,
name?: string,
): Promise<Models.User<Preferences>>

Create User with Scrypt Modified Password

Create a new user. Password provided must be hashed with the Scrypt Modified algorithm. Use the POST /users endpoint to create users with a plain text password.

createScryptUser<Preferences extends Models.Preferences>(
userId: string,
email: string,
password: string,
passwordSalt: string,
passwordCpu: number,
passwordMemory: number,
passwordParallel: number,
passwordLength: number,
name?: string,
): Promise<Models.User<Preferences>>

Create User with Scrypt Password

Create a new user. Password provided must be hashed with the Scrypt algorithm. Use the POST /users endpoint to create users with a plain text password.

createSHAUser<Preferences extends Models.Preferences>(
userId: string,
email: string,
password: string,
passwordVersion?: string,
name?: string,
): Promise<Models.User<Preferences>>

Create User with SHA Password

Create a new user. Password provided must be hashed with the SHA algorithm. Use the POST /users endpoint to create users with a plain text password.

delete(userId: string): Promise<Response>

Delete User

Delete a user by its unique ID, thereby releasing it's ID. Since ID is released and can be reused, all user-related resources like documents or storage files should be deleted before user deletion. If you want to keep ID reserved, use the updateStatus endpoint instead.

deleteSession(userId: string, sessionId: string): Promise<Response>

Delete User Session

Delete a user sessions by its unique ID.

deleteSessions(userId: string): Promise<Response>

Delete User Sessions

Delete all user's sessions by using the user's unique ID.

get<Preferences extends Models.Preferences>(userId: string): Promise<Models.User<Preferences>>

Get User

Get a user by its unique ID.

getLogs(userId: string, queries?: string[]): Promise<Models.LogList>

Get User Logs

Get the user activity logs list by its unique ID.

getMemberships(userId: string): Promise<Models.MembershipList>

Get User Memberships

Get the user membership list by its unique ID.

getPrefs<Preferences extends Models.Preferences>(userId: string): Promise<Preferences>

Get User Preferences

Get the user preferences by its unique ID.

getSessions(userId: string): Promise<Models.SessionList>

Get User Sessions

Get the user sessions list by its unique ID.

list<Preferences extends Models.Preferences>(queries?: string[], search?: string): Promise<Models.UserList<Preferences>>

List Users

Get a list of all the project's users. You can use the query params to filter your results.

updateEmail<Preferences extends Models.Preferences>(userId: string, email: string): Promise<Models.User<Preferences>>

Update Email

Update the user email by its unique ID.

updateEmailVerification<Preferences extends Models.Preferences>(userId: string, emailVerification: boolean): Promise<Models.User<Preferences>>

Update Email Verification

Update the user email verification status by its unique ID.

updateName<Preferences extends Models.Preferences>(userId: string, name: string): Promise<Models.User<Preferences>>

Update Name

Update the user name by its unique ID.

updatePassword<Preferences extends Models.Preferences>(userId: string, password: string): Promise<Models.User<Preferences>>

Update Password

Update the user password by its unique ID.

updatePhone<Preferences extends Models.Preferences>(userId: string, number: string): Promise<Models.User<Preferences>>

Update Phone

Update the user phone by its unique ID.

updatePhoneVerification<Preferences extends Models.Preferences>(userId: string, phoneVerification: boolean): Promise<Models.User<Preferences>>

Update Phone Verification

Update the user phone verification status by its unique ID.

updatePrefs<Preferences extends Models.Preferences>(userId: string, prefs: object): Promise<Preferences>

Update User Preferences

Update the user preferences by its unique ID. The object you pass is stored as is, and replaces any previous value. The maximum allowed prefs size is 64kB and throws error if exceeded.

updateStatus<Preferences extends Models.Preferences>(userId: string, status: boolean): Promise<Models.User<Preferences>>

Update User Status

Update the user status by its unique ID. Use this endpoint as an alternative to deleting a user if you want to keep user's ID reserved.