fix: bad ux

This commit is contained in:
juancwu 2026-01-26 21:23:33 +00:00
commit 5a425b8c60
15 changed files with 791 additions and 463 deletions

View file

@ -65,6 +65,67 @@ func (c *Client) RetrieveDNSRecords(domain string) (*DNSRecordsResponse, error)
return &resp, nil
}
func (c *Client) CreateDNSRecord(domain string, record DNSRecord) error {
reqBody := struct {
BaseRequest
Name string `json:"name"`
Type string `json:"type"`
Content string `json:"content"`
TTL string `json:"ttl,omitempty"`
Priority string `json:"prio,omitempty"`
}{
BaseRequest: BaseRequest{
APIKey: c.APIKey,
SecretAPIKey: c.SecretAPIKey,
},
Name: record.Name,
Type: record.Type,
Content: record.Content,
TTL: fmt.Sprintf("%v", record.TTL),
Priority: fmt.Sprintf("%v", record.Priority),
}
var resp BaseResponse
return c.post("/dns/create/"+domain, reqBody, &resp)
}
func (c *Client) EditDNSRecord(domain string, id string, record DNSRecord) error {
reqBody := struct {
BaseRequest
Name string `json:"name"`
Type string `json:"type"`
Content string `json:"content"`
TTL string `json:"ttl,omitempty"`
Priority string `json:"prio,omitempty"`
}{
BaseRequest: BaseRequest{
APIKey: c.APIKey,
SecretAPIKey: c.SecretAPIKey,
},
Name: record.Name,
Type: record.Type,
Content: record.Content,
TTL: fmt.Sprintf("%v", record.TTL),
Priority: fmt.Sprintf("%v", record.Priority),
}
var resp BaseResponse
return c.post("/dns/edit/"+domain+"/"+id, reqBody, &resp)
}
func (c *Client) DeleteDNSRecord(domain, id string) error {
reqBody := struct {
BaseRequest
}{
BaseRequest: BaseRequest{
APIKey: c.APIKey,
SecretAPIKey: c.SecretAPIKey,
},
}
var resp BaseResponse
return c.post("/dns/delete/"+domain+"/"+id, reqBody, &resp)
}
func (c *Client) Ping() (*PingResponse, error) {
reqBody := PingRequest{
BaseRequest: BaseRequest{