error rates
This commit is contained in:
parent
4aeb565596
commit
16d4198364
13 changed files with 323 additions and 9 deletions
|
|
@ -78,6 +78,7 @@ type Client struct {
|
|||
GetAppUserLNURLInfo func(req GetAppUserLNURLInfoRequest) (*LnurlPayInfoResponse, error)
|
||||
GetAppsMetrics func(req AppsMetricsRequest) (*AppsMetrics, error)
|
||||
GetDebitAuthorizations func() (*DebitAuthorizations, error)
|
||||
GetErrorStats func() (*ErrorStats, error)
|
||||
GetHttpCreds func() (*HttpCreds, error)
|
||||
GetInviteLinkState func(req GetInviteTokenStateRequest) (*GetInviteTokenStateResponse, error)
|
||||
GetLNURLChannelLink func() (*LnurlLinkResponse, error)
|
||||
|
|
@ -758,6 +759,32 @@ func NewClient(params ClientParams) *Client {
|
|||
}
|
||||
return &res, nil
|
||||
},
|
||||
GetErrorStats: func() (*ErrorStats, error) {
|
||||
auth, err := params.RetrieveMetricsAuth()
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
finalRoute := "/api/reports/errors"
|
||||
body := []byte{}
|
||||
resBody, err := doPostRequest(params.BaseURL+finalRoute, body, auth)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
result := ResultError{}
|
||||
err = json.Unmarshal(resBody, &result)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if result.Status == "ERROR" {
|
||||
return nil, fmt.Errorf(result.Reason)
|
||||
}
|
||||
res := ErrorStats{}
|
||||
err = json.Unmarshal(resBody, &res)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &res, nil
|
||||
},
|
||||
// server streaming method: GetHttpCreds not implemented
|
||||
GetInviteLinkState: func(req GetInviteTokenStateRequest) (*GetInviteTokenStateResponse, error) {
|
||||
auth, err := params.RetrieveAdminAuth()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue