fix get url arguments passing
chore: update gitignore chore: rename some structures feat: support sdk init
This commit is contained in:
@@ -3,9 +3,9 @@ package public
|
||||
import "github.com/XingfenD/rainyun_api_go_sdk/apis"
|
||||
|
||||
type PublicService struct {
|
||||
client *apis.Client
|
||||
client *apis.RyClient
|
||||
}
|
||||
|
||||
func NewPublicService(c *apis.Client) *PublicService {
|
||||
func NewPublicService(c *apis.RyClient) *PublicService {
|
||||
return &PublicService{client: c}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,6 @@ type AppConfigValue struct {
|
||||
func (s *PublicService) GetAppConfig() (*GetAppConfigResponse, error) {
|
||||
path := "/app_config"
|
||||
var resp GetAppConfigResponse
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, &resp)
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, nil, &resp)
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ func (s *PublicService) GetNews() (*GetNewsResponse, error) {
|
||||
path := "/news"
|
||||
|
||||
var resp GetNewsResponse
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, &resp)
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, nil, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package public
|
||||
import (
|
||||
"github.com/XingfenD/rainyun_api_go_sdk/apis/common"
|
||||
"github.com/XingfenD/rainyun_api_go_sdk/constant"
|
||||
"github.com/bytedance/sonic"
|
||||
)
|
||||
|
||||
// https://api.rainyun.com/#/paths/status/get
|
||||
@@ -34,11 +35,27 @@ type NodeStatusRecordItem struct {
|
||||
Data string `json:"Data"`
|
||||
}
|
||||
|
||||
// TODO
|
||||
func (s *PublicService) GetStatus() (*GetStatusResponse, error) {
|
||||
func (req *GetStatusRequest) BuildQueryMap() (map[string]string, error) {
|
||||
rst := make(map[string]string, 1)
|
||||
optionString, err := sonic.Marshal(req.Options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
rst["options"] = string(optionString)
|
||||
|
||||
return rst, nil
|
||||
}
|
||||
|
||||
func (s *PublicService) GetStatus(req *GetStatusRequest) (*GetStatusResponse, error) {
|
||||
path := "/status"
|
||||
|
||||
var resp GetStatusResponse
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, &resp)
|
||||
|
||||
querys, err := req.BuildQueryMap()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
err = s.client.Do(constant.HTTPMethod_GET, path, querys, nil, &resp)
|
||||
return &resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user