-
Notifications
You must be signed in to change notification settings - Fork 23
/
profile.go
136 lines (122 loc) · 6.08 KB
/
profile.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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
package plivo
type ProfileService struct {
client *Client
}
type CreateProfileRequestParams struct {
ProfileAlias string `json:"profile_alias" validate:"required"`
CustomerType string `json:"customer_type" validate:"oneof= DIRECT RESELLER"`
EntityType string `json:"entity_type" validate:"oneof= PRIVATE PUBLIC NON_PROFIT GOVERNMENT INDIVIDUAL"`
CompanyName string `json:"company_name" validate:"required,max=100"`
Ein string `json:"ein" validate:"max=100"`
EinIssuingCountry string `json:"ein_issuing_country" validate:"max=2"`
Address *Address `json:"address" validate:"required"`
StockSymbol string `json:"stock_symbol" validate:"required_if=EntityType PUBLIC,max=10"`
StockExchange string `json:"stock_exchange" validate:"required_if=EntityType PUBLIC,oneof= NASDAQ NYSE AMEX AMX ASX B3 BME BSE FRA ICEX JPX JSE KRX LON NSE OMX SEHK SGX SSE STO SWX SZSE TSX TWSE VSE OTHER ''"`
Website string `json:"website" validate:"max=100"`
Vertical string `json:"vertical" validate:"oneof= PROFESSIONAL REAL_ESTATE HEALTHCARE HUMAN_RESOURCES ENERGY ENTERTAINMENT RETAIL TRANSPORTATION AGRICULTURE INSURANCE POSTAL EDUCATION HOSPITALITY FINANCIAL POLITICAL GAMBLING LEGAL CONSTRUCTION NGO MANUFACTURING GOVERNMENT TECHNOLOGY COMMUNICATION"`
AltBusinessID string `json:"alt_business_id" validate:"max=50"`
AltBusinessidType string `json:"alt_business_id_type" validate:"oneof= DUNS LEI GIIN NONE ''"`
PlivoSubaccount string `json:"plivo_subaccount" validate:"max=20"`
AuthorizedContact *AuthorizedContact `json:"authorized_contact"`
}
type CreateProfileResponse struct {
ApiID string `json:"api_id"`
ProfileUUID string `json:"profile_uuid,omitempty"`
Message string `json:"message,omitempty"`
}
type ProfileGetResponse struct {
ApiID string `json:"api_id"`
Profile Profile `json:"profile"`
}
type ProfileListParams struct {
Limit int `url:"limit,omitempty"`
Offset int `url:"offset,omitempty"`
}
type ProfileListResponse struct {
ApiID string `json:"api_id"`
Meta struct {
Previous *string
Next *string
Offset int64
Limit int64
} `json:"meta"`
ProfileResponse []Profile `json:"profiles"`
}
type DeleteProfileResponse struct {
ApiID string `json:"api_id"`
Message string `json:"message,omitempty"`
}
type UpdateProfileRequestParams struct {
EntityType string `json:"entity_type" validate:"oneof= PRIVATE PUBLIC NON_PROFIT GOVERNMENT INDIVIDUAL"`
CompanyName string `json:"company_name" validate:"required,max=100"`
Address *Address `json:"address" validate:"required"`
Website string `json:"website" validate:"max=100"`
Vertical string `json:"vertical" validate:"oneof= PROFESSIONAL REAL_ESTATE HEALTHCARE HUMAN_RESOURCES ENERGY ENTERTAINMENT RETAIL TRANSPORTATION AGRICULTURE INSURANCE POSTAL EDUCATION HOSPITALITY FINANCIAL POLITICAL GAMBLING LEGAL CONSTRUCTION NGO MANUFACTURING GOVERNMENT TECHNOLOGY COMMUNICATION"`
AuthorizedContact *AuthorizedContact `json:"authorized_contact"`
}
type Profile struct {
ProfileUUID string `json:"profile_uuid,omitempty"`
ProfileAlias string `json:"profile_alias,omitempty"`
ProfileType string `json:"profile_type,omitempty"`
PrimaryProfile string `json:"primary_profile,omitempty"`
CustomerType string `json:"customer_type,omitempty"`
EntityType string `json:"entity_type,omitempty"`
CompanyName string `json:"company_name,omitempty"`
Ein string `json:"ein,omitempty"`
EinIssuingCountry string `json:"ein_issuing_country,omitempty"`
Address Address `json:"address,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"`
PlivoSubaccount string `json:"plivo_subaccount,omitempty"`
AuthorizedContact AuthorizedContact `json:"authorized_contact,omitempty"`
CreatedAt string `json:"created_at,omitempty"`
}
func (service *ProfileService) List(param ProfileListParams) (response *ProfileListResponse, err error) {
req, err := service.client.NewRequest("GET", param, "Profile")
if err != nil {
return
}
response = &ProfileListResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
func (service *ProfileService) Get(ProfileUUID string) (response *ProfileGetResponse, err error) {
req, err := service.client.NewRequest("GET", nil, "Profile/%s", ProfileUUID)
if err != nil {
return
}
response = &ProfileGetResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
func (service *ProfileService) Create(params CreateProfileRequestParams) (response *CreateProfileResponse, err error) {
req, err := service.client.NewRequest("POST", params, "Profile")
if err != nil {
return
}
response = &CreateProfileResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
func (service *ProfileService) Delete(profileUUID string) (response *DeleteProfileResponse, err error) {
req, err := service.client.NewRequest("DELETE", nil, "Profile/%s", profileUUID)
if err != nil {
return
}
response = &DeleteProfileResponse{}
err = service.client.ExecuteRequest(req, response)
return
}
func (service *ProfileService) Update(profileUUID string, params UpdateProfileRequestParams) (response *ProfileGetResponse, err error) {
req, err := service.client.NewRequest("POST", params, "Profile/%s", profileUUID)
if err != nil {
return
}
response = &ProfileGetResponse{}
err = service.client.ExecuteRequest(req, response)
return
}