-
Notifications
You must be signed in to change notification settings - Fork 23
/
brand.go
106 lines (97 loc) · 4.21 KB
/
brand.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
package plivo
type BrandService struct {
client *Client
}
type BrandCreationParams struct {
BrandAlias string `json:"brand_alias" url:"brand_alias" validate:"required"`
Type string `json:"brand_type" url:"brand_type" validate:"oneof= STARTER STANDARD ''"`
ProfileUUID string `json:"profile_uuid" url:"profile_uuid" validate:"required,max=36"`
SecondaryVetting *string `json:"secondary_vetting,omitempty" url:"secondary_vetting,omitempty"`
URL string `json:"url,omitempty" url:"url,omitempty"`
Method string `json:"method,omitempty" url:"method,omitempty"`
}
type BrandCreationResponse struct {
ApiID string `json:"api_id,omitempty"`
BrandID string `json:"brand_id,omitempty"`
Message string `json:"message,omitempty"`
}
type BrandListResponse struct {
ApiID string `json:"api_id,omitempty"`
BrandResponse []Brand `json:"brands,omitempty"`
}
type BrandGetResponse struct {
ApiID string `json:"api_id,omitempty"`
Brand Brand `json:"brand,omitempty"`
}
type Brand struct {
BrandAlias string `json:"brand_alias,omitempty"`
EntityType string `json:"entity_type,omitempty"`
BrandID string `json:"brand_id,omitempty"`
ProfileUUID string `json:"profile_uuid,omitempty"`
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Name string `json:"name,omitempty"`
CompanyName string `json:"company_name,omitempty"`
BrandType string `json:"brand_type,omitempty"`
Ein string `json:"ein,omitempty"`
EinIssuingCountry string `json:"ein_issuing_country,omitempty"`
StockSymbol string `json:"stock_symbol,omitempty"`
StockExchange string `json:"stock_exchange,omitempty"`
Website string `json:"website,omitempty"`
Vertical string `json:"vertical,omitempty"`
AltBusinessID string `json:"alt_business_id,omitempty"`
AltBusinessidType string `json:"alt_business_id_type,omitempty"`
RegistrationStatus string `json:"registration_status,omitempty"`
VettingStatus string `json:"vetting_status,omitempty"`
VettingScore int64 `json:"vetting_score,omitempty"`
Address Address `json:"address,omitempty"`
AuthorizedContact AuthorizedContact `json:"authorized_contact,omitempty"`
}
type BrandListParams struct {
Type *string `json:"type,omitempty"`
Status *string `json:"status,omitempty"`
Limit int `url:"limit,omitempty"`
Offset int `url:"offset,omitempty"`
}
type Address struct {
Street string `json:"street" validate:"max=100"`
City string `json:"city" validate:"max=100"`
State string `json:"state" validate:"max=20"`
PostalCode string `json:"postal_code" validate:"max=10"`
Country string `json:"country" validate:"max=2"`
}
type AuthorizedContact struct {
FirstName string `json:"first_name,omitempty"`
LastName string `json:"last_name,omitempty"`
Phone string `json:"phone,omitempty" validate:"max=16"`
Email string `json:"email,omitempty" validate:"max=100"`
Title string `json:"title,omitempty"`
Seniority string `json:"seniority,omitempty"`
}
func (service *BrandService) List(params BrandListParams) (response *BrandListResponse, err error) {
req, err := service.client.NewRequest("GET", params, "10dlc/Brand")
if err != nil {
return
}
response = &BrandListResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
func (service *BrandService) Get(brandID string) (response *BrandGetResponse, err error) {
req, err := service.client.NewRequest("GET", nil, "10dlc/Brand/%s", brandID)
if err != nil {
return
}
response = &BrandGetResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
func (service *BrandService) Create(params BrandCreationParams) (response *BrandCreationResponse, err error) {
req, err := service.client.NewRequest("POST", params, "10dlc/Brand")
if err != nil {
return
}
response = &BrandCreationResponse{}
err = service.client.ExecuteRequest(req, response)
return
}