users

package
v0.13.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2025 License: BSD-3-Clause Imports: 5 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CreateArgon2UserOption

type CreateArgon2UserOption func(*CreateArgon2UserOptions)

type CreateArgon2UserOptions

type CreateArgon2UserOptions struct {
	Name string
	// contains filtered or unexported fields
}

func (CreateArgon2UserOptions) New

type CreateBcryptUserOption

type CreateBcryptUserOption func(*CreateBcryptUserOptions)

type CreateBcryptUserOptions

type CreateBcryptUserOptions struct {
	Name string
	// contains filtered or unexported fields
}

func (CreateBcryptUserOptions) New

type CreateJWTOption

type CreateJWTOption func(*CreateJWTOptions)

type CreateJWTOptions

type CreateJWTOptions struct {
	SessionId string
	Duration  int
	// contains filtered or unexported fields
}

func (CreateJWTOptions) New

func (options CreateJWTOptions) New() *CreateJWTOptions

type CreateMD5UserOption

type CreateMD5UserOption func(*CreateMD5UserOptions)

type CreateMD5UserOptions

type CreateMD5UserOptions struct {
	Name string
	// contains filtered or unexported fields
}

func (CreateMD5UserOptions) New

type CreateOption

type CreateOption func(*CreateOptions)

type CreateOptions

type CreateOptions struct {
	Email    string
	Phone    string
	Password string
	Name     string
	// contains filtered or unexported fields
}

func (CreateOptions) New

func (options CreateOptions) New() *CreateOptions

type CreatePHPassUserOption

type CreatePHPassUserOption func(*CreatePHPassUserOptions)

type CreatePHPassUserOptions

type CreatePHPassUserOptions struct {
	Name string
	// contains filtered or unexported fields
}

func (CreatePHPassUserOptions) New

type CreateSHAUserOption

type CreateSHAUserOption func(*CreateSHAUserOptions)

type CreateSHAUserOptions

type CreateSHAUserOptions struct {
	PasswordVersion string
	Name            string
	// contains filtered or unexported fields
}

func (CreateSHAUserOptions) New

type CreateScryptModifiedUserOption

type CreateScryptModifiedUserOption func(*CreateScryptModifiedUserOptions)

type CreateScryptModifiedUserOptions

type CreateScryptModifiedUserOptions struct {
	Name string
	// contains filtered or unexported fields
}

func (CreateScryptModifiedUserOptions) New

type CreateScryptUserOption

type CreateScryptUserOption func(*CreateScryptUserOptions)

type CreateScryptUserOptions

type CreateScryptUserOptions struct {
	Name string
	// contains filtered or unexported fields
}

func (CreateScryptUserOptions) New

type CreateTargetOption

type CreateTargetOption func(*CreateTargetOptions)

type CreateTargetOptions

type CreateTargetOptions struct {
	ProviderId string
	Name       string
	// contains filtered or unexported fields
}

func (CreateTargetOptions) New

type CreateTokenOption

type CreateTokenOption func(*CreateTokenOptions)

type CreateTokenOptions

type CreateTokenOptions struct {
	Length int
	Expire int
	// contains filtered or unexported fields
}

func (CreateTokenOptions) New

func (options CreateTokenOptions) New() *CreateTokenOptions

type ListIdentitiesOption

type ListIdentitiesOption func(*ListIdentitiesOptions)

type ListIdentitiesOptions

type ListIdentitiesOptions struct {
	Queries []string
	Search  string
	// contains filtered or unexported fields
}

func (ListIdentitiesOptions) New

type ListLogsOption

type ListLogsOption func(*ListLogsOptions)

type ListLogsOptions

type ListLogsOptions struct {
	Queries []string
	// contains filtered or unexported fields
}

func (ListLogsOptions) New

func (options ListLogsOptions) New() *ListLogsOptions

type ListMembershipsOption added in v0.7.0

type ListMembershipsOption func(*ListMembershipsOptions)

type ListMembershipsOptions added in v0.7.0

type ListMembershipsOptions struct {
	Queries []string
	Search  string
	// contains filtered or unexported fields
}

func (ListMembershipsOptions) New added in v0.7.0

type ListOption

type ListOption func(*ListOptions)

type ListOptions

type ListOptions struct {
	Queries []string
	Search  string
	// contains filtered or unexported fields
}

func (ListOptions) New

func (options ListOptions) New() *ListOptions

type ListTargetsOption

type ListTargetsOption func(*ListTargetsOptions)

type ListTargetsOptions

type ListTargetsOptions struct {
	Queries []string
	// contains filtered or unexported fields
}

func (ListTargetsOptions) New

func (options ListTargetsOptions) New() *ListTargetsOptions

type UpdateTargetOption

type UpdateTargetOption func(*UpdateTargetOptions)

type UpdateTargetOptions

type UpdateTargetOptions struct {
	Identifier string
	ProviderId string
	Name       string
	// contains filtered or unexported fields
}

func (UpdateTargetOptions) New

type Users

type Users struct {
	// contains filtered or unexported fields
}

Users service

func New

func New(clt client.Client) *Users

func (*Users) Create

func (srv *Users) Create(UserId string, optionalSetters ...CreateOption) (*models.User, error)

Create create a new user.

func (*Users) CreateArgon2User

func (srv *Users) CreateArgon2User(UserId string, Email string, Password string, optionalSetters ...CreateArgon2UserOption) (*models.User, error)

CreateArgon2User create a new user. Password provided must be hashed with the [Argon2](https://en.wikipedia.org/wiki/Argon2) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateBcryptUser

func (srv *Users) CreateBcryptUser(UserId string, Email string, Password string, optionalSetters ...CreateBcryptUserOption) (*models.User, error)

CreateBcryptUser create a new user. Password provided must be hashed with the [Bcrypt](https://en.wikipedia.org/wiki/Bcrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateJWT

func (srv *Users) CreateJWT(UserId string, optionalSetters ...CreateJWTOption) (*models.Jwt, error)

CreateJWT use this endpoint to create a JSON Web Token for user by its unique ID. You can use the resulting JWT to authenticate on behalf of the user. The JWT secret will become invalid if the session it uses gets deleted.

func (*Users) CreateMD5User

func (srv *Users) CreateMD5User(UserId string, Email string, Password string, optionalSetters ...CreateMD5UserOption) (*models.User, error)

CreateMD5User create a new user. Password provided must be hashed with the [MD5](https://en.wikipedia.org/wiki/MD5) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateMFARecoveryCodes added in v0.10.0

func (srv *Users) CreateMFARecoveryCodes(UserId string) (*models.MfaRecoveryCodes, error)

CreateMFARecoveryCodes generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK.

func (*Users) CreateMfaRecoveryCodes deprecated

func (srv *Users) CreateMfaRecoveryCodes(UserId string) (*models.MfaRecoveryCodes, error)

CreateMfaRecoveryCodes generate recovery codes used as backup for MFA flow for User ID. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method by client SDK.

Deprecated: This API has been deprecated since 1.8.0. Please use `Users.createMFARecoveryCodes` instead.

func (*Users) CreatePHPassUser

func (srv *Users) CreatePHPassUser(UserId string, Email string, Password string, optionalSetters ...CreatePHPassUserOption) (*models.User, error)

CreatePHPassUser create a new user. Password provided must be hashed with the [PHPass](https://www.openwall.com/phpass/) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateSHAUser

func (srv *Users) CreateSHAUser(UserId string, Email string, Password string, optionalSetters ...CreateSHAUserOption) (*models.User, error)

CreateSHAUser create a new user. Password provided must be hashed with the [SHA](https://en.wikipedia.org/wiki/Secure_Hash_Algorithm) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateScryptModifiedUser

func (srv *Users) CreateScryptModifiedUser(UserId string, Email string, Password string, PasswordSalt string, PasswordSaltSeparator string, PasswordSignerKey string, optionalSetters ...CreateScryptModifiedUserOption) (*models.User, error)

CreateScryptModifiedUser create a new user. Password provided must be hashed with the [Scrypt Modified](https://gist.github.com/Meldiron/eecf84a0225eccb5a378d45bb27462cc) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateScryptUser

func (srv *Users) CreateScryptUser(UserId string, Email string, Password string, PasswordSalt string, PasswordCpu int, PasswordMemory int, PasswordParallel int, PasswordLength int, optionalSetters ...CreateScryptUserOption) (*models.User, error)

CreateScryptUser create a new user. Password provided must be hashed with the [Scrypt](https://github.com/Tarsnap/scrypt) algorithm. Use the [POST /users](https://appwrite.io/docs/server/users#usersCreate) endpoint to create users with a plain text password.

func (*Users) CreateSession

func (srv *Users) CreateSession(UserId string) (*models.Session, error)

CreateSession creates a session for a user. Returns an immediately usable session object.

If you want to generate a token for a custom authentication flow, use the [POST /users/{userId}/tokens](https://appwrite.io/docs/server/users#createToken) endpoint.

func (*Users) CreateTarget

func (srv *Users) CreateTarget(UserId string, TargetId string, ProviderType string, Identifier string, optionalSetters ...CreateTargetOption) (*models.Target, error)

CreateTarget create a messaging target.

func (*Users) CreateToken

func (srv *Users) CreateToken(UserId string, optionalSetters ...CreateTokenOption) (*models.Token, error)

CreateToken returns a token with a secret key for creating a session. Use the user ID and secret and submit a request to the [PUT /account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process.

func (*Users) Delete

func (srv *Users) Delete(UserId string) (*interface{}, error)

Delete 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](https://appwrite.io/docs/server/users#usersUpdateStatus) endpoint instead.

func (*Users) DeleteIdentity

func (srv *Users) DeleteIdentity(IdentityId string) (*interface{}, error)

DeleteIdentity delete an identity by its unique ID.

func (*Users) DeleteMFAAuthenticator added in v0.10.0

func (srv *Users) DeleteMFAAuthenticator(UserId string, Type string) (*interface{}, error)

DeleteMFAAuthenticator delete an authenticator app.

func (*Users) DeleteMfaAuthenticator deprecated

func (srv *Users) DeleteMfaAuthenticator(UserId string, Type string) (*interface{}, error)

DeleteMfaAuthenticator delete an authenticator app.

Deprecated: This API has been deprecated since 1.8.0. Please use `Users.deleteMFAAuthenticator` instead.

func (*Users) DeleteSession

func (srv *Users) DeleteSession(UserId string, SessionId string) (*interface{}, error)

DeleteSession delete a user sessions by its unique ID.

func (*Users) DeleteSessions

func (srv *Users) DeleteSessions(UserId string) (*interface{}, error)

DeleteSessions delete all user's sessions by using the user's unique ID.

func (*Users) DeleteTarget

func (srv *Users) DeleteTarget(UserId string, TargetId string) (*interface{}, error)

DeleteTarget delete a messaging target.

func (*Users) Get

func (srv *Users) Get(UserId string) (*models.User, error)

Get get a user by its unique ID.

func (*Users) GetMFARecoveryCodes added in v0.10.0

func (srv *Users) GetMFARecoveryCodes(UserId string) (*models.MfaRecoveryCodes, error)

GetMFARecoveryCodes get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.

func (*Users) GetMfaRecoveryCodes deprecated

func (srv *Users) GetMfaRecoveryCodes(UserId string) (*models.MfaRecoveryCodes, error)

GetMfaRecoveryCodes get recovery codes that can be used as backup for MFA flow by User ID. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.

Deprecated: This API has been deprecated since 1.8.0. Please use `Users.getMFARecoveryCodes` instead.

func (*Users) GetPrefs

func (srv *Users) GetPrefs(UserId string) (*models.Preferences, error)

GetPrefs get the user preferences by its unique ID.

func (*Users) GetTarget

func (srv *Users) GetTarget(UserId string, TargetId string) (*models.Target, error)

GetTarget get a user's push notification target by ID.

func (*Users) List

func (srv *Users) List(optionalSetters ...ListOption) (*models.UserList, error)

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

func (*Users) ListIdentities

func (srv *Users) ListIdentities(optionalSetters ...ListIdentitiesOption) (*models.IdentityList, error)

ListIdentities get identities for all users.

func (*Users) ListLogs

func (srv *Users) ListLogs(UserId string, optionalSetters ...ListLogsOption) (*models.LogList, error)

ListLogs get the user activity logs list by its unique ID.

func (*Users) ListMFAFactors added in v0.10.0

func (srv *Users) ListMFAFactors(UserId string) (*models.MfaFactors, error)

ListMFAFactors list the factors available on the account to be used as a MFA challange.

func (*Users) ListMemberships

func (srv *Users) ListMemberships(UserId string, optionalSetters ...ListMembershipsOption) (*models.MembershipList, error)

ListMemberships get the user membership list by its unique ID.

func (*Users) ListMfaFactors deprecated

func (srv *Users) ListMfaFactors(UserId string) (*models.MfaFactors, error)

ListMfaFactors list the factors available on the account to be used as a MFA challange.

Deprecated: This API has been deprecated since 1.8.0. Please use `Users.listMFAFactors` instead.

func (*Users) ListSessions

func (srv *Users) ListSessions(UserId string) (*models.SessionList, error)

ListSessions get the user sessions list by its unique ID.

func (*Users) ListTargets

func (srv *Users) ListTargets(UserId string, optionalSetters ...ListTargetsOption) (*models.TargetList, error)

ListTargets list the messaging targets that are associated with a user.

func (*Users) UpdateEmail

func (srv *Users) UpdateEmail(UserId string, Email string) (*models.User, error)

UpdateEmail update the user email by its unique ID.

func (*Users) UpdateEmailVerification

func (srv *Users) UpdateEmailVerification(UserId string, EmailVerification bool) (*models.User, error)

UpdateEmailVerification update the user email verification status by its unique ID.

func (*Users) UpdateLabels

func (srv *Users) UpdateLabels(UserId string, Labels []string) (*models.User, error)

UpdateLabels update the user labels by its unique ID.

Labels can be used to grant access to resources. While teams are a way for user's to share access to a resource, labels can be defined by the developer to grant access without an invitation. See the [Permissions docs](https://appwrite.io/docs/permissions) for more info.

func (*Users) UpdateMFA added in v0.10.0

func (srv *Users) UpdateMFA(UserId string, Mfa bool) (*models.User, error)

UpdateMFA enable or disable MFA on a user account.

func (*Users) UpdateMFARecoveryCodes added in v0.10.0

func (srv *Users) UpdateMFARecoveryCodes(UserId string) (*models.MfaRecoveryCodes, error)

UpdateMFARecoveryCodes regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.

func (*Users) UpdateMfa deprecated

func (srv *Users) UpdateMfa(UserId string, Mfa bool) (*models.User, error)

UpdateMfa enable or disable MFA on a user account.

Deprecated: This API has been deprecated since 1.8.0. Please use `Users.updateMFA` instead.

func (*Users) UpdateMfaRecoveryCodes deprecated

func (srv *Users) UpdateMfaRecoveryCodes(UserId string) (*models.MfaRecoveryCodes, error)

UpdateMfaRecoveryCodes regenerate recovery codes that can be used as backup for MFA flow by User ID. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method.

Deprecated: This API has been deprecated since 1.8.0. Please use `Users.updateMFARecoveryCodes` instead.

func (*Users) UpdateName

func (srv *Users) UpdateName(UserId string, Name string) (*models.User, error)

UpdateName update the user name by its unique ID.

func (*Users) UpdatePassword

func (srv *Users) UpdatePassword(UserId string, Password string) (*models.User, error)

UpdatePassword update the user password by its unique ID.

func (*Users) UpdatePhone

func (srv *Users) UpdatePhone(UserId string, Number string) (*models.User, error)

UpdatePhone update the user phone by its unique ID.

func (*Users) UpdatePhoneVerification

func (srv *Users) UpdatePhoneVerification(UserId string, PhoneVerification bool) (*models.User, error)

UpdatePhoneVerification update the user phone verification status by its unique ID.

func (*Users) UpdatePrefs

func (srv *Users) UpdatePrefs(UserId string, Prefs interface{}) (*models.Preferences, error)

UpdatePrefs 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.

func (*Users) UpdateStatus

func (srv *Users) UpdateStatus(UserId string, Status bool) (*models.User, error)

UpdateStatus 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.

func (*Users) UpdateTarget

func (srv *Users) UpdateTarget(UserId string, TargetId string, optionalSetters ...UpdateTargetOption) (*models.Target, error)

UpdateTarget update a messaging target.

func (*Users) WithCreateArgon2UserName

func (srv *Users) WithCreateArgon2UserName(v string) CreateArgon2UserOption

func (*Users) WithCreateBcryptUserName

func (srv *Users) WithCreateBcryptUserName(v string) CreateBcryptUserOption

func (*Users) WithCreateEmail

func (srv *Users) WithCreateEmail(v string) CreateOption

func (*Users) WithCreateJWTDuration

func (srv *Users) WithCreateJWTDuration(v int) CreateJWTOption

func (*Users) WithCreateJWTSessionId

func (srv *Users) WithCreateJWTSessionId(v string) CreateJWTOption

func (*Users) WithCreateMD5UserName

func (srv *Users) WithCreateMD5UserName(v string) CreateMD5UserOption

func (*Users) WithCreateName

func (srv *Users) WithCreateName(v string) CreateOption

func (*Users) WithCreatePHPassUserName

func (srv *Users) WithCreatePHPassUserName(v string) CreatePHPassUserOption

func (*Users) WithCreatePassword

func (srv *Users) WithCreatePassword(v string) CreateOption

func (*Users) WithCreatePhone

func (srv *Users) WithCreatePhone(v string) CreateOption

func (*Users) WithCreateSHAUserName

func (srv *Users) WithCreateSHAUserName(v string) CreateSHAUserOption

func (*Users) WithCreateSHAUserPasswordVersion

func (srv *Users) WithCreateSHAUserPasswordVersion(v string) CreateSHAUserOption

func (*Users) WithCreateScryptModifiedUserName

func (srv *Users) WithCreateScryptModifiedUserName(v string) CreateScryptModifiedUserOption

func (*Users) WithCreateScryptUserName

func (srv *Users) WithCreateScryptUserName(v string) CreateScryptUserOption

func (*Users) WithCreateTargetName

func (srv *Users) WithCreateTargetName(v string) CreateTargetOption

func (*Users) WithCreateTargetProviderId

func (srv *Users) WithCreateTargetProviderId(v string) CreateTargetOption

func (*Users) WithCreateTokenExpire

func (srv *Users) WithCreateTokenExpire(v int) CreateTokenOption

func (*Users) WithCreateTokenLength

func (srv *Users) WithCreateTokenLength(v int) CreateTokenOption

func (*Users) WithListIdentitiesQueries

func (srv *Users) WithListIdentitiesQueries(v []string) ListIdentitiesOption

func (*Users) WithListIdentitiesSearch

func (srv *Users) WithListIdentitiesSearch(v string) ListIdentitiesOption

func (*Users) WithListLogsQueries

func (srv *Users) WithListLogsQueries(v []string) ListLogsOption

func (*Users) WithListMembershipsQueries added in v0.7.0

func (srv *Users) WithListMembershipsQueries(v []string) ListMembershipsOption

func (*Users) WithListMembershipsSearch added in v0.7.0

func (srv *Users) WithListMembershipsSearch(v string) ListMembershipsOption

func (*Users) WithListQueries

func (srv *Users) WithListQueries(v []string) ListOption

func (*Users) WithListSearch

func (srv *Users) WithListSearch(v string) ListOption

func (*Users) WithListTargetsQueries

func (srv *Users) WithListTargetsQueries(v []string) ListTargetsOption

func (*Users) WithUpdateTargetIdentifier

func (srv *Users) WithUpdateTargetIdentifier(v string) UpdateTargetOption

func (*Users) WithUpdateTargetName

func (srv *Users) WithUpdateTargetName(v string) UpdateTargetOption

func (*Users) WithUpdateTargetProviderId

func (srv *Users) WithUpdateTargetProviderId(v string) UpdateTargetOption

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL