forked from billputer/go-namecheap
-
Notifications
You must be signed in to change notification settings - Fork 3
/
ns.go
35 lines (29 loc) · 857 Bytes
/
ns.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
package namecheap
import "net/url"
const (
nsCreate = "namecheap.domains.ns.create"
nsDelete = "namecheap.domains.ns.delete"
nsGetInfo = "namecheap.domains.ns.getInfo"
nsUpdate = "namecheap.domains.ns.update"
)
type DomainNSInfoResult struct {
Domain string `xml:"Domain,attr"`
Nameserver string `xml:"Nameserver,attr"`
IP string `xml:"IP,attr"`
Statuses []string `xml:"NameserverStatuses>Status"`
}
func (client *Client) NSGetInfo(sld, tld, nameserver string) (*DomainNSInfoResult, error) {
requestInfo := &ApiRequest{
command: nsGetInfo,
method: "POST",
params: url.Values{},
}
requestInfo.params.Set("SLD", sld)
requestInfo.params.Set("TLD", tld)
requestInfo.params.Set("Nameserver", nameserver)
resp, err := client.do(requestInfo)
if err != nil {
return nil, err
}
return resp.DomainNSInfo, nil
}