-
Notifications
You must be signed in to change notification settings - Fork 23
/
pricing.go
76 lines (72 loc) · 2.38 KB
/
pricing.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
package plivo
type PricingService struct {
client *Client
}
type PricingGetParams struct {
CountryISO string `json:"country_iso" url:"country_iso"`
}
type Pricing struct {
APIID string `json:"api_id" url:"api_id"`
Country string `json:"country" url:"country"`
CountryCode int `json:"country_code" url:"country_code"`
CountryISO string `json:"country_iso" url:"country_iso"`
Message struct {
Inbound struct {
Rate string `json:"rate" url:"rate"`
} `json:"inbound" url:"inbound"`
Outbound struct {
Rate string `json:"rate" url:"rate"`
} `json:"outbound" url:"outbound"`
OutboundNetworksList []struct {
GroupName string `json:"group_name" url:"group_name"`
Rate string `json:"rate" url:"rate"`
} `json:"outbound_networks_list" url:"outbound_networks_list"`
} `json:"message" url:"message"`
PhoneNumbers struct {
Local struct {
Rate string `json:"rate" url:"rate"`
} `json:"local" url:"local"`
Tollfree struct {
Rate string `json:"rate" url:"rate"`
} `json:"tollfree" url:"tollfree"`
} `json:"phone_numbers" url:"phone_numbers"`
Voice struct {
Inbound struct {
IP struct {
Rate string `json:"rate" url:"rate"`
} `json:"ip" url:"ip"`
Local struct {
Rate string `json:"rate" url:"rate"`
} `json:"local" url:"local"`
Tollfree struct {
Rate string `json:"rate" url:"rate"`
} `json:"tollfree" url:"tollfree"`
} `json:"inbound" url:"inbound"`
Outbound struct {
IP struct {
Rate string `json:"rate" url:"rate"`
} `json:"ip" url:"ip"`
Local struct {
Rate string `json:"rate" url:"rate"`
} `json:"local" url:"local"`
Rates []struct {
OriginationPrefix []string `json:"origination_prefix" url:"origination_prefix"`
Prefix []string `json:"prefix" url:"prefix"`
Rate string `json:"rate" url:"rate"`
VoiceNetworkGroup string `json:"voice_network_group" url:"voice_network_group"`
} `json:"rates" url:"rates"`
Tollfree struct {
Rate string `json:"rate" url:"rate"`
} `json:"tollfree" url:"tollfree"`
} `json:"outbound" url:"outbound"`
} `json:"voice" url:"voice"`
}
func (service *PricingService) Get(countryISO string) (response *Pricing, err error) {
req, err := service.client.NewRequest("GET", PricingGetParams{countryISO}, "Pricing")
if err != nil {
return nil, err
}
response = &Pricing{}
err = service.client.ExecuteRequest(req, response)
return
}