133 lines
3.8 KiB
Plaintext
133 lines
3.8 KiB
Plaintext
syntax = "v1"
|
||
|
||
type (
|
||
MemberMeData {
|
||
TenantID string `json:"tenant_id"`
|
||
UID string `json:"uid"`
|
||
ZitadelEmail string `json:"zitadel_email,omitempty"`
|
||
DisplayName string `json:"display_name,omitempty"`
|
||
Avatar string `json:"avatar,omitempty"`
|
||
Phone string `json:"phone,omitempty"`
|
||
Language string `json:"language,omitempty"`
|
||
Currency string `json:"currency,omitempty"`
|
||
Status string `json:"status"`
|
||
Origin string `json:"origin"`
|
||
BusinessEmail string `json:"business_email,omitempty"`
|
||
BusinessEmailVerified bool `json:"business_email_verified"`
|
||
BusinessPhone string `json:"business_phone,omitempty"`
|
||
BusinessPhoneVerified bool `json:"business_phone_verified"`
|
||
TOTPEnrolled bool `json:"totp_enrolled"`
|
||
CreateAt int64 `json:"create_at"`
|
||
UpdateAt int64 `json:"update_at"`
|
||
}
|
||
|
||
UpdateMemberMeReq {
|
||
DisplayName string `json:"display_name,optional"`
|
||
Avatar string `json:"avatar,optional"`
|
||
Language string `json:"language,optional"`
|
||
Currency string `json:"currency,optional"`
|
||
Phone string `json:"phone,optional"`
|
||
}
|
||
|
||
VerificationStartReq {
|
||
Target string `json:"target"`
|
||
}
|
||
|
||
VerificationStartData {
|
||
ChallengeID string `json:"challenge_id"`
|
||
ExpiresIn int `json:"expires_in"`
|
||
}
|
||
|
||
VerificationConfirmReq {
|
||
ChallengeID string `json:"challenge_id"`
|
||
Code string `json:"code"`
|
||
}
|
||
|
||
TOTPStatusData {
|
||
Enrolled bool `json:"enrolled"`
|
||
EnrolledAt int64 `json:"enrolled_at,omitempty"`
|
||
BackupCodesRemaining int `json:"backup_codes_remaining"`
|
||
Digits int `json:"digits,omitempty"`
|
||
PeriodSeconds int `json:"period_seconds,omitempty"`
|
||
}
|
||
|
||
TOTPEnrollStartData {
|
||
OtpauthURL string `json:"otpauth_url"`
|
||
Issuer string `json:"issuer"`
|
||
Account string `json:"account"`
|
||
Digits int `json:"digits"`
|
||
PeriodSec int `json:"period_seconds"`
|
||
ExpiresIn int `json:"expires_in"`
|
||
}
|
||
|
||
TOTPEnrollConfirmReq {
|
||
Code string `json:"code"`
|
||
}
|
||
|
||
TOTPEnrollConfirmData {
|
||
BackupCodes []string `json:"backup_codes"`
|
||
}
|
||
|
||
TOTPVerifyReq {
|
||
Code string `json:"code"`
|
||
}
|
||
|
||
TOTPBackupCodesData {
|
||
BackupCodes []string `json:"backup_codes"`
|
||
}
|
||
)
|
||
|
||
@server(
|
||
group: member
|
||
prefix: /api/v1/members
|
||
)
|
||
service gateway {
|
||
@doc "取得當前會員 profile(dev:Header X-Tenant-ID + X-UID)"
|
||
@handler getMemberMe
|
||
get /me returns (MemberMeData)
|
||
|
||
@doc "更新當前會員 profile"
|
||
@handler updateMemberMe
|
||
patch /me (UpdateMemberMeReq) returns (MemberMeData)
|
||
|
||
@doc "開始業務 email 驗證"
|
||
@handler startEmailVerification
|
||
post /me/verifications/email/start (VerificationStartReq) returns (VerificationStartData)
|
||
|
||
@doc "確認業務 email 驗證"
|
||
@handler confirmEmailVerification
|
||
post /me/verifications/email/confirm (VerificationConfirmReq)
|
||
|
||
@doc "開始業務 phone 驗證"
|
||
@handler startPhoneVerification
|
||
post /me/verifications/phone/start (VerificationStartReq) returns (VerificationStartData)
|
||
|
||
@doc "確認業務 phone 驗證"
|
||
@handler confirmPhoneVerification
|
||
post /me/verifications/phone/confirm (VerificationConfirmReq)
|
||
|
||
@doc "TOTP 狀態"
|
||
@handler getTOTPStatus
|
||
get /me/totp returns (TOTPStatusData)
|
||
|
||
@doc "開始 TOTP 綁定"
|
||
@handler startTOTPEnroll
|
||
post /me/totp/enroll-start returns (TOTPEnrollStartData)
|
||
|
||
@doc "確認 TOTP 綁定"
|
||
@handler confirmTOTPEnroll
|
||
post /me/totp/enroll-confirm (TOTPEnrollConfirmReq) returns (TOTPEnrollConfirmData)
|
||
|
||
@doc "驗證 TOTP(step-up 測試)"
|
||
@handler verifyTOTP
|
||
post /me/totp/verify (TOTPVerifyReq)
|
||
|
||
@doc "重產 TOTP 備援碼"
|
||
@handler regenerateTOTPBackupCodes
|
||
post /me/totp/backup-codes returns (TOTPBackupCodesData)
|
||
|
||
@doc "解除 TOTP 綁定"
|
||
@handler disableTOTP
|
||
delete /me/totp
|
||
}
|