@apideck/unify 0.25.1 → 0.26.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 (84) hide show
  1. package/README.md +7 -0
  2. package/docs/sdks/categories/README.md +181 -0
  3. package/funcs/accountingCategoriesGet.d.ts +18 -0
  4. package/funcs/accountingCategoriesGet.d.ts.map +1 -0
  5. package/funcs/accountingCategoriesGet.js +133 -0
  6. package/funcs/accountingCategoriesGet.js.map +1 -0
  7. package/funcs/accountingCategoriesList.d.ts +21 -0
  8. package/funcs/accountingCategoriesList.d.ts.map +1 -0
  9. package/funcs/accountingCategoriesList.js +151 -0
  10. package/funcs/accountingCategoriesList.js.map +1 -0
  11. package/jsr.json +1 -1
  12. package/lib/config.d.ts +4 -4
  13. package/lib/config.js +4 -4
  14. package/models/components/bill.d.ts +2 -2
  15. package/models/components/category.d.ts +114 -0
  16. package/models/components/category.d.ts.map +1 -0
  17. package/models/components/category.js +121 -0
  18. package/models/components/category.js.map +1 -0
  19. package/models/components/expense.d.ts +10 -0
  20. package/models/components/expense.d.ts.map +1 -1
  21. package/models/components/expense.js +4 -0
  22. package/models/components/expense.js.map +1 -1
  23. package/models/components/formfieldoption.d.ts +6 -6
  24. package/models/components/formfieldoption.d.ts.map +1 -1
  25. package/models/components/formfieldoption.js +4 -4
  26. package/models/components/formfieldoption.js.map +1 -1
  27. package/models/components/getcategoriesresponse.d.ts +79 -0
  28. package/models/components/getcategoriesresponse.d.ts.map +1 -0
  29. package/models/components/getcategoriesresponse.js +89 -0
  30. package/models/components/getcategoriesresponse.js.map +1 -0
  31. package/models/components/getcategoryresponse.d.ts +67 -0
  32. package/models/components/getcategoryresponse.d.ts.map +1 -0
  33. package/models/components/getcategoryresponse.js +83 -0
  34. package/models/components/getcategoryresponse.js.map +1 -0
  35. package/models/components/index.d.ts +3 -0
  36. package/models/components/index.d.ts.map +1 -1
  37. package/models/components/index.js +3 -0
  38. package/models/components/index.js.map +1 -1
  39. package/models/components/invoice.d.ts +2 -2
  40. package/models/components/supplier.d.ts +10 -0
  41. package/models/components/supplier.d.ts.map +1 -1
  42. package/models/components/supplier.js +8 -0
  43. package/models/components/supplier.js.map +1 -1
  44. package/models/operations/accountingcategoriesall.d.ts +131 -0
  45. package/models/operations/accountingcategoriesall.d.ts.map +1 -0
  46. package/models/operations/accountingcategoriesall.js +149 -0
  47. package/models/operations/accountingcategoriesall.js.map +1 -0
  48. package/models/operations/accountingcategoriesone.d.ts +126 -0
  49. package/models/operations/accountingcategoriesone.d.ts.map +1 -0
  50. package/models/operations/accountingcategoriesone.js +145 -0
  51. package/models/operations/accountingcategoriesone.js.map +1 -0
  52. package/models/operations/index.d.ts +2 -0
  53. package/models/operations/index.d.ts.map +1 -1
  54. package/models/operations/index.js +2 -0
  55. package/models/operations/index.js.map +1 -1
  56. package/package.json +1 -1
  57. package/sdk/accounting.d.ts +3 -0
  58. package/sdk/accounting.d.ts.map +1 -1
  59. package/sdk/accounting.js +4 -0
  60. package/sdk/accounting.js.map +1 -1
  61. package/sdk/categories.d.ts +22 -0
  62. package/sdk/categories.d.ts.map +1 -0
  63. package/sdk/categories.js +33 -0
  64. package/sdk/categories.js.map +1 -0
  65. package/src/__tests__/categories.test.ts +127 -0
  66. package/src/funcs/accountingCategoriesGet.ts +230 -0
  67. package/src/funcs/accountingCategoriesList.ts +288 -0
  68. package/src/lib/config.ts +4 -4
  69. package/src/models/components/bill.ts +2 -2
  70. package/src/models/components/category.ts +193 -0
  71. package/src/models/components/expense.ts +14 -0
  72. package/src/models/components/formfieldoption.ts +12 -12
  73. package/src/models/components/getcategoriesresponse.ts +154 -0
  74. package/src/models/components/getcategoryresponse.ts +128 -0
  75. package/src/models/components/index.ts +3 -0
  76. package/src/models/components/invoice.ts +2 -2
  77. package/src/models/components/supplier.ts +18 -0
  78. package/src/models/operations/accountingcategoriesall.ts +277 -0
  79. package/src/models/operations/accountingcategoriesone.ts +268 -0
  80. package/src/models/operations/index.ts +2 -0
  81. package/src/sdk/accounting.ts +6 -0
  82. package/src/sdk/categories.ts +48 -0
  83. package/src/types/constdatetime.ts +1 -1
  84. package/types/constdatetime.js +1 -1
@@ -0,0 +1,288 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { ApideckCore } from "../core.js";
6
+ import { dlv } from "../lib/dlv.js";
7
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { ApideckError } from "../models/errors/apideckerror.js";
15
+ import {
16
+ ConnectionError,
17
+ InvalidRequestError,
18
+ RequestAbortedError,
19
+ RequestTimeoutError,
20
+ UnexpectedClientError,
21
+ } from "../models/errors/httpclienterrors.js";
22
+ import * as errors from "../models/errors/index.js";
23
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
24
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
25
+ import * as operations from "../models/operations/index.js";
26
+ import { APICall, APIPromise } from "../types/async.js";
27
+ import { Result } from "../types/fp.js";
28
+ import {
29
+ createPageIterator,
30
+ haltIterator,
31
+ PageIterator,
32
+ Paginator,
33
+ } from "../types/operations.js";
34
+
35
+ /**
36
+ * List Categories
37
+ *
38
+ * @remarks
39
+ * List Categories
40
+ */
41
+ export function accountingCategoriesList(
42
+ client: ApideckCore,
43
+ request: operations.AccountingCategoriesAllRequest,
44
+ options?: RequestOptions,
45
+ ): APIPromise<
46
+ PageIterator<
47
+ Result<
48
+ operations.AccountingCategoriesAllResponse,
49
+ | errors.BadRequestResponse
50
+ | errors.UnauthorizedResponse
51
+ | errors.PaymentRequiredResponse
52
+ | errors.NotFoundResponse
53
+ | errors.UnprocessableResponse
54
+ | ApideckError
55
+ | ResponseValidationError
56
+ | ConnectionError
57
+ | RequestAbortedError
58
+ | RequestTimeoutError
59
+ | InvalidRequestError
60
+ | UnexpectedClientError
61
+ | SDKValidationError
62
+ >,
63
+ { cursor: string }
64
+ >
65
+ > {
66
+ return new APIPromise($do(
67
+ client,
68
+ request,
69
+ options,
70
+ ));
71
+ }
72
+
73
+ async function $do(
74
+ client: ApideckCore,
75
+ request: operations.AccountingCategoriesAllRequest,
76
+ options?: RequestOptions,
77
+ ): Promise<
78
+ [
79
+ PageIterator<
80
+ Result<
81
+ operations.AccountingCategoriesAllResponse,
82
+ | errors.BadRequestResponse
83
+ | errors.UnauthorizedResponse
84
+ | errors.PaymentRequiredResponse
85
+ | errors.NotFoundResponse
86
+ | errors.UnprocessableResponse
87
+ | ApideckError
88
+ | ResponseValidationError
89
+ | ConnectionError
90
+ | RequestAbortedError
91
+ | RequestTimeoutError
92
+ | InvalidRequestError
93
+ | UnexpectedClientError
94
+ | SDKValidationError
95
+ >,
96
+ { cursor: string }
97
+ >,
98
+ APICall,
99
+ ]
100
+ > {
101
+ const parsed = safeParse(
102
+ request,
103
+ (value) =>
104
+ operations.AccountingCategoriesAllRequest$outboundSchema.parse(value),
105
+ "Input validation failed",
106
+ );
107
+ if (!parsed.ok) {
108
+ return [haltIterator(parsed), { status: "invalid" }];
109
+ }
110
+ const payload = parsed.value;
111
+ const body = null;
112
+
113
+ const path = pathToFunc("/accounting/categories")();
114
+
115
+ const query = encodeFormQuery({
116
+ "cursor": payload.cursor,
117
+ "fields": payload.fields,
118
+ "limit": payload.limit,
119
+ "raw": payload.raw,
120
+ });
121
+
122
+ const headers = new Headers(compactMap({
123
+ Accept: "application/json",
124
+ "x-apideck-app-id": encodeSimple(
125
+ "x-apideck-app-id",
126
+ payload.appId ?? client._options.appId,
127
+ { explode: false, charEncoding: "none" },
128
+ ),
129
+ "x-apideck-consumer-id": encodeSimple(
130
+ "x-apideck-consumer-id",
131
+ payload.consumerId ?? client._options.consumerId,
132
+ { explode: false, charEncoding: "none" },
133
+ ),
134
+ "x-apideck-service-id": encodeSimple(
135
+ "x-apideck-service-id",
136
+ payload.serviceId,
137
+ { explode: false, charEncoding: "none" },
138
+ ),
139
+ }));
140
+
141
+ const secConfig = await extractSecurity(client._options.apiKey);
142
+ const securityInput = secConfig == null ? {} : { apiKey: secConfig };
143
+ const requestSecurity = resolveGlobalSecurity(securityInput);
144
+
145
+ const context = {
146
+ options: client._options,
147
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
148
+ operationID: "accounting.categoriesAll",
149
+ oAuth2Scopes: [],
150
+
151
+ resolvedSecurity: requestSecurity,
152
+
153
+ securitySource: client._options.apiKey,
154
+ retryConfig: options?.retries
155
+ || client._options.retryConfig
156
+ || {
157
+ strategy: "backoff",
158
+ backoff: {
159
+ initialInterval: 500,
160
+ maxInterval: 60000,
161
+ exponent: 1.5,
162
+ maxElapsedTime: 3600000,
163
+ },
164
+ retryConnectionErrors: true,
165
+ }
166
+ || { strategy: "none" },
167
+ retryCodes: options?.retryCodes || ["408", "500", "502", "503", "504"],
168
+ };
169
+
170
+ const requestRes = client._createRequest(context, {
171
+ security: requestSecurity,
172
+ method: "GET",
173
+ baseURL: options?.serverURL,
174
+ path: path,
175
+ headers: headers,
176
+ query: query,
177
+ body: body,
178
+ userAgent: client._options.userAgent,
179
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
180
+ }, options);
181
+ if (!requestRes.ok) {
182
+ return [haltIterator(requestRes), { status: "invalid" }];
183
+ }
184
+ const req = requestRes.value;
185
+
186
+ const doResult = await client._do(req, {
187
+ context,
188
+ errorCodes: ["400", "401", "402", "404", "422", "4XX", "5XX"],
189
+ retryConfig: context.retryConfig,
190
+ retryCodes: context.retryCodes,
191
+ });
192
+ if (!doResult.ok) {
193
+ return [haltIterator(doResult), { status: "request-error", request: req }];
194
+ }
195
+ const response = doResult.value;
196
+
197
+ const responseFields = {
198
+ HttpMeta: { Response: response, Request: req },
199
+ };
200
+
201
+ const [result, raw] = await M.match<
202
+ operations.AccountingCategoriesAllResponse,
203
+ | errors.BadRequestResponse
204
+ | errors.UnauthorizedResponse
205
+ | errors.PaymentRequiredResponse
206
+ | errors.NotFoundResponse
207
+ | errors.UnprocessableResponse
208
+ | ApideckError
209
+ | ResponseValidationError
210
+ | ConnectionError
211
+ | RequestAbortedError
212
+ | RequestTimeoutError
213
+ | InvalidRequestError
214
+ | UnexpectedClientError
215
+ | SDKValidationError
216
+ >(
217
+ M.json(200, operations.AccountingCategoriesAllResponse$inboundSchema, {
218
+ key: "GetCategoriesResponse",
219
+ }),
220
+ M.jsonErr(400, errors.BadRequestResponse$inboundSchema),
221
+ M.jsonErr(401, errors.UnauthorizedResponse$inboundSchema),
222
+ M.jsonErr(402, errors.PaymentRequiredResponse$inboundSchema),
223
+ M.jsonErr(404, errors.NotFoundResponse$inboundSchema),
224
+ M.jsonErr(422, errors.UnprocessableResponse$inboundSchema),
225
+ M.fail("4XX"),
226
+ M.fail("5XX"),
227
+ M.json(
228
+ "default",
229
+ operations.AccountingCategoriesAllResponse$inboundSchema,
230
+ { key: "UnexpectedErrorResponse" },
231
+ ),
232
+ )(response, req, { extraFields: responseFields });
233
+ if (!result.ok) {
234
+ return [haltIterator(result), {
235
+ status: "complete",
236
+ request: req,
237
+ response,
238
+ }];
239
+ }
240
+
241
+ const nextFunc = (
242
+ responseData: unknown,
243
+ ): {
244
+ next: Paginator<
245
+ Result<
246
+ operations.AccountingCategoriesAllResponse,
247
+ | errors.BadRequestResponse
248
+ | errors.UnauthorizedResponse
249
+ | errors.PaymentRequiredResponse
250
+ | errors.NotFoundResponse
251
+ | errors.UnprocessableResponse
252
+ | ApideckError
253
+ | ResponseValidationError
254
+ | ConnectionError
255
+ | RequestAbortedError
256
+ | RequestTimeoutError
257
+ | InvalidRequestError
258
+ | UnexpectedClientError
259
+ | SDKValidationError
260
+ >
261
+ >;
262
+ "~next"?: { cursor: string };
263
+ } => {
264
+ const nextCursor = dlv(responseData, "meta.cursors.next");
265
+ if (typeof nextCursor !== "string") {
266
+ return { next: () => null };
267
+ }
268
+
269
+ const nextVal = () =>
270
+ accountingCategoriesList(
271
+ client,
272
+ {
273
+ ...request,
274
+ cursor: nextCursor,
275
+ },
276
+ options,
277
+ );
278
+
279
+ return { next: nextVal, "~next": { cursor: nextCursor } };
280
+ };
281
+
282
+ const page = { ...result, ...nextFunc(raw) };
283
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
284
+ status: "complete",
285
+ request: req,
286
+ response,
287
+ }];
288
+ }
package/src/lib/config.ts CHANGED
@@ -67,8 +67,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
67
67
 
68
68
  export const SDK_METADATA = {
69
69
  language: "typescript",
70
- openapiDocVersion: "10.17.2",
71
- sdkVersion: "0.25.1",
72
- genVersion: "2.629.1",
73
- userAgent: "speakeasy-sdk/typescript 0.25.1 2.629.1 10.17.2 @apideck/unify",
70
+ openapiDocVersion: "10.18.0",
71
+ sdkVersion: "0.26.0",
72
+ genVersion: "2.632.2",
73
+ userAgent: "speakeasy-sdk/typescript 0.26.0 2.632.2 10.18.0 @apideck/unify",
74
74
  } as const;
@@ -141,7 +141,7 @@ export type Bill = {
141
141
  */
142
142
  poNumber?: string | null | undefined;
143
143
  /**
144
- * Optional bill reference.
144
+ * Optional reference identifier for the transaction.
145
145
  */
146
146
  reference?: string | null | undefined;
147
147
  lineItems?: Array<BillLineItem> | undefined;
@@ -285,7 +285,7 @@ export type BillInput = {
285
285
  */
286
286
  poNumber?: string | null | undefined;
287
287
  /**
288
- * Optional bill reference.
288
+ * Optional reference identifier for the transaction.
289
289
  */
290
290
  reference?: string | null | undefined;
291
291
  lineItems?: Array<BillLineItemInput> | undefined;
@@ -0,0 +1,193 @@
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 { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+ import {
12
+ PassThroughBody,
13
+ PassThroughBody$inboundSchema,
14
+ PassThroughBody$Outbound,
15
+ PassThroughBody$outboundSchema,
16
+ } from "./passthroughbody.js";
17
+
18
+ /**
19
+ * Based on the status some functionality is enabled or disabled.
20
+ */
21
+ export const CategoryStatus = {
22
+ Active: "active",
23
+ Inactive: "inactive",
24
+ } as const;
25
+ /**
26
+ * Based on the status some functionality is enabled or disabled.
27
+ */
28
+ export type CategoryStatus = ClosedEnum<typeof CategoryStatus>;
29
+
30
+ export type Category = {
31
+ /**
32
+ * A unique identifier for an object.
33
+ */
34
+ id?: string | undefined;
35
+ /**
36
+ * The name of the category.
37
+ */
38
+ name?: string | undefined;
39
+ /**
40
+ * Based on the status some functionality is enabled or disabled.
41
+ */
42
+ status?: CategoryStatus | undefined;
43
+ /**
44
+ * When custom mappings are configured on the resource, the result is included here.
45
+ */
46
+ customMappings?: { [k: string]: any } | null | undefined;
47
+ /**
48
+ * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object.
49
+ */
50
+ rowVersion?: string | null | undefined;
51
+ /**
52
+ * The user who last updated the object.
53
+ */
54
+ updatedBy?: string | null | undefined;
55
+ /**
56
+ * The user who created the object.
57
+ */
58
+ createdBy?: string | null | undefined;
59
+ /**
60
+ * The date and time when the object was last updated.
61
+ */
62
+ updatedAt?: Date | null | undefined;
63
+ /**
64
+ * The date and time when the object was created.
65
+ */
66
+ createdAt?: Date | null | undefined;
67
+ /**
68
+ * The pass_through property allows passing service-specific, custom data or structured modifications in request body when creating or updating resources.
69
+ */
70
+ passThrough?: Array<PassThroughBody> | undefined;
71
+ };
72
+
73
+ /** @internal */
74
+ export const CategoryStatus$inboundSchema: z.ZodNativeEnum<
75
+ typeof CategoryStatus
76
+ > = z.nativeEnum(CategoryStatus);
77
+
78
+ /** @internal */
79
+ export const CategoryStatus$outboundSchema: z.ZodNativeEnum<
80
+ typeof CategoryStatus
81
+ > = CategoryStatus$inboundSchema;
82
+
83
+ /**
84
+ * @internal
85
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
86
+ */
87
+ export namespace CategoryStatus$ {
88
+ /** @deprecated use `CategoryStatus$inboundSchema` instead. */
89
+ export const inboundSchema = CategoryStatus$inboundSchema;
90
+ /** @deprecated use `CategoryStatus$outboundSchema` instead. */
91
+ export const outboundSchema = CategoryStatus$outboundSchema;
92
+ }
93
+
94
+ /** @internal */
95
+ export const Category$inboundSchema: z.ZodType<
96
+ Category,
97
+ z.ZodTypeDef,
98
+ unknown
99
+ > = z.object({
100
+ id: z.string().optional(),
101
+ name: z.string().optional(),
102
+ status: CategoryStatus$inboundSchema.optional(),
103
+ custom_mappings: z.nullable(z.record(z.any())).optional(),
104
+ row_version: z.nullable(z.string()).optional(),
105
+ updated_by: z.nullable(z.string()).optional(),
106
+ created_by: z.nullable(z.string()).optional(),
107
+ updated_at: z.nullable(
108
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
109
+ ).optional(),
110
+ created_at: z.nullable(
111
+ z.string().datetime({ offset: true }).transform(v => new Date(v)),
112
+ ).optional(),
113
+ pass_through: z.array(PassThroughBody$inboundSchema).optional(),
114
+ }).transform((v) => {
115
+ return remap$(v, {
116
+ "custom_mappings": "customMappings",
117
+ "row_version": "rowVersion",
118
+ "updated_by": "updatedBy",
119
+ "created_by": "createdBy",
120
+ "updated_at": "updatedAt",
121
+ "created_at": "createdAt",
122
+ "pass_through": "passThrough",
123
+ });
124
+ });
125
+
126
+ /** @internal */
127
+ export type Category$Outbound = {
128
+ id?: string | undefined;
129
+ name?: string | undefined;
130
+ status?: string | undefined;
131
+ custom_mappings?: { [k: string]: any } | null | undefined;
132
+ row_version?: string | null | undefined;
133
+ updated_by?: string | null | undefined;
134
+ created_by?: string | null | undefined;
135
+ updated_at?: string | null | undefined;
136
+ created_at?: string | null | undefined;
137
+ pass_through?: Array<PassThroughBody$Outbound> | undefined;
138
+ };
139
+
140
+ /** @internal */
141
+ export const Category$outboundSchema: z.ZodType<
142
+ Category$Outbound,
143
+ z.ZodTypeDef,
144
+ Category
145
+ > = z.object({
146
+ id: z.string().optional(),
147
+ name: z.string().optional(),
148
+ status: CategoryStatus$outboundSchema.optional(),
149
+ customMappings: z.nullable(z.record(z.any())).optional(),
150
+ rowVersion: z.nullable(z.string()).optional(),
151
+ updatedBy: z.nullable(z.string()).optional(),
152
+ createdBy: z.nullable(z.string()).optional(),
153
+ updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
154
+ createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
155
+ passThrough: z.array(PassThroughBody$outboundSchema).optional(),
156
+ }).transform((v) => {
157
+ return remap$(v, {
158
+ customMappings: "custom_mappings",
159
+ rowVersion: "row_version",
160
+ updatedBy: "updated_by",
161
+ createdBy: "created_by",
162
+ updatedAt: "updated_at",
163
+ createdAt: "created_at",
164
+ passThrough: "pass_through",
165
+ });
166
+ });
167
+
168
+ /**
169
+ * @internal
170
+ * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
171
+ */
172
+ export namespace Category$ {
173
+ /** @deprecated use `Category$inboundSchema` instead. */
174
+ export const inboundSchema = Category$inboundSchema;
175
+ /** @deprecated use `Category$outboundSchema` instead. */
176
+ export const outboundSchema = Category$outboundSchema;
177
+ /** @deprecated use `Category$Outbound` instead. */
178
+ export type Outbound = Category$Outbound;
179
+ }
180
+
181
+ export function categoryToJSON(category: Category): string {
182
+ return JSON.stringify(Category$outboundSchema.parse(category));
183
+ }
184
+
185
+ export function categoryFromJSON(
186
+ jsonString: string,
187
+ ): SafeParseResult<Category, SDKValidationError> {
188
+ return safeParse(
189
+ jsonString,
190
+ (x) => Category$inboundSchema.parse(JSON.parse(x)),
191
+ `Failed to parse 'Category' from JSON`,
192
+ );
193
+ }
@@ -137,6 +137,10 @@ export type Expense = {
137
137
  * Expense line items linked to this expense.
138
138
  */
139
139
  lineItems: Array<ExpenseLineItem>;
140
+ /**
141
+ * Optional reference identifier for the transaction.
142
+ */
143
+ reference?: string | null | undefined;
140
144
  customFields?: Array<CustomField> | undefined;
141
145
  /**
142
146
  * When custom mappings are configured on the resource, the result is included here.
@@ -226,6 +230,10 @@ export type ExpenseInput = {
226
230
  * Expense line items linked to this expense.
227
231
  */
228
232
  lineItems: Array<ExpenseLineItemInput>;
233
+ /**
234
+ * Optional reference identifier for the transaction.
235
+ */
236
+ reference?: string | null | undefined;
229
237
  customFields?: Array<CustomField> | undefined;
230
238
  /**
231
239
  * A binary value used to detect updates to a object and prevent data conflicts. It is incremented each time an update is made to the object.
@@ -298,6 +306,7 @@ export const Expense$inboundSchema: z.ZodType<Expense, z.ZodTypeDef, unknown> =
298
306
  tax_rate: LinkedTaxRate$inboundSchema.optional(),
299
307
  total_amount: z.nullable(z.number()).optional(),
300
308
  line_items: z.array(ExpenseLineItem$inboundSchema),
309
+ reference: z.nullable(z.string()).optional(),
301
310
  custom_fields: z.array(CustomField$inboundSchema).optional(),
302
311
  custom_mappings: z.nullable(z.record(z.any())).optional(),
303
312
  updated_at: z.nullable(
@@ -352,6 +361,7 @@ export type Expense$Outbound = {
352
361
  tax_rate?: LinkedTaxRate$Outbound | undefined;
353
362
  total_amount?: number | null | undefined;
354
363
  line_items: Array<ExpenseLineItem$Outbound>;
364
+ reference?: string | null | undefined;
355
365
  custom_fields?: Array<CustomField$Outbound> | undefined;
356
366
  custom_mappings?: { [k: string]: any } | null | undefined;
357
367
  updated_at?: string | null | undefined;
@@ -384,6 +394,7 @@ export const Expense$outboundSchema: z.ZodType<
384
394
  taxRate: LinkedTaxRate$outboundSchema.optional(),
385
395
  totalAmount: z.nullable(z.number()).optional(),
386
396
  lineItems: z.array(ExpenseLineItem$outboundSchema),
397
+ reference: z.nullable(z.string()).optional(),
387
398
  customFields: z.array(CustomField$outboundSchema).optional(),
388
399
  customMappings: z.nullable(z.record(z.any())).optional(),
389
400
  updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
@@ -466,6 +477,7 @@ export const ExpenseInput$inboundSchema: z.ZodType<
466
477
  tax_rate: LinkedTaxRateInput$inboundSchema.optional(),
467
478
  total_amount: z.nullable(z.number()).optional(),
468
479
  line_items: z.array(ExpenseLineItemInput$inboundSchema),
480
+ reference: z.nullable(z.string()).optional(),
469
481
  custom_fields: z.array(CustomField$inboundSchema).optional(),
470
482
  row_version: z.nullable(z.string()).optional(),
471
483
  pass_through: z.array(PassThroughBody$inboundSchema).optional(),
@@ -505,6 +517,7 @@ export type ExpenseInput$Outbound = {
505
517
  tax_rate?: LinkedTaxRateInput$Outbound | undefined;
506
518
  total_amount?: number | null | undefined;
507
519
  line_items: Array<ExpenseLineItemInput$Outbound>;
520
+ reference?: string | null | undefined;
508
521
  custom_fields?: Array<CustomField$Outbound> | undefined;
509
522
  row_version?: string | null | undefined;
510
523
  pass_through?: Array<PassThroughBody$Outbound> | undefined;
@@ -531,6 +544,7 @@ export const ExpenseInput$outboundSchema: z.ZodType<
531
544
  taxRate: LinkedTaxRateInput$outboundSchema.optional(),
532
545
  totalAmount: z.nullable(z.number()).optional(),
533
546
  lineItems: z.array(ExpenseLineItemInput$outboundSchema),
547
+ reference: z.nullable(z.string()).optional(),
534
548
  customFields: z.array(CustomField$outboundSchema).optional(),
535
549
  rowVersion: z.nullable(z.string()).optional(),
536
550
  passThrough: z.array(PassThroughBody$outboundSchema).optional(),
@@ -20,8 +20,8 @@ import {
20
20
  } from "./simpleformfieldoption.js";
21
21
 
22
22
  export type FormFieldOption =
23
- | (SimpleFormFieldOption & { optionType: "simple" })
24
- | (FormFieldOptionGroup & { optionType: "group" });
23
+ | (FormFieldOptionGroup & { optionType: "group" })
24
+ | (SimpleFormFieldOption & { optionType: "simple" });
25
25
 
26
26
  /** @internal */
27
27
  export const FormFieldOption$inboundSchema: z.ZodType<
@@ -29,13 +29,13 @@ export const FormFieldOption$inboundSchema: z.ZodType<
29
29
  z.ZodTypeDef,
30
30
  unknown
31
31
  > = z.union([
32
- SimpleFormFieldOption$inboundSchema.and(
33
- z.object({ option_type: z.literal("simple") }).transform((v) => ({
32
+ FormFieldOptionGroup$inboundSchema.and(
33
+ z.object({ option_type: z.literal("group") }).transform((v) => ({
34
34
  optionType: v.option_type,
35
35
  })),
36
36
  ),
37
- FormFieldOptionGroup$inboundSchema.and(
38
- z.object({ option_type: z.literal("group") }).transform((v) => ({
37
+ SimpleFormFieldOption$inboundSchema.and(
38
+ z.object({ option_type: z.literal("simple") }).transform((v) => ({
39
39
  optionType: v.option_type,
40
40
  })),
41
41
  ),
@@ -43,8 +43,8 @@ export const FormFieldOption$inboundSchema: z.ZodType<
43
43
 
44
44
  /** @internal */
45
45
  export type FormFieldOption$Outbound =
46
- | (SimpleFormFieldOption$Outbound & { option_type: "simple" })
47
- | (FormFieldOptionGroup$Outbound & { option_type: "group" });
46
+ | (FormFieldOptionGroup$Outbound & { option_type: "group" })
47
+ | (SimpleFormFieldOption$Outbound & { option_type: "simple" });
48
48
 
49
49
  /** @internal */
50
50
  export const FormFieldOption$outboundSchema: z.ZodType<
@@ -52,13 +52,13 @@ export const FormFieldOption$outboundSchema: z.ZodType<
52
52
  z.ZodTypeDef,
53
53
  FormFieldOption
54
54
  > = z.union([
55
- SimpleFormFieldOption$outboundSchema.and(
56
- z.object({ optionType: z.literal("simple") }).transform((v) => ({
55
+ FormFieldOptionGroup$outboundSchema.and(
56
+ z.object({ optionType: z.literal("group") }).transform((v) => ({
57
57
  option_type: v.optionType,
58
58
  })),
59
59
  ),
60
- FormFieldOptionGroup$outboundSchema.and(
61
- z.object({ optionType: z.literal("group") }).transform((v) => ({
60
+ SimpleFormFieldOption$outboundSchema.and(
61
+ z.object({ optionType: z.literal("simple") }).transform((v) => ({
62
62
  option_type: v.optionType,
63
63
  })),
64
64
  ),