fetch single metric
This commit is contained in:
parent
a4e9a23d74
commit
db3c27c7f2
13 changed files with 137 additions and 19 deletions
|
|
@ -93,7 +93,7 @@ type Client struct {
|
|||
GetNPubLinkingState func(req GetNPubLinking) (*NPubLinking, error)
|
||||
GetPaymentState func(req GetPaymentStateRequest) (*PaymentState, error)
|
||||
GetSeed func() (*LndSeed, error)
|
||||
GetUsageMetrics func() (*UsageMetrics, error)
|
||||
GetUsageMetrics func(req UsageMetricReq) (*UsageMetrics, error)
|
||||
GetUserInfo func() (*UserInfo, error)
|
||||
GetUserOffer func(req OfferId) (*OfferConfig, error)
|
||||
GetUserOfferInvoices func(req GetUserOfferInvoicesReq) (*OfferInvoices, error)
|
||||
|
|
@ -1057,13 +1057,16 @@ func NewClient(params ClientParams) *Client {
|
|||
}
|
||||
return &res, nil
|
||||
},
|
||||
GetUsageMetrics: func() (*UsageMetrics, error) {
|
||||
GetUsageMetrics: func(req UsageMetricReq) (*UsageMetrics, error) {
|
||||
auth, err := params.RetrieveMetricsAuth()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalRoute := "/api/reports/usage"
|
||||
body := []byte{}
|
||||
body, err := json.Marshal(req)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
|
|||
|
|
@ -392,6 +392,11 @@ type LnurlWithdrawInfoResponse struct {
|
|||
Paylink string `json:"payLink"`
|
||||
Tag string `json:"tag"`
|
||||
}
|
||||
type MetricsFile struct {
|
||||
App_id string `json:"app_id"`
|
||||
Metrics_name string `json:"metrics_name"`
|
||||
Page int64 `json:"page"`
|
||||
}
|
||||
type MigrationUpdate struct {
|
||||
Closure *ClosureMigration `json:"closure"`
|
||||
Relays *RelaysMigration `json:"relays"`
|
||||
|
|
@ -566,6 +571,10 @@ type UsageMetric struct {
|
|||
Success bool `json:"success"`
|
||||
Validate_in_nano int64 `json:"validate_in_nano"`
|
||||
}
|
||||
type UsageMetricReq struct {
|
||||
Limit int64 `json:"limit"`
|
||||
Metrics_file *MetricsFile `json:"metrics_file"`
|
||||
}
|
||||
type UsageMetricTlv struct {
|
||||
Available_chunks []int64 `json:"available_chunks"`
|
||||
Base_64_tlvs []string `json:"base_64_tlvs"`
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue