feat: migrate all remaining modules from rainyun-go-sdk
- domain(24), product(8), rbm(10), rca(21), rgs(38), ros(19), ssl(5), user(10), workorder(11), public remaining 5 - split nested response structs into reusable named types - rgs reuses rcs request/response types - fix source bugs: malformed paths, resp vs &resp, missing bodies - register all 11 services in sdk.New
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package public
|
||||
|
||||
import "github.com/XingfenD/rainyun_api_go_sdk/constant"
|
||||
|
||||
// https://api.rainyun.com/#/paths/product~1rgs~1egg_type/get
|
||||
|
||||
// 获取蛋(游戏类型)类型列表
|
||||
type GetEggTypeListResponse struct {
|
||||
Code int `json:"code"`
|
||||
Data []EggTypeItem `json:"data"`
|
||||
}
|
||||
|
||||
type EggTypeItem struct {
|
||||
ID int `json:"id"` // 蛋(游戏类型)ID
|
||||
EggName string `json:"egg_name"` // 蛋(游戏类型)名称
|
||||
Egg EggItem `json:"egg"`
|
||||
Docker string `json:"docker"` // docker镜像地址
|
||||
McsmDocker string `json:"mcsm_docker"`
|
||||
Env EggTypeEnv `json:"env"`
|
||||
Order int `json:"order"`
|
||||
IsHidden bool `json:"is_hidden"`
|
||||
UpdateTime int `json:"update_time"`
|
||||
AutoUpdate bool `json:"auto_update"`
|
||||
}
|
||||
|
||||
type EggTypeEnv struct {
|
||||
ServerType string `json:"SERVER_TYPE"`
|
||||
ServerVersion string `json:"SERVER_VERSION"`
|
||||
Subver string `json:"SUBVER"`
|
||||
Latest bool `json:"LATEST"`
|
||||
Prerelease bool `json:"PRERELEASE"`
|
||||
}
|
||||
|
||||
func (s *PublicService) GetEggTypeList() (*GetEggTypeListResponse, error) {
|
||||
path := "/product/rgs/egg_type"
|
||||
|
||||
var resp GetEggTypeListResponse
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, nil, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package public
|
||||
|
||||
import "github.com/XingfenD/rainyun_api_go_sdk/constant"
|
||||
|
||||
// https://api.rainyun.com/#/paths/product~1rgs~1egg/get
|
||||
|
||||
// 获取蛋(游戏)列表
|
||||
type GetEggListResponse struct {
|
||||
Code int `json:"code"`
|
||||
Data []EggItem `json:"data"`
|
||||
}
|
||||
|
||||
type EggItem struct {
|
||||
Name string `json:"name"` // 名称
|
||||
EggGroup string `json:"egg_group"` // 分组
|
||||
Title string `json:"title"` // 标题
|
||||
Desc string `json:"desc"` // 描述
|
||||
IconURL string `json:"icon_url"` // 图标
|
||||
Order int `json:"order"` // 排序
|
||||
IsHidden bool `json:"is_hidden"` // 是否隐藏
|
||||
SaveDirs []string `json:"save_dirs"` // 重装时建议的需要保留的目录
|
||||
}
|
||||
|
||||
func (s *PublicService) GetEggList() (*GetEggListResponse, error) {
|
||||
path := "/product/rgs/egg"
|
||||
|
||||
var resp GetEggListResponse
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, nil, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package public
|
||||
|
||||
import "github.com/XingfenD/rainyun_api_go_sdk/constant"
|
||||
|
||||
// https://api.rainyun.com/#/paths/product~1rcs~1os-templates/get
|
||||
|
||||
// 获取RCS操作系统列表
|
||||
type GetRcsOSListResponse struct {
|
||||
Code int `json:"code"`
|
||||
Data []RcsOSListItem `json:"data"`
|
||||
}
|
||||
|
||||
type RcsOSListItem struct {
|
||||
ID int `json:"id"` // 系统ID
|
||||
Region string `json:"region"` // 地域
|
||||
Subtype string `json:"subtype"` // 类型(kvm)
|
||||
Machine string `json:"machine"` // unknown
|
||||
Name string `json:"name"` // 英文名
|
||||
Version string `json:"version"` // 版本
|
||||
SyncStatus string `json:"sync_status"`
|
||||
OsType string `json:"os_type"` // 系统类型(windows/linux)
|
||||
ChineseName string `json:"chinese_name"` // 中文名
|
||||
Icon string `json:"icon"` // 图标
|
||||
IsWithBbr bool `json:"is_with_bbr"` // 是否支持BBR
|
||||
IsEol bool `json:"is_eol"` // 是否已过时
|
||||
IsAvailable bool `json:"is_available"` // 是否可用
|
||||
Order int `json:"order"` // 排序
|
||||
LatestFilename string `json:"latest_filename"` // 最新文件名
|
||||
NoVMAgent bool `json:"no_vm_agent"` // 是否无虚拟机Agent
|
||||
}
|
||||
|
||||
func (s *PublicService) GetRcsOSList() (*GetRcsOSListResponse, error) {
|
||||
path := "/product/rcs/os-templates"
|
||||
|
||||
var resp GetRcsOSListResponse
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, nil, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package public
|
||||
|
||||
import "github.com/XingfenD/rainyun_api_go_sdk/constant"
|
||||
|
||||
// https://api.rainyun.com/#/paths/product~1rgs~1os-templates/get
|
||||
|
||||
// 获取游戏云系统列表
|
||||
type GetRgsOSListResponse struct {
|
||||
Code int `json:"code"`
|
||||
Data []RgsOSListItem `json:"data"`
|
||||
}
|
||||
|
||||
type RgsOSListItem struct {
|
||||
ID int `json:"id"`
|
||||
Region string `json:"region"`
|
||||
Subtype string `json:"subtype"`
|
||||
Machine string `json:"machine"`
|
||||
Name string `json:"name"`
|
||||
Version string `json:"version"`
|
||||
SyncStatus string `json:"sync_status"`
|
||||
OsType string `json:"os_type"`
|
||||
ChineseName string `json:"chinese_name"`
|
||||
Icon string `json:"icon"`
|
||||
IsWithBbr bool `json:"is_with_bbr"`
|
||||
IsEol bool `json:"is_eol"`
|
||||
IsAvailable bool `json:"is_available"`
|
||||
Order int `json:"order"`
|
||||
LatestFilename string `json:"latest_filename"`
|
||||
NoVMAgent bool `json:"no_vm_agent"`
|
||||
}
|
||||
|
||||
func (s *PublicService) GetRgsOSList() (*GetRgsOSListResponse, error) {
|
||||
path := "/product/rgs/os-templates"
|
||||
|
||||
var resp GetRgsOSListResponse
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, nil, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package public
|
||||
|
||||
import "github.com/XingfenD/rainyun_api_go_sdk/constant"
|
||||
|
||||
// https://api.rainyun.com/#/paths/product~1ros~1plans/get
|
||||
|
||||
// 获取对象存储套餐列表
|
||||
type GetRosPlanListResponse struct {
|
||||
Code int `json:"code"`
|
||||
Data []RosPlanItem `json:"data"`
|
||||
}
|
||||
|
||||
type RosPlanItem struct {
|
||||
ID int `json:"id"`
|
||||
Region string `json:"region"`
|
||||
Subtype string `json:"subtype"`
|
||||
PlanName string `json:"plan_name"`
|
||||
Machine string `json:"machine"`
|
||||
ChargeType string `json:"charge_type"`
|
||||
Chinese string `json:"chinese"`
|
||||
IsFree bool `json:"is_free"`
|
||||
PointRenewPrice any `json:"point_renew_price"` // 积分续费价格
|
||||
IsSelling bool `json:"is_selling"`
|
||||
Price int `json:"price"`
|
||||
StorageSize int `json:"storage_size"`
|
||||
Bandwidth int `json:"bandwidth"`
|
||||
ExtraTransferPrice float64 `json:"extra_transfer_price"`
|
||||
ExtraStoragePrice float64 `json:"extra_storage_price"`
|
||||
}
|
||||
|
||||
func (s *PublicService) GetRosPlanList() (*GetRosPlanListResponse, error) {
|
||||
path := "/product/ros/plans"
|
||||
|
||||
var resp GetRosPlanListResponse
|
||||
err := s.client.Do(constant.HTTPMethod_GET, path, nil, nil, &resp)
|
||||
|
||||
return &resp, err
|
||||
}
|
||||
Reference in New Issue
Block a user