@apideck/unify 0.11.6 → 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 (97) 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/lib/config.d.ts +4 -4
  13. package/lib/config.js +4 -4
  14. package/models/components/agedcreditors.d.ts +51 -0
  15. package/models/components/agedcreditors.d.ts.map +1 -0
  16. package/models/components/agedcreditors.js +86 -0
  17. package/models/components/agedcreditors.js.map +1 -0
  18. package/models/components/ageddebtors.d.ts +51 -0
  19. package/models/components/ageddebtors.d.ts.map +1 -0
  20. package/models/components/ageddebtors.js +86 -0
  21. package/models/components/ageddebtors.js.map +1 -0
  22. package/models/components/agedreportfilter.d.ts +47 -0
  23. package/models/components/agedreportfilter.d.ts.map +1 -0
  24. package/models/components/agedreportfilter.js +80 -0
  25. package/models/components/agedreportfilter.js.map +1 -0
  26. package/models/components/balancebyperiod.d.ts +46 -0
  27. package/models/components/balancebyperiod.d.ts.map +1 -0
  28. package/models/components/balancebyperiod.js +84 -0
  29. package/models/components/balancebyperiod.js.map +1 -0
  30. package/models/components/balancebytransaction.d.ts +99 -0
  31. package/models/components/balancebytransaction.d.ts.map +1 -0
  32. package/models/components/balancebytransaction.js +115 -0
  33. package/models/components/balancebytransaction.js.map +1 -0
  34. package/models/components/getagedcreditorsresponse.d.ts +58 -0
  35. package/models/components/getagedcreditorsresponse.d.ts.map +1 -0
  36. package/models/components/getagedcreditorsresponse.js +79 -0
  37. package/models/components/getagedcreditorsresponse.js.map +1 -0
  38. package/models/components/getageddebtorsresponse.d.ts +58 -0
  39. package/models/components/getageddebtorsresponse.d.ts.map +1 -0
  40. package/models/components/getageddebtorsresponse.js +79 -0
  41. package/models/components/getageddebtorsresponse.js.map +1 -0
  42. package/models/components/index.d.ts +9 -0
  43. package/models/components/index.d.ts.map +1 -1
  44. package/models/components/index.js +9 -0
  45. package/models/components/index.js.map +1 -1
  46. package/models/components/outstandingbalance.d.ts +40 -0
  47. package/models/components/outstandingbalance.d.ts.map +1 -0
  48. package/models/components/outstandingbalance.js +77 -0
  49. package/models/components/outstandingbalance.js.map +1 -0
  50. package/models/components/outstandingbalancebycurrency.d.ts +36 -0
  51. package/models/components/outstandingbalancebycurrency.d.ts.map +1 -0
  52. package/models/components/outstandingbalancebycurrency.js +72 -0
  53. package/models/components/outstandingbalancebycurrency.js.map +1 -0
  54. package/models/operations/accountingagedcreditorsone.d.ts +125 -0
  55. package/models/operations/accountingagedcreditorsone.d.ts.map +1 -0
  56. package/models/operations/accountingagedcreditorsone.js +153 -0
  57. package/models/operations/accountingagedcreditorsone.js.map +1 -0
  58. package/models/operations/accountingageddebtorsone.d.ts +125 -0
  59. package/models/operations/accountingageddebtorsone.d.ts.map +1 -0
  60. package/models/operations/accountingageddebtorsone.js +153 -0
  61. package/models/operations/accountingageddebtorsone.js.map +1 -0
  62. package/models/operations/index.d.ts +2 -0
  63. package/models/operations/index.d.ts.map +1 -1
  64. package/models/operations/index.js +2 -0
  65. package/models/operations/index.js.map +1 -1
  66. package/package.json +1 -1
  67. package/sdk/accounting.d.ts +6 -0
  68. package/sdk/accounting.d.ts.map +1 -1
  69. package/sdk/accounting.js +10 -0
  70. package/sdk/accounting.js.map +1 -1
  71. package/sdk/agedcreditors.d.ts +12 -0
  72. package/sdk/agedcreditors.d.ts.map +1 -0
  73. package/sdk/agedcreditors.js +22 -0
  74. package/sdk/agedcreditors.js.map +1 -0
  75. package/sdk/ageddebtors.d.ts +12 -0
  76. package/sdk/ageddebtors.d.ts.map +1 -0
  77. package/sdk/ageddebtors.js +22 -0
  78. package/sdk/ageddebtors.js.map +1 -0
  79. package/src/funcs/accountingAgedCreditorsGet.ts +192 -0
  80. package/src/funcs/accountingAgedDebtorsGet.ts +192 -0
  81. package/src/lib/config.ts +4 -4
  82. package/src/models/components/agedcreditors.ts +116 -0
  83. package/src/models/components/ageddebtors.ts +116 -0
  84. package/src/models/components/agedreportfilter.ts +105 -0
  85. package/src/models/components/balancebyperiod.ts +109 -0
  86. package/src/models/components/balancebytransaction.ts +162 -0
  87. package/src/models/components/getagedcreditorsresponse.ts +119 -0
  88. package/src/models/components/getageddebtorsresponse.ts +119 -0
  89. package/src/models/components/index.ts +9 -0
  90. package/src/models/components/outstandingbalance.ts +107 -0
  91. package/src/models/components/outstandingbalancebycurrency.ts +95 -0
  92. package/src/models/operations/accountingagedcreditorsone.ts +277 -0
  93. package/src/models/operations/accountingageddebtorsone.ts +273 -0
  94. package/src/models/operations/index.ts +2 -0
  95. package/src/sdk/accounting.ts +12 -0
  96. package/src/sdk/agedcreditors.ts +27 -0
  97. package/src/sdk/ageddebtors.ts +27 -0
@@ -0,0 +1,192 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ApideckCore } from "../core.js";
6
+ import {
7
+ encodeDeepObjectQuery,
8
+ encodeFormQuery,
9
+ encodeSimple,
10
+ queryJoin,
11
+ } from "../lib/encodings.js";
12
+ import * as M from "../lib/matchers.js";
13
+ import { safeParse } from "../lib/schemas.js";
14
+ import { RequestOptions } from "../lib/sdks.js";
15
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
16
+ import { pathToFunc } from "../lib/url.js";
17
+ import { APIError } from "../models/errors/apierror.js";
18
+ import {
19
+ ConnectionError,
20
+ InvalidRequestError,
21
+ RequestAbortedError,
22
+ RequestTimeoutError,
23
+ UnexpectedClientError,
24
+ } from "../models/errors/httpclienterrors.js";
25
+ import * as errors from "../models/errors/index.js";
26
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
27
+ import * as operations from "../models/operations/index.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Get Aged Creditors
32
+ *
33
+ * @remarks
34
+ * Get Aged Creditors
35
+ */
36
+ export async function accountingAgedCreditorsGet(
37
+ client: ApideckCore,
38
+ request: operations.AccountingAgedCreditorsOneRequest,
39
+ options?: RequestOptions,
40
+ ): Promise<
41
+ Result<
42
+ operations.AccountingAgedCreditorsOneResponse,
43
+ | errors.BadRequestResponse
44
+ | errors.UnauthorizedResponse
45
+ | errors.PaymentRequiredResponse
46
+ | errors.NotFoundResponse
47
+ | errors.UnprocessableResponse
48
+ | APIError
49
+ | SDKValidationError
50
+ | UnexpectedClientError
51
+ | InvalidRequestError
52
+ | RequestAbortedError
53
+ | RequestTimeoutError
54
+ | ConnectionError
55
+ >
56
+ > {
57
+ const parsed = safeParse(
58
+ request,
59
+ (value) =>
60
+ operations.AccountingAgedCreditorsOneRequest$outboundSchema.parse(value),
61
+ "Input validation failed",
62
+ );
63
+ if (!parsed.ok) {
64
+ return parsed;
65
+ }
66
+ const payload = parsed.value;
67
+ const body = null;
68
+
69
+ const path = pathToFunc("/accounting/aged-creditors")();
70
+
71
+ const query = queryJoin(
72
+ encodeDeepObjectQuery({
73
+ "filter": payload.filter,
74
+ "pass_through": payload.pass_through,
75
+ }),
76
+ encodeFormQuery({
77
+ "fields": payload.fields,
78
+ "raw": payload.raw,
79
+ }),
80
+ );
81
+
82
+ const headers = new Headers({
83
+ Accept: "application/json",
84
+ "x-apideck-service-id": encodeSimple(
85
+ "x-apideck-service-id",
86
+ payload.serviceId,
87
+ { explode: false, charEncoding: "none" },
88
+ ),
89
+ "x-apideck-app-id": encodeSimple(
90
+ "x-apideck-app-id",
91
+ client._options.appId,
92
+ { explode: false, charEncoding: "none" },
93
+ ),
94
+ "x-apideck-consumer-id": encodeSimple(
95
+ "x-apideck-consumer-id",
96
+ client._options.consumerId,
97
+ { explode: false, charEncoding: "none" },
98
+ ),
99
+ });
100
+
101
+ const secConfig = await extractSecurity(client._options.apiKey);
102
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
103
+ const requestSecurity = resolveGlobalSecurity(securityInput);
104
+
105
+ const context = {
106
+ operationID: "accounting.agedCreditorsOne",
107
+ oAuth2Scopes: [],
108
+
109
+ resolvedSecurity: requestSecurity,
110
+
111
+ securitySource: client._options.apiKey,
112
+ retryConfig: options?.retries
113
+ || client._options.retryConfig
114
+ || {
115
+ strategy: "backoff",
116
+ backoff: {
117
+ initialInterval: 500,
118
+ maxInterval: 60000,
119
+ exponent: 1.5,
120
+ maxElapsedTime: 3600000,
121
+ },
122
+ retryConnectionErrors: true,
123
+ }
124
+ || { strategy: "none" },
125
+ retryCodes: options?.retryCodes || ["5XX"],
126
+ };
127
+
128
+ const requestRes = client._createRequest(context, {
129
+ security: requestSecurity,
130
+ method: "GET",
131
+ path: path,
132
+ headers: headers,
133
+ query: query,
134
+ body: body,
135
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
136
+ }, options);
137
+ if (!requestRes.ok) {
138
+ return requestRes;
139
+ }
140
+ const req = requestRes.value;
141
+
142
+ const doResult = await client._do(req, {
143
+ context,
144
+ errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
145
+ retryConfig: context.retryConfig,
146
+ retryCodes: context.retryCodes,
147
+ });
148
+ if (!doResult.ok) {
149
+ return doResult;
150
+ }
151
+ const response = doResult.value;
152
+
153
+ const responseFields = {
154
+ HttpMeta: { Response: response, Request: req },
155
+ };
156
+
157
+ const [result] = await M.match<
158
+ operations.AccountingAgedCreditorsOneResponse,
159
+ | errors.BadRequestResponse
160
+ | errors.UnauthorizedResponse
161
+ | errors.PaymentRequiredResponse
162
+ | errors.NotFoundResponse
163
+ | errors.UnprocessableResponse
164
+ | APIError
165
+ | SDKValidationError
166
+ | UnexpectedClientError
167
+ | InvalidRequestError
168
+ | RequestAbortedError
169
+ | RequestTimeoutError
170
+ | ConnectionError
171
+ >(
172
+ M.json(200, operations.AccountingAgedCreditorsOneResponse$inboundSchema, {
173
+ key: "GetAgedCreditorsResponse",
174
+ }),
175
+ M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
176
+ M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
177
+ M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
178
+ M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
179
+ M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
180
+ M.fail(["4XX", "5XX"]),
181
+ M.json(
182
+ "default",
183
+ operations.AccountingAgedCreditorsOneResponse$inboundSchema,
184
+ { key: "UnexpectedErrorResponse" },
185
+ ),
186
+ )(response, req, { extraFields: responseFields });
187
+ if (!result.ok) {
188
+ return result;
189
+ }
190
+
191
+ return result;
192
+ }
@@ -0,0 +1,192 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ApideckCore } from "../core.js";
6
+ import {
7
+ encodeDeepObjectQuery,
8
+ encodeFormQuery,
9
+ encodeSimple,
10
+ queryJoin,
11
+ } from "../lib/encodings.js";
12
+ import * as M from "../lib/matchers.js";
13
+ import { safeParse } from "../lib/schemas.js";
14
+ import { RequestOptions } from "../lib/sdks.js";
15
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
16
+ import { pathToFunc } from "../lib/url.js";
17
+ import { APIError } from "../models/errors/apierror.js";
18
+ import {
19
+ ConnectionError,
20
+ InvalidRequestError,
21
+ RequestAbortedError,
22
+ RequestTimeoutError,
23
+ UnexpectedClientError,
24
+ } from "../models/errors/httpclienterrors.js";
25
+ import * as errors from "../models/errors/index.js";
26
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
27
+ import * as operations from "../models/operations/index.js";
28
+ import { Result } from "../types/fp.js";
29
+
30
+ /**
31
+ * Get Aged Debtors
32
+ *
33
+ * @remarks
34
+ * Get Aged Debtors
35
+ */
36
+ export async function accountingAgedDebtorsGet(
37
+ client: ApideckCore,
38
+ request: operations.AccountingAgedDebtorsOneRequest,
39
+ options?: RequestOptions,
40
+ ): Promise<
41
+ Result<
42
+ operations.AccountingAgedDebtorsOneResponse,
43
+ | errors.BadRequestResponse
44
+ | errors.UnauthorizedResponse
45
+ | errors.PaymentRequiredResponse
46
+ | errors.NotFoundResponse
47
+ | errors.UnprocessableResponse
48
+ | APIError
49
+ | SDKValidationError
50
+ | UnexpectedClientError
51
+ | InvalidRequestError
52
+ | RequestAbortedError
53
+ | RequestTimeoutError
54
+ | ConnectionError
55
+ >
56
+ > {
57
+ const parsed = safeParse(
58
+ request,
59
+ (value) =>
60
+ operations.AccountingAgedDebtorsOneRequest$outboundSchema.parse(value),
61
+ "Input validation failed",
62
+ );
63
+ if (!parsed.ok) {
64
+ return parsed;
65
+ }
66
+ const payload = parsed.value;
67
+ const body = null;
68
+
69
+ const path = pathToFunc("/accounting/aged-debtors")();
70
+
71
+ const query = queryJoin(
72
+ encodeDeepObjectQuery({
73
+ "filter": payload.filter,
74
+ "pass_through": payload.pass_through,
75
+ }),
76
+ encodeFormQuery({
77
+ "fields": payload.fields,
78
+ "raw": payload.raw,
79
+ }),
80
+ );
81
+
82
+ const headers = new Headers({
83
+ Accept: "application/json",
84
+ "x-apideck-service-id": encodeSimple(
85
+ "x-apideck-service-id",
86
+ payload.serviceId,
87
+ { explode: false, charEncoding: "none" },
88
+ ),
89
+ "x-apideck-app-id": encodeSimple(
90
+ "x-apideck-app-id",
91
+ client._options.appId,
92
+ { explode: false, charEncoding: "none" },
93
+ ),
94
+ "x-apideck-consumer-id": encodeSimple(
95
+ "x-apideck-consumer-id",
96
+ client._options.consumerId,
97
+ { explode: false, charEncoding: "none" },
98
+ ),
99
+ });
100
+
101
+ const secConfig = await extractSecurity(client._options.apiKey);
102
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
103
+ const requestSecurity = resolveGlobalSecurity(securityInput);
104
+
105
+ const context = {
106
+ operationID: "accounting.agedDebtorsOne",
107
+ oAuth2Scopes: [],
108
+
109
+ resolvedSecurity: requestSecurity,
110
+
111
+ securitySource: client._options.apiKey,
112
+ retryConfig: options?.retries
113
+ || client._options.retryConfig
114
+ || {
115
+ strategy: "backoff",
116
+ backoff: {
117
+ initialInterval: 500,
118
+ maxInterval: 60000,
119
+ exponent: 1.5,
120
+ maxElapsedTime: 3600000,
121
+ },
122
+ retryConnectionErrors: true,
123
+ }
124
+ || { strategy: "none" },
125
+ retryCodes: options?.retryCodes || ["5XX"],
126
+ };
127
+
128
+ const requestRes = client._createRequest(context, {
129
+ security: requestSecurity,
130
+ method: "GET",
131
+ path: path,
132
+ headers: headers,
133
+ query: query,
134
+ body: body,
135
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
136
+ }, options);
137
+ if (!requestRes.ok) {
138
+ return requestRes;
139
+ }
140
+ const req = requestRes.value;
141
+
142
+ const doResult = await client._do(req, {
143
+ context,
144
+ errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
145
+ retryConfig: context.retryConfig,
146
+ retryCodes: context.retryCodes,
147
+ });
148
+ if (!doResult.ok) {
149
+ return doResult;
150
+ }
151
+ const response = doResult.value;
152
+
153
+ const responseFields = {
154
+ HttpMeta: { Response: response, Request: req },
155
+ };
156
+
157
+ const [result] = await M.match<
158
+ operations.AccountingAgedDebtorsOneResponse,
159
+ | errors.BadRequestResponse
160
+ | errors.UnauthorizedResponse
161
+ | errors.PaymentRequiredResponse
162
+ | errors.NotFoundResponse
163
+ | errors.UnprocessableResponse
164
+ | APIError
165
+ | SDKValidationError
166
+ | UnexpectedClientError
167
+ | InvalidRequestError
168
+ | RequestAbortedError
169
+ | RequestTimeoutError
170
+ | ConnectionError
171
+ >(
172
+ M.json(200, operations.AccountingAgedDebtorsOneResponse$inboundSchema, {
173
+ key: "GetAgedDebtorsResponse",
174
+ }),
175
+ M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
176
+ M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
177
+ M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
178
+ M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
179
+ M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
180
+ M.fail(["4XX", "5XX"]),
181
+ M.json(
182
+ "default",
183
+ operations.AccountingAgedDebtorsOneResponse$inboundSchema,
184
+ { key: "UnexpectedErrorResponse" },
185
+ ),
186
+ )(response, req, { extraFields: responseFields });
187
+ if (!result.ok) {
188
+ return result;
189
+ }
190
+
191
+ return result;
192
+ }
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.6",
68
- genVersion: "2.477.0",
69
- userAgent: "speakeasy-sdk/typescript 0.11.6 2.477.0 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
+ }