Files
EdgeAPI/internal/dnsclients/cloudflare/response_base.go

23 lines
489 B
Go
Raw Normal View History

2024-05-17 18:27:26 +08:00
// Copyright 2021 GoEdge CDN goedge.cdn@gmail.com. All rights reserved.
2021-04-15 17:02:01 +08:00
package cloudflare
type BaseResponse struct {
Success bool `json:"success"`
Errors []struct {
Code int `json:"code"`
Message string `json:"message"`
} `json:"errors"`
}
func (this *BaseResponse) IsOk() bool {
return this.Success
}
func (this *BaseResponse) LastError() (code int, message string) {
if len(this.Errors) == 0 {
return 0, ""
}
return this.Errors[0].Code, this.Errors[0].Message
}