up
This commit is contained in:
@@ -191,6 +191,20 @@ type HostingerHosting struct {
|
||||
|
||||
// ─── Métodos de la API ───────────────────────────────────────────────────────
|
||||
|
||||
// GetVPSByID obtiene una VM específica por su ID.
|
||||
func (c *HostingerClient) GetVPSByID(vmID int) (*HostingerVPS, error) {
|
||||
path := fmt.Sprintf("/vps/v1/virtual-machines/%d", vmID)
|
||||
body, err := c.getRaw(context.Background(), path)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var vps HostingerVPS
|
||||
if err := json.Unmarshal(body, &vps); err != nil {
|
||||
return nil, fmt.Errorf("hostinger: no se pudo interpretar respuesta VPS: %w", err)
|
||||
}
|
||||
return &vps, nil
|
||||
}
|
||||
|
||||
// GetVPSList obtiene la lista de VPS/VMs.
|
||||
func (c *HostingerClient) GetVPSList() ([]HostingerVPS, error) {
|
||||
body, err := c.getRaw(context.Background(), "/vps/v1/virtual-machines")
|
||||
|
||||
Reference in New Issue
Block a user