refactor: clean code
This commit is contained in:
45
internal/pkg/vendors/dnsla-sdk/api.go
vendored
45
internal/pkg/vendors/dnsla-sdk/api.go
vendored
@@ -7,46 +7,31 @@ import (
|
||||
)
|
||||
|
||||
func (c *Client) ListDomains(req *ListDomainsRequest) (*ListDomainsResponse, error) {
|
||||
resp := ListDomainsResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodGet, "/domainList", req, &resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
resp := &ListDomainsResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodGet, "/domainList", req, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *Client) ListRecords(req *ListRecordsRequest) (*ListRecordsResponse, error) {
|
||||
resp := ListRecordsResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodGet, "/recordList", req, &resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
resp := &ListRecordsResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodGet, "/recordList", req, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *Client) CreateRecord(req *CreateRecordRequest) (*CreateRecordResponse, error) {
|
||||
resp := CreateRecordResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodPost, "/record", req, &resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
resp := &CreateRecordResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodPost, "/record", req, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *Client) UpdateRecord(req *UpdateRecordRequest) (*UpdateRecordResponse, error) {
|
||||
resp := UpdateRecordResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodPut, "/record", req, &resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
resp := &UpdateRecordResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodPut, "/record", req, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
func (c *Client) DeleteRecord(req *DeleteRecordRequest) (*DeleteRecordResponse, error) {
|
||||
resp := DeleteRecordResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodDelete, fmt.Sprintf("/record?id=%s", url.QueryEscape(req.Id)), req, &resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
resp := &DeleteRecordResponse{}
|
||||
err := c.sendRequestWithResult(http.MethodDelete, fmt.Sprintf("/record?id=%s", url.QueryEscape(req.Id)), req, resp)
|
||||
return resp, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user