2025-09-30 16:53:31 +00:00
|
|
|
|
// Code generated by goctl. DO NOT EDIT.
|
2025-10-02 16:16:33 +00:00
|
|
|
|
// goctl 1.8.1
|
2025-09-30 16:53:31 +00:00
|
|
|
|
|
|
|
|
|
package types
|
|
|
|
|
|
2025-10-02 06:43:57 +00:00
|
|
|
|
type Authorization struct {
|
|
|
|
|
Authorization string `header:"Authorization" validate:"required"`
|
|
|
|
|
}
|
|
|
|
|
|
2025-09-30 16:53:31 +00:00
|
|
|
|
type BaseReq struct {
|
|
|
|
|
}
|
|
|
|
|
|
2025-10-02 06:43:57 +00:00
|
|
|
|
type CredentialsPayload struct {
|
2025-10-02 16:16:33 +00:00
|
|
|
|
Password string `json:"password" validate:"required,min=8,max=128"` // 密碼 (後端應使用 bcrypt 進行雜湊)
|
|
|
|
|
PasswordConfirm string `json:"password_confirm" validate:"eqfield=Password"` // 確認密碼
|
|
|
|
|
AccountType string `json:"account_type" validate:"required,oneof=email phone any"` // 帳號型別 email phone any
|
2025-10-02 06:43:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type ErrorResp struct {
|
|
|
|
|
Code int `json:"code"`
|
|
|
|
|
Msg string `json:"msg"`
|
|
|
|
|
Details string `json:"details,omitempty"`
|
|
|
|
|
Error interface{} `json:"error,omitempty"` // 可選的錯誤信息
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type LoginReq struct {
|
2025-10-02 16:16:33 +00:00
|
|
|
|
AuthMethod string `json:"auth_method" validate:"required,oneof=credentials platform"` // 驗證類型 credentials platform
|
|
|
|
|
LoginID string `json:"login_id" validate:"required,min=3,max=50"` // 信箱或手機號碼
|
|
|
|
|
Credentials *CredentialsPayload `json:"credentials,optional"` // AuthMethod 為 'credentials' 時使用
|
|
|
|
|
Platform *PlatformPayload `json:"platform,optional"` // AuthMethod 為 'platform' 時使用
|
2025-10-02 06:43:57 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type LoginResp struct {
|
|
|
|
|
UID string `json:"uid"`
|
|
|
|
|
AccessToken string `json:"access_token"`
|
|
|
|
|
RefreshToken string `json:"refresh_token"`
|
|
|
|
|
TokenType string `json:"token_type"` // 通常固定為 "Bearer"
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PagerResp struct {
|
|
|
|
|
Total int64 `json:"total"`
|
|
|
|
|
Size int64 `json:"size"`
|
|
|
|
|
Index int64 `json:"index"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PlatformPayload struct {
|
2025-10-02 16:16:33 +00:00
|
|
|
|
Provider string `json:"provider" validate:"required,oneof=google line apple"` // 平台名稱,目前支援 google line apple
|
2025-10-02 06:43:57 +00:00
|
|
|
|
Token string `json:"token" validate:"required"` // 平台提供的 Access Token 或 ID Token
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RefreshTokenReq struct {
|
|
|
|
|
RefreshToken string `json:"refresh_token" validate:"required"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RefreshTokenResp struct {
|
|
|
|
|
AccessToken string `json:"access_token"`
|
|
|
|
|
RefreshToken string `json:"refresh_token"` // 可選:某些策略下刷新後也會換發新的 Refresh Token
|
|
|
|
|
TokenType string `json:"token_type"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RequestPasswordResetReq struct {
|
|
|
|
|
Identifier string `json:"identifier" validate:"required,email|phone"` // 使用者帳號 (信箱或手機)
|
|
|
|
|
AccountType string `json:"account_type" validate:"required,oneof=email phone"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RequestVerificationCodeReq struct {
|
|
|
|
|
Purpose string `json:"purpose" validate:"required,oneof=email_verification phone_verification"`
|
|
|
|
|
Authorization
|
2025-09-30 16:53:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-10-02 06:43:57 +00:00
|
|
|
|
type ResetPasswordReq struct {
|
|
|
|
|
Identifier string `json:"identifier" validate:"required"`
|
|
|
|
|
VerifyCode string `json:"verify_code" validate:"required"` // 來自上一步驗證通過的 Code,作為一種「票證」
|
|
|
|
|
Password string `json:"password" validate:"required,min=8,max=128"` // 新密碼
|
|
|
|
|
PasswordConfirm string `json:"password_confirm" validate:"eqfield=Password"` // 確認新密碼
|
2025-09-30 16:53:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type RespOK struct {
|
2025-10-02 06:43:57 +00:00
|
|
|
|
Code int `json:"code"`
|
|
|
|
|
Msg string `json:"msg"`
|
|
|
|
|
Data interface{} `json:"data,omitempty"`
|
2025-09-30 16:53:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-10-02 06:43:57 +00:00
|
|
|
|
type SubmitVerificationCodeReq struct {
|
|
|
|
|
Purpose string `json:"purpose" validate:"required,oneof=email_verification phone_verification"`
|
|
|
|
|
VerifyCode string `json:"verify_code" validate:"required,len=6"`
|
|
|
|
|
Authorization
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpdatePasswordReq struct {
|
|
|
|
|
CurrentPassword string `json:"current_password" validate:"required"`
|
|
|
|
|
NewPassword string `json:"new_password" validate:"required,min=8,max=128"`
|
|
|
|
|
NewPasswordConfirm string `json:"new_password_confirm" validate:"eqfield=NewPassword"`
|
|
|
|
|
Authorization
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UpdateUserInfoReq struct {
|
|
|
|
|
AvatarURL *string `json:"avatar_url,optional"` // 頭像 URL
|
|
|
|
|
FullName *string `json:"full_name,optional"` // 用戶全名
|
|
|
|
|
Nickname *string `json:"nickname,optional"` // 暱稱
|
|
|
|
|
GenderCode *string `json:"gender_code,optional" validate:"omitempty,oneof=secret male female"` // 性別
|
|
|
|
|
Birthdate *string `json:"birthdate,optional"` // 生日 (格式: 1993-04-17)
|
|
|
|
|
Address *string `json:"address,optional"` // 地址
|
|
|
|
|
PreferredLanguage *string `json:"preferred_language,optional" validate:"omitempty,oneof=zh-tw en-us"` // 語言
|
|
|
|
|
Currency *string `json:"currency,optional" validate:"omitempty,oneof=TWD USD"` // 貨幣代號
|
|
|
|
|
National *string `json:"national,optional"` // 國家
|
|
|
|
|
PostCode *string `json:"post_code,optional"` // 郵遞區號
|
|
|
|
|
Carrier *string `json:"carrier,optional"` // 載具
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type UserInfoResp struct {
|
|
|
|
|
Platform string `json:"platform"` // 註冊平台
|
|
|
|
|
UID string `json:"uid"` // 用戶 UID
|
|
|
|
|
AvatarURL string `json:"avatar_url"` // 頭像 URL
|
|
|
|
|
FullName string `json:"full_name"` // 用戶全名
|
|
|
|
|
Nickname string `json:"nickname"` // 暱稱
|
|
|
|
|
GenderCode string `json:"gender_code"` // 性別代碼
|
|
|
|
|
Birthdate string `json:"birthdate"` // 生日 (格式: 1993-04-17)
|
|
|
|
|
PhoneNumber string `json:"phone_number"` // 電話
|
|
|
|
|
IsPhoneVerified bool `json:"is_phone_verified"` // 手機是否已驗證
|
|
|
|
|
Email string `json:"email"` // 信箱
|
|
|
|
|
IsEmailVerified bool `json:"is_email_verified"` // 信箱是否已驗證
|
|
|
|
|
Address string `json:"address"` // 地址
|
|
|
|
|
UserStatus string `json:"user_status"` // 用戶狀態
|
|
|
|
|
PreferredLanguage string `json:"preferred_language"` // 偏好語言
|
|
|
|
|
Currency string `json:"currency"` // 偏好幣種
|
|
|
|
|
National string `json:"national"` // 國家
|
|
|
|
|
PostCode string `json:"post_code"` // 郵遞區號
|
|
|
|
|
Carrier string `json:"carrier"` // 載具
|
|
|
|
|
Role string `json:"role"` // 角色
|
|
|
|
|
UpdateAt string `json:"update_at"`
|
|
|
|
|
CreateAt string `json:"create_at"`
|
|
|
|
|
Authorization
|
2025-09-30 16:53:31 +00:00
|
|
|
|
}
|
|
|
|
|
|
2025-10-02 06:43:57 +00:00
|
|
|
|
type VerifyCodeReq struct {
|
|
|
|
|
Identifier string `json:"identifier" validate:"required"`
|
|
|
|
|
VerifyCode string `json:"verify_code" validate:"required,len=6"`
|
2025-09-30 16:53:31 +00:00
|
|
|
|
}
|