-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsandboxcompany.go
372 lines (318 loc) · 14.9 KB
/
sandboxcompany.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
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package finchgo
import (
"context"
"net/http"
"github.com/Finch-API/finch-api-go/internal/apijson"
"github.com/Finch-API/finch-api-go/internal/param"
"github.com/Finch-API/finch-api-go/internal/requestconfig"
"github.com/Finch-API/finch-api-go/option"
)
// SandboxCompanyService contains methods and other services that help with
// interacting with the Finch API.
//
// Note, unlike clients, this service does not read variables from the environment
// automatically. You should not instantiate this service directly, and instead use
// the [NewSandboxCompanyService] method instead.
type SandboxCompanyService struct {
Options []option.RequestOption
}
// NewSandboxCompanyService generates a new service that applies the given options
// to each request. These options are applied after the parent client's options (if
// there is one), and before any request-specific options.
func NewSandboxCompanyService(opts ...option.RequestOption) (r *SandboxCompanyService) {
r = &SandboxCompanyService{}
r.Options = opts
return
}
// Update a sandbox company's data
func (r *SandboxCompanyService) Update(ctx context.Context, body SandboxCompanyUpdateParams, opts ...option.RequestOption) (res *SandboxCompanyUpdateResponse, err error) {
opts = append(r.Options[:], opts...)
path := "sandbox/company"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPut, path, body, &res, opts...)
return
}
type SandboxCompanyUpdateResponse struct {
// An array of bank account objects associated with the payroll/HRIS system.
Accounts []SandboxCompanyUpdateResponseAccount `json:"accounts,required,nullable"`
// The array of company departments.
Departments []SandboxCompanyUpdateResponseDepartment `json:"departments,required,nullable"`
// The employer identification number.
Ein string `json:"ein,required,nullable"`
// The entity type object.
Entity SandboxCompanyUpdateResponseEntity `json:"entity,required,nullable"`
// The legal name of the company.
LegalName string `json:"legal_name,required,nullable"`
Locations []Location `json:"locations,required,nullable"`
// The email of the main administrator on the account.
PrimaryEmail string `json:"primary_email,required,nullable"`
// The phone number of the main administrator on the account. Format: `XXXXXXXXXX`
PrimaryPhoneNumber string `json:"primary_phone_number,required,nullable"`
JSON sandboxCompanyUpdateResponseJSON `json:"-"`
}
// sandboxCompanyUpdateResponseJSON contains the JSON metadata for the struct
// [SandboxCompanyUpdateResponse]
type sandboxCompanyUpdateResponseJSON struct {
Accounts apijson.Field
Departments apijson.Field
Ein apijson.Field
Entity apijson.Field
LegalName apijson.Field
Locations apijson.Field
PrimaryEmail apijson.Field
PrimaryPhoneNumber apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *SandboxCompanyUpdateResponse) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r sandboxCompanyUpdateResponseJSON) RawJSON() string {
return r.raw
}
type SandboxCompanyUpdateResponseAccount struct {
// The name of the bank associated in the payroll/HRIS system.
AccountName string `json:"account_name,nullable"`
// 10-12 digit number to specify the bank account
AccountNumber string `json:"account_number,nullable"`
// The type of bank account.
AccountType SandboxCompanyUpdateResponseAccountsAccountType `json:"account_type,nullable"`
// Name of the banking institution.
InstitutionName string `json:"institution_name,nullable"`
// A nine-digit code that's based on the U.S. Bank location where your account was
// opened.
RoutingNumber string `json:"routing_number,nullable"`
JSON sandboxCompanyUpdateResponseAccountJSON `json:"-"`
}
// sandboxCompanyUpdateResponseAccountJSON contains the JSON metadata for the
// struct [SandboxCompanyUpdateResponseAccount]
type sandboxCompanyUpdateResponseAccountJSON struct {
AccountName apijson.Field
AccountNumber apijson.Field
AccountType apijson.Field
InstitutionName apijson.Field
RoutingNumber apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *SandboxCompanyUpdateResponseAccount) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r sandboxCompanyUpdateResponseAccountJSON) RawJSON() string {
return r.raw
}
// The type of bank account.
type SandboxCompanyUpdateResponseAccountsAccountType string
const (
SandboxCompanyUpdateResponseAccountsAccountTypeChecking SandboxCompanyUpdateResponseAccountsAccountType = "checking"
SandboxCompanyUpdateResponseAccountsAccountTypeSavings SandboxCompanyUpdateResponseAccountsAccountType = "savings"
)
func (r SandboxCompanyUpdateResponseAccountsAccountType) IsKnown() bool {
switch r {
case SandboxCompanyUpdateResponseAccountsAccountTypeChecking, SandboxCompanyUpdateResponseAccountsAccountTypeSavings:
return true
}
return false
}
type SandboxCompanyUpdateResponseDepartment struct {
// The department name.
Name string `json:"name,nullable"`
// The parent department, if present.
Parent SandboxCompanyUpdateResponseDepartmentsParent `json:"parent,nullable"`
JSON sandboxCompanyUpdateResponseDepartmentJSON `json:"-"`
}
// sandboxCompanyUpdateResponseDepartmentJSON contains the JSON metadata for the
// struct [SandboxCompanyUpdateResponseDepartment]
type sandboxCompanyUpdateResponseDepartmentJSON struct {
Name apijson.Field
Parent apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *SandboxCompanyUpdateResponseDepartment) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r sandboxCompanyUpdateResponseDepartmentJSON) RawJSON() string {
return r.raw
}
// The parent department, if present.
type SandboxCompanyUpdateResponseDepartmentsParent struct {
// The parent department's name.
Name string `json:"name,nullable"`
JSON sandboxCompanyUpdateResponseDepartmentsParentJSON `json:"-"`
}
// sandboxCompanyUpdateResponseDepartmentsParentJSON contains the JSON metadata for
// the struct [SandboxCompanyUpdateResponseDepartmentsParent]
type sandboxCompanyUpdateResponseDepartmentsParentJSON struct {
Name apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *SandboxCompanyUpdateResponseDepartmentsParent) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r sandboxCompanyUpdateResponseDepartmentsParentJSON) RawJSON() string {
return r.raw
}
// The entity type object.
type SandboxCompanyUpdateResponseEntity struct {
// The tax payer subtype of the company.
Subtype SandboxCompanyUpdateResponseEntitySubtype `json:"subtype,nullable"`
// The tax payer type of the company.
Type SandboxCompanyUpdateResponseEntityType `json:"type,nullable"`
JSON sandboxCompanyUpdateResponseEntityJSON `json:"-"`
}
// sandboxCompanyUpdateResponseEntityJSON contains the JSON metadata for the struct
// [SandboxCompanyUpdateResponseEntity]
type sandboxCompanyUpdateResponseEntityJSON struct {
Subtype apijson.Field
Type apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *SandboxCompanyUpdateResponseEntity) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r sandboxCompanyUpdateResponseEntityJSON) RawJSON() string {
return r.raw
}
// The tax payer subtype of the company.
type SandboxCompanyUpdateResponseEntitySubtype string
const (
SandboxCompanyUpdateResponseEntitySubtypeSCorporation SandboxCompanyUpdateResponseEntitySubtype = "s_corporation"
SandboxCompanyUpdateResponseEntitySubtypeCCorporation SandboxCompanyUpdateResponseEntitySubtype = "c_corporation"
SandboxCompanyUpdateResponseEntitySubtypeBCorporation SandboxCompanyUpdateResponseEntitySubtype = "b_corporation"
)
func (r SandboxCompanyUpdateResponseEntitySubtype) IsKnown() bool {
switch r {
case SandboxCompanyUpdateResponseEntitySubtypeSCorporation, SandboxCompanyUpdateResponseEntitySubtypeCCorporation, SandboxCompanyUpdateResponseEntitySubtypeBCorporation:
return true
}
return false
}
// The tax payer type of the company.
type SandboxCompanyUpdateResponseEntityType string
const (
SandboxCompanyUpdateResponseEntityTypeLlc SandboxCompanyUpdateResponseEntityType = "llc"
SandboxCompanyUpdateResponseEntityTypeLp SandboxCompanyUpdateResponseEntityType = "lp"
SandboxCompanyUpdateResponseEntityTypeCorporation SandboxCompanyUpdateResponseEntityType = "corporation"
SandboxCompanyUpdateResponseEntityTypeSoleProprietor SandboxCompanyUpdateResponseEntityType = "sole_proprietor"
SandboxCompanyUpdateResponseEntityTypeNonProfit SandboxCompanyUpdateResponseEntityType = "non_profit"
SandboxCompanyUpdateResponseEntityTypePartnership SandboxCompanyUpdateResponseEntityType = "partnership"
SandboxCompanyUpdateResponseEntityTypeCooperative SandboxCompanyUpdateResponseEntityType = "cooperative"
)
func (r SandboxCompanyUpdateResponseEntityType) IsKnown() bool {
switch r {
case SandboxCompanyUpdateResponseEntityTypeLlc, SandboxCompanyUpdateResponseEntityTypeLp, SandboxCompanyUpdateResponseEntityTypeCorporation, SandboxCompanyUpdateResponseEntityTypeSoleProprietor, SandboxCompanyUpdateResponseEntityTypeNonProfit, SandboxCompanyUpdateResponseEntityTypePartnership, SandboxCompanyUpdateResponseEntityTypeCooperative:
return true
}
return false
}
type SandboxCompanyUpdateParams struct {
// An array of bank account objects associated with the payroll/HRIS system.
Accounts param.Field[[]SandboxCompanyUpdateParamsAccount] `json:"accounts,required"`
// The array of company departments.
Departments param.Field[[]SandboxCompanyUpdateParamsDepartment] `json:"departments,required"`
// The employer identification number.
Ein param.Field[string] `json:"ein,required"`
// The entity type object.
Entity param.Field[SandboxCompanyUpdateParamsEntity] `json:"entity,required"`
// The legal name of the company.
LegalName param.Field[string] `json:"legal_name,required"`
Locations param.Field[[]LocationParam] `json:"locations,required"`
// The email of the main administrator on the account.
PrimaryEmail param.Field[string] `json:"primary_email,required"`
// The phone number of the main administrator on the account. Format: `XXXXXXXXXX`
PrimaryPhoneNumber param.Field[string] `json:"primary_phone_number,required"`
}
func (r SandboxCompanyUpdateParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
type SandboxCompanyUpdateParamsAccount struct {
// The name of the bank associated in the payroll/HRIS system.
AccountName param.Field[string] `json:"account_name"`
// 10-12 digit number to specify the bank account
AccountNumber param.Field[string] `json:"account_number"`
// The type of bank account.
AccountType param.Field[SandboxCompanyUpdateParamsAccountsAccountType] `json:"account_type"`
// Name of the banking institution.
InstitutionName param.Field[string] `json:"institution_name"`
// A nine-digit code that's based on the U.S. Bank location where your account was
// opened.
RoutingNumber param.Field[string] `json:"routing_number"`
}
func (r SandboxCompanyUpdateParamsAccount) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The type of bank account.
type SandboxCompanyUpdateParamsAccountsAccountType string
const (
SandboxCompanyUpdateParamsAccountsAccountTypeChecking SandboxCompanyUpdateParamsAccountsAccountType = "checking"
SandboxCompanyUpdateParamsAccountsAccountTypeSavings SandboxCompanyUpdateParamsAccountsAccountType = "savings"
)
func (r SandboxCompanyUpdateParamsAccountsAccountType) IsKnown() bool {
switch r {
case SandboxCompanyUpdateParamsAccountsAccountTypeChecking, SandboxCompanyUpdateParamsAccountsAccountTypeSavings:
return true
}
return false
}
type SandboxCompanyUpdateParamsDepartment struct {
// The department name.
Name param.Field[string] `json:"name"`
// The parent department, if present.
Parent param.Field[SandboxCompanyUpdateParamsDepartmentsParent] `json:"parent"`
}
func (r SandboxCompanyUpdateParamsDepartment) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The parent department, if present.
type SandboxCompanyUpdateParamsDepartmentsParent struct {
// The parent department's name.
Name param.Field[string] `json:"name"`
}
func (r SandboxCompanyUpdateParamsDepartmentsParent) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The entity type object.
type SandboxCompanyUpdateParamsEntity struct {
// The tax payer subtype of the company.
Subtype param.Field[SandboxCompanyUpdateParamsEntitySubtype] `json:"subtype"`
// The tax payer type of the company.
Type param.Field[SandboxCompanyUpdateParamsEntityType] `json:"type"`
}
func (r SandboxCompanyUpdateParamsEntity) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The tax payer subtype of the company.
type SandboxCompanyUpdateParamsEntitySubtype string
const (
SandboxCompanyUpdateParamsEntitySubtypeSCorporation SandboxCompanyUpdateParamsEntitySubtype = "s_corporation"
SandboxCompanyUpdateParamsEntitySubtypeCCorporation SandboxCompanyUpdateParamsEntitySubtype = "c_corporation"
SandboxCompanyUpdateParamsEntitySubtypeBCorporation SandboxCompanyUpdateParamsEntitySubtype = "b_corporation"
)
func (r SandboxCompanyUpdateParamsEntitySubtype) IsKnown() bool {
switch r {
case SandboxCompanyUpdateParamsEntitySubtypeSCorporation, SandboxCompanyUpdateParamsEntitySubtypeCCorporation, SandboxCompanyUpdateParamsEntitySubtypeBCorporation:
return true
}
return false
}
// The tax payer type of the company.
type SandboxCompanyUpdateParamsEntityType string
const (
SandboxCompanyUpdateParamsEntityTypeLlc SandboxCompanyUpdateParamsEntityType = "llc"
SandboxCompanyUpdateParamsEntityTypeLp SandboxCompanyUpdateParamsEntityType = "lp"
SandboxCompanyUpdateParamsEntityTypeCorporation SandboxCompanyUpdateParamsEntityType = "corporation"
SandboxCompanyUpdateParamsEntityTypeSoleProprietor SandboxCompanyUpdateParamsEntityType = "sole_proprietor"
SandboxCompanyUpdateParamsEntityTypeNonProfit SandboxCompanyUpdateParamsEntityType = "non_profit"
SandboxCompanyUpdateParamsEntityTypePartnership SandboxCompanyUpdateParamsEntityType = "partnership"
SandboxCompanyUpdateParamsEntityTypeCooperative SandboxCompanyUpdateParamsEntityType = "cooperative"
)
func (r SandboxCompanyUpdateParamsEntityType) IsKnown() bool {
switch r {
case SandboxCompanyUpdateParamsEntityTypeLlc, SandboxCompanyUpdateParamsEntityTypeLp, SandboxCompanyUpdateParamsEntityTypeCorporation, SandboxCompanyUpdateParamsEntityTypeSoleProprietor, SandboxCompanyUpdateParamsEntityTypeNonProfit, SandboxCompanyUpdateParamsEntityTypePartnership, SandboxCompanyUpdateParamsEntityTypeCooperative:
return true
}
return false
}