-
Notifications
You must be signed in to change notification settings - Fork 2
/
dnsrecord.go
55 lines (43 loc) · 1.32 KB
/
dnsrecord.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
package files_sdk
import (
"encoding/json"
lib "github.com/Files-com/files-sdk-go/v3/lib"
)
type DnsRecord struct {
Id string `json:"id,omitempty" path:"id,omitempty" url:"id,omitempty"`
Domain string `json:"domain,omitempty" path:"domain,omitempty" url:"domain,omitempty"`
Rrtype string `json:"rrtype,omitempty" path:"rrtype,omitempty" url:"rrtype,omitempty"`
Value string `json:"value,omitempty" path:"value,omitempty" url:"value,omitempty"`
}
func (d DnsRecord) Identifier() interface{} {
return d.Id
}
type DnsRecordCollection []DnsRecord
type DnsRecordListParams struct {
ListParams
}
func (d *DnsRecord) UnmarshalJSON(data []byte) error {
type dnsRecord DnsRecord
var v dnsRecord
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, map[string]interface{}{})
}
*d = DnsRecord(v)
return nil
}
func (d *DnsRecordCollection) UnmarshalJSON(data []byte) error {
type dnsRecords DnsRecordCollection
var v dnsRecords
if err := json.Unmarshal(data, &v); err != nil {
return lib.ErrorWithOriginalResponse{}.ProcessError(data, err, []map[string]interface{}{})
}
*d = DnsRecordCollection(v)
return nil
}
func (d *DnsRecordCollection) ToSlice() *[]interface{} {
ret := make([]interface{}, len(*d))
for i, v := range *d {
ret[i] = v
}
return &ret
}