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:
nutcas3
2026-04-25 05:33:41 +03:00
parent 91b8d53662
commit bd3226edf0
8 changed files with 466 additions and 448 deletions
+34
View File
@@ -0,0 +1,34 @@
package api
// Packet Gateway Integration
type PacketStats struct {
IP uint64 `json:"ip"`
Bytes uint64 `json:"bytes"`
}
type PacketCreditInfo struct {
IP uint64 `json:"ip"`
Credit int64 `json:"credit"`
}
// GetPacketStats retrieves packet statistics
func (c *Client) GetPacketStats() ([]PacketStats, error) {
var resp struct {
Data []PacketStats `json:"data"`
}
if err := c.doGetJSON("/api/v1/packet-gateway/stats", &resp); err != nil {
return nil, err
}
return resp.Data, nil
}
// GetPacketCreditInfo retrieves credit information from packet gateway
func (c *Client) GetPacketCreditInfo() ([]PacketCreditInfo, error) {
var resp struct {
Data []PacketCreditInfo `json:"data"`
}
if err := c.doGetJSON("/api/v1/packet-gateway/credits", &resp); err != nil {
return nil, err
}
return resp.Data, nil
}