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"` } // 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"` } SubscribeClient { Id int64 `json:"id"` Name string `json:"name"` Description string `json:"description,omitempty"` Icon string `json:"icon,omitempty"` Scheme string `json:"scheme,omitempty"` IsDefault bool `json:"is_default"` DownloadLink DownloadLink `json:"download_link,omitempty"` } GetSubscribeClientResponse { Total int64 `json:"total"` List []SubscribeClient `json:"list"` } ContactRequest { Name string `json:"name" validate:"required"` Email string `json:"email" validate:"required,email"` OtherContact string `json:"other_contact,optional"` Notes string `json:"notes,optional"` } GetDownloadLinkRequest { InviteCode string `form:"invite_code,optional"` Platform string `form:"platform" validate:"required,oneof=windows mac ios android"` } GetDownloadLinkResponse { Url string `json:"url"` } GetAppVersionRequest { Platform string `form:"platform" validate:"required,oneof=windows mac ios android"` } ) @server ( prefix: v1/common group: common middleware: DeviceMiddleware ) service ppanel { @doc "Get global config" @handler GetGlobalConfig get /site/config returns (GetGlobalConfigResponse) @doc "Submit contact info" @handler SubmitContact post /contact (ContactRequest) @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) @doc "Get Client" @handler GetClient get /client returns (GetSubscribeClientResponse) @doc "Get Download Link" @handler GetDownloadLink get /client/download (GetDownloadLinkRequest) returns (GetDownloadLinkResponse) @doc "Get App Version" @handler GetAppVersion get /app/version (GetAppVersionRequest) returns (ApplicationVersion) }