-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathexport.go
More file actions
1204 lines (1047 loc) · 47.1 KB
/
export.go
File metadata and controls
1204 lines (1047 loc) · 47.1 KB
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
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
package increase
import (
"context"
"errors"
"fmt"
"net/http"
"net/url"
"slices"
"time"
"github.com/Increase/increase-go/internal/apijson"
"github.com/Increase/increase-go/internal/apiquery"
"github.com/Increase/increase-go/internal/param"
"github.com/Increase/increase-go/internal/requestconfig"
"github.com/Increase/increase-go/option"
"github.com/Increase/increase-go/packages/pagination"
)
// ExportService contains methods and other services that help with interacting
// with the increase 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 [NewExportService] method instead.
type ExportService struct {
Options []option.RequestOption
}
// NewExportService 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 NewExportService(opts ...option.RequestOption) (r *ExportService) {
r = &ExportService{}
r.Options = opts
return
}
// Create an Export
func (r *ExportService) New(ctx context.Context, body ExportNewParams, opts ...option.RequestOption) (res *Export, err error) {
opts = slices.Concat(r.Options, opts)
path := "exports"
err = requestconfig.ExecuteNewRequest(ctx, http.MethodPost, path, body, &res, opts...)
return res, err
}
// Retrieve an Export
func (r *ExportService) Get(ctx context.Context, exportID string, opts ...option.RequestOption) (res *Export, err error) {
opts = slices.Concat(r.Options, opts)
if exportID == "" {
err = errors.New("missing required export_id parameter")
return nil, err
}
path := fmt.Sprintf("exports/%s", exportID)
err = requestconfig.ExecuteNewRequest(ctx, http.MethodGet, path, nil, &res, opts...)
return res, err
}
// List Exports
func (r *ExportService) List(ctx context.Context, query ExportListParams, opts ...option.RequestOption) (res *pagination.Page[Export], err error) {
var raw *http.Response
opts = slices.Concat(r.Options, opts)
opts = append([]option.RequestOption{option.WithResponseInto(&raw)}, opts...)
path := "exports"
cfg, err := requestconfig.NewRequestConfig(ctx, http.MethodGet, path, query, &res, opts...)
if err != nil {
return nil, err
}
err = cfg.Execute()
if err != nil {
return nil, err
}
res.SetPageConfig(cfg, raw)
return res, nil
}
// List Exports
func (r *ExportService) ListAutoPaging(ctx context.Context, query ExportListParams, opts ...option.RequestOption) *pagination.PageAutoPager[Export] {
return pagination.NewPageAutoPager(r.List(ctx, query, opts...))
}
// Exports are generated files. Some exports can contain a lot of data, like a CSV
// of your transactions. Others can be a single document, like a tax form. Since
// they can take a while, they are generated asynchronously. We send a webhook when
// they are ready. For more information, please read our
// [Exports documentation](https://increase.com/documentation/exports).
type Export struct {
// The Export identifier.
ID string `json:"id" api:"required"`
// Details of the account statement BAI2 export. This field will be present when
// the `category` is equal to `account_statement_bai2`.
AccountStatementBai2 ExportAccountStatementBai2 `json:"account_statement_bai2" api:"required,nullable"`
// Details of the account statement OFX export. This field will be present when the
// `category` is equal to `account_statement_ofx`.
AccountStatementOfx ExportAccountStatementOfx `json:"account_statement_ofx" api:"required,nullable"`
// Details of the account verification letter export. This field will be present
// when the `category` is equal to `account_verification_letter`.
AccountVerificationLetter ExportAccountVerificationLetter `json:"account_verification_letter" api:"required,nullable"`
// Details of the balance CSV export. This field will be present when the
// `category` is equal to `balance_csv`.
BalanceCsv ExportBalanceCsv `json:"balance_csv" api:"required,nullable"`
// Details of the bookkeeping account balance CSV export. This field will be
// present when the `category` is equal to `bookkeeping_account_balance_csv`.
BookkeepingAccountBalanceCsv ExportBookkeepingAccountBalanceCsv `json:"bookkeeping_account_balance_csv" api:"required,nullable"`
// The category of the Export. We may add additional possible values for this enum
// over time; your application should be able to handle that gracefully.
Category ExportCategory `json:"category" api:"required"`
// The time the Export was created.
CreatedAt time.Time `json:"created_at" api:"required" format:"date-time"`
// Details of the dashboard table CSV export. This field will be present when the
// `category` is equal to `dashboard_table_csv`.
DashboardTableCsv ExportDashboardTableCsv `json:"dashboard_table_csv" api:"required,nullable"`
// Details of the entity CSV export. This field will be present when the `category`
// is equal to `entity_csv`.
EntityCsv ExportEntityCsv `json:"entity_csv" api:"required,nullable"`
// Details of the fee CSV export. This field will be present when the `category` is
// equal to `fee_csv`.
FeeCsv ExportFeeCsv `json:"fee_csv" api:"required,nullable"`
// Details of the Form 1099-INT export. This field will be present when the
// `category` is equal to `form_1099_int`.
Form1099Int ExportForm1099Int `json:"form_1099_int" api:"required,nullable"`
// Details of the Form 1099-MISC export. This field will be present when the
// `category` is equal to `form_1099_misc`.
Form1099Misc ExportForm1099Misc `json:"form_1099_misc" api:"required,nullable"`
// Details of the funding instructions export. This field will be present when the
// `category` is equal to `funding_instructions`.
FundingInstructions ExportFundingInstructions `json:"funding_instructions" api:"required,nullable"`
// The idempotency key you chose for this object. This value is unique across
// Increase and is used to ensure that a request is only processed once. Learn more
// about [idempotency](https://increase.com/documentation/idempotency-keys).
IdempotencyKey string `json:"idempotency_key" api:"required,nullable"`
// The result of the Export. This will be present when the Export's status
// transitions to `complete`.
Result ExportResult `json:"result" api:"required,nullable"`
// The status of the Export.
Status ExportStatus `json:"status" api:"required"`
// Details of the transaction CSV export. This field will be present when the
// `category` is equal to `transaction_csv`.
TransactionCsv ExportTransactionCsv `json:"transaction_csv" api:"required,nullable"`
// A constant representing the object's type. For this resource it will always be
// `export`.
Type ExportType `json:"type" api:"required"`
// Details of the vendor CSV export. This field will be present when the `category`
// is equal to `vendor_csv`.
VendorCsv ExportVendorCsv `json:"vendor_csv" api:"required,nullable"`
// Details of the voided check export. This field will be present when the
// `category` is equal to `voided_check`.
VoidedCheck ExportVoidedCheck `json:"voided_check" api:"required,nullable"`
ExtraFields map[string]interface{} `json:"-" api:"extrafields"`
JSON exportJSON `json:"-"`
}
// exportJSON contains the JSON metadata for the struct [Export]
type exportJSON struct {
ID apijson.Field
AccountStatementBai2 apijson.Field
AccountStatementOfx apijson.Field
AccountVerificationLetter apijson.Field
BalanceCsv apijson.Field
BookkeepingAccountBalanceCsv apijson.Field
Category apijson.Field
CreatedAt apijson.Field
DashboardTableCsv apijson.Field
EntityCsv apijson.Field
FeeCsv apijson.Field
Form1099Int apijson.Field
Form1099Misc apijson.Field
FundingInstructions apijson.Field
IdempotencyKey apijson.Field
Result apijson.Field
Status apijson.Field
TransactionCsv apijson.Field
Type apijson.Field
VendorCsv apijson.Field
VoidedCheck apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *Export) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportJSON) RawJSON() string {
return r.raw
}
// Details of the account statement BAI2 export. This field will be present when
// the `category` is equal to `account_statement_bai2`.
type ExportAccountStatementBai2 struct {
// Filter results by Account.
AccountID string `json:"account_id" api:"required,nullable"`
// The date for which to retrieve the balance.
EffectiveDate time.Time `json:"effective_date" api:"required,nullable" format:"date"`
// Filter results by Program.
ProgramID string `json:"program_id" api:"required,nullable"`
JSON exportAccountStatementBai2JSON `json:"-"`
}
// exportAccountStatementBai2JSON contains the JSON metadata for the struct
// [ExportAccountStatementBai2]
type exportAccountStatementBai2JSON struct {
AccountID apijson.Field
EffectiveDate apijson.Field
ProgramID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportAccountStatementBai2) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportAccountStatementBai2JSON) RawJSON() string {
return r.raw
}
// Details of the account statement OFX export. This field will be present when the
// `category` is equal to `account_statement_ofx`.
type ExportAccountStatementOfx struct {
// The Account to create a statement for.
AccountID string `json:"account_id" api:"required"`
// Filter transactions by their created date.
CreatedAt ExportAccountStatementOfxCreatedAt `json:"created_at" api:"required,nullable"`
JSON exportAccountStatementOfxJSON `json:"-"`
}
// exportAccountStatementOfxJSON contains the JSON metadata for the struct
// [ExportAccountStatementOfx]
type exportAccountStatementOfxJSON struct {
AccountID apijson.Field
CreatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportAccountStatementOfx) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportAccountStatementOfxJSON) RawJSON() string {
return r.raw
}
// Filter transactions by their created date.
type ExportAccountStatementOfxCreatedAt struct {
// Filter results to transactions created after this time.
After time.Time `json:"after" api:"required,nullable" format:"date-time"`
// Filter results to transactions created before this time.
Before time.Time `json:"before" api:"required,nullable" format:"date-time"`
JSON exportAccountStatementOfxCreatedAtJSON `json:"-"`
}
// exportAccountStatementOfxCreatedAtJSON contains the JSON metadata for the struct
// [ExportAccountStatementOfxCreatedAt]
type exportAccountStatementOfxCreatedAtJSON struct {
After apijson.Field
Before apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportAccountStatementOfxCreatedAt) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportAccountStatementOfxCreatedAtJSON) RawJSON() string {
return r.raw
}
// Details of the account verification letter export. This field will be present
// when the `category` is equal to `account_verification_letter`.
type ExportAccountVerificationLetter struct {
// The Account Number to create a letter for.
AccountNumberID string `json:"account_number_id" api:"required"`
// The date of the balance to include in the letter.
BalanceDate time.Time `json:"balance_date" api:"required,nullable" format:"date"`
JSON exportAccountVerificationLetterJSON `json:"-"`
}
// exportAccountVerificationLetterJSON contains the JSON metadata for the struct
// [ExportAccountVerificationLetter]
type exportAccountVerificationLetterJSON struct {
AccountNumberID apijson.Field
BalanceDate apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportAccountVerificationLetter) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportAccountVerificationLetterJSON) RawJSON() string {
return r.raw
}
// Details of the balance CSV export. This field will be present when the
// `category` is equal to `balance_csv`.
type ExportBalanceCsv struct {
// Filter results by Account.
AccountID string `json:"account_id" api:"required,nullable"`
// Filter balances by their created date.
CreatedAt ExportBalanceCsvCreatedAt `json:"created_at" api:"required,nullable"`
JSON exportBalanceCsvJSON `json:"-"`
}
// exportBalanceCsvJSON contains the JSON metadata for the struct
// [ExportBalanceCsv]
type exportBalanceCsvJSON struct {
AccountID apijson.Field
CreatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportBalanceCsv) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportBalanceCsvJSON) RawJSON() string {
return r.raw
}
// Filter balances by their created date.
type ExportBalanceCsvCreatedAt struct {
// Filter balances created after this time.
After time.Time `json:"after" api:"required,nullable" format:"date-time"`
// Filter balances created before this time.
Before time.Time `json:"before" api:"required,nullable" format:"date-time"`
JSON exportBalanceCsvCreatedAtJSON `json:"-"`
}
// exportBalanceCsvCreatedAtJSON contains the JSON metadata for the struct
// [ExportBalanceCsvCreatedAt]
type exportBalanceCsvCreatedAtJSON struct {
After apijson.Field
Before apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportBalanceCsvCreatedAt) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportBalanceCsvCreatedAtJSON) RawJSON() string {
return r.raw
}
// Details of the bookkeeping account balance CSV export. This field will be
// present when the `category` is equal to `bookkeeping_account_balance_csv`.
type ExportBookkeepingAccountBalanceCsv struct {
// Filter results by Bookkeeping Account.
BookkeepingAccountID string `json:"bookkeeping_account_id" api:"required,nullable"`
// Filter balances by their created date.
CreatedAt ExportBookkeepingAccountBalanceCsvCreatedAt `json:"created_at" api:"required,nullable"`
JSON exportBookkeepingAccountBalanceCsvJSON `json:"-"`
}
// exportBookkeepingAccountBalanceCsvJSON contains the JSON metadata for the struct
// [ExportBookkeepingAccountBalanceCsv]
type exportBookkeepingAccountBalanceCsvJSON struct {
BookkeepingAccountID apijson.Field
CreatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportBookkeepingAccountBalanceCsv) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportBookkeepingAccountBalanceCsvJSON) RawJSON() string {
return r.raw
}
// Filter balances by their created date.
type ExportBookkeepingAccountBalanceCsvCreatedAt struct {
// Filter balances created after this time.
After time.Time `json:"after" api:"required,nullable" format:"date-time"`
// Filter balances created before this time.
Before time.Time `json:"before" api:"required,nullable" format:"date-time"`
JSON exportBookkeepingAccountBalanceCsvCreatedAtJSON `json:"-"`
}
// exportBookkeepingAccountBalanceCsvCreatedAtJSON contains the JSON metadata for
// the struct [ExportBookkeepingAccountBalanceCsvCreatedAt]
type exportBookkeepingAccountBalanceCsvCreatedAtJSON struct {
After apijson.Field
Before apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportBookkeepingAccountBalanceCsvCreatedAt) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportBookkeepingAccountBalanceCsvCreatedAtJSON) RawJSON() string {
return r.raw
}
// The category of the Export. We may add additional possible values for this enum
// over time; your application should be able to handle that gracefully.
type ExportCategory string
const (
ExportCategoryAccountStatementOfx ExportCategory = "account_statement_ofx"
ExportCategoryAccountStatementBai2 ExportCategory = "account_statement_bai2"
ExportCategoryTransactionCsv ExportCategory = "transaction_csv"
ExportCategoryBalanceCsv ExportCategory = "balance_csv"
ExportCategoryBookkeepingAccountBalanceCsv ExportCategory = "bookkeeping_account_balance_csv"
ExportCategoryEntityCsv ExportCategory = "entity_csv"
ExportCategoryVendorCsv ExportCategory = "vendor_csv"
ExportCategoryDashboardTableCsv ExportCategory = "dashboard_table_csv"
ExportCategoryAccountVerificationLetter ExportCategory = "account_verification_letter"
ExportCategoryFundingInstructions ExportCategory = "funding_instructions"
ExportCategoryForm1099Int ExportCategory = "form_1099_int"
ExportCategoryForm1099Misc ExportCategory = "form_1099_misc"
ExportCategoryFeeCsv ExportCategory = "fee_csv"
ExportCategoryVoidedCheck ExportCategory = "voided_check"
)
func (r ExportCategory) IsKnown() bool {
switch r {
case ExportCategoryAccountStatementOfx, ExportCategoryAccountStatementBai2, ExportCategoryTransactionCsv, ExportCategoryBalanceCsv, ExportCategoryBookkeepingAccountBalanceCsv, ExportCategoryEntityCsv, ExportCategoryVendorCsv, ExportCategoryDashboardTableCsv, ExportCategoryAccountVerificationLetter, ExportCategoryFundingInstructions, ExportCategoryForm1099Int, ExportCategoryForm1099Misc, ExportCategoryFeeCsv, ExportCategoryVoidedCheck:
return true
}
return false
}
// Details of the dashboard table CSV export. This field will be present when the
// `category` is equal to `dashboard_table_csv`.
type ExportDashboardTableCsv struct {
JSON exportDashboardTableCsvJSON `json:"-"`
}
// exportDashboardTableCsvJSON contains the JSON metadata for the struct
// [ExportDashboardTableCsv]
type exportDashboardTableCsvJSON struct {
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportDashboardTableCsv) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportDashboardTableCsvJSON) RawJSON() string {
return r.raw
}
// Details of the entity CSV export. This field will be present when the `category`
// is equal to `entity_csv`.
type ExportEntityCsv struct {
JSON exportEntityCsvJSON `json:"-"`
}
// exportEntityCsvJSON contains the JSON metadata for the struct [ExportEntityCsv]
type exportEntityCsvJSON struct {
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportEntityCsv) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportEntityCsvJSON) RawJSON() string {
return r.raw
}
// Details of the fee CSV export. This field will be present when the `category` is
// equal to `fee_csv`.
type ExportFeeCsv struct {
// Filter fees by their created date. The time range must not include any fees that
// are part of an open fee statement.
CreatedAt ExportFeeCsvCreatedAt `json:"created_at" api:"required,nullable"`
JSON exportFeeCsvJSON `json:"-"`
}
// exportFeeCsvJSON contains the JSON metadata for the struct [ExportFeeCsv]
type exportFeeCsvJSON struct {
CreatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportFeeCsv) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportFeeCsvJSON) RawJSON() string {
return r.raw
}
// Filter fees by their created date. The time range must not include any fees that
// are part of an open fee statement.
type ExportFeeCsvCreatedAt struct {
// Filter fees created after this time.
After time.Time `json:"after" api:"required,nullable" format:"date-time"`
// Filter fees created before this time.
Before time.Time `json:"before" api:"required,nullable" format:"date-time"`
JSON exportFeeCsvCreatedAtJSON `json:"-"`
}
// exportFeeCsvCreatedAtJSON contains the JSON metadata for the struct
// [ExportFeeCsvCreatedAt]
type exportFeeCsvCreatedAtJSON struct {
After apijson.Field
Before apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportFeeCsvCreatedAt) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportFeeCsvCreatedAtJSON) RawJSON() string {
return r.raw
}
// Details of the Form 1099-INT export. This field will be present when the
// `category` is equal to `form_1099_int`.
type ExportForm1099Int struct {
// The Account the tax form is for.
AccountID string `json:"account_id" api:"required"`
// Whether the tax form is a corrected form.
Corrected bool `json:"corrected" api:"required"`
// A description of the tax form.
Description string `json:"description" api:"required"`
// The tax year for the tax form.
Year int64 `json:"year" api:"required"`
JSON exportForm1099IntJSON `json:"-"`
}
// exportForm1099IntJSON contains the JSON metadata for the struct
// [ExportForm1099Int]
type exportForm1099IntJSON struct {
AccountID apijson.Field
Corrected apijson.Field
Description apijson.Field
Year apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportForm1099Int) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportForm1099IntJSON) RawJSON() string {
return r.raw
}
// Details of the Form 1099-MISC export. This field will be present when the
// `category` is equal to `form_1099_misc`.
type ExportForm1099Misc struct {
// The Account the tax form is for.
AccountID string `json:"account_id" api:"required"`
// Whether the tax form is a corrected form.
Corrected bool `json:"corrected" api:"required"`
// The tax year for the tax form.
Year int64 `json:"year" api:"required"`
JSON exportForm1099MiscJSON `json:"-"`
}
// exportForm1099MiscJSON contains the JSON metadata for the struct
// [ExportForm1099Misc]
type exportForm1099MiscJSON struct {
AccountID apijson.Field
Corrected apijson.Field
Year apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportForm1099Misc) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportForm1099MiscJSON) RawJSON() string {
return r.raw
}
// Details of the funding instructions export. This field will be present when the
// `category` is equal to `funding_instructions`.
type ExportFundingInstructions struct {
// The Account Number to create funding instructions for.
AccountNumberID string `json:"account_number_id" api:"required"`
JSON exportFundingInstructionsJSON `json:"-"`
}
// exportFundingInstructionsJSON contains the JSON metadata for the struct
// [ExportFundingInstructions]
type exportFundingInstructionsJSON struct {
AccountNumberID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportFundingInstructions) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportFundingInstructionsJSON) RawJSON() string {
return r.raw
}
// The result of the Export. This will be present when the Export's status
// transitions to `complete`.
type ExportResult struct {
// The File containing the contents of the Export.
FileID string `json:"file_id" api:"required"`
JSON exportResultJSON `json:"-"`
}
// exportResultJSON contains the JSON metadata for the struct [ExportResult]
type exportResultJSON struct {
FileID apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportResult) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportResultJSON) RawJSON() string {
return r.raw
}
// The status of the Export.
type ExportStatus string
const (
ExportStatusPending ExportStatus = "pending"
ExportStatusComplete ExportStatus = "complete"
ExportStatusFailed ExportStatus = "failed"
)
func (r ExportStatus) IsKnown() bool {
switch r {
case ExportStatusPending, ExportStatusComplete, ExportStatusFailed:
return true
}
return false
}
// Details of the transaction CSV export. This field will be present when the
// `category` is equal to `transaction_csv`.
type ExportTransactionCsv struct {
// Filter results by Account.
AccountID string `json:"account_id" api:"required,nullable"`
// Filter transactions by their created date.
CreatedAt ExportTransactionCsvCreatedAt `json:"created_at" api:"required,nullable"`
JSON exportTransactionCsvJSON `json:"-"`
}
// exportTransactionCsvJSON contains the JSON metadata for the struct
// [ExportTransactionCsv]
type exportTransactionCsvJSON struct {
AccountID apijson.Field
CreatedAt apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportTransactionCsv) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportTransactionCsvJSON) RawJSON() string {
return r.raw
}
// Filter transactions by their created date.
type ExportTransactionCsvCreatedAt struct {
// Filter transactions created after this time.
After time.Time `json:"after" api:"required,nullable" format:"date-time"`
// Filter transactions created before this time.
Before time.Time `json:"before" api:"required,nullable" format:"date-time"`
JSON exportTransactionCsvCreatedAtJSON `json:"-"`
}
// exportTransactionCsvCreatedAtJSON contains the JSON metadata for the struct
// [ExportTransactionCsvCreatedAt]
type exportTransactionCsvCreatedAtJSON struct {
After apijson.Field
Before apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportTransactionCsvCreatedAt) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportTransactionCsvCreatedAtJSON) RawJSON() string {
return r.raw
}
// A constant representing the object's type. For this resource it will always be
// `export`.
type ExportType string
const (
ExportTypeExport ExportType = "export"
)
func (r ExportType) IsKnown() bool {
switch r {
case ExportTypeExport:
return true
}
return false
}
// Details of the vendor CSV export. This field will be present when the `category`
// is equal to `vendor_csv`.
type ExportVendorCsv struct {
JSON exportVendorCsvJSON `json:"-"`
}
// exportVendorCsvJSON contains the JSON metadata for the struct [ExportVendorCsv]
type exportVendorCsvJSON struct {
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportVendorCsv) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportVendorCsvJSON) RawJSON() string {
return r.raw
}
// Details of the voided check export. This field will be present when the
// `category` is equal to `voided_check`.
type ExportVoidedCheck struct {
// The Account Number for the voided check.
AccountNumberID string `json:"account_number_id" api:"required"`
// The payer information printed on the check.
Payer []ExportVoidedCheckPayer `json:"payer" api:"required"`
JSON exportVoidedCheckJSON `json:"-"`
}
// exportVoidedCheckJSON contains the JSON metadata for the struct
// [ExportVoidedCheck]
type exportVoidedCheckJSON struct {
AccountNumberID apijson.Field
Payer apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportVoidedCheck) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportVoidedCheckJSON) RawJSON() string {
return r.raw
}
type ExportVoidedCheckPayer struct {
// The contents of the line.
Line string `json:"line" api:"required"`
JSON exportVoidedCheckPayerJSON `json:"-"`
}
// exportVoidedCheckPayerJSON contains the JSON metadata for the struct
// [ExportVoidedCheckPayer]
type exportVoidedCheckPayerJSON struct {
Line apijson.Field
raw string
ExtraFields map[string]apijson.Field
}
func (r *ExportVoidedCheckPayer) UnmarshalJSON(data []byte) (err error) {
return apijson.UnmarshalRoot(data, r)
}
func (r exportVoidedCheckPayerJSON) RawJSON() string {
return r.raw
}
type ExportNewParams struct {
// The type of Export to create.
Category param.Field[ExportNewParamsCategory] `json:"category" api:"required"`
// Options for the created export. Required if `category` is equal to
// `account_statement_bai2`.
AccountStatementBai2 param.Field[ExportNewParamsAccountStatementBai2] `json:"account_statement_bai2"`
// Options for the created export. Required if `category` is equal to
// `account_statement_ofx`.
AccountStatementOfx param.Field[ExportNewParamsAccountStatementOfx] `json:"account_statement_ofx"`
// Options for the created export. Required if `category` is equal to
// `account_verification_letter`.
AccountVerificationLetter param.Field[ExportNewParamsAccountVerificationLetter] `json:"account_verification_letter"`
// Options for the created export. Required if `category` is equal to
// `balance_csv`.
BalanceCsv param.Field[ExportNewParamsBalanceCsv] `json:"balance_csv"`
// Options for the created export. Required if `category` is equal to
// `bookkeeping_account_balance_csv`.
BookkeepingAccountBalanceCsv param.Field[ExportNewParamsBookkeepingAccountBalanceCsv] `json:"bookkeeping_account_balance_csv"`
// Options for the created export. Required if `category` is equal to `entity_csv`.
EntityCsv param.Field[ExportNewParamsEntityCsv] `json:"entity_csv"`
// Options for the created export. Required if `category` is equal to
// `funding_instructions`.
FundingInstructions param.Field[ExportNewParamsFundingInstructions] `json:"funding_instructions"`
// Options for the created export. Required if `category` is equal to
// `transaction_csv`.
TransactionCsv param.Field[ExportNewParamsTransactionCsv] `json:"transaction_csv"`
// Options for the created export. Required if `category` is equal to `vendor_csv`.
VendorCsv param.Field[ExportNewParamsVendorCsv] `json:"vendor_csv"`
// Options for the created export. Required if `category` is equal to
// `voided_check`.
VoidedCheck param.Field[ExportNewParamsVoidedCheck] `json:"voided_check"`
}
func (r ExportNewParams) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// The type of Export to create.
type ExportNewParamsCategory string
const (
ExportNewParamsCategoryAccountStatementOfx ExportNewParamsCategory = "account_statement_ofx"
ExportNewParamsCategoryAccountStatementBai2 ExportNewParamsCategory = "account_statement_bai2"
ExportNewParamsCategoryTransactionCsv ExportNewParamsCategory = "transaction_csv"
ExportNewParamsCategoryBalanceCsv ExportNewParamsCategory = "balance_csv"
ExportNewParamsCategoryBookkeepingAccountBalanceCsv ExportNewParamsCategory = "bookkeeping_account_balance_csv"
ExportNewParamsCategoryEntityCsv ExportNewParamsCategory = "entity_csv"
ExportNewParamsCategoryVendorCsv ExportNewParamsCategory = "vendor_csv"
ExportNewParamsCategoryAccountVerificationLetter ExportNewParamsCategory = "account_verification_letter"
ExportNewParamsCategoryFundingInstructions ExportNewParamsCategory = "funding_instructions"
ExportNewParamsCategoryVoidedCheck ExportNewParamsCategory = "voided_check"
)
func (r ExportNewParamsCategory) IsKnown() bool {
switch r {
case ExportNewParamsCategoryAccountStatementOfx, ExportNewParamsCategoryAccountStatementBai2, ExportNewParamsCategoryTransactionCsv, ExportNewParamsCategoryBalanceCsv, ExportNewParamsCategoryBookkeepingAccountBalanceCsv, ExportNewParamsCategoryEntityCsv, ExportNewParamsCategoryVendorCsv, ExportNewParamsCategoryAccountVerificationLetter, ExportNewParamsCategoryFundingInstructions, ExportNewParamsCategoryVoidedCheck:
return true
}
return false
}
// Options for the created export. Required if `category` is equal to
// `account_statement_bai2`.
type ExportNewParamsAccountStatementBai2 struct {
// The Account to create a BAI2 report for. If not provided, all open accounts will
// be included.
AccountID param.Field[string] `json:"account_id"`
// The date to create a BAI2 report for. If not provided, the current date will be
// used. The timezone is UTC. If the current date is used, the report will include
// intraday balances, otherwise it will include end-of-day balances for the
// provided date.
EffectiveDate param.Field[time.Time] `json:"effective_date" format:"date"`
// The Program to create a BAI2 report for. If not provided, all open accounts will
// be included.
ProgramID param.Field[string] `json:"program_id"`
}
func (r ExportNewParamsAccountStatementBai2) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Options for the created export. Required if `category` is equal to
// `account_statement_ofx`.
type ExportNewParamsAccountStatementOfx struct {
// The Account to create a statement for.
AccountID param.Field[string] `json:"account_id" api:"required"`
// Filter results by time range on the `created_at` attribute.
CreatedAt param.Field[ExportNewParamsAccountStatementOfxCreatedAt] `json:"created_at"`
}
func (r ExportNewParamsAccountStatementOfx) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Filter results by time range on the `created_at` attribute.
type ExportNewParamsAccountStatementOfxCreatedAt struct {
// Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
// timestamp.
After param.Field[time.Time] `json:"after" format:"date-time"`
// Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
// timestamp.
Before param.Field[time.Time] `json:"before" format:"date-time"`
// Return results on or after this
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
OnOrAfter param.Field[time.Time] `json:"on_or_after" format:"date-time"`
// Return results on or before this
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
OnOrBefore param.Field[time.Time] `json:"on_or_before" format:"date-time"`
}
func (r ExportNewParamsAccountStatementOfxCreatedAt) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Options for the created export. Required if `category` is equal to
// `account_verification_letter`.
type ExportNewParamsAccountVerificationLetter struct {
// The Account Number to create a letter for.
AccountNumberID param.Field[string] `json:"account_number_id" api:"required"`
// The date of the balance to include in the letter. Defaults to the current date.
BalanceDate param.Field[time.Time] `json:"balance_date" format:"date"`
}
func (r ExportNewParamsAccountVerificationLetter) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Options for the created export. Required if `category` is equal to
// `balance_csv`.
type ExportNewParamsBalanceCsv struct {
// Filter exported Balances to the specified Account.
AccountID param.Field[string] `json:"account_id"`
// Filter results by time range on the `created_at` attribute.
CreatedAt param.Field[ExportNewParamsBalanceCsvCreatedAt] `json:"created_at"`
}
func (r ExportNewParamsBalanceCsv) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Filter results by time range on the `created_at` attribute.
type ExportNewParamsBalanceCsvCreatedAt struct {
// Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
// timestamp.
After param.Field[time.Time] `json:"after" format:"date-time"`
// Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
// timestamp.
Before param.Field[time.Time] `json:"before" format:"date-time"`
// Return results on or after this
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
OnOrAfter param.Field[time.Time] `json:"on_or_after" format:"date-time"`
// Return results on or before this
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
OnOrBefore param.Field[time.Time] `json:"on_or_before" format:"date-time"`
}
func (r ExportNewParamsBalanceCsvCreatedAt) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Options for the created export. Required if `category` is equal to
// `bookkeeping_account_balance_csv`.
type ExportNewParamsBookkeepingAccountBalanceCsv struct {
// Filter exported Bookkeeping Account Balances to the specified Bookkeeping
// Account.
BookkeepingAccountID param.Field[string] `json:"bookkeeping_account_id"`
// Filter results by time range on the `created_at` attribute.
CreatedAt param.Field[ExportNewParamsBookkeepingAccountBalanceCsvCreatedAt] `json:"created_at"`
}
func (r ExportNewParamsBookkeepingAccountBalanceCsv) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Filter results by time range on the `created_at` attribute.
type ExportNewParamsBookkeepingAccountBalanceCsvCreatedAt struct {
// Return results after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
// timestamp.
After param.Field[time.Time] `json:"after" format:"date-time"`
// Return results before this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601)
// timestamp.
Before param.Field[time.Time] `json:"before" format:"date-time"`
// Return results on or after this
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
OnOrAfter param.Field[time.Time] `json:"on_or_after" format:"date-time"`
// Return results on or before this
// [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) timestamp.
OnOrBefore param.Field[time.Time] `json:"on_or_before" format:"date-time"`
}
func (r ExportNewParamsBookkeepingAccountBalanceCsvCreatedAt) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Options for the created export. Required if `category` is equal to `entity_csv`.
type ExportNewParamsEntityCsv struct {
}
func (r ExportNewParamsEntityCsv) MarshalJSON() (data []byte, err error) {
return apijson.MarshalRoot(r)
}
// Options for the created export. Required if `category` is equal to
// `funding_instructions`.
type ExportNewParamsFundingInstructions struct {
// The Account Number to create funding instructions for.
AccountNumberID param.Field[string] `json:"account_number_id" api:"required"`
}