fix: unwrap nested Data field in server Get response

This commit is contained in:
2026-07-29 00:54:28 +08:00
parent 317dc9c4e5
commit 38d5b3f338
+5 -3
View File
@@ -40,12 +40,14 @@ func (s *ServerService) List(ctx context.Context) ([]provider.Server, error) {
}
func (s *ServerService) Get(ctx context.Context, id string) (*provider.Server, error) {
var raw rainyunServer
var resp struct {
Data rainyunServer `json:"Data"`
}
path := fmt.Sprintf("/product/rcs/%s/", id)
if err := s.client.get(ctx, path, &raw); err != nil {
if err := s.client.get(ctx, path, &resp); err != nil {
return nil, err
}
sv := toServer(raw)
sv := toServer(resp.Data)
return &sv, nil
}