0
0
mirror of https://github.com/crazy-max/diun.git synced 2024-12-22 19:38:28 +00:00
crazy-max_diun/vendor/github.com/gregdel/pushover/response.go
2024-12-14 22:30:21 +01:00

27 lines
665 B
Go

package pushover
import "fmt"
// Response represents a response from the API.
type Response struct {
Status int `json:"status"`
ID string `json:"request"`
Errors Errors `json:"errors"`
Receipt string `json:"receipt"`
Limit *Limit
}
// String represents a printable form of the response.
func (r Response) String() string {
ret := fmt.Sprintf("Status: %d\n", r.Status)
ret += fmt.Sprintf("Request id: %s\n", r.ID)
if r.Receipt != "" {
ret += fmt.Sprintf("Receipt: %s\n", r.Receipt)
}
if r.Limit != nil {
ret += fmt.Sprintf("Usage %d/%d messages\nNext reset : %s",
r.Limit.Remaining, r.Limit.Total, r.Limit.NextReset)
}
return ret
}