Help us shape the future of Go! Take the 2026 Go Developer Survey

dto

package
v1.21.2 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: GPL-3.0 Imports: 1 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppleLoginCallbackRequest

type AppleLoginCallbackRequest struct {
	Code    string `form:"code"`
	IDToken string `form:"id_token"`
	State   string `form:"state"`
}

type AuthMethodConfig

type AuthMethodConfig struct {
	Id      int64  `json:"id"`
	Method  string `json:"method"`
	Config  any    `json:"config"`
	Enabled bool   `json:"enabled"`
}

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 BindOAuthCallbackRequest

type BindOAuthCallbackRequest struct {
	Method   string `json:"method" validate:"required,oneof=google apple telegram github facebook"`
	Callback any    `json:"callback" validate:"required"`
}

type BindOAuthRequest

type BindOAuthRequest struct {
	Method   string `json:"method" validate:"required,oneof=google apple telegram github facebook"`
	Redirect string `json:"redirect" validate:"required"`
}

type BindOAuthResponse

type BindOAuthResponse struct {
	Redirect string `json:"redirect"`
}

type BindTelegramResponse

type BindTelegramResponse struct {
	Url       string `json:"url"`
	ExpiredAt int64  `json:"expired_at"`
}

type CheckUserRequest

type CheckUserRequest struct {
	Email string `form:"email" validate:"required,email"`
}

type CheckUserResponse

type CheckUserResponse struct {
	Exist bool `json:"exist"`
}

type CheckVerificationCodeRequest

type CheckVerificationCodeRequest struct {
	Method  string `json:"method" validate:"required,oneof=email mobile"`
	Account string `json:"account" validate:"required"`
	Code    string `json:"code" validate:"required"`
	Type    uint8  `json:"type" validate:"required,oneof=1 2"`
}

type CheckVerificationCodeResponse added in v1.21.0

type CheckVerificationCodeResponse struct {
	Status bool `json:"status"`

} // @name dto.CheckVerificationCodeRespone

type CreateUserAuthMethodRequest

type CreateUserAuthMethodRequest struct {
	UserId         int64  `json:"user_id"`
	AuthType       string `json:"auth_type"`
	AuthIdentifier string `json:"auth_identifier"`
}

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 DeleteUserAuthMethodRequest

type DeleteUserAuthMethodRequest struct {
	UserId   int64  `json:"user_id"`
	AuthType string `json:"auth_type"`
}

type DeleteUserDeviceRequest added in v1.21.0

type DeleteUserDeviceRequest struct {
	Id int64 `json:"id"`

} // @name dto.DeleteUserDeivceRequest

type DeviceLoginRequest

type DeviceLoginRequest struct {
	Identifier string `json:"identifier" validate:"required,max=255"`
	Invite     string `json:"invite"`
	CfToken    string `json:"cf_token"`
}

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 GetUserListResponse struct {
	Total int64  `json:"total"`
	List  []User `json:"list"`
}

type GetUserLoginLogsRequest

type GetUserLoginLogsRequest struct {
	Page   int   `form:"page" validate:"required,gt=0"`
	Size   int   `form:"size" validate:"required,gt=0,lte=100"`
	UserId int64 `form:"user_id"`
}

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 ResetPasswordRequest struct {
	Identifier string `json:"identifier"`
	Email      string `json:"email" validate:"required,email"`
	Password   string `json:"password" validate:"required,min=8,max=128"`
	Code       string `json:"code"`
	CfToken    string `json:"cf_token"`
}

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 SendCodeResponse struct {
	Code   string `json:"code,omitempty"`
	Status bool   `json:"status"`
}

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 TelephoneCheckUserRequest

type TelephoneCheckUserRequest struct {
	Telephone         string `form:"telephone" validate:"required"`
	TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
}

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 TestSmsSendRequest struct {
	AreaCode  string `json:"area_code" validate:"required"`
	Telephone string `json:"telephone" validate:"required"`
}

type UnbindDeviceRequest

type UnbindDeviceRequest struct {
	Id int64 `json:"id" validate:"required"`
}

type UnbindOAuthRequest

type UnbindOAuthRequest struct {
	Method string `json:"method"`
}

type UpdateAuthMethodConfigRequest

type UpdateAuthMethodConfigRequest struct {
	Id      int64  `json:"id"`
	Method  string `json:"method"`
	Config  any    `json:"config"`
	Enabled *bool  `json:"enabled"`
}

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 UpdateUserAuthMethodRequest

type UpdateUserAuthMethodRequest struct {
	UserId         int64  `json:"user_id"`
	AuthType       string `json:"auth_type"`
	AuthIdentifier string `json:"auth_identifier"`
}

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 UpdateUserNotifyRequest struct {
	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 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 UserAuthMethod struct {
	AuthType       string `json:"auth_type"`
	AuthIdentifier string `json:"auth_identifier"`
	Verified       bool   `json:"verified"`
}

type UserDevice

type UserDevice struct {
	Id         int64  `json:"id"`
	Ip         string `json:"ip"`
	Identifier string `json:"identifier"`
	UserAgent  string `json:"user_agent"`
	Online     bool   `json:"online"`
	Enabled    bool   `json:"enabled"`
	CreatedAt  int64  `json:"created_at"`
	UpdatedAt  int64  `json:"updated_at"`
}

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 UserLoginRequest struct {
	Identifier string `json:"identifier"`
	Email      string `json:"email" validate:"required,email"`
	Password   string `json:"password" validate:"required"`
	CfToken    string `json:"cf_token"`
}

type UserRegisterRequest

type UserRegisterRequest struct {
	Identifier string `json:"identifier"`
	Email      string `json:"email" validate:"required,email"`
	Password   string `json:"password" validate:"required,min=8,max=128"`
	Invite     string `json:"invite"`
	Code       string `json:"code"`
	CfToken    string `json:"cf_token"`
}

type VerifyEmailRequest

type VerifyEmailRequest struct {
	Email string `json:"email" validate:"required,email"`
	Code  string `json:"code" validate:"required"`
}

Jump to

Keyboard shortcuts

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