init: 1.0.0
This commit is contained in:
+125
@@ -0,0 +1,125 @@
|
||||
syntax = "v1"
|
||||
|
||||
info (
|
||||
title: "Common API"
|
||||
desc: "API for ppanel"
|
||||
author: "Tension"
|
||||
email: "tension@ppanel.com"
|
||||
version: "0.0.1"
|
||||
)
|
||||
|
||||
import "./types.api"
|
||||
|
||||
type (
|
||||
VeifyConfig {
|
||||
TurnstileSiteKey string `json:"turnstile_site_key"`
|
||||
EnableLoginVerify bool `json:"enable_login_verify"`
|
||||
EnableRegisterVerify bool `json:"enable_register_verify"`
|
||||
EnableResetPasswordVerify bool `json:"enable_reset_password_verify"`
|
||||
}
|
||||
GetGlobalConfigResponse {
|
||||
Site SiteConfig `json:"site"`
|
||||
Verify VeifyConfig `json:"verify"`
|
||||
Auth AuthConfig `json:"auth"`
|
||||
Invite InviteConfig `json:"invite"`
|
||||
Currency Currency `json:"currency"`
|
||||
Subscribe SubscribeConfig `json:"subscribe"`
|
||||
VerifyCode PubilcVerifyCodeConfig `json:"verify_code"`
|
||||
OAuthMethods []string `json:"oauth_methods"`
|
||||
WebAd bool `json:"web_ad"`
|
||||
}
|
||||
Currency {
|
||||
CurrencyUnit string `json:"currency_unit"`
|
||||
CurrencySymbol string `json:"currency_symbol"`
|
||||
}
|
||||
GetTosResponse {
|
||||
TosContent string `json:"tos_content"`
|
||||
}
|
||||
GetAppcationResponse {
|
||||
Config ApplicationConfig `json:"config"`
|
||||
Applications []ApplicationResponseInfo `json:"applications"`
|
||||
}
|
||||
// GetCodeRequest Get code request
|
||||
SendCodeRequest {
|
||||
Email string `json:"email" validate:"required"`
|
||||
Type uint8 `json:"type" validate:"required"`
|
||||
}
|
||||
SendSmsCodeRequest {
|
||||
Type uint8 `json:"type" validate:"required"`
|
||||
Telephone string `json:"telephone" validate:"required"`
|
||||
TelephoneAreaCode string `json:"telephone_area_code" validate:"required"`
|
||||
}
|
||||
// GetCodeResponse Get code response
|
||||
SendCodeResponse {
|
||||
Code string `json:"code,omitempty"`
|
||||
Status bool `json:"status"`
|
||||
}
|
||||
// GetStatResponse Get stat response
|
||||
GetStatResponse {
|
||||
User int64 `json:"user"`
|
||||
Node int64 `json:"node"`
|
||||
Country int64 `json:"country"`
|
||||
Protocol []string `json:"protocol"`
|
||||
}
|
||||
// Get ads
|
||||
GetAdsRequest {
|
||||
Device string `form:"device"`
|
||||
Position string `form:"position"`
|
||||
}
|
||||
GetAdsResponse {
|
||||
List []Ads `json:"list"`
|
||||
}
|
||||
CheckVerificationCodeRequest {
|
||||
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"`
|
||||
}
|
||||
|
||||
CheckVerificationCodeRespone{
|
||||
Status bool `json:"status"`
|
||||
}
|
||||
)
|
||||
|
||||
@server (
|
||||
prefix: v1/common
|
||||
group: common
|
||||
)
|
||||
service ppanel {
|
||||
@doc "Get global config"
|
||||
@handler GetGlobalConfig
|
||||
get /site/config returns (GetGlobalConfigResponse)
|
||||
|
||||
@doc "Get Tos Content"
|
||||
@handler GetApplication
|
||||
get /application returns (GetAppcationResponse)
|
||||
|
||||
@doc "Get Tos Content"
|
||||
@handler GetTos
|
||||
get /site/tos returns (GetTosResponse)
|
||||
|
||||
@doc "Get Privacy Policy"
|
||||
@handler GetPrivacyPolicy
|
||||
get /site/privacy returns (PrivacyPolicyConfig)
|
||||
|
||||
@doc "Get stat"
|
||||
@handler GetStat
|
||||
get /site/stat returns (GetStatResponse)
|
||||
|
||||
@doc "Get verification code"
|
||||
@handler SendEmailCode
|
||||
post /send_code (SendCodeRequest) returns (SendCodeResponse)
|
||||
|
||||
@doc "Get sms verification code"
|
||||
@handler SendSmsCode
|
||||
post /send_sms_code (SendSmsCodeRequest) returns (SendCodeResponse)
|
||||
|
||||
@doc "Get Ads"
|
||||
@handler GetAds
|
||||
get /ads (GetAdsRequest) returns (GetAdsResponse)
|
||||
|
||||
@doc "Check verification code"
|
||||
@handler CheckVerificationCode
|
||||
post /check_verification_code (CheckVerificationCodeRequest) returns (CheckVerificationCodeRespone)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user