mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-10-21 20:24:27 +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,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
|
||||
}
|
||||
Reference in New Issue
Block a user