2018-09-15 17:07:24 +00:00
|
|
|
package namecheap
|
|
|
|
|
|
|
|
import "encoding/xml"
|
|
|
|
|
2018-09-24 19:07:20 +00:00
|
|
|
// record describes a DNS record returned by the Namecheap DNS gethosts API.
|
2018-09-15 17:07:24 +00:00
|
|
|
// Namecheap uses the term "host" to refer to all DNS records that include
|
|
|
|
// a host field (A, AAAA, CNAME, NS, TXT, URL).
|
2018-09-24 19:07:20 +00:00
|
|
|
type record struct {
|
2018-09-15 17:07:24 +00:00
|
|
|
Type string `xml:",attr"`
|
|
|
|
Name string `xml:",attr"`
|
|
|
|
Address string `xml:",attr"`
|
|
|
|
MXPref string `xml:",attr"`
|
|
|
|
TTL string `xml:",attr"`
|
|
|
|
}
|
|
|
|
|
|
|
|
// apierror describes an error record in a namecheap API response.
|
|
|
|
type apierror struct {
|
|
|
|
Number int `xml:",attr"`
|
|
|
|
Description string `xml:",innerxml"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type setHostsResponse struct {
|
|
|
|
XMLName xml.Name `xml:"ApiResponse"`
|
|
|
|
Status string `xml:"Status,attr"`
|
|
|
|
Errors []apierror `xml:"Errors>Error"`
|
|
|
|
Result struct {
|
|
|
|
IsSuccess string `xml:",attr"`
|
|
|
|
} `xml:"CommandResponse>DomainDNSSetHostsResult"`
|
|
|
|
}
|
|
|
|
|
|
|
|
type getHostsResponse struct {
|
|
|
|
XMLName xml.Name `xml:"ApiResponse"`
|
|
|
|
Status string `xml:"Status,attr"`
|
|
|
|
Errors []apierror `xml:"Errors>Error"`
|
2018-09-24 19:07:20 +00:00
|
|
|
Hosts []record `xml:"CommandResponse>DomainDNSGetHostsResult>host"`
|
2018-09-15 17:07:24 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
type getTldsResponse struct {
|
|
|
|
XMLName xml.Name `xml:"ApiResponse"`
|
|
|
|
Errors []apierror `xml:"Errors>Error"`
|
|
|
|
Result []struct {
|
|
|
|
Name string `xml:",attr"`
|
|
|
|
} `xml:"CommandResponse>Tlds>Tld"`
|
|
|
|
}
|