finish some public api

rename public service
This commit is contained in:
2026-08-03 12:25:51 +08:00
parent 2869730bdd
commit 86fba66370
4 changed files with 65 additions and 4 deletions
+3 -3
View File
@@ -2,10 +2,10 @@ package public
import "github.com/XingfenD/rainyun_api_go_sdk/apis" import "github.com/XingfenD/rainyun_api_go_sdk/apis"
type Service struct { type PublicService struct {
client *apis.Client client *apis.Client
} }
func NewService(c *apis.Client) *Service { func NewPublicService(c *apis.Client) *PublicService {
return &Service{client: c} return &PublicService{client: c}
} }
+1 -1
View File
@@ -24,7 +24,7 @@ type AppConfigValue struct {
OriginalIndex int `json:"originalIndex"` OriginalIndex int `json:"originalIndex"`
} }
func (s *Service) GetAppConfig() (*GetAppConfigResponse, error) { func (s *PublicService) GetAppConfig() (*GetAppConfigResponse, error) {
path := "/app_config" path := "/app_config"
var resp GetAppConfigResponse var resp GetAppConfigResponse
err := s.client.Do(constant.HTTPMethod_GET, path, nil, &resp) err := s.client.Do(constant.HTTPMethod_GET, path, nil, &resp)
+28
View File
@@ -0,0 +1,28 @@
package public
import (
"time"
"github.com/XingfenD/rainyun_api_go_sdk/constant"
)
type GetNewsResponse struct {
Code int `json:"code"`
Data []RainyunNewsItem `json:"data"`
}
type RainyunNewsItem struct {
Type string `json:"Type"`
Title string `json:"Title"`
TimeStamp time.Time `json:"TimeStamp"`
URL string `json:"URL"`
}
func (s *PublicService) GetNews() (*GetNewsResponse, error) {
path := "/news"
var resp GetNewsResponse
err := s.client.Do(constant.HTTPMethod_GET, path, nil, &resp)
return &resp, err
}
+33
View File
@@ -1 +1,34 @@
package public package public
import "github.com/XingfenD/rainyun_api_go_sdk/constant"
type GetStatusResponse struct {
Code int `json:"code"`
Data NodeStatus `json:"data"`
}
type NodeStatus struct {
TotalRecords int `json:"TotalRecords"`
OngoingServiceEvents []interface{} `json:"OngoingServiceEvents"`
Records []NodeStatusRecordItem `json:"Records"`
}
type NodeStatusRecordItem struct {
UUID string `json:"UUID"`
ChineseName string `json:"ChineseName"`
Product string `json:"Product"`
CPU float64 `json:"CPU"`
Memory float64 `json:"Memory"`
NetOut int `json:"NetOut"`
UpdateTime string `json:"UpdateTime"`
Status string `json:"Status"`
Data string `json:"Data"`
}
func (s *PublicService) GetStatus() (*GetStatusResponse, error) {
path := "/status"
var resp GetStatusResponse
err := s.client.Do(constant.HTTPMethod_GET, path, nil, &resp)
return &resp, err
}