@apideck/unify 0.11.5 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (119) hide show
  1. package/README.md +27 -15
  2. package/docs/sdks/agedcreditors/README.md +113 -0
  3. package/docs/sdks/ageddebtors/README.md +113 -0
  4. package/funcs/accountingAgedCreditorsGet.d.ts +16 -0
  5. package/funcs/accountingAgedCreditorsGet.d.ts.map +1 -0
  6. package/funcs/accountingAgedCreditorsGet.js +121 -0
  7. package/funcs/accountingAgedCreditorsGet.js.map +1 -0
  8. package/funcs/accountingAgedDebtorsGet.d.ts +16 -0
  9. package/funcs/accountingAgedDebtorsGet.d.ts.map +1 -0
  10. package/funcs/accountingAgedDebtorsGet.js +121 -0
  11. package/funcs/accountingAgedDebtorsGet.js.map +1 -0
  12. package/funcs/accountingAttachmentsDownload.d.ts +1 -1
  13. package/funcs/accountingAttachmentsDownload.d.ts.map +1 -1
  14. package/funcs/accountingAttachmentsDownload.js +1 -1
  15. package/funcs/accountingAttachmentsDownload.js.map +1 -1
  16. package/funcs/fileStorageFilesDownload.d.ts +1 -1
  17. package/funcs/fileStorageFilesDownload.d.ts.map +1 -1
  18. package/funcs/fileStorageFilesDownload.js +1 -1
  19. package/funcs/fileStorageFilesDownload.js.map +1 -1
  20. package/funcs/fileStorageFilesExport.d.ts +1 -1
  21. package/funcs/fileStorageFilesExport.d.ts.map +1 -1
  22. package/funcs/fileStorageFilesExport.js +1 -1
  23. package/funcs/fileStorageFilesExport.js.map +1 -1
  24. package/hooks/hooks.d.ts.map +1 -1
  25. package/hooks/hooks.js +18 -0
  26. package/hooks/hooks.js.map +1 -1
  27. package/hooks/types.d.ts +1 -0
  28. package/hooks/types.d.ts.map +1 -1
  29. package/lib/config.d.ts +4 -4
  30. package/lib/config.js +4 -4
  31. package/models/components/agedcreditors.d.ts +51 -0
  32. package/models/components/agedcreditors.d.ts.map +1 -0
  33. package/models/components/agedcreditors.js +86 -0
  34. package/models/components/agedcreditors.js.map +1 -0
  35. package/models/components/ageddebtors.d.ts +51 -0
  36. package/models/components/ageddebtors.d.ts.map +1 -0
  37. package/models/components/ageddebtors.js +86 -0
  38. package/models/components/ageddebtors.js.map +1 -0
  39. package/models/components/agedreportfilter.d.ts +47 -0
  40. package/models/components/agedreportfilter.d.ts.map +1 -0
  41. package/models/components/agedreportfilter.js +80 -0
  42. package/models/components/agedreportfilter.js.map +1 -0
  43. package/models/components/balancebyperiod.d.ts +46 -0
  44. package/models/components/balancebyperiod.d.ts.map +1 -0
  45. package/models/components/balancebyperiod.js +84 -0
  46. package/models/components/balancebyperiod.js.map +1 -0
  47. package/models/components/balancebytransaction.d.ts +99 -0
  48. package/models/components/balancebytransaction.d.ts.map +1 -0
  49. package/models/components/balancebytransaction.js +115 -0
  50. package/models/components/balancebytransaction.js.map +1 -0
  51. package/models/components/getagedcreditorsresponse.d.ts +58 -0
  52. package/models/components/getagedcreditorsresponse.d.ts.map +1 -0
  53. package/models/components/getagedcreditorsresponse.js +79 -0
  54. package/models/components/getagedcreditorsresponse.js.map +1 -0
  55. package/models/components/getageddebtorsresponse.d.ts +58 -0
  56. package/models/components/getageddebtorsresponse.d.ts.map +1 -0
  57. package/models/components/getageddebtorsresponse.js +79 -0
  58. package/models/components/getageddebtorsresponse.js.map +1 -0
  59. package/models/components/index.d.ts +9 -0
  60. package/models/components/index.d.ts.map +1 -1
  61. package/models/components/index.js +9 -0
  62. package/models/components/index.js.map +1 -1
  63. package/models/components/outstandingbalance.d.ts +40 -0
  64. package/models/components/outstandingbalance.d.ts.map +1 -0
  65. package/models/components/outstandingbalance.js +77 -0
  66. package/models/components/outstandingbalance.js.map +1 -0
  67. package/models/components/outstandingbalancebycurrency.d.ts +36 -0
  68. package/models/components/outstandingbalancebycurrency.d.ts.map +1 -0
  69. package/models/components/outstandingbalancebycurrency.js +72 -0
  70. package/models/components/outstandingbalancebycurrency.js.map +1 -0
  71. package/models/operations/accountingagedcreditorsone.d.ts +125 -0
  72. package/models/operations/accountingagedcreditorsone.d.ts.map +1 -0
  73. package/models/operations/accountingagedcreditorsone.js +153 -0
  74. package/models/operations/accountingagedcreditorsone.js.map +1 -0
  75. package/models/operations/accountingageddebtorsone.d.ts +125 -0
  76. package/models/operations/accountingageddebtorsone.d.ts.map +1 -0
  77. package/models/operations/accountingageddebtorsone.js +153 -0
  78. package/models/operations/accountingageddebtorsone.js.map +1 -0
  79. package/models/operations/index.d.ts +2 -0
  80. package/models/operations/index.d.ts.map +1 -1
  81. package/models/operations/index.js +2 -0
  82. package/models/operations/index.js.map +1 -1
  83. package/package.json +1 -3
  84. package/sdk/accounting.d.ts +6 -0
  85. package/sdk/accounting.d.ts.map +1 -1
  86. package/sdk/accounting.js +10 -0
  87. package/sdk/accounting.js.map +1 -1
  88. package/sdk/agedcreditors.d.ts +12 -0
  89. package/sdk/agedcreditors.d.ts.map +1 -0
  90. package/sdk/agedcreditors.js +22 -0
  91. package/sdk/agedcreditors.js.map +1 -0
  92. package/sdk/ageddebtors.d.ts +12 -0
  93. package/sdk/ageddebtors.d.ts.map +1 -0
  94. package/sdk/ageddebtors.js +22 -0
  95. package/sdk/ageddebtors.js.map +1 -0
  96. package/src/funcs/accountingAgedCreditorsGet.ts +192 -0
  97. package/src/funcs/accountingAgedDebtorsGet.ts +192 -0
  98. package/src/funcs/accountingAttachmentsDownload.ts +1 -1
  99. package/src/funcs/fileStorageFilesDownload.ts +1 -1
  100. package/src/funcs/fileStorageFilesExport.ts +1 -1
  101. package/src/hooks/hooks.ts +20 -0
  102. package/src/hooks/types.ts +7 -0
  103. package/src/lib/config.ts +4 -4
  104. package/src/models/components/agedcreditors.ts +116 -0
  105. package/src/models/components/ageddebtors.ts +116 -0
  106. package/src/models/components/agedreportfilter.ts +105 -0
  107. package/src/models/components/balancebyperiod.ts +109 -0
  108. package/src/models/components/balancebytransaction.ts +162 -0
  109. package/src/models/components/getagedcreditorsresponse.ts +119 -0
  110. package/src/models/components/getageddebtorsresponse.ts +119 -0
  111. package/src/models/components/index.ts +9 -0
  112. package/src/models/components/outstandingbalance.ts +107 -0
  113. package/src/models/components/outstandingbalancebycurrency.ts +95 -0
  114. package/src/models/operations/accountingagedcreditorsone.ts +277 -0
  115. package/src/models/operations/accountingageddebtorsone.ts +273 -0
  116. package/src/models/operations/index.ts +2 -0
  117. package/src/sdk/accounting.ts +12 -0
  118. package/src/sdk/agedcreditors.ts +27 -0
  119. package/src/sdk/ageddebtors.ts +27 -0
package/src/lib/config.ts CHANGED
@@ -63,8 +63,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
63
63
 
64
64
  export const SDK_METADATA = {
65
65
  language: "typescript",
66
- openapiDocVersion: "10.8.3",
67
- sdkVersion: "0.11.5",
68
- genVersion: "2.472.1",
69
- userAgent: "speakeasy-sdk/typescript 0.11.5 2.472.1 10.8.3 @apideck/unify",
66
+ openapiDocVersion: "10.9.0",
67
+ sdkVersion: "0.12.0",
68
+ genVersion: "2.477.4",
69
+ userAgent: "speakeasy-sdk/typescript 0.12.0 2.477.4 10.9.0 @apideck/unify",
70
70
  } as const;
@@ -0,0 +1,116 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { RFCDate } from "../../types/rfcdate.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import {
12
+ OutstandingBalance,
13
+ OutstandingBalance$inboundSchema,
14
+ OutstandingBalance$Outbound,
15
+ OutstandingBalance$outboundSchema,
16
+ } from "./outstandingbalance.js";
17
+
18
+ export type AgedCreditors = {
19
+ /**
20
+ * The exact date and time the report was generated.
21
+ */
22
+ reportGeneratedAt?: Date | undefined;
23
+ /**
24
+ * The cutoff date for transactions included in the report.
25
+ */
26
+ reportAsOfDate?: RFCDate | undefined;
27
+ /**
28
+ * Number of aging periods shown in the report.
29
+ */
30
+ periodCount?: number | undefined;
31
+ /**
32
+ * Length of each aging period in days.
33
+ */
34
+ periodLength?: number | undefined;
35
+ outstandingBalances?: Array<OutstandingBalance> | undefined;
36
+ };
37
+
38
+ /** @internal */
39
+ export const AgedCreditors$inboundSchema: z.ZodType<
40
+ AgedCreditors,
41
+ z.ZodTypeDef,
42
+ unknown
43
+ > = z.object({
44
+ report_generated_at: z.string().datetime({ offset: true }).transform(v =>
45
+ new Date(v)
46
+ ).optional(),
47
+ report_as_of_date: z.string().transform(v => new RFCDate(v)).optional(),
48
+ period_count: z.number().int().default(4),
49
+ period_length: z.number().int().default(30),
50
+ outstanding_balances: z.array(OutstandingBalance$inboundSchema).optional(),
51
+ }).transform((v) => {
52
+ return remap$(v, {
53
+ "report_generated_at": "reportGeneratedAt",
54
+ "report_as_of_date": "reportAsOfDate",
55
+ "period_count": "periodCount",
56
+ "period_length": "periodLength",
57
+ "outstanding_balances": "outstandingBalances",
58
+ });
59
+ });
60
+
61
+ /** @internal */
62
+ export type AgedCreditors$Outbound = {
63
+ report_generated_at?: string | undefined;
64
+ report_as_of_date?: string | undefined;
65
+ period_count: number;
66
+ period_length: number;
67
+ outstanding_balances?: Array<OutstandingBalance$Outbound> | undefined;
68
+ };
69
+
70
+ /** @internal */
71
+ export const AgedCreditors$outboundSchema: z.ZodType<
72
+ AgedCreditors$Outbound,
73
+ z.ZodTypeDef,
74
+ AgedCreditors
75
+ > = z.object({
76
+ reportGeneratedAt: z.date().transform(v => v.toISOString()).optional(),
77
+ reportAsOfDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(),
78
+ periodCount: z.number().int().default(4),
79
+ periodLength: z.number().int().default(30),
80
+ outstandingBalances: z.array(OutstandingBalance$outboundSchema).optional(),
81
+ }).transform((v) => {
82
+ return remap$(v, {
83
+ reportGeneratedAt: "report_generated_at",
84
+ reportAsOfDate: "report_as_of_date",
85
+ periodCount: "period_count",
86
+ periodLength: "period_length",
87
+ outstandingBalances: "outstanding_balances",
88
+ });
89
+ });
90
+
91
+ /**
92
+ * @internal
93
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
94
+ */
95
+ export namespace AgedCreditors$ {
96
+ /** @deprecated use `AgedCreditors$inboundSchema` instead. */
97
+ export const inboundSchema = AgedCreditors$inboundSchema;
98
+ /** @deprecated use `AgedCreditors$outboundSchema` instead. */
99
+ export const outboundSchema = AgedCreditors$outboundSchema;
100
+ /** @deprecated use `AgedCreditors$Outbound` instead. */
101
+ export type Outbound = AgedCreditors$Outbound;
102
+ }
103
+
104
+ export function agedCreditorsToJSON(agedCreditors: AgedCreditors): string {
105
+ return JSON.stringify(AgedCreditors$outboundSchema.parse(agedCreditors));
106
+ }
107
+
108
+ export function agedCreditorsFromJSON(
109
+ jsonString: string,
110
+ ): SafeParseResult<AgedCreditors, SDKValidationError> {
111
+ return safeParse(
112
+ jsonString,
113
+ (x) => AgedCreditors$inboundSchema.parse(JSON.parse(x)),
114
+ `Failed to parse 'AgedCreditors' from JSON`,
115
+ );
116
+ }
@@ -0,0 +1,116 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { RFCDate } from "../../types/rfcdate.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import {
12
+ OutstandingBalance,
13
+ OutstandingBalance$inboundSchema,
14
+ OutstandingBalance$Outbound,
15
+ OutstandingBalance$outboundSchema,
16
+ } from "./outstandingbalance.js";
17
+
18
+ export type AgedDebtors = {
19
+ /**
20
+ * The exact date and time the report was generated.
21
+ */
22
+ reportGeneratedAt?: Date | undefined;
23
+ /**
24
+ * The cutoff date for transactions included in the report.
25
+ */
26
+ reportAsOfDate?: RFCDate | undefined;
27
+ /**
28
+ * Number of aging periods shown in the report.
29
+ */
30
+ periodCount?: number | undefined;
31
+ /**
32
+ * Length of each aging period in days.
33
+ */
34
+ periodLength?: number | undefined;
35
+ outstandingBalances?: Array<OutstandingBalance> | undefined;
36
+ };
37
+
38
+ /** @internal */
39
+ export const AgedDebtors$inboundSchema: z.ZodType<
40
+ AgedDebtors,
41
+ z.ZodTypeDef,
42
+ unknown
43
+ > = z.object({
44
+ report_generated_at: z.string().datetime({ offset: true }).transform(v =>
45
+ new Date(v)
46
+ ).optional(),
47
+ report_as_of_date: z.string().transform(v => new RFCDate(v)).optional(),
48
+ period_count: z.number().int().default(4),
49
+ period_length: z.number().int().default(30),
50
+ outstanding_balances: z.array(OutstandingBalance$inboundSchema).optional(),
51
+ }).transform((v) => {
52
+ return remap$(v, {
53
+ "report_generated_at": "reportGeneratedAt",
54
+ "report_as_of_date": "reportAsOfDate",
55
+ "period_count": "periodCount",
56
+ "period_length": "periodLength",
57
+ "outstanding_balances": "outstandingBalances",
58
+ });
59
+ });
60
+
61
+ /** @internal */
62
+ export type AgedDebtors$Outbound = {
63
+ report_generated_at?: string | undefined;
64
+ report_as_of_date?: string | undefined;
65
+ period_count: number;
66
+ period_length: number;
67
+ outstanding_balances?: Array<OutstandingBalance$Outbound> | undefined;
68
+ };
69
+
70
+ /** @internal */
71
+ export const AgedDebtors$outboundSchema: z.ZodType<
72
+ AgedDebtors$Outbound,
73
+ z.ZodTypeDef,
74
+ AgedDebtors
75
+ > = z.object({
76
+ reportGeneratedAt: z.date().transform(v => v.toISOString()).optional(),
77
+ reportAsOfDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(),
78
+ periodCount: z.number().int().default(4),
79
+ periodLength: z.number().int().default(30),
80
+ outstandingBalances: z.array(OutstandingBalance$outboundSchema).optional(),
81
+ }).transform((v) => {
82
+ return remap$(v, {
83
+ reportGeneratedAt: "report_generated_at",
84
+ reportAsOfDate: "report_as_of_date",
85
+ periodCount: "period_count",
86
+ periodLength: "period_length",
87
+ outstandingBalances: "outstanding_balances",
88
+ });
89
+ });
90
+
91
+ /**
92
+ * @internal
93
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
94
+ */
95
+ export namespace AgedDebtors$ {
96
+ /** @deprecated use `AgedDebtors$inboundSchema` instead. */
97
+ export const inboundSchema = AgedDebtors$inboundSchema;
98
+ /** @deprecated use `AgedDebtors$outboundSchema` instead. */
99
+ export const outboundSchema = AgedDebtors$outboundSchema;
100
+ /** @deprecated use `AgedDebtors$Outbound` instead. */
101
+ export type Outbound = AgedDebtors$Outbound;
102
+ }
103
+
104
+ export function agedDebtorsToJSON(agedDebtors: AgedDebtors): string {
105
+ return JSON.stringify(AgedDebtors$outboundSchema.parse(agedDebtors));
106
+ }
107
+
108
+ export function agedDebtorsFromJSON(
109
+ jsonString: string,
110
+ ): SafeParseResult<AgedDebtors, SDKValidationError> {
111
+ return safeParse(
112
+ jsonString,
113
+ (x) => AgedDebtors$inboundSchema.parse(JSON.parse(x)),
114
+ `Failed to parse 'AgedDebtors' from JSON`,
115
+ );
116
+ }
@@ -0,0 +1,105 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
+
11
+ export type AgedReportFilter = {
12
+ /**
13
+ * Filter by customer id
14
+ */
15
+ customerId?: string | undefined;
16
+ /**
17
+ * The cutoff date for considering transactions
18
+ */
19
+ reportAsOfDate?: string | undefined;
20
+ /**
21
+ * Number of periods to split the aged creditors report into
22
+ */
23
+ periodCount?: number | undefined;
24
+ /**
25
+ * Length of each period in days
26
+ */
27
+ periodLength?: number | undefined;
28
+ };
29
+
30
+ /** @internal */
31
+ export const AgedReportFilter$inboundSchema: z.ZodType<
32
+ AgedReportFilter,
33
+ z.ZodTypeDef,
34
+ unknown
35
+ > = z.object({
36
+ customer_id: z.string().optional(),
37
+ report_as_of_date: z.string().optional(),
38
+ period_count: z.number().int().optional(),
39
+ period_length: z.number().int().optional(),
40
+ }).transform((v) => {
41
+ return remap$(v, {
42
+ "customer_id": "customerId",
43
+ "report_as_of_date": "reportAsOfDate",
44
+ "period_count": "periodCount",
45
+ "period_length": "periodLength",
46
+ });
47
+ });
48
+
49
+ /** @internal */
50
+ export type AgedReportFilter$Outbound = {
51
+ customer_id?: string | undefined;
52
+ report_as_of_date?: string | undefined;
53
+ period_count?: number | undefined;
54
+ period_length?: number | undefined;
55
+ };
56
+
57
+ /** @internal */
58
+ export const AgedReportFilter$outboundSchema: z.ZodType<
59
+ AgedReportFilter$Outbound,
60
+ z.ZodTypeDef,
61
+ AgedReportFilter
62
+ > = z.object({
63
+ customerId: z.string().optional(),
64
+ reportAsOfDate: z.string().optional(),
65
+ periodCount: z.number().int().optional(),
66
+ periodLength: z.number().int().optional(),
67
+ }).transform((v) => {
68
+ return remap$(v, {
69
+ customerId: "customer_id",
70
+ reportAsOfDate: "report_as_of_date",
71
+ periodCount: "period_count",
72
+ periodLength: "period_length",
73
+ });
74
+ });
75
+
76
+ /**
77
+ * @internal
78
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
79
+ */
80
+ export namespace AgedReportFilter$ {
81
+ /** @deprecated use `AgedReportFilter$inboundSchema` instead. */
82
+ export const inboundSchema = AgedReportFilter$inboundSchema;
83
+ /** @deprecated use `AgedReportFilter$outboundSchema` instead. */
84
+ export const outboundSchema = AgedReportFilter$outboundSchema;
85
+ /** @deprecated use `AgedReportFilter$Outbound` instead. */
86
+ export type Outbound = AgedReportFilter$Outbound;
87
+ }
88
+
89
+ export function agedReportFilterToJSON(
90
+ agedReportFilter: AgedReportFilter,
91
+ ): string {
92
+ return JSON.stringify(
93
+ AgedReportFilter$outboundSchema.parse(agedReportFilter),
94
+ );
95
+ }
96
+
97
+ export function agedReportFilterFromJSON(
98
+ jsonString: string,
99
+ ): SafeParseResult<AgedReportFilter, SDKValidationError> {
100
+ return safeParse(
101
+ jsonString,
102
+ (x) => AgedReportFilter$inboundSchema.parse(JSON.parse(x)),
103
+ `Failed to parse 'AgedReportFilter' from JSON`,
104
+ );
105
+ }
@@ -0,0 +1,109 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import { RFCDate } from "../../types/rfcdate.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import {
12
+ BalanceByTransaction,
13
+ BalanceByTransaction$inboundSchema,
14
+ BalanceByTransaction$Outbound,
15
+ BalanceByTransaction$outboundSchema,
16
+ } from "./balancebytransaction.js";
17
+
18
+ export type BalanceByPeriod = {
19
+ /**
20
+ * Start date of the period.
21
+ */
22
+ startDate?: RFCDate | undefined;
23
+ /**
24
+ * End date of the period.
25
+ */
26
+ endDate?: RFCDate | undefined;
27
+ /**
28
+ * Total amount of the period.
29
+ */
30
+ totalAmount?: number | undefined;
31
+ balancesByTransaction?: Array<BalanceByTransaction> | undefined;
32
+ };
33
+
34
+ /** @internal */
35
+ export const BalanceByPeriod$inboundSchema: z.ZodType<
36
+ BalanceByPeriod,
37
+ z.ZodTypeDef,
38
+ unknown
39
+ > = z.object({
40
+ start_date: z.string().transform(v => new RFCDate(v)).optional(),
41
+ end_date: z.string().transform(v => new RFCDate(v)).optional(),
42
+ total_amount: z.number().optional(),
43
+ balances_by_transaction: z.array(BalanceByTransaction$inboundSchema)
44
+ .optional(),
45
+ }).transform((v) => {
46
+ return remap$(v, {
47
+ "start_date": "startDate",
48
+ "end_date": "endDate",
49
+ "total_amount": "totalAmount",
50
+ "balances_by_transaction": "balancesByTransaction",
51
+ });
52
+ });
53
+
54
+ /** @internal */
55
+ export type BalanceByPeriod$Outbound = {
56
+ start_date?: string | undefined;
57
+ end_date?: string | undefined;
58
+ total_amount?: number | undefined;
59
+ balances_by_transaction?: Array<BalanceByTransaction$Outbound> | undefined;
60
+ };
61
+
62
+ /** @internal */
63
+ export const BalanceByPeriod$outboundSchema: z.ZodType<
64
+ BalanceByPeriod$Outbound,
65
+ z.ZodTypeDef,
66
+ BalanceByPeriod
67
+ > = z.object({
68
+ startDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(),
69
+ endDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(),
70
+ totalAmount: z.number().optional(),
71
+ balancesByTransaction: z.array(BalanceByTransaction$outboundSchema)
72
+ .optional(),
73
+ }).transform((v) => {
74
+ return remap$(v, {
75
+ startDate: "start_date",
76
+ endDate: "end_date",
77
+ totalAmount: "total_amount",
78
+ balancesByTransaction: "balances_by_transaction",
79
+ });
80
+ });
81
+
82
+ /**
83
+ * @internal
84
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
85
+ */
86
+ export namespace BalanceByPeriod$ {
87
+ /** @deprecated use `BalanceByPeriod$inboundSchema` instead. */
88
+ export const inboundSchema = BalanceByPeriod$inboundSchema;
89
+ /** @deprecated use `BalanceByPeriod$outboundSchema` instead. */
90
+ export const outboundSchema = BalanceByPeriod$outboundSchema;
91
+ /** @deprecated use `BalanceByPeriod$Outbound` instead. */
92
+ export type Outbound = BalanceByPeriod$Outbound;
93
+ }
94
+
95
+ export function balanceByPeriodToJSON(
96
+ balanceByPeriod: BalanceByPeriod,
97
+ ): string {
98
+ return JSON.stringify(BalanceByPeriod$outboundSchema.parse(balanceByPeriod));
99
+ }
100
+
101
+ export function balanceByPeriodFromJSON(
102
+ jsonString: string,
103
+ ): SafeParseResult<BalanceByPeriod, SDKValidationError> {
104
+ return safeParse(
105
+ jsonString,
106
+ (x) => BalanceByPeriod$inboundSchema.parse(JSON.parse(x)),
107
+ `Failed to parse 'BalanceByPeriod' from JSON`,
108
+ );
109
+ }
@@ -0,0 +1,162 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { ClosedEnum } from "../../types/enums.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import { RFCDate } from "../../types/rfcdate.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ /**
14
+ * Type of the transaction.
15
+ */
16
+ export const TransactionType = {
17
+ Invoice: "invoice",
18
+ CreditNote: "credit_note",
19
+ Bill: "bill",
20
+ Payment: "payment",
21
+ BillPayment: "bill-payment",
22
+ } as const;
23
+ /**
24
+ * Type of the transaction.
25
+ */
26
+ export type TransactionType = ClosedEnum<typeof TransactionType>;
27
+
28
+ export type BalanceByTransaction = {
29
+ /**
30
+ * Unique identifier for the transaction.
31
+ */
32
+ transactionId?: string | undefined;
33
+ /**
34
+ * Date of the transaction.
35
+ */
36
+ transactionDate?: RFCDate | undefined;
37
+ /**
38
+ * Type of the transaction.
39
+ */
40
+ transactionType?: TransactionType | undefined;
41
+ /**
42
+ * Due date of the transaction.
43
+ */
44
+ dueDate?: RFCDate | undefined;
45
+ /**
46
+ * Original amount of the transaction.
47
+ */
48
+ originalAmount?: number | undefined;
49
+ /**
50
+ * Outstanding balance of the transaction.
51
+ */
52
+ outstandingBalance?: number | undefined;
53
+ };
54
+
55
+ /** @internal */
56
+ export const TransactionType$inboundSchema: z.ZodNativeEnum<
57
+ typeof TransactionType
58
+ > = z.nativeEnum(TransactionType);
59
+
60
+ /** @internal */
61
+ export const TransactionType$outboundSchema: z.ZodNativeEnum<
62
+ typeof TransactionType
63
+ > = TransactionType$inboundSchema;
64
+
65
+ /**
66
+ * @internal
67
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
68
+ */
69
+ export namespace TransactionType$ {
70
+ /** @deprecated use `TransactionType$inboundSchema` instead. */
71
+ export const inboundSchema = TransactionType$inboundSchema;
72
+ /** @deprecated use `TransactionType$outboundSchema` instead. */
73
+ export const outboundSchema = TransactionType$outboundSchema;
74
+ }
75
+
76
+ /** @internal */
77
+ export const BalanceByTransaction$inboundSchema: z.ZodType<
78
+ BalanceByTransaction,
79
+ z.ZodTypeDef,
80
+ unknown
81
+ > = z.object({
82
+ transaction_id: z.string().optional(),
83
+ transaction_date: z.string().transform(v => new RFCDate(v)).optional(),
84
+ transaction_type: TransactionType$inboundSchema.optional(),
85
+ due_date: z.string().transform(v => new RFCDate(v)).optional(),
86
+ original_amount: z.number().optional(),
87
+ outstanding_balance: z.number().optional(),
88
+ }).transform((v) => {
89
+ return remap$(v, {
90
+ "transaction_id": "transactionId",
91
+ "transaction_date": "transactionDate",
92
+ "transaction_type": "transactionType",
93
+ "due_date": "dueDate",
94
+ "original_amount": "originalAmount",
95
+ "outstanding_balance": "outstandingBalance",
96
+ });
97
+ });
98
+
99
+ /** @internal */
100
+ export type BalanceByTransaction$Outbound = {
101
+ transaction_id?: string | undefined;
102
+ transaction_date?: string | undefined;
103
+ transaction_type?: string | undefined;
104
+ due_date?: string | undefined;
105
+ original_amount?: number | undefined;
106
+ outstanding_balance?: number | undefined;
107
+ };
108
+
109
+ /** @internal */
110
+ export const BalanceByTransaction$outboundSchema: z.ZodType<
111
+ BalanceByTransaction$Outbound,
112
+ z.ZodTypeDef,
113
+ BalanceByTransaction
114
+ > = z.object({
115
+ transactionId: z.string().optional(),
116
+ transactionDate: z.instanceof(RFCDate).transform(v => v.toString())
117
+ .optional(),
118
+ transactionType: TransactionType$outboundSchema.optional(),
119
+ dueDate: z.instanceof(RFCDate).transform(v => v.toString()).optional(),
120
+ originalAmount: z.number().optional(),
121
+ outstandingBalance: z.number().optional(),
122
+ }).transform((v) => {
123
+ return remap$(v, {
124
+ transactionId: "transaction_id",
125
+ transactionDate: "transaction_date",
126
+ transactionType: "transaction_type",
127
+ dueDate: "due_date",
128
+ originalAmount: "original_amount",
129
+ outstandingBalance: "outstanding_balance",
130
+ });
131
+ });
132
+
133
+ /**
134
+ * @internal
135
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
136
+ */
137
+ export namespace BalanceByTransaction$ {
138
+ /** @deprecated use `BalanceByTransaction$inboundSchema` instead. */
139
+ export const inboundSchema = BalanceByTransaction$inboundSchema;
140
+ /** @deprecated use `BalanceByTransaction$outboundSchema` instead. */
141
+ export const outboundSchema = BalanceByTransaction$outboundSchema;
142
+ /** @deprecated use `BalanceByTransaction$Outbound` instead. */
143
+ export type Outbound = BalanceByTransaction$Outbound;
144
+ }
145
+
146
+ export function balanceByTransactionToJSON(
147
+ balanceByTransaction: BalanceByTransaction,
148
+ ): string {
149
+ return JSON.stringify(
150
+ BalanceByTransaction$outboundSchema.parse(balanceByTransaction),
151
+ );
152
+ }
153
+
154
+ export function balanceByTransactionFromJSON(
155
+ jsonString: string,
156
+ ): SafeParseResult<BalanceByTransaction, SDKValidationError> {
157
+ return safeParse(
158
+ jsonString,
159
+ (x) => BalanceByTransaction$inboundSchema.parse(JSON.parse(x)),
160
+ `Failed to parse 'BalanceByTransaction' from JSON`,
161
+ );
162
+ }