list dns records

This commit is contained in:
juancwu 2026-01-23 16:55:10 +00:00
commit 04ebd05a8f
5 changed files with 244 additions and 3 deletions

View file

@ -48,6 +48,23 @@ func (c *Client) DomainListAll(start int, includeLabels bool) (*DomainListAllRes
return &resp, nil
}
func (c *Client) RetrieveDNSRecords(domain string) (*DNSRecordsResponse, error) {
reqBody := DNSRecordsRequest{
BaseRequest: BaseRequest{
APIKey: c.APIKey,
SecretAPIKey: c.SecretAPIKey,
},
}
var resp DNSRecordsResponse
err := c.post("/dns/retrieve/"+domain, reqBody, &resp)
if err != nil {
return nil, err
}
return &resp, nil
}
func (c *Client) Ping() (*PingResponse, error) {
reqBody := PingRequest{
BaseRequest: BaseRequest{

View file

@ -56,3 +56,25 @@ type DomainLabel struct {
Title string `json:"title"`
Color string `json:"color"`
}
// DNSRecordsRequest is used to get a list of DNS records
type DNSRecordsRequest struct {
BaseRequest
}
// DNSRecord it is what it says it is.
type DNSRecord struct {
ID string `json:"id"`
Name string `json:"name"`
Type string `json:"type"`
Content string `json:"content"`
TTL any `json:"ttl"`
Priority any `json:"prio"`
Notes string `json:"notes"`
}
// DNSRecordsResponse it is what it says it is.
type DNSRecordsResponse struct {
BaseResponse
Records []DNSRecord `json:"records"`
}