-
Notifications
You must be signed in to change notification settings - Fork 28
/
Copy pathusers.go
44 lines (38 loc) · 1.06 KB
/
users.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
36
37
38
39
40
41
42
43
44
package namecheap
import (
"net/url"
)
const (
usersGetPricing = "namecheap.users.getPricing"
)
type UsersGetPricingResult struct {
ProductType string `xml:"Name,attr"`
ProductCategory []struct {
Name string `xml:"Name,attr"`
Product []struct {
Name string `xml:"Name,attr"`
Price []struct {
Duration int `xml:"Duration,attr"`
DurationType string `xml:"DurationType,attr"`
Price float64 `xml:"Price,attr"`
RegularPrice float64 `xml:"RegularPrice,attr"`
YourPrice float64 `xml:"YourPrice,attr"`
CouponPrice float64 `xml:"CouponPrice,attr"`
Currency string `xml:"Currency,attr"`
} `xml:"Price"`
} `xml:"Product"`
} `xml:"ProductCategory"`
}
func (client *Client) UsersGetPricing(productType string) ([]UsersGetPricingResult, error) {
requestInfo := &ApiRequest{
command: usersGetPricing,
method: "POST",
params: url.Values{},
}
requestInfo.params.Set("ProductType", productType)
resp, err := client.do(requestInfo)
if err != nil {
return nil, err
}
return resp.UsersGetPricing, nil
}