diff --git a/domain.go b/domain.go index aefb601..4ffaa96 100644 --- a/domain.go +++ b/domain.go @@ -97,12 +97,18 @@ type DomainCreateOption struct { Nameservers []string } -func (client *Client) DomainsGetList() ([]DomainGetListResult, error) { +func (client *Client) DomainsGetList(currentPage uint, pageSize uint) ([]DomainGetListResult, error) { + if pageSize > 100 { + // Maximum page size supported by the Namecheap API + pageSize = 100 + } requestInfo := &ApiRequest{ command: domainsGetList, method: "POST", params: url.Values{}, } + requestInfo.params.Set("CurrentPage", strconv.Itoa(int(currentPage))) + requestInfo.params.Set("PageSize", strconv.Itoa(int(pageSize))) resp, err := client.do(requestInfo) if err != nil { diff --git a/users.go b/users.go index 7d8e0f0..b68ca53 100644 --- a/users.go +++ b/users.go @@ -27,14 +27,20 @@ type UsersGetPricingResult struct { } `xml:"ProductCategory"` } -func (client *Client) UsersGetPricing(productType string) ([]UsersGetPricingResult, error) { +func (client *Client) UsersGetPricing(productType, productCategory, productName string) ([]UsersGetPricingResult, error) { requestInfo := &ApiRequest{ command: usersGetPricing, - method: "POST", + method: "GET", params: url.Values{}, } requestInfo.params.Set("ProductType", productType) + if len(productCategory) > 0 && productCategory != "*" { + requestInfo.params.Set("ProductCategory", productCategory) + } + if len(productName) > 0 && productName != "*" { + requestInfo.params.Set("ProductName", productName) + } resp, err := client.do(requestInfo) if err != nil { return nil, err