55 lines
890 B
Go
55 lines
890 B
Go
package playtogo
|
|
|
|
type RecordType int
|
|
|
|
const (
|
|
A RecordType = iota
|
|
AAAA
|
|
CNAME
|
|
MX
|
|
TXT
|
|
SPF
|
|
SRV
|
|
CAA
|
|
PTR
|
|
NS
|
|
)
|
|
|
|
var recordTypeNames = map[RecordType]string{
|
|
A: "A",
|
|
AAAA: "AAAA",
|
|
CNAME: "CNAME",
|
|
MX: "MX",
|
|
TXT: "TXT",
|
|
SPF: "SPF",
|
|
SRV: "SRV",
|
|
CAA: "CAA",
|
|
PTR: "PTR",
|
|
NS: "NS",
|
|
}
|
|
|
|
func (t RecordType) String() string {
|
|
return recordTypeNames[t]
|
|
}
|
|
|
|
type ApiResponse[T any] struct {
|
|
Success bool `json:"success"`
|
|
Data T `json:"data"`
|
|
Error any `json:"error"`
|
|
}
|
|
|
|
type CreateRecordAddress struct {
|
|
Address string `json:"address"`
|
|
}
|
|
|
|
type CreateRecord struct {
|
|
Name string `json:"name"`
|
|
Records []CreateRecordAddress `json:"records"`
|
|
TTL int `json:"ttl"`
|
|
Type string `json:"type"`
|
|
}
|
|
|
|
type CreateRecordResult struct {
|
|
DomainID int `json:"domain_id"`
|
|
Zone string `json:"zone"`
|
|
}
|