mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-21 12:14:28 +00:00
feat: Refactor CLI API client by splitting billing, carrier, and charging modules into separate files
- Extract Invoice, Payment, Subscriber types and GetInvoices, GetPayments, GenerateInvoice methods to billing.go - Extract CarrierInfo, ConnectivityStatus, ProfileInfo types and carrier connector methods to carrier.go - Extract CreditCheckRequest/Response, CreditBalanceResponse types and charging engine methods to charging.go - Add PacketStats, CreditInfo types and GetPacketStats, GetCreditInfo
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
package api
|
||||
|
||||
// Service describes a platform service
|
||||
type Service struct {
|
||||
Name string `json:"name"`
|
||||
Status string `json:"status"`
|
||||
Version string `json:"version"`
|
||||
Uptime string `json:"uptime"`
|
||||
CPU float64 `json:"cpu"`
|
||||
Memory string `json:"memory"`
|
||||
}
|
||||
|
||||
// PostRestart requests the API to restart the named service.
|
||||
func (c *Client) PostRestart(name string) error {
|
||||
return c.doPostJSON("/api/v1/services/"+name+"/restart", nil, nil)
|
||||
}
|
||||
|
||||
// ListServices returns platform services
|
||||
func (c *Client) ListServices() ([]Service, error) {
|
||||
var resp struct {
|
||||
Data []Service `json:"data"`
|
||||
}
|
||||
if err := c.doGetJSON("/api/v1/services", &resp); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return resp.Data, nil
|
||||
}
|
||||
Reference in New Issue
Block a user