forked from omniboost/go-fortnox
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathget_company_settings.go
152 lines (124 loc) · 4.26 KB
/
get_company_settings.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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
package fortnox
import (
"net/http"
"net/url"
"github.com/maokomioko/go-fortnox/utils"
)
func (c *Client) NewGetCompanySettingsRequest() GetCompanySettingsRequest {
r := GetCompanySettingsRequest{
client: c,
method: http.MethodGet,
headers: http.Header{},
}
r.queryParams = r.NewGetCompanySettingsQueryParams()
r.pathParams = r.NewGetCompanySettingsPathParams()
r.requestBody = r.NewGetCompanySettingsRequestBody()
return r
}
type GetCompanySettingsRequest struct {
client *Client
queryParams *GetCompanySettingsQueryParams
pathParams *GetCompanySettingsPathParams
method string
headers http.Header
requestBody GetCompanySettingsRequestBody
}
func (r GetCompanySettingsRequest) NewGetCompanySettingsQueryParams() *GetCompanySettingsQueryParams {
return &GetCompanySettingsQueryParams{}
}
type GetCompanySettingsQueryParams struct {
}
func (p GetCompanySettingsQueryParams) ToURLValues() (url.Values, error) {
encoder := utils.NewSchemaEncoder()
params := url.Values{}
err := encoder.Encode(p, params)
if err != nil {
return params, err
}
return params, nil
}
func (r *GetCompanySettingsRequest) QueryParams() *GetCompanySettingsQueryParams {
return r.queryParams
}
func (r GetCompanySettingsRequest) NewGetCompanySettingsPathParams() *GetCompanySettingsPathParams {
return &GetCompanySettingsPathParams{}
}
type GetCompanySettingsPathParams struct {
}
func (p *GetCompanySettingsPathParams) Params() map[string]string {
return map[string]string{}
}
func (r *GetCompanySettingsRequest) PathParams() *GetCompanySettingsPathParams {
return r.pathParams
}
func (r *GetCompanySettingsRequest) SetMethod(method string) {
r.method = method
}
func (r *GetCompanySettingsRequest) Method() string {
return r.method
}
func (r GetCompanySettingsRequest) NewGetCompanySettingsRequestBody() GetCompanySettingsRequestBody {
return GetCompanySettingsRequestBody{}
}
type GetCompanySettingsRequestBody struct{}
func (r *GetCompanySettingsRequest) RequestBody() *GetCompanySettingsRequestBody {
return &r.requestBody
}
func (r *GetCompanySettingsRequest) SetRequestBody(body GetCompanySettingsRequestBody) {
r.requestBody = body
}
func (r *GetCompanySettingsRequest) NewResponseBody() *GetCompanySettingsResponseBody {
return &GetCompanySettingsResponseBody{}
}
type GetCompanySettingsResponseBody struct {
CompanySettings CompanySettings
}
func (r *GetCompanySettingsRequest) URL() url.URL {
return r.client.GetEndpointURL("/settings/company", r.PathParams())
}
func (r *GetCompanySettingsRequest) Do() (GetCompanySettingsResponseBody, error) {
// Create http request
req, err := r.client.NewRequest(nil, r.Method(), r.URL(), nil)
if err != nil {
return *r.NewResponseBody(), err
}
// Process query parameters
err = utils.AddQueryParamsToRequest(r.QueryParams(), req, false)
if err != nil {
return *r.NewResponseBody(), err
}
responseBody := r.NewResponseBody()
_, err = r.client.Do(req, responseBody)
return *responseBody, err
}
type CompanySettings struct {
Address string `json:"Address"`
BG string `json:"BG"`
BIC string `json:"BIC"`
BranchCode string `json:"BranchCode"`
City string `json:"City"`
ContactFirstName string `json:"ContactFirstName"`
ContactLastName string `json:"ContactLastName"`
Country string `json:"Country"`
CountryCode string `json:"CountryCode"`
DatabaseNumber int `json:"DatabaseNumber"`
Domicile string `json:"Domicile"`
Email string `json:"Email"`
Fax string `json:"Fax"`
IBAN string `json:"IBAN"`
Name string `json:"Name"`
OrganizationNumber string `json:"OrganizationNumber"`
PG string `json:"PG"`
Phone1 string `json:"Phone1"`
Phone2 string `json:"Phone2"`
TaxEnabled bool `json:"TaxEnabled"`
VATNumber string `json:"VATNumber"`
VisitAddress string `json:"VisitAddress"`
VisitCity string `json:"VisitCity"`
VisitCountry string `json:"VisitCountry"`
VisitCountryCode string `json:"VisitCountryCode"`
VisitName string `json:"VisitName"`
VisitZipCode string `json:"VisitZipCode"`
WWW string `json:"WWW"`
ZipCode string `json:"ZipCode"`
}