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 { CaptchaType string `json:"captcha_type"` TurnstileSiteKey string `json:"turnstile_site_key"` EnableUserLoginCaptcha bool `json:"enable_user_login_captcha"` EnableUserRegisterCaptcha bool `json:"enable_user_register_captcha"` EnableAdminLoginCaptcha bool `json:"enable_admin_login_captcha"` EnableUserResetPasswordCaptcha bool `json:"enable_user_reset_password_captcha"` } 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"` Signature SignatureConfig `json:"signature"` 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"` Exist bool `json:"exist"` } 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"` } HeartbeatResponse { Status bool `json:"status"` Message string `json:"message,omitempty"` Timestamp int64 `json:"timestamp,omitempty"` } GetDownloadLinkRequest { InviteCode string `form:"invite_code,optional"` Platform string `form:"platform" validate:"required,oneof=windows mac ios android"` } GetDownloadLinkResponse { Url string `json:"url"` } ContactRequest { Name string `json:"name" validate:"required,max=100"` Email string `json:"email" validate:"required,email"` OtherContact string `json:"other_contact" validate:"max=200"` Notes string `json:"notes" validate:"max=2000"` } ReportLogMessageRequest { Platform string `json:"platform" validate:"required,max=32"` AppVersion string `json:"app_version" validate:"required,max=64"` OsName string `json:"os_name" validate:"max=64"` OsVersion string `json:"os_version" validate:"max=64"` DeviceId string `json:"device_id" validate:"required,max=255"` UserId int64 `json:"user_id"` SessionId string `json:"session_id" validate:"max=255"` Level uint8 `json:"level"` ErrorCode string `json:"error_code" validate:"max=128"` Message string `json:"message" validate:"required,max=65535"` Stack string `json:"stack" validate:"max=1048576"` Context interface{} `json:"context"` OccurredAt int64 `json:"occurred_at"` } ReportLogMessageResponse { Id int64 `json:"id"` } LegacyCheckVerificationCodeRequest { Method string `json:"method" form:"method" validate:"omitempty,oneof=email mobile"` Account string `json:"account" form:"account"` Email string `json:"email" form:"email"` Code string `json:"code" form:"code" validate:"required"` Type uint8 `json:"type" form:"type" validate:"required"` } LegacyCheckVerificationCodeResponse { Status bool `json:"status"` Exist bool `json:"exist"` } ) @server ( prefix: v1/common group: common middleware: DeviceMiddleware ) service ppanel { @doc "Get global config" @handler GetGlobalConfig get /site/config returns (GetGlobalConfigResponse) @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 "Heartbeat" @handler Heartbeat get /heartbeat returns (HeartbeatResponse) @doc "Get Download Link" @handler GetDownloadLink get /client/download (GetDownloadLinkRequest) returns (GetDownloadLinkResponse) @doc "Submit Contact" @handler SubmitContact post /contact (ContactRequest) @doc "Report log message" @handler ReportLogMessage post /log/report (ReportLogMessageRequest) returns (ReportLogMessageResponse) @doc "Check verification code (legacy v1)" @handler CheckCodeLegacy post /check_code (LegacyCheckVerificationCodeRequest) returns (LegacyCheckVerificationCodeResponse) @doc "Check verification code (legacy v2, consume code)" @handler CheckCodeLegacyV2 post /check_code/v2 (LegacyCheckVerificationCodeRequest) returns (LegacyCheckVerificationCodeResponse) }