-
-
Notifications
You must be signed in to change notification settings - Fork 1k
/
models.go
37 lines (31 loc) · 986 Bytes
/
models.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package internal
import (
"encoding/json"
"fmt"
)
// Record a DNS record.
type Record struct {
ID string `json:"id,omitempty"`
Source string `json:"source,omitempty"`
Type string `json:"type,omitempty"`
TTL int `json:"ttl,omitempty"`
Target string `json:"target,omitempty"`
}
type DNSDomain struct {
ID uint64 `json:"id,omitempty"`
CustomerName string `json:"customer_name,omitempty"`
}
type APIResponse struct {
Result string `json:"result"`
Data json.RawMessage `json:"data,omitempty"`
ErrResponse *APIErrorResponse `json:"error,omitempty"`
}
type APIErrorResponse struct {
Code string `json:"code"`
Description string `json:"description,omitempty"`
Context map[string]string `json:"context,omitempty"`
Errors []APIErrorResponse `json:"errors,omitempty"`
}
func (a APIErrorResponse) Error() string {
return fmt.Sprintf("code: %s, description: %s", a.Code, a.Description)
}