Documentation
¶
Index ¶
- type Account
- func (srv *Account) Create(UserId string, Email string, Password string, optionalSetters ...CreateOption) (*models.User, error)
- func (srv *Account) CreateAnonymousSession() (*models.Session, error)
- func (srv *Account) CreateEmailPasswordSession(Email string, Password string) (*models.Session, error)
- func (srv *Account) CreateEmailToken(UserId string, Email string, optionalSetters ...CreateEmailTokenOption) (*models.Token, error)
- func (srv *Account) CreateJWT() (*models.Jwt, error)
- func (srv *Account) CreateMagicURLToken(UserId string, Email string, optionalSetters ...CreateMagicURLTokenOption) (*models.Token, error)
- func (srv *Account) CreateMfaAuthenticator(Type string) (*models.MfaType, error)
- func (srv *Account) CreateMfaChallenge(Factor string) (*models.MfaChallenge, error)
- func (srv *Account) CreateMfaRecoveryCodes() (*models.MfaRecoveryCodes, error)
- func (srv *Account) CreateOAuth2Token(Provider string, optionalSetters ...CreateOAuth2TokenOption) (*bool, error)
- func (srv *Account) CreatePhoneToken(UserId string, Phone string) (*models.Token, error)
- func (srv *Account) CreatePhoneVerification() (*models.Token, error)
- func (srv *Account) CreateRecovery(Email string, Url string) (*models.Token, error)
- func (srv *Account) CreateSession(UserId string, Secret string) (*models.Session, error)
- func (srv *Account) CreateVerification(Url string) (*models.Token, error)
- func (srv *Account) DeleteIdentity(IdentityId string) (*interface{}, error)
- func (srv *Account) DeleteMfaAuthenticator(Type string) (*interface{}, error)
- func (srv *Account) DeleteSession(SessionId string) (*interface{}, error)
- func (srv *Account) DeleteSessions() (*interface{}, error)
- func (srv *Account) Get() (*models.User, error)
- func (srv *Account) GetMfaRecoveryCodes() (*models.MfaRecoveryCodes, error)
- func (srv *Account) GetPrefs() (*models.Preferences, error)
- func (srv *Account) GetSession(SessionId string) (*models.Session, error)
- func (srv *Account) ListIdentities(optionalSetters ...ListIdentitiesOption) (*models.IdentityList, error)
- func (srv *Account) ListLogs(optionalSetters ...ListLogsOption) (*models.LogList, error)
- func (srv *Account) ListMfaFactors() (*models.MfaFactors, error)
- func (srv *Account) ListSessions() (*models.SessionList, error)
- func (srv *Account) UpdateEmail(Email string, Password string) (*models.User, error)
- func (srv *Account) UpdateMFA(Mfa bool) (*models.User, error)
- func (srv *Account) UpdateMagicURLSession(UserId string, Secret string) (*models.Session, error)
- func (srv *Account) UpdateMfaAuthenticator(Type string, Otp string) (*models.User, error)
- func (srv *Account) UpdateMfaChallenge(ChallengeId string, Otp string) (*models.Session, error)
- func (srv *Account) UpdateMfaRecoveryCodes() (*models.MfaRecoveryCodes, error)
- func (srv *Account) UpdateName(Name string) (*models.User, error)
- func (srv *Account) UpdatePassword(Password string, optionalSetters ...UpdatePasswordOption) (*models.User, error)
- func (srv *Account) UpdatePhone(Phone string, Password string) (*models.User, error)
- func (srv *Account) UpdatePhoneSession(UserId string, Secret string) (*models.Session, error)
- func (srv *Account) UpdatePhoneVerification(UserId string, Secret string) (*models.Token, error)
- func (srv *Account) UpdatePrefs(Prefs interface{}) (*models.User, error)
- func (srv *Account) UpdateRecovery(UserId string, Secret string, Password string) (*models.Token, error)
- func (srv *Account) UpdateSession(SessionId string) (*models.Session, error)
- func (srv *Account) UpdateStatus() (*models.User, error)
- func (srv *Account) UpdateVerification(UserId string, Secret string) (*models.Token, error)
- func (srv *Account) WithCreateEmailTokenPhrase(v bool) CreateEmailTokenOption
- func (srv *Account) WithCreateMagicURLTokenPhrase(v bool) CreateMagicURLTokenOption
- func (srv *Account) WithCreateMagicURLTokenUrl(v string) CreateMagicURLTokenOption
- func (srv *Account) WithCreateName(v string) CreateOption
- func (srv *Account) WithCreateOAuth2TokenFailure(v string) CreateOAuth2TokenOption
- func (srv *Account) WithCreateOAuth2TokenScopes(v []string) CreateOAuth2TokenOption
- func (srv *Account) WithCreateOAuth2TokenSuccess(v string) CreateOAuth2TokenOption
- func (srv *Account) WithListIdentitiesQueries(v []string) ListIdentitiesOption
- func (srv *Account) WithListLogsQueries(v []string) ListLogsOption
- func (srv *Account) WithUpdatePasswordOldPassword(v string) UpdatePasswordOption
- type CreateEmailTokenOption
- type CreateEmailTokenOptions
- type CreateMagicURLTokenOption
- type CreateMagicURLTokenOptions
- type CreateOAuth2TokenOption
- type CreateOAuth2TokenOptions
- type CreateOption
- type CreateOptions
- type ListIdentitiesOption
- type ListIdentitiesOptions
- type ListLogsOption
- type ListLogsOptions
- type UpdatePasswordOption
- type UpdatePasswordOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account service
func (*Account) Create ¶
func (srv *Account) Create(UserId string, Email string, Password string, optionalSetters ...CreateOption) (*models.User, error)
Create use this endpoint to allow a new user to register a new account in your project. After the user registration completes successfully, you can use the [/account/verfication](https://appwrite.io/docs/references/cloud/client-web/account#createVerification) route to start verifying the user email address. To allow the new user to login to their new account, you need to create a new [account session](https://appwrite.io/docs/references/cloud/client-web/account#createEmailSession).
func (*Account) CreateAnonymousSession ¶
CreateAnonymousSession use this endpoint to allow a new user to register an anonymous account in your project. This route will also create a new session for the user. To allow the new user to convert an anonymous account to a normal account, you need to update its [email and password](https://appwrite.io/docs/references/cloud/client-web/account#updateEmail) or create an [OAuth2 session](https://appwrite.io/docs/references/cloud/client-web/account#CreateOAuth2Session).
func (*Account) CreateEmailPasswordSession ¶
func (srv *Account) CreateEmailPasswordSession(Email string, Password string) (*models.Session, error)
CreateEmailPasswordSession allow the user to login into their account by providing a valid email and password combination. This route will create a new session for the user.
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
func (*Account) CreateEmailToken ¶
func (srv *Account) CreateEmailToken(UserId string, Email string, optionalSetters ...CreateEmailTokenOption) (*models.Token, error)
CreateEmailToken sends the user an email with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's email is valid for 15 minutes.
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
func (*Account) CreateJWT ¶
CreateJWT use this endpoint to create a JSON Web Token. You can use the resulting JWT to authenticate on behalf of the current user when working with the Appwrite server-side API and SDKs. The JWT secret is valid for 15 minutes from its creation and will be invalid if the user will logout in that time frame.
func (*Account) CreateMagicURLToken ¶
func (srv *Account) CreateMagicURLToken(UserId string, Email string, optionalSetters ...CreateMagicURLTokenOption) (*models.Token, error)
CreateMagicURLToken sends the user an email with a secret key for creating a session. If the provided user ID has not been registered, a new user will be created. When the user clicks the link in the email, the user is redirected back to the URL you provided with the secret key and userId values attached to the URL query string. Use the query string parameters to submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The link sent to the user's email address is valid for 1 hour.
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
func (*Account) CreateMfaAuthenticator ¶
CreateMfaAuthenticator add an authenticator app to be used as an MFA factor. Verify the authenticator using the [verify authenticator](/docs/references/cloud/client-web/account#updateMfaAuthenticator) method.
func (*Account) CreateMfaChallenge ¶
func (srv *Account) CreateMfaChallenge(Factor string) (*models.MfaChallenge, error)
CreateMfaChallenge begin the process of MFA verification after sign-in. Finish the flow with [updateMfaChallenge](/docs/references/cloud/client-web/account#updateMfaChallenge) method.
func (*Account) CreateMfaRecoveryCodes ¶
func (srv *Account) CreateMfaRecoveryCodes() (*models.MfaRecoveryCodes, error)
CreateMfaRecoveryCodes generate recovery codes as backup for MFA flow. It's recommended to generate and show then immediately after user successfully adds their authehticator. Recovery codes can be used as a MFA verification type in [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
func (*Account) CreateOAuth2Token ¶
func (srv *Account) CreateOAuth2Token(Provider string, optionalSetters ...CreateOAuth2TokenOption) (*bool, error)
CreateOAuth2Token allow the user to login to their account using the OAuth2 provider of their choice. Each OAuth2 provider should be enabled from the Appwrite console first. Use the success and failure arguments to provide a redirect URL's back to your app when login is completed.
If authentication succeeds, `userId` and `secret` of a token will be appended to the success URL as query parameters. These can be used to create a new session using the [Create session](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint.
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
func (*Account) CreatePhoneToken ¶
CreatePhoneToken sends the user an SMS with a secret key for creating a session. If the provided user ID has not be registered, a new user will be created. Use the returned user ID and secret and submit a request to the [POST /v1/account/sessions/token](https://appwrite.io/docs/references/cloud/client-web/account#createSession) endpoint to complete the login process. The secret sent to the user's phone is valid for 15 minutes.
A user is limited to 10 active sessions at a time by default. [Learn more about session limits](https://appwrite.io/docs/authentication-security#limits).
func (*Account) CreatePhoneVerification ¶
CreatePhoneVerification use this endpoint to send a verification SMS to the currently logged in user. This endpoint is meant for use after updating a user's phone number using the [accountUpdatePhone](https://appwrite.io/docs/references/cloud/client-web/account#updatePhone) endpoint. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updatePhoneVerification). The verification code sent to the user's phone number is valid for 15 minutes.
func (*Account) CreateRecovery ¶
CreateRecovery sends the user an email with a temporary secret key for password reset. When the user clicks the confirmation link he is redirected back to your app password reset URL with the secret key and email address values attached to the URL query string. Use the query string params to submit a request to the [PUT /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#updateRecovery) endpoint to complete the process. The verification link sent to the user's email address is valid for 1 hour.
func (*Account) CreateSession ¶
CreateSession use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
func (*Account) CreateVerification ¶
CreateVerification use this endpoint to send a verification message to your user email address to confirm they are the valid owners of that address. Both the **userId** and **secret** arguments will be passed as query parameters to the URL you have provided to be attached to the verification email. The provided URL should redirect the user back to your app and allow you to complete the verification process by verifying both the **userId** and **secret** parameters. Learn more about how to [complete the verification process](https://appwrite.io/docs/references/cloud/client-web/account#updateVerification). The verification link sent to the user's email address is valid for 7 days.
Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md), the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
func (*Account) DeleteIdentity ¶
DeleteIdentity delete an identity by its unique ID.
func (*Account) DeleteMfaAuthenticator ¶
DeleteMfaAuthenticator delete an authenticator for a user by ID.
func (*Account) DeleteSession ¶
DeleteSession logout the user. Use 'current' as the session ID to logout on this device, use a session ID to logout on another device. If you're looking to logout the user on all devices, use [Delete Sessions](https://appwrite.io/docs/references/cloud/client-web/account#deleteSessions) instead.
func (*Account) DeleteSessions ¶
DeleteSessions delete all sessions from the user account and remove any sessions cookies from the end client.
func (*Account) GetMfaRecoveryCodes ¶
func (srv *Account) GetMfaRecoveryCodes() (*models.MfaRecoveryCodes, error)
GetMfaRecoveryCodes get recovery codes that can be used as backup for MFA flow. Before getting codes, they must be generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to read recovery codes.
func (*Account) GetPrefs ¶
func (srv *Account) GetPrefs() (*models.Preferences, error)
GetPrefs get the preferences as a key-value object for the currently logged in user.
func (*Account) GetSession ¶
GetSession use this endpoint to get a logged in user's session using a Session ID. Inputting 'current' will return the current session being used.
func (*Account) ListIdentities ¶
func (srv *Account) ListIdentities(optionalSetters ...ListIdentitiesOption) (*models.IdentityList, error)
ListIdentities get the list of identities for the currently logged in user.
func (*Account) ListLogs ¶
func (srv *Account) ListLogs(optionalSetters ...ListLogsOption) (*models.LogList, error)
ListLogs get the list of latest security activity logs for the currently logged in user. Each log returns user IP address, location and date and time of log.
func (*Account) ListMfaFactors ¶
func (srv *Account) ListMfaFactors() (*models.MfaFactors, error)
ListMfaFactors list the factors available on the account to be used as a MFA challange.
func (*Account) ListSessions ¶
func (srv *Account) ListSessions() (*models.SessionList, error)
ListSessions get the list of active sessions across different devices for the currently logged in user.
func (*Account) UpdateEmail ¶
UpdateEmail update currently logged in user account email address. After changing user address, the user confirmation status will get reset. A new confirmation email is not sent automatically however you can use the send confirmation email endpoint again to send the confirmation email. For security measures, user password is required to complete this request. This endpoint can also be used to convert an anonymous account to a normal one, by passing an email address and a new password.
func (*Account) UpdateMagicURLSession ¶
UpdateMagicURLSession use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
func (*Account) UpdateMfaAuthenticator ¶
UpdateMfaAuthenticator verify an authenticator app after adding it using the [add authenticator](/docs/references/cloud/client-web/account#createMfaAuthenticator) method.
func (*Account) UpdateMfaChallenge ¶
UpdateMfaChallenge complete the MFA challenge by providing the one-time password. Finish the process of MFA verification by providing the one-time password. To begin the flow, use [createMfaChallenge](/docs/references/cloud/client-web/account#createMfaChallenge) method.
func (*Account) UpdateMfaRecoveryCodes ¶
func (srv *Account) UpdateMfaRecoveryCodes() (*models.MfaRecoveryCodes, error)
UpdateMfaRecoveryCodes regenerate recovery codes that can be used as backup for MFA flow. Before regenerating codes, they must be first generated using [createMfaRecoveryCodes](/docs/references/cloud/client-web/account#createMfaRecoveryCodes) method. An OTP challenge is required to regenreate recovery codes.
func (*Account) UpdateName ¶
UpdateName update currently logged in user account name.
func (*Account) UpdatePassword ¶
func (srv *Account) UpdatePassword(Password string, optionalSetters ...UpdatePasswordOption) (*models.User, error)
UpdatePassword update currently logged in user password. For validation, user is required to pass in the new password, and the old password. For users created with OAuth, Team Invites and Magic URL, oldPassword is optional.
func (*Account) UpdatePhone ¶
UpdatePhone update the currently logged in user's phone number. After updating the phone number, the phone verification status will be reset. A confirmation SMS is not sent automatically, however you can use the [POST /account/verification/phone](https://appwrite.io/docs/references/cloud/client-web/account#createPhoneVerification) endpoint to send a confirmation SMS.
func (*Account) UpdatePhoneSession ¶
UpdatePhoneSession use this endpoint to create a session from token. Provide the **userId** and **secret** parameters from the successful response of authentication flows initiated by token creation. For example, magic URL and phone login.
func (*Account) UpdatePhoneVerification ¶
UpdatePhoneVerification use this endpoint to complete the user phone verification process. Use the **userId** and **secret** that were sent to your user's phone number to verify the user email ownership. If confirmed this route will return a 200 status code.
func (*Account) UpdatePrefs ¶
UpdatePrefs update currently logged in user account preferences. 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 (*Account) UpdateRecovery ¶
func (srv *Account) UpdateRecovery(UserId string, Secret string, Password string) (*models.Token, error)
UpdateRecovery use this endpoint to complete the user account password reset. Both the **userId** and **secret** arguments will be passed as query parameters to the redirect URL you have provided when sending your request to the [POST /account/recovery](https://appwrite.io/docs/references/cloud/client-web/account#createRecovery) endpoint.
Please note that in order to avoid a [Redirect Attack](https://github.com/OWASP/CheatSheetSeries/blob/master/cheatsheets/Unvalidated_Redirects_and_Forwards_Cheat_Sheet.md) the only valid redirect URLs are the ones from domains you have set when adding your platforms in the console interface.
func (*Account) UpdateSession ¶
UpdateSession use this endpoint to extend a session's length. Extending a session is useful when session expiry is short. If the session was created using an OAuth provider, this endpoint refreshes the access token from the provider.
func (*Account) UpdateStatus ¶
UpdateStatus block the currently logged in user account. Behind the scene, the user record is not deleted but permanently blocked from any access. To completely delete a user, use the Users API instead.
func (*Account) UpdateVerification ¶
UpdateVerification use this endpoint to complete the user email verification process. Use both the **userId** and **secret** parameters that were attached to your app URL to verify the user email ownership. If confirmed this route will return a 200 status code.
func (*Account) WithCreateEmailTokenPhrase ¶
func (srv *Account) WithCreateEmailTokenPhrase(v bool) CreateEmailTokenOption
func (*Account) WithCreateMagicURLTokenPhrase ¶
func (srv *Account) WithCreateMagicURLTokenPhrase(v bool) CreateMagicURLTokenOption
func (*Account) WithCreateMagicURLTokenUrl ¶
func (srv *Account) WithCreateMagicURLTokenUrl(v string) CreateMagicURLTokenOption
func (*Account) WithCreateName ¶
func (srv *Account) WithCreateName(v string) CreateOption
func (*Account) WithCreateOAuth2TokenFailure ¶
func (srv *Account) WithCreateOAuth2TokenFailure(v string) CreateOAuth2TokenOption
func (*Account) WithCreateOAuth2TokenScopes ¶
func (srv *Account) WithCreateOAuth2TokenScopes(v []string) CreateOAuth2TokenOption
func (*Account) WithCreateOAuth2TokenSuccess ¶
func (srv *Account) WithCreateOAuth2TokenSuccess(v string) CreateOAuth2TokenOption
func (*Account) WithListIdentitiesQueries ¶
func (srv *Account) WithListIdentitiesQueries(v []string) ListIdentitiesOption
func (*Account) WithListLogsQueries ¶
func (srv *Account) WithListLogsQueries(v []string) ListLogsOption
func (*Account) WithUpdatePasswordOldPassword ¶
func (srv *Account) WithUpdatePasswordOldPassword(v string) UpdatePasswordOption
type CreateEmailTokenOption ¶
type CreateEmailTokenOption func(*CreateEmailTokenOptions)
type CreateEmailTokenOptions ¶
type CreateEmailTokenOptions struct { Phrase bool // contains filtered or unexported fields }
func (CreateEmailTokenOptions) New ¶
func (options CreateEmailTokenOptions) New() *CreateEmailTokenOptions
type CreateMagicURLTokenOption ¶
type CreateMagicURLTokenOption func(*CreateMagicURLTokenOptions)
type CreateMagicURLTokenOptions ¶
type CreateMagicURLTokenOptions struct { Url string Phrase bool // contains filtered or unexported fields }
func (CreateMagicURLTokenOptions) New ¶
func (options CreateMagicURLTokenOptions) New() *CreateMagicURLTokenOptions
type CreateOAuth2TokenOption ¶
type CreateOAuth2TokenOption func(*CreateOAuth2TokenOptions)
type CreateOAuth2TokenOptions ¶
type CreateOAuth2TokenOptions struct { Success string Failure string Scopes []string // contains filtered or unexported fields }
func (CreateOAuth2TokenOptions) New ¶
func (options CreateOAuth2TokenOptions) New() *CreateOAuth2TokenOptions
type CreateOption ¶
type CreateOption func(*CreateOptions)
type CreateOptions ¶
type CreateOptions struct { Name string // contains filtered or unexported fields }
func (CreateOptions) New ¶
func (options CreateOptions) New() *CreateOptions
type ListIdentitiesOption ¶
type ListIdentitiesOption func(*ListIdentitiesOptions)
type ListIdentitiesOptions ¶
type ListIdentitiesOptions struct { Queries []string // contains filtered or unexported fields }
func (ListIdentitiesOptions) New ¶
func (options ListIdentitiesOptions) New() *ListIdentitiesOptions
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 UpdatePasswordOption ¶
type UpdatePasswordOption func(*UpdatePasswordOptions)
type UpdatePasswordOptions ¶
type UpdatePasswordOptions struct { OldPassword string // contains filtered or unexported fields }
func (UpdatePasswordOptions) New ¶
func (options UpdatePasswordOptions) New() *UpdatePasswordOptions