@clientcasa/sdk 0.4.1 → 0.5.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 (93) hide show
  1. package/README.md +7 -0
  2. package/esm/funcs/document-versions-get.d.ts +16 -0
  3. package/esm/funcs/document-versions-get.d.ts.map +1 -0
  4. package/esm/funcs/document-versions-get.js +107 -0
  5. package/esm/funcs/document-versions-get.js.map +1 -0
  6. package/esm/funcs/document-versions-list.d.ts +21 -0
  7. package/esm/funcs/document-versions-list.d.ts.map +1 -0
  8. package/esm/funcs/document-versions-list.js +145 -0
  9. package/esm/funcs/document-versions-list.js.map +1 -0
  10. package/esm/funcs/invoices-list.js +1 -0
  11. package/esm/funcs/invoices-list.js.map +1 -1
  12. package/esm/lib/config.d.ts +3 -3
  13. package/esm/lib/config.js +3 -3
  14. package/esm/lib/sdks.d.ts.map +1 -1
  15. package/esm/lib/sdks.js +37 -12
  16. package/esm/lib/sdks.js.map +1 -1
  17. package/esm/models/client-create.d.ts +5 -0
  18. package/esm/models/client-create.d.ts.map +1 -1
  19. package/esm/models/client-create.js +3 -0
  20. package/esm/models/client-create.js.map +1 -1
  21. package/esm/models/client-tax-settings.d.ts +21 -0
  22. package/esm/models/client-tax-settings.d.ts.map +1 -0
  23. package/esm/models/client-tax-settings.js +25 -0
  24. package/esm/models/client-tax-settings.js.map +1 -0
  25. package/esm/models/client-update.d.ts +5 -0
  26. package/esm/models/client-update.d.ts.map +1 -1
  27. package/esm/models/client-update.js +3 -0
  28. package/esm/models/client-update.js.map +1 -1
  29. package/esm/models/client.d.ts +25 -0
  30. package/esm/models/client.d.ts.map +1 -1
  31. package/esm/models/client.js +22 -0
  32. package/esm/models/client.js.map +1 -1
  33. package/esm/models/document-version-list.d.ts +13 -0
  34. package/esm/models/document-version-list.d.ts.map +1 -0
  35. package/esm/models/document-version-list.js +16 -0
  36. package/esm/models/document-version-list.js.map +1 -0
  37. package/esm/models/document-version.d.ts +106 -0
  38. package/esm/models/document-version.d.ts.map +1 -0
  39. package/esm/models/document-version.js +67 -0
  40. package/esm/models/document-version.js.map +1 -0
  41. package/esm/models/index.d.ts +3 -0
  42. package/esm/models/index.d.ts.map +1 -1
  43. package/esm/models/index.js +3 -0
  44. package/esm/models/index.js.map +1 -1
  45. package/esm/models/invoice.d.ts +4 -0
  46. package/esm/models/invoice.d.ts.map +1 -1
  47. package/esm/models/invoice.js +1 -0
  48. package/esm/models/invoice.js.map +1 -1
  49. package/esm/models/operations/get-document-version.d.ts +27 -0
  50. package/esm/models/operations/get-document-version.d.ts.map +1 -0
  51. package/esm/models/operations/get-document-version.js +20 -0
  52. package/esm/models/operations/get-document-version.js.map +1 -0
  53. package/esm/models/operations/index.d.ts +2 -0
  54. package/esm/models/operations/index.d.ts.map +1 -1
  55. package/esm/models/operations/index.js +2 -0
  56. package/esm/models/operations/index.js.map +1 -1
  57. package/esm/models/operations/list-document-versions.d.ts +61 -0
  58. package/esm/models/operations/list-document-versions.d.ts.map +1 -0
  59. package/esm/models/operations/list-document-versions.js +47 -0
  60. package/esm/models/operations/list-document-versions.js.map +1 -0
  61. package/esm/models/operations/list-invoices.d.ts +5 -0
  62. package/esm/models/operations/list-invoices.d.ts.map +1 -1
  63. package/esm/models/operations/list-invoices.js +1 -0
  64. package/esm/models/operations/list-invoices.js.map +1 -1
  65. package/esm/sdk/document-versions.d.ts +20 -0
  66. package/esm/sdk/document-versions.d.ts.map +1 -0
  67. package/esm/sdk/document-versions.js +26 -0
  68. package/esm/sdk/document-versions.js.map +1 -0
  69. package/esm/sdk/sdk.d.ts +3 -0
  70. package/esm/sdk/sdk.d.ts.map +1 -1
  71. package/esm/sdk/sdk.js +5 -0
  72. package/esm/sdk/sdk.js.map +1 -1
  73. package/jsr.json +1 -1
  74. package/package.json +1 -1
  75. package/src/funcs/document-versions-get.ts +203 -0
  76. package/src/funcs/document-versions-list.ts +284 -0
  77. package/src/funcs/invoices-list.ts +1 -0
  78. package/src/lib/config.ts +3 -3
  79. package/src/lib/sdks.ts +41 -13
  80. package/src/models/client-create.ts +11 -0
  81. package/src/models/client-tax-settings.ts +58 -0
  82. package/src/models/client-update.ts +11 -0
  83. package/src/models/client.ts +56 -0
  84. package/src/models/document-version-list.ts +40 -0
  85. package/src/models/document-version.ts +175 -0
  86. package/src/models/index.ts +3 -0
  87. package/src/models/invoice.ts +5 -0
  88. package/src/models/operations/get-document-version.ts +61 -0
  89. package/src/models/operations/index.ts +2 -0
  90. package/src/models/operations/list-document-versions.ts +132 -0
  91. package/src/models/operations/list-invoices.ts +6 -0
  92. package/src/sdk/document-versions.ts +50 -0
  93. package/src/sdk/sdk.ts +6 -0
@@ -0,0 +1,284 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { ClientCasaCore } from "../core.js";
7
+ import { dlv } from "../lib/dlv.js";
8
+ import { encodeFormQuery } from "../lib/encodings.js";
9
+ import { matchStatusCode } from "../lib/http.js";
10
+ import * as M from "../lib/matchers.js";
11
+ import { compactMap } from "../lib/primitives.js";
12
+ import { safeParse } from "../lib/schemas.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { resolveSecurity } from "../lib/security.js";
15
+ import { pathToFunc } from "../lib/url.js";
16
+ import { ClientCasaError } from "../models/errors/client-casa-error.js";
17
+ import {
18
+ ConnectionError,
19
+ InvalidRequestError,
20
+ RequestAbortedError,
21
+ RequestTimeoutError,
22
+ UnexpectedClientError,
23
+ } from "../models/errors/http-client-errors.js";
24
+ import * as errors from "../models/errors/index.js";
25
+ import { ResponseValidationError } from "../models/errors/response-validation-error.js";
26
+ import { SDKValidationError } from "../models/errors/sdk-validation-error.js";
27
+ import * as operations from "../models/operations/index.js";
28
+ import { APICall, APIPromise } from "../types/async.js";
29
+ import { Result } from "../types/fp.js";
30
+ import {
31
+ createPageIterator,
32
+ haltIterator,
33
+ PageIterator,
34
+ Paginator,
35
+ } from "../types/operations.js";
36
+
37
+ /**
38
+ * List document versions
39
+ *
40
+ * @remarks
41
+ * Read-only audit trail of issued document versions across smart-files, invoices, and standalone contracts. Checkpoints (internal draft edit-history) are never returned. Frozen content and client access tokens are not exposed.
42
+ */
43
+ export function documentVersionsList(
44
+ client: ClientCasaCore,
45
+ security: operations.ListDocumentVersionsSecurity,
46
+ request?: operations.ListDocumentVersionsRequest | undefined,
47
+ options?: RequestOptions,
48
+ ): APIPromise<
49
+ PageIterator<
50
+ Result<
51
+ operations.ListDocumentVersionsResponse,
52
+ | errors.ApiError
53
+ | ClientCasaError
54
+ | ResponseValidationError
55
+ | ConnectionError
56
+ | RequestAbortedError
57
+ | RequestTimeoutError
58
+ | InvalidRequestError
59
+ | UnexpectedClientError
60
+ | SDKValidationError
61
+ >,
62
+ { page: number }
63
+ >
64
+ > {
65
+ return new APIPromise($do(
66
+ client,
67
+ security,
68
+ request,
69
+ options,
70
+ ));
71
+ }
72
+
73
+ async function $do(
74
+ client: ClientCasaCore,
75
+ security: operations.ListDocumentVersionsSecurity,
76
+ request?: operations.ListDocumentVersionsRequest | undefined,
77
+ options?: RequestOptions,
78
+ ): Promise<
79
+ [
80
+ PageIterator<
81
+ Result<
82
+ operations.ListDocumentVersionsResponse,
83
+ | errors.ApiError
84
+ | ClientCasaError
85
+ | ResponseValidationError
86
+ | ConnectionError
87
+ | RequestAbortedError
88
+ | RequestTimeoutError
89
+ | InvalidRequestError
90
+ | UnexpectedClientError
91
+ | SDKValidationError
92
+ >,
93
+ { page: number }
94
+ >,
95
+ APICall,
96
+ ]
97
+ > {
98
+ const parsed = safeParse(
99
+ request,
100
+ (value) =>
101
+ z.parse(
102
+ z.optional(operations.ListDocumentVersionsRequest$outboundSchema),
103
+ value,
104
+ ),
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("/api/v1/document-versions")();
114
+
115
+ const query = encodeFormQuery({
116
+ "contractId": payload?.contractId,
117
+ "documentId": payload?.documentId,
118
+ "documentType": payload?.documentType,
119
+ "invoiceId": payload?.invoiceId,
120
+ "page": payload?.page,
121
+ "pageSize": payload?.pageSize,
122
+ });
123
+
124
+ const headers = new Headers(compactMap({
125
+ Accept: "application/json",
126
+ }));
127
+
128
+ const requestSecurity = resolveSecurity(
129
+ [
130
+ {
131
+ fieldName: "x-api-key",
132
+ type: "apiKey:header",
133
+ value: security?.apiKey,
134
+ },
135
+ ],
136
+ [
137
+ {
138
+ fieldName: "Authorization",
139
+ type: "http:bearer",
140
+ value: security?.bearer,
141
+ },
142
+ ],
143
+ );
144
+
145
+ const context = {
146
+ options: client._options,
147
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
148
+ operationID: "listDocumentVersions",
149
+ oAuth2Scopes: null,
150
+
151
+ resolvedSecurity: requestSecurity,
152
+
153
+ securitySource: security,
154
+ retryConfig: options?.retries
155
+ || client._options.retryConfig
156
+ || {
157
+ strategy: "backoff",
158
+ backoff: {
159
+ initialInterval: 500,
160
+ maxInterval: 30000,
161
+ exponent: 1.5,
162
+ maxElapsedTime: 30000,
163
+ },
164
+ retryConnectionErrors: true,
165
+ }
166
+ || { strategy: "none" },
167
+ retryCodes: options?.retryCodes || ["429", "5XX"],
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
+ isErrorStatusCode: (statusCode: number) =>
189
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
190
+ retryConfig: context.retryConfig,
191
+ retryCodes: context.retryCodes,
192
+ });
193
+ if (!doResult.ok) {
194
+ return [haltIterator(doResult), { status: "request-error", request: req }];
195
+ }
196
+ const response = doResult.value;
197
+
198
+ const responseFields = {
199
+ HttpMeta: { Response: response, Request: req },
200
+ };
201
+
202
+ const [result, raw] = await M.match<
203
+ operations.ListDocumentVersionsResponse,
204
+ | errors.ApiError
205
+ | ClientCasaError
206
+ | ResponseValidationError
207
+ | ConnectionError
208
+ | RequestAbortedError
209
+ | RequestTimeoutError
210
+ | InvalidRequestError
211
+ | UnexpectedClientError
212
+ | SDKValidationError
213
+ >(
214
+ M.json(200, operations.ListDocumentVersionsResponse$inboundSchema, {
215
+ key: "Result",
216
+ }),
217
+ M.jsonErr([400, 401, 403, 429], errors.ApiError$inboundSchema),
218
+ M.jsonErr(500, errors.ApiError$inboundSchema),
219
+ M.fail("4XX"),
220
+ M.fail("5XX"),
221
+ )(response, req, { extraFields: responseFields });
222
+ if (!result.ok) {
223
+ return [haltIterator(result), {
224
+ status: "complete",
225
+ request: req,
226
+ response,
227
+ }];
228
+ }
229
+
230
+ const nextFunc = (
231
+ responseData: unknown,
232
+ ): {
233
+ next: Paginator<
234
+ Result<
235
+ operations.ListDocumentVersionsResponse,
236
+ | errors.ApiError
237
+ | ClientCasaError
238
+ | ResponseValidationError
239
+ | ConnectionError
240
+ | RequestAbortedError
241
+ | RequestTimeoutError
242
+ | InvalidRequestError
243
+ | UnexpectedClientError
244
+ | SDKValidationError
245
+ >
246
+ >;
247
+ "~next"?: { page: number };
248
+ } => {
249
+ const page = request?.page ?? 1;
250
+ const nextPage = page + 1;
251
+
252
+ if (!responseData) {
253
+ return { next: () => null };
254
+ }
255
+ const results = dlv(responseData, "data");
256
+ if (!Array.isArray(results) || !results.length) {
257
+ return { next: () => null };
258
+ }
259
+ const limit = request?.pageSize ?? 25;
260
+ if (results.length < limit) {
261
+ return { next: () => null };
262
+ }
263
+
264
+ const nextVal = () =>
265
+ documentVersionsList(
266
+ client,
267
+ security,
268
+ {
269
+ ...request!,
270
+ page: nextPage,
271
+ },
272
+ options,
273
+ );
274
+
275
+ return { next: nextVal, "~next": { page: nextPage } };
276
+ };
277
+
278
+ const page = { ...result, ...nextFunc(raw) };
279
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
280
+ status: "complete",
281
+ request: req,
282
+ response,
283
+ }];
284
+ }
@@ -112,6 +112,7 @@ async function $do(
112
112
  "page": payload?.page,
113
113
  "pageSize": payload?.pageSize,
114
114
  "status": payload?.status,
115
+ "supersedesInvoice": payload?.supersedesInvoice,
115
116
  });
116
117
 
117
118
  const headers = new Headers(compactMap({
package/src/lib/config.ts CHANGED
@@ -61,7 +61,7 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
61
61
  export const SDK_METADATA = {
62
62
  language: "typescript",
63
63
  openapiDocVersion: "1.0.0",
64
- sdkVersion: "0.4.1",
65
- genVersion: "2.900.0",
66
- userAgent: "speakeasy-sdk/typescript 0.4.1 2.900.0 1.0.0 @clientcasa/sdk",
64
+ sdkVersion: "0.5.0",
65
+ genVersion: "2.900.1",
66
+ userAgent: "speakeasy-sdk/typescript 0.5.0 2.900.1 1.0.0 @clientcasa/sdk",
67
67
  } as const;
package/src/lib/sdks.ts CHANGED
@@ -132,27 +132,55 @@ export class ClientSDK {
132
132
  if (path) {
133
133
  baseURL.pathname = baseURL.pathname.replace(/\/+$/, "") + "/";
134
134
  reqURL = new URL(path, baseURL);
135
+ if (!reqURL.search && baseURL.search) {
136
+ reqURL.search = baseURL.search;
137
+ }
135
138
  } else {
136
139
  reqURL = baseURL;
137
140
  }
138
141
  reqURL.hash = "";
139
142
 
140
- let finalQuery = query || "";
141
-
142
- const secQuery: string[] = [];
143
- for (const [k, v] of Object.entries(security?.queryParams || {})) {
144
- const q = encodeForm(k, v, { charEncoding: "percent" });
145
- if (typeof q !== "undefined") {
146
- secQuery.push(q);
143
+ // Appends already-encoded query pairs to a query string, replacing any
144
+ // existing pairs with the same key so later sources take precedence.
145
+ const mergeQuery = (current: string, additions: string): string => {
146
+ if (!additions) {
147
+ return current;
147
148
  }
148
- }
149
- if (secQuery.length) {
150
- finalQuery += `&${secQuery.join("&")}`;
151
- }
149
+ const additionKeys = new Set(
150
+ additions
151
+ .split("&")
152
+ .filter((pair) => pair !== "")
153
+ .map((pair) => pair.split("=")[0] ?? ""),
154
+ );
155
+ const kept = current.split("&").filter((pair) => {
156
+ return pair !== "" && !additionKeys.has(pair.split("=")[0] ?? "");
157
+ });
158
+ return [...kept, additions].join("&");
159
+ };
160
+
161
+ const encodeQueryRecord = (record: Record<string, unknown>): string => {
162
+ return Object.entries(record)
163
+ .map(([k, v]) => {
164
+ if (v == null) {
165
+ return undefined;
166
+ }
167
+ const value = v;
168
+ return encodeForm(k, value, {
169
+ explode: Array.isArray(value),
170
+ charEncoding: "percent",
171
+ });
172
+ })
173
+ .filter((pair): pair is string => typeof pair !== "undefined")
174
+ .join("&");
175
+ };
176
+
177
+ const finalQuery = [
178
+ query || "",
179
+ encodeQueryRecord(security?.queryParams || {}),
180
+ ].reduce(mergeQuery, reqURL.search.slice(1));
152
181
 
153
182
  if (finalQuery) {
154
- const q = finalQuery.startsWith("&") ? finalQuery.slice(1) : finalQuery;
155
- reqURL.search = `?${q}`;
183
+ reqURL.search = `?${finalQuery}`;
156
184
  }
157
185
 
158
186
  const headers = new Headers(opHeaders);
@@ -4,6 +4,11 @@
4
4
 
5
5
  import * as z from "zod/v4-mini";
6
6
  import { ClosedEnum } from "../types/enums.js";
7
+ import {
8
+ ClientTaxSettings,
9
+ ClientTaxSettings$Outbound,
10
+ ClientTaxSettings$outboundSchema,
11
+ } from "./client-tax-settings.js";
7
12
 
8
13
  export const ClientCreateStatus = {
9
14
  New: "new",
@@ -20,6 +25,8 @@ export type ClientCreate = {
20
25
  name: string;
21
26
  status?: ClientCreateStatus | undefined;
22
27
  notes?: string | undefined;
28
+ taxSettings?: ClientTaxSettings | undefined;
29
+ invoiceRemindersEnabled?: boolean | undefined;
23
30
  };
24
31
 
25
32
  /** @internal */
@@ -32,6 +39,8 @@ export type ClientCreate$Outbound = {
32
39
  name: string;
33
40
  status: string;
34
41
  notes?: string | undefined;
42
+ taxSettings?: ClientTaxSettings$Outbound | undefined;
43
+ invoiceRemindersEnabled?: boolean | undefined;
35
44
  };
36
45
 
37
46
  /** @internal */
@@ -42,6 +51,8 @@ export const ClientCreate$outboundSchema: z.ZodMiniType<
42
51
  name: z.string(),
43
52
  status: z._default(ClientCreateStatus$outboundSchema, "active"),
44
53
  notes: z.optional(z.string()),
54
+ taxSettings: z.optional(ClientTaxSettings$outboundSchema),
55
+ invoiceRemindersEnabled: z.optional(z.boolean()),
45
56
  });
46
57
 
47
58
  export function clientCreateToJSON(clientCreate: ClientCreate): string {
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import * as types from "../types/primitives.js";
9
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
10
+
11
+ export type ClientTaxSettings = {
12
+ defaultTaxable: boolean;
13
+ overrideTaxRate: boolean;
14
+ taxRate: number | null;
15
+ };
16
+
17
+ /** @internal */
18
+ export const ClientTaxSettings$inboundSchema: z.ZodMiniType<
19
+ ClientTaxSettings,
20
+ unknown
21
+ > = z.object({
22
+ defaultTaxable: types.boolean(),
23
+ overrideTaxRate: types.boolean(),
24
+ taxRate: types.nullable(types.number()),
25
+ });
26
+ /** @internal */
27
+ export type ClientTaxSettings$Outbound = {
28
+ defaultTaxable: boolean;
29
+ overrideTaxRate: boolean;
30
+ taxRate: number | null;
31
+ };
32
+
33
+ /** @internal */
34
+ export const ClientTaxSettings$outboundSchema: z.ZodMiniType<
35
+ ClientTaxSettings$Outbound,
36
+ ClientTaxSettings
37
+ > = z.object({
38
+ defaultTaxable: z.boolean(),
39
+ overrideTaxRate: z.boolean(),
40
+ taxRate: z.nullable(z.number()),
41
+ });
42
+
43
+ export function clientTaxSettingsToJSON(
44
+ clientTaxSettings: ClientTaxSettings,
45
+ ): string {
46
+ return JSON.stringify(
47
+ ClientTaxSettings$outboundSchema.parse(clientTaxSettings),
48
+ );
49
+ }
50
+ export function clientTaxSettingsFromJSON(
51
+ jsonString: string,
52
+ ): SafeParseResult<ClientTaxSettings, SDKValidationError> {
53
+ return safeParse(
54
+ jsonString,
55
+ (x) => ClientTaxSettings$inboundSchema.parse(JSON.parse(x)),
56
+ `Failed to parse 'ClientTaxSettings' from JSON`,
57
+ );
58
+ }
@@ -4,6 +4,11 @@
4
4
 
5
5
  import * as z from "zod/v4-mini";
6
6
  import { ClosedEnum } from "../types/enums.js";
7
+ import {
8
+ ClientTaxSettings,
9
+ ClientTaxSettings$Outbound,
10
+ ClientTaxSettings$outboundSchema,
11
+ } from "./client-tax-settings.js";
7
12
 
8
13
  export const ClientUpdateStatus = {
9
14
  New: "new",
@@ -20,6 +25,8 @@ export type ClientUpdate = {
20
25
  name?: string | undefined;
21
26
  status?: ClientUpdateStatus | undefined;
22
27
  notes?: string | undefined;
28
+ taxSettings?: ClientTaxSettings | undefined;
29
+ invoiceRemindersEnabled?: boolean | undefined;
23
30
  };
24
31
 
25
32
  /** @internal */
@@ -32,6 +39,8 @@ export type ClientUpdate$Outbound = {
32
39
  name?: string | undefined;
33
40
  status: string;
34
41
  notes?: string | undefined;
42
+ taxSettings?: ClientTaxSettings$Outbound | undefined;
43
+ invoiceRemindersEnabled?: boolean | undefined;
35
44
  };
36
45
 
37
46
  /** @internal */
@@ -42,6 +51,8 @@ export const ClientUpdate$outboundSchema: z.ZodMiniType<
42
51
  name: z.optional(z.string()),
43
52
  status: z._default(ClientUpdateStatus$outboundSchema, "active"),
44
53
  notes: z.optional(z.string()),
54
+ taxSettings: z.optional(ClientTaxSettings$outboundSchema),
55
+ invoiceRemindersEnabled: z.optional(z.boolean()),
45
56
  });
46
57
 
47
58
  export function clientUpdateToJSON(clientUpdate: ClientUpdate): string {
@@ -8,6 +8,10 @@ import * as openEnums from "../types/enums.js";
8
8
  import { OpenEnum } from "../types/enums.js";
9
9
  import { Result as SafeParseResult } from "../types/fp.js";
10
10
  import * as types from "../types/primitives.js";
11
+ import {
12
+ ClientTaxSettings,
13
+ ClientTaxSettings$inboundSchema,
14
+ } from "./client-tax-settings.js";
11
15
  import { SDKValidationError } from "./errors/sdk-validation-error.js";
12
16
 
13
17
  export const ClientStatus = {
@@ -21,6 +25,20 @@ export const ClientStatus = {
21
25
  } as const;
22
26
  export type ClientStatus = OpenEnum<typeof ClientStatus>;
23
27
 
28
+ export const RecurringBillingStatus = {
29
+ Active: "active",
30
+ PastDue: "past_due",
31
+ Paused: "paused",
32
+ Suspended: "suspended",
33
+ PendingSetup: "pending_setup",
34
+ } as const;
35
+ export type RecurringBillingStatus = OpenEnum<typeof RecurringBillingStatus>;
36
+
37
+ export type RecurringBilling = {
38
+ status: RecurringBillingStatus;
39
+ nextBillingDate: Date | null;
40
+ };
41
+
24
42
  export type Client = {
25
43
  /**
26
44
  * UUID v4
@@ -29,6 +47,13 @@ export type Client = {
29
47
  name: string;
30
48
  status: ClientStatus;
31
49
  notes: string | null;
50
+ taxSettings: ClientTaxSettings;
51
+ invoiceRemindersEnabled: boolean;
52
+ recurringBilling: RecurringBilling | null;
53
+ /**
54
+ * UUID v4
55
+ */
56
+ sourceSubmissionId: string | null;
32
57
  /**
33
58
  * ISO 8601 timestamp (UTC)
34
59
  */
@@ -43,12 +68,43 @@ export type Client = {
43
68
  export const ClientStatus$inboundSchema: z.ZodMiniType<ClientStatus, unknown> =
44
69
  openEnums.inboundSchema(ClientStatus);
45
70
 
71
+ /** @internal */
72
+ export const RecurringBillingStatus$inboundSchema: z.ZodMiniType<
73
+ RecurringBillingStatus,
74
+ unknown
75
+ > = openEnums.inboundSchema(RecurringBillingStatus);
76
+
77
+ /** @internal */
78
+ export const RecurringBilling$inboundSchema: z.ZodMiniType<
79
+ RecurringBilling,
80
+ unknown
81
+ > = z.object({
82
+ status: RecurringBillingStatus$inboundSchema,
83
+ nextBillingDate: types.nullable(types.date()),
84
+ });
85
+
86
+ export function recurringBillingFromJSON(
87
+ jsonString: string,
88
+ ): SafeParseResult<RecurringBilling, SDKValidationError> {
89
+ return safeParse(
90
+ jsonString,
91
+ (x) => RecurringBilling$inboundSchema.parse(JSON.parse(x)),
92
+ `Failed to parse 'RecurringBilling' from JSON`,
93
+ );
94
+ }
95
+
46
96
  /** @internal */
47
97
  export const Client$inboundSchema: z.ZodMiniType<Client, unknown> = z.object({
48
98
  id: types.string(),
49
99
  name: types.string(),
50
100
  status: ClientStatus$inboundSchema,
51
101
  notes: types.nullable(types.string()),
102
+ taxSettings: ClientTaxSettings$inboundSchema,
103
+ invoiceRemindersEnabled: types.boolean(),
104
+ recurringBilling: types.nullable(
105
+ z.lazy(() => RecurringBilling$inboundSchema),
106
+ ),
107
+ sourceSubmissionId: types.nullable(types.string()),
52
108
  createdAt: types.date(),
53
109
  updatedAt: types.date(),
54
110
  });
@@ -0,0 +1,40 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v4-mini";
6
+ import { safeParse } from "../lib/schemas.js";
7
+ import { Result as SafeParseResult } from "../types/fp.js";
8
+ import {
9
+ DocumentVersion,
10
+ DocumentVersion$inboundSchema,
11
+ } from "./document-version.js";
12
+ import { SDKValidationError } from "./errors/sdk-validation-error.js";
13
+ import {
14
+ PaginationMeta,
15
+ PaginationMeta$inboundSchema,
16
+ } from "./pagination-meta.js";
17
+
18
+ export type DocumentVersionList = {
19
+ data: Array<DocumentVersion>;
20
+ pagination: PaginationMeta;
21
+ };
22
+
23
+ /** @internal */
24
+ export const DocumentVersionList$inboundSchema: z.ZodMiniType<
25
+ DocumentVersionList,
26
+ unknown
27
+ > = z.object({
28
+ data: z.array(DocumentVersion$inboundSchema),
29
+ pagination: PaginationMeta$inboundSchema,
30
+ });
31
+
32
+ export function documentVersionListFromJSON(
33
+ jsonString: string,
34
+ ): SafeParseResult<DocumentVersionList, SDKValidationError> {
35
+ return safeParse(
36
+ jsonString,
37
+ (x) => DocumentVersionList$inboundSchema.parse(JSON.parse(x)),
38
+ `Failed to parse 'DocumentVersionList' from JSON`,
39
+ );
40
+ }