Documentation
¶
Overview ¶
Package dto holds the identity module's contract: the request and response types of its facade and HTTP handlers. Their JSON and Swagger names are the public API.
Index ¶
- type AppleLoginCallbackRequest
- type AuthMethodConfig
- type AuthPlatformInfoSnapshot
- type AuthPlatformResponse
- type BatchDeleteUserRequest
- type BindOAuthCallbackRequest
- type BindOAuthRequest
- type BindOAuthResponse
- type BindTelegramResponse
- type CheckUserRequest
- type CheckUserResponse
- type CheckVerificationCodeRequest
- type CheckVerificationCodeResponse
- type CreateUserAuthMethodRequest
- type CreateUserRequest
- type DeleteUserAuthMethodRequest
- type DeleteUserDeviceRequest
- type DeviceLoginRequest
- type GetAuthMethodConfigRequest
- type GetAuthMethodListResponse
- type GetDetailRequest
- type GetDeviceListResponse
- type GetLoginLogRequest
- type GetLoginLogResponse
- type GetOAuthMethodsResponse
- type GetUserAuthMethodRequest
- type GetUserAuthMethodResponse
- type GetUserListRequest
- type GetUserListResponse
- type GetUserLoginLogsRequest
- type GetUserLoginLogsResponse
- type KickOfflineRequest
- type LoginResponse
- type OAuthLoginGetTokenRequest
- type OAuthLoginRequest
- type OAuthLoginResponse
- type ResetPasswordRequest
- type SendCodeRequest
- type SendCodeResponse
- type SendSmsCodeRequest
- type TelephoneCheckUserRequest
- type TelephoneCheckUserResponse
- type TelephoneLoginRequest
- type TelephoneRegisterRequest
- type TelephoneResetPasswordRequest
- type TestEmailSendRequest
- type TestSmsSendRequest
- type UnbindDeviceRequest
- type UnbindOAuthRequest
- type UpdateAuthMethodConfigRequest
- type UpdateBindEmailRequest
- type UpdateBindMobileRequest
- type UpdateUserAuthMethodRequest
- type UpdateUserBasicInfoRequest
- type UpdateUserNotifyRequest
- type UpdateUserNotifySettingRequest
- type UpdateUserPasswordRequest
- type UpdateUserPasswordResponse
- type UpdateUserRulesRequest
- type User
- type UserAuthMethod
- type UserDevice
- type UserLoginLog
- type UserLoginRequest
- type UserRegisterRequest
- type VerifyEmailRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AuthMethodConfig ¶
type AuthPlatformInfoSnapshot ¶
type AuthPlatformInfoSnapshot = integration.Info // @name dto.PlatformInfo
type AuthPlatformResponse ¶
type AuthPlatformResponse struct {
List []AuthPlatformInfoSnapshot `json:"list"`
} // @name dto.PlatformResponse
type BatchDeleteUserRequest ¶
type BatchDeleteUserRequest struct {
Ids []int64 `json:"ids" validate:"required"`
}
type BindOAuthRequest ¶
type BindOAuthResponse ¶
type BindOAuthResponse struct {
Redirect string `json:"redirect"`
}
type BindTelegramResponse ¶
type CheckUserRequest ¶
type CheckUserRequest struct {
Email string `form:"email" validate:"required,email"`
}
type CheckUserResponse ¶
type CheckUserResponse struct {
Exist bool `json:"exist"`
}
type CheckVerificationCodeResponse ¶ added in v1.21.0
type CheckVerificationCodeResponse struct {
Status bool `json:"status"`
} // @name dto.CheckVerificationCodeRespone
type CreateUserRequest ¶
type CreateUserRequest struct {
Email string `json:"email"`
Telephone string `json:"telephone"`
TelephoneAreaCode string `json:"telephone_area_code"`
Password string `json:"password"`
ProductId int64 `json:"product_id"`
Duration int64 `json:"duration"`
ReferralPercentage uint8 `json:"referral_percentage" validate:"lte=100"`
OnlyFirstPurchase bool `json:"only_first_purchase"`
RefererUser string `json:"referer_user"`
ReferCode string `json:"refer_code"`
Balance int64 `json:"balance"`
Commission int64 `json:"commission"`
GiftAmount int64 `json:"gift_amount"`
IsAdmin bool `json:"is_admin"`
}
type DeleteUserDeviceRequest ¶ added in v1.21.0
type DeleteUserDeviceRequest struct {
Id int64 `json:"id"`
} // @name dto.DeleteUserDeivceRequest
type DeviceLoginRequest ¶
type GetAuthMethodConfigRequest ¶
type GetAuthMethodConfigRequest struct {
Method string `form:"method"`
}
type GetAuthMethodListResponse ¶
type GetAuthMethodListResponse struct {
List []AuthMethodConfig `json:"list"`
}
type GetDetailRequest ¶
type GetDetailRequest struct {
Id int64 `form:"id" validate:"required"`
}
type GetDeviceListResponse ¶
type GetDeviceListResponse struct {
List []UserDevice `json:"list"`
Total int64 `json:"total"`
}
type GetLoginLogRequest ¶
type GetLoginLogRequest struct {
Page int `form:"page" validate:"required,gt=0"`
Size int `form:"size" validate:"required,gt=0,lte=100"`
}
Cross-domain view types are module-owned snapshots. They deliberately duplicate JSON shapes instead of coupling one module's API to another.
type GetLoginLogResponse ¶
type GetLoginLogResponse struct {
List []UserLoginLog `json:"list"`
Total int64 `json:"total"`
}
type GetOAuthMethodsResponse ¶
type GetOAuthMethodsResponse struct {
Methods []UserAuthMethod `json:"methods"`
}
type GetUserAuthMethodRequest ¶
type GetUserAuthMethodRequest struct {
UserId int64 `json:"user_id"`
}
type GetUserAuthMethodResponse ¶
type GetUserAuthMethodResponse struct {
AuthMethods []UserAuthMethod `json:"auth_methods"`
}
type GetUserListRequest ¶
type GetUserListRequest struct {
Page int `form:"page" validate:"required,gt=0"`
Size int `form:"size" validate:"required,gt=0,lte=100"`
Search string `form:"search,omitempty"`
UserId *int64 `form:"user_id,omitempty"`
Unscoped bool `form:"unscoped,omitempty"`
SubscribeId *int64 `form:"subscribe_id,omitempty"`
UserSubscribeId *int64 `form:"user_subscribe_id,omitempty"`
UserSubscribeToken string `form:"user_subscribe_token,omitempty"`
}
type GetUserListResponse ¶
type GetUserLoginLogsRequest ¶
type GetUserLoginLogsResponse ¶
type GetUserLoginLogsResponse struct {
List []UserLoginLog `json:"list"`
Total int64 `json:"total"`
}
type KickOfflineRequest ¶
type KickOfflineRequest struct {
Id int64 `json:"id"`
}
type LoginResponse ¶
type LoginResponse struct {
Token string `json:"token"`
// ThirdPartyBindings lists the types of the third-party sign-in methods
// (OAuth providers, Telegram) still bound to the account after a
// password reset, so the client can show them: a binding made during a
// compromise keeps signing in until its owner removes it. Empty for
// every other sign-in.
ThirdPartyBindings []string `json:"third_party_bindings,omitempty"`
}
type OAuthLoginGetTokenRequest ¶
type OAuthLoginGetTokenRequest struct {
Method string `json:"method" validate:"required"` // google, facebook, apple, telegram, github etc.
Callback any `json:"callback" validate:"required"`
Invite string `json:"invite"`
CfToken string `json:"cf_token"`
// Nonce is the value the client sent when it started this sign-in; a
// sign-in started with a nonce is completed only with the same one, and
// one started without a nonce only without one.
Nonce string `json:"nonce" validate:"max=128"`
}
type OAuthLoginRequest ¶ added in v1.21.0
type OAuthLoginRequest struct {
Method string `json:"method" validate:"required"` // google, facebook, apple, telegram, github etc.
Redirect string `json:"redirect"`
// Nonce is an optional random value the client generates and keeps (for
// example in session storage) for this sign-in; it is presented again on
// the token exchange, so a sign-in another browser started cannot be
// completed in this one. At least 16 random characters are recommended.
Nonce string `json:"nonce" validate:"max=128"`
} // @name dto.OAthLoginRequest
type OAuthLoginResponse ¶
type OAuthLoginResponse struct {
Redirect string `json:"redirect"`
}
type ResetPasswordRequest ¶
type SendCodeRequest ¶
type SendCodeRequest struct {
Email string `json:"email" validate:"required,email"`
Type uint8 `json:"type" validate:"required,oneof=1 2"`
// CfToken is the Turnstile response an anonymous request for a
// registration code (type 1) carries while registration verification is
// on; other requests leave it empty.
CfToken string `json:"cf_token"`
}
type SendCodeResponse ¶
type SendSmsCodeRequest ¶
type SendSmsCodeRequest struct {
Type uint8 `json:"type" validate:"required,oneof=1 2"`
Telephone string `json:"telephone" validate:"required"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
// CfToken is the Turnstile response an anonymous request for a
// registration code (type 1) carries while registration verification is
// on; other requests leave it empty.
CfToken string `json:"cf_token"`
}
type TelephoneCheckUserResponse ¶
type TelephoneCheckUserResponse struct {
Exist bool `json:"exist"`
}
type TelephoneLoginRequest ¶
type TelephoneLoginRequest struct {
Identifier string `json:"identifier"`
Telephone string `json:"telephone" validate:"required"`
TelephoneCode string `json:"telephone_code"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
Password string `json:"password"`
CfToken string `json:"cf_token"`
}
type TelephoneRegisterRequest ¶
type TelephoneRegisterRequest struct {
Identifier string `json:"identifier"`
Telephone string `json:"telephone" validate:"required"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
Password string `json:"password" validate:"required,min=8,max=128"`
Invite string `json:"invite"`
Code string `json:"code"`
CfToken string `json:"cf_token"`
}
type TelephoneResetPasswordRequest ¶
type TelephoneResetPasswordRequest struct {
Identifier string `json:"identifier"`
Telephone string `json:"telephone" validate:"required"`
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
Password string `json:"password" validate:"required,min=8,max=128"`
Code string `json:"code"`
CfToken string `json:"cf_token"`
}
type TestEmailSendRequest ¶
type TestEmailSendRequest struct {
Email string `json:"email" validate:"required,email"`
}
type TestSmsSendRequest ¶
type UnbindDeviceRequest ¶
type UnbindDeviceRequest struct {
Id int64 `json:"id" validate:"required"`
}
type UnbindOAuthRequest ¶
type UnbindOAuthRequest struct {
Method string `json:"method"`
}
type UpdateBindEmailRequest ¶
type UpdateBindEmailRequest struct {
Email string `json:"email" validate:"required,email"`
// Code is the register-type verification code sent to Email.
Code string `json:"code" validate:"required"`
// Password is the account's current password. Replacing an email the
// account already has requires it when the account has a password; a
// first binding does not.
Password string `json:"password" validate:"max=128"`
// CurrentCode is the security-type verification code sent to the email
// the account already has. Replacing it requires the code when the
// account has no password.
CurrentCode string `json:"current_code"`
}
type UpdateBindMobileRequest ¶
type UpdateBindMobileRequest struct {
AreaCode string `json:"area_code" validate:"required"`
Mobile string `json:"mobile" validate:"required"`
// Code is the register-type verification code sent to Mobile.
Code string `json:"code" validate:"required"`
// Password is the account's current password. Replacing a number the
// account already has requires it when the account has a password; a
// first binding does not.
Password string `json:"password" validate:"max=128"`
// CurrentCode is the security-type verification code sent to the number
// the account already has. Replacing it requires the code when the
// account has no password.
CurrentCode string `json:"current_code"`
}
type UpdateUserBasicInfoRequest ¶ added in v1.21.0
type UpdateUserBasicInfoRequest struct {
UserId int64 `json:"user_id" validate:"required"`
Password string `json:"password"`
Avatar string `json:"avatar"`
// Balance, Commission and GiftAmount are wallet amounts to set; one
// left out of the request leaves that amount as it is, so a client
// sending only what the administrator edited cannot revert the money
// movements made since the form was loaded.
Balance *int64 `json:"balance"`
Commission *int64 `json:"commission"`
ReferralPercentage uint8 `json:"referral_percentage" validate:"lte=100"`
OnlyFirstPurchase bool `json:"only_first_purchase"`
GiftAmount *int64 `json:"gift_amount"`
Telegram int64 `json:"telegram"`
ReferCode string `json:"refer_code"`
RefererId int64 `json:"referer_id"`
Enable bool `json:"enable"`
IsAdmin bool `json:"is_admin"`
} // @name dto.UpdateUserBasiceInfoRequest
type UpdateUserNotifyRequest ¶
type UpdateUserNotifySettingRequest ¶
type UpdateUserNotifySettingRequest struct {
UserId int64 `json:"user_id" validate:"required"`
EnableBalanceNotify bool `json:"enable_balance_notify"`
EnableLoginNotify bool `json:"enable_login_notify"`
EnableSubscribeNotify bool `json:"enable_subscribe_notify"`
EnableTradeNotify bool `json:"enable_trade_notify"`
}
type UpdateUserPasswordRequest ¶
type UpdateUserPasswordRequest struct {
// OldPassword is required once the account has a password.
OldPassword string `json:"old_password" validate:"max=128"`
Password string `json:"password" validate:"required,min=8,max=128"`
// CurrentCode is the security-type verification code sent to the email
// or phone number the account has bound. Setting the first password of
// an account that has one bound requires it; an account with neither a
// password nor a bound email or phone number (OAuth or device sign-in
// only) sets its first password without it.
CurrentCode string `json:"current_code"`
}
type UpdateUserPasswordResponse ¶ added in v1.21.0
type UpdateUserPasswordResponse struct {
// ThirdPartyBindings lists the types of the third-party sign-in methods
// (OAuth providers, Telegram) still bound to the account, so the client
// can show them: a binding made during a compromise keeps signing in
// until its owner removes it.
ThirdPartyBindings []string `json:"third_party_bindings"`
}
UpdateUserPasswordResponse reports what a password change leaves in place.
type UpdateUserRulesRequest ¶
type UpdateUserRulesRequest struct {
Rules []string `json:"rules" validate:"required"`
}
type User ¶
type User struct {
Id int64 `json:"id"`
Avatar string `json:"avatar"`
Balance int64 `json:"balance"`
Commission int64 `json:"commission"`
ReferralPercentage uint8 `json:"referral_percentage" validate:"lte=100"`
OnlyFirstPurchase bool `json:"only_first_purchase"`
GiftAmount int64 `json:"gift_amount"`
Telegram int64 `json:"telegram"`
ReferCode string `json:"refer_code"`
RefererId int64 `json:"referer_id"`
Enable bool `json:"enable"`
IsAdmin bool `json:"is_admin,omitempty"`
EnableBalanceNotify bool `json:"enable_balance_notify"`
EnableLoginNotify bool `json:"enable_login_notify"`
EnableSubscribeNotify bool `json:"enable_subscribe_notify"`
EnableTradeNotify bool `json:"enable_trade_notify"`
AuthMethods []UserAuthMethod `json:"auth_methods"`
UserDevices []UserDevice `json:"user_devices"`
Rules []string `json:"rules"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
DeletedAt int64 `json:"deleted_at,omitempty"`
}
type UserAuthMethod ¶
type UserDevice ¶
type UserLoginLog ¶
type UserLoginLog struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
LoginIP string `json:"login_ip"`
UserAgent string `json:"user_agent"`
Success bool `json:"success"`
Timestamp int64 `json:"timestamp"`
ActorID int64 `json:"actor_id,omitempty"`
IPCountryCode string `json:"ip_country_code,omitempty"`
IPCountry string `json:"ip_country,omitempty"`
IPRegion string `json:"ip_region,omitempty"`
IPCity string `json:"ip_city,omitempty"`
IPASN uint `json:"ip_asn,omitempty"`
IPASOrganization string `json:"ip_as_organization,omitempty"`
}
type UserLoginRequest ¶
type UserRegisterRequest ¶
type VerifyEmailRequest ¶
Click to show internal directories.
Click to hide internal directories.