-
-
Notifications
You must be signed in to change notification settings - Fork 977
/
types.go
36 lines (30 loc) · 835 Bytes
/
types.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
package internal
// Record represents the content of a DNS record.
type Record struct {
ID int64 `json:"record_id,omitempty"`
Name string `json:"name,omitempty"`
Data string `json:"data,omitempty"`
Type string `json:"type,omitempty"`
TTL int `json:"ttl,omitempty"`
Priority int `json:"priority,omitempty"`
}
type Response interface {
GetStatus() int
GetMessage() string
}
// apiResponse represents an API response.
type apiResponse[S any, R any] struct {
Status int `json:"status"`
Message string `json:"message"`
Records S `json:"records,omitempty"`
Record R `json:"record,omitempty"`
}
func (a apiResponse[S, R]) GetStatus() int {
return a.Status
}
func (a apiResponse[S, R]) GetMessage() string {
return a.Message
}
type recordHeader struct {
ID int64 `json:"id"`
}