@greensecurity/javascript-sdk 0.43.1-beta.40 → 0.43.1-beta.44

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 (195) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/invoices.test.js +32 -0
  3. package/dist/commonjs/__tests__/invoices.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  5. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  6. package/dist/commonjs/__tests__/zones.test.js +28 -4
  7. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  8. package/dist/commonjs/funcs/alertsListAlerts.js +4 -2
  9. package/dist/commonjs/funcs/alertsListAlerts.js.map +1 -1
  10. package/dist/commonjs/funcs/invoicesListInvoices.d.ts +33 -0
  11. package/dist/commonjs/funcs/invoicesListInvoices.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/invoicesListInvoices.js +177 -0
  13. package/dist/commonjs/funcs/invoicesListInvoices.js.map +1 -0
  14. package/dist/commonjs/lib/config.d.ts +2 -2
  15. package/dist/commonjs/lib/config.js +2 -2
  16. package/dist/commonjs/models/components/expand.d.ts +1 -0
  17. package/dist/commonjs/models/components/expand.d.ts.map +1 -1
  18. package/dist/commonjs/models/components/expand.js +1 -0
  19. package/dist/commonjs/models/components/expand.js.map +1 -1
  20. package/dist/commonjs/models/components/index.d.ts +1 -0
  21. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  22. package/dist/commonjs/models/components/index.js +1 -0
  23. package/dist/commonjs/models/components/index.js.map +1 -1
  24. package/dist/commonjs/models/components/invoice.d.ts +1 -0
  25. package/dist/commonjs/models/components/invoice.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/invoice.js +1 -0
  27. package/dist/commonjs/models/components/invoice.js.map +1 -1
  28. package/dist/commonjs/models/components/invoicefinancialstatus.d.ts +10 -0
  29. package/dist/commonjs/models/components/invoicefinancialstatus.d.ts.map +1 -0
  30. package/dist/commonjs/models/components/invoicefinancialstatus.js +47 -0
  31. package/dist/commonjs/models/components/invoicefinancialstatus.js.map +1 -0
  32. package/dist/commonjs/models/components/supervisor.d.ts +2 -2
  33. package/dist/commonjs/models/components/supervisor.d.ts.map +1 -1
  34. package/dist/commonjs/models/components/supervisor.js +2 -2
  35. package/dist/commonjs/models/components/supervisor.js.map +1 -1
  36. package/dist/commonjs/models/components/vendor.d.ts +1 -1
  37. package/dist/commonjs/models/components/vendor.d.ts.map +1 -1
  38. package/dist/commonjs/models/components/vendor.js +1 -1
  39. package/dist/commonjs/models/components/vendor.js.map +1 -1
  40. package/dist/commonjs/models/operations/index.d.ts +1 -0
  41. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  42. package/dist/commonjs/models/operations/index.js +1 -0
  43. package/dist/commonjs/models/operations/index.js.map +1 -1
  44. package/dist/commonjs/models/operations/listalerts.d.ts +5 -0
  45. package/dist/commonjs/models/operations/listalerts.d.ts.map +1 -1
  46. package/dist/commonjs/models/operations/listalerts.js +2 -0
  47. package/dist/commonjs/models/operations/listalerts.js.map +1 -1
  48. package/dist/commonjs/models/operations/listinvoices.d.ts +92 -0
  49. package/dist/commonjs/models/operations/listinvoices.d.ts.map +1 -0
  50. package/dist/commonjs/models/operations/listinvoices.js +96 -0
  51. package/dist/commonjs/models/operations/listinvoices.js.map +1 -0
  52. package/dist/commonjs/models/operations/listvendorinvoices.d.ts +3 -17
  53. package/dist/commonjs/models/operations/listvendorinvoices.d.ts.map +1 -1
  54. package/dist/commonjs/models/operations/listvendorinvoices.js +3 -11
  55. package/dist/commonjs/models/operations/listvendorinvoices.js.map +1 -1
  56. package/dist/commonjs/models/operations/updateuseralerts.d.ts +7 -0
  57. package/dist/commonjs/models/operations/updateuseralerts.d.ts.map +1 -1
  58. package/dist/commonjs/models/operations/updateuseralerts.js +2 -0
  59. package/dist/commonjs/models/operations/updateuseralerts.js.map +1 -1
  60. package/dist/commonjs/react-query/alertsListAlerts.core.d.ts +2 -0
  61. package/dist/commonjs/react-query/alertsListAlerts.core.d.ts.map +1 -1
  62. package/dist/commonjs/react-query/alertsListAlerts.core.js +2 -0
  63. package/dist/commonjs/react-query/alertsListAlerts.core.js.map +1 -1
  64. package/dist/commonjs/react-query/alertsListAlerts.d.ts +2 -0
  65. package/dist/commonjs/react-query/alertsListAlerts.d.ts.map +1 -1
  66. package/dist/commonjs/react-query/alertsListAlerts.js.map +1 -1
  67. package/dist/commonjs/react-query/index.d.ts +1 -0
  68. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  69. package/dist/commonjs/react-query/index.js +1 -0
  70. package/dist/commonjs/react-query/index.js.map +1 -1
  71. package/dist/commonjs/react-query/invoicesListInvoices.core.d.ts +52 -0
  72. package/dist/commonjs/react-query/invoicesListInvoices.core.d.ts.map +1 -0
  73. package/dist/commonjs/react-query/invoicesListInvoices.core.js +107 -0
  74. package/dist/commonjs/react-query/invoicesListInvoices.core.js.map +1 -0
  75. package/dist/commonjs/react-query/invoicesListInvoices.d.ts +116 -0
  76. package/dist/commonjs/react-query/invoicesListInvoices.d.ts.map +1 -0
  77. package/dist/commonjs/react-query/invoicesListInvoices.js +148 -0
  78. package/dist/commonjs/react-query/invoicesListInvoices.js.map +1 -0
  79. package/dist/commonjs/react-query/vendorsListVendorInvoices.core.d.ts +2 -2
  80. package/dist/commonjs/react-query/vendorsListVendorInvoices.d.ts +2 -2
  81. package/dist/commonjs/sdk/invoices.d.ts +22 -0
  82. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  83. package/dist/commonjs/sdk/invoices.js +23 -0
  84. package/dist/commonjs/sdk/invoices.js.map +1 -1
  85. package/dist/esm/__tests__/invoices.test.js +32 -0
  86. package/dist/esm/__tests__/invoices.test.js.map +1 -1
  87. package/dist/esm/__tests__/webhooks.test.js +1 -1
  88. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  89. package/dist/esm/__tests__/zones.test.js +28 -4
  90. package/dist/esm/__tests__/zones.test.js.map +1 -1
  91. package/dist/esm/funcs/alertsListAlerts.js +5 -3
  92. package/dist/esm/funcs/alertsListAlerts.js.map +1 -1
  93. package/dist/esm/funcs/invoicesListInvoices.d.ts +33 -0
  94. package/dist/esm/funcs/invoicesListInvoices.d.ts.map +1 -0
  95. package/dist/esm/funcs/invoicesListInvoices.js +141 -0
  96. package/dist/esm/funcs/invoicesListInvoices.js.map +1 -0
  97. package/dist/esm/lib/config.d.ts +2 -2
  98. package/dist/esm/lib/config.js +2 -2
  99. package/dist/esm/models/components/expand.d.ts +1 -0
  100. package/dist/esm/models/components/expand.d.ts.map +1 -1
  101. package/dist/esm/models/components/expand.js +1 -0
  102. package/dist/esm/models/components/expand.js.map +1 -1
  103. package/dist/esm/models/components/index.d.ts +1 -0
  104. package/dist/esm/models/components/index.d.ts.map +1 -1
  105. package/dist/esm/models/components/index.js +1 -0
  106. package/dist/esm/models/components/index.js.map +1 -1
  107. package/dist/esm/models/components/invoice.d.ts +1 -0
  108. package/dist/esm/models/components/invoice.d.ts.map +1 -1
  109. package/dist/esm/models/components/invoice.js +1 -0
  110. package/dist/esm/models/components/invoice.js.map +1 -1
  111. package/dist/esm/models/components/invoicefinancialstatus.d.ts +10 -0
  112. package/dist/esm/models/components/invoicefinancialstatus.d.ts.map +1 -0
  113. package/dist/esm/models/components/invoicefinancialstatus.js +11 -0
  114. package/dist/esm/models/components/invoicefinancialstatus.js.map +1 -0
  115. package/dist/esm/models/components/supervisor.d.ts +2 -2
  116. package/dist/esm/models/components/supervisor.d.ts.map +1 -1
  117. package/dist/esm/models/components/supervisor.js +2 -2
  118. package/dist/esm/models/components/supervisor.js.map +1 -1
  119. package/dist/esm/models/components/vendor.d.ts +1 -1
  120. package/dist/esm/models/components/vendor.d.ts.map +1 -1
  121. package/dist/esm/models/components/vendor.js +1 -1
  122. package/dist/esm/models/components/vendor.js.map +1 -1
  123. package/dist/esm/models/operations/index.d.ts +1 -0
  124. package/dist/esm/models/operations/index.d.ts.map +1 -1
  125. package/dist/esm/models/operations/index.js +1 -0
  126. package/dist/esm/models/operations/index.js.map +1 -1
  127. package/dist/esm/models/operations/listalerts.d.ts +5 -0
  128. package/dist/esm/models/operations/listalerts.d.ts.map +1 -1
  129. package/dist/esm/models/operations/listalerts.js +2 -0
  130. package/dist/esm/models/operations/listalerts.js.map +1 -1
  131. package/dist/esm/models/operations/listinvoices.d.ts +92 -0
  132. package/dist/esm/models/operations/listinvoices.d.ts.map +1 -0
  133. package/dist/esm/models/operations/listinvoices.js +57 -0
  134. package/dist/esm/models/operations/listinvoices.js.map +1 -0
  135. package/dist/esm/models/operations/listvendorinvoices.d.ts +3 -17
  136. package/dist/esm/models/operations/listvendorinvoices.d.ts.map +1 -1
  137. package/dist/esm/models/operations/listvendorinvoices.js +2 -10
  138. package/dist/esm/models/operations/listvendorinvoices.js.map +1 -1
  139. package/dist/esm/models/operations/updateuseralerts.d.ts +7 -0
  140. package/dist/esm/models/operations/updateuseralerts.d.ts.map +1 -1
  141. package/dist/esm/models/operations/updateuseralerts.js +2 -0
  142. package/dist/esm/models/operations/updateuseralerts.js.map +1 -1
  143. package/dist/esm/react-query/alertsListAlerts.core.d.ts +2 -0
  144. package/dist/esm/react-query/alertsListAlerts.core.d.ts.map +1 -1
  145. package/dist/esm/react-query/alertsListAlerts.core.js +2 -0
  146. package/dist/esm/react-query/alertsListAlerts.core.js.map +1 -1
  147. package/dist/esm/react-query/alertsListAlerts.d.ts +2 -0
  148. package/dist/esm/react-query/alertsListAlerts.d.ts.map +1 -1
  149. package/dist/esm/react-query/alertsListAlerts.js.map +1 -1
  150. package/dist/esm/react-query/index.d.ts +1 -0
  151. package/dist/esm/react-query/index.d.ts.map +1 -1
  152. package/dist/esm/react-query/index.js +1 -0
  153. package/dist/esm/react-query/index.js.map +1 -1
  154. package/dist/esm/react-query/invoicesListInvoices.core.d.ts +52 -0
  155. package/dist/esm/react-query/invoicesListInvoices.core.d.ts.map +1 -0
  156. package/dist/esm/react-query/invoicesListInvoices.core.js +99 -0
  157. package/dist/esm/react-query/invoicesListInvoices.core.js.map +1 -0
  158. package/dist/esm/react-query/invoicesListInvoices.d.ts +116 -0
  159. package/dist/esm/react-query/invoicesListInvoices.d.ts.map +1 -0
  160. package/dist/esm/react-query/invoicesListInvoices.js +133 -0
  161. package/dist/esm/react-query/invoicesListInvoices.js.map +1 -0
  162. package/dist/esm/react-query/vendorsListVendorInvoices.core.d.ts +2 -2
  163. package/dist/esm/react-query/vendorsListVendorInvoices.d.ts +2 -2
  164. package/dist/esm/sdk/invoices.d.ts +22 -0
  165. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  166. package/dist/esm/sdk/invoices.js +23 -0
  167. package/dist/esm/sdk/invoices.js.map +1 -1
  168. package/examples/package-lock.json +1 -1
  169. package/jsr.json +1 -1
  170. package/package.json +1 -1
  171. package/src/__tests__/invoices.test.ts +35 -0
  172. package/src/__tests__/webhooks.test.ts +1 -1
  173. package/src/__tests__/zones.test.ts +28 -4
  174. package/src/funcs/alertsListAlerts.ts +12 -7
  175. package/src/funcs/invoicesListInvoices.ts +270 -0
  176. package/src/lib/config.ts +2 -2
  177. package/src/models/components/expand.ts +1 -0
  178. package/src/models/components/index.ts +1 -0
  179. package/src/models/components/invoice.ts +2 -0
  180. package/src/models/components/invoicefinancialstatus.ts +17 -0
  181. package/src/models/components/supervisor.ts +4 -4
  182. package/src/models/components/vendor.ts +2 -2
  183. package/src/models/operations/index.ts +1 -0
  184. package/src/models/operations/listalerts.ts +7 -0
  185. package/src/models/operations/listinvoices.ts +181 -0
  186. package/src/models/operations/listvendorinvoices.ts +5 -22
  187. package/src/models/operations/updateuseralerts.ts +9 -0
  188. package/src/react-query/alertsListAlerts.core.ts +4 -0
  189. package/src/react-query/alertsListAlerts.ts +2 -0
  190. package/src/react-query/index.ts +1 -0
  191. package/src/react-query/invoicesListInvoices.core.ts +214 -0
  192. package/src/react-query/invoicesListInvoices.ts +284 -0
  193. package/src/react-query/vendorsListVendorInvoices.core.ts +2 -2
  194. package/src/react-query/vendorsListVendorInvoices.ts +2 -2
  195. package/src/sdk/invoices.ts +31 -0
@@ -0,0 +1,270 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { dlv } from "../lib/dlv.js";
7
+ import { encodeFormQuery, queryJoin } 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 { GreenSecurityError } from "../models/errors/greensecurityerror.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 invoices
37
+ *
38
+ * @remarks
39
+ * List invoices. The result set is automatically scoped based on the authenticated user's role.
40
+ * API users may filter results by **only one** of the following query parameters:
41
+ * - vendor_id
42
+ * - company_id
43
+ * - facility_id
44
+ * - system_id
45
+ * Supplying more than one will return `400 Bad Request`.
46
+ * If none are provided, the request falls back to all authorized resources.
47
+ *
48
+ * Available `expand` scopes are:
49
+ * - invoice.line_items
50
+ * - invoice.invoice_transactions
51
+ * - invoice.representative
52
+ */
53
+ export function invoicesListInvoices(
54
+ client: GreenSecurityCore,
55
+ request: operations.ListInvoicesRequest,
56
+ options?: RequestOptions,
57
+ ): APIPromise<
58
+ PageIterator<
59
+ Result<
60
+ operations.ListInvoicesResponse,
61
+ | errors.ApiErrorResponse
62
+ | GreenSecurityError
63
+ | ResponseValidationError
64
+ | ConnectionError
65
+ | RequestAbortedError
66
+ | RequestTimeoutError
67
+ | InvalidRequestError
68
+ | UnexpectedClientError
69
+ | SDKValidationError
70
+ >,
71
+ { page: number }
72
+ >
73
+ > {
74
+ return new APIPromise($do(
75
+ client,
76
+ request,
77
+ options,
78
+ ));
79
+ }
80
+
81
+ async function $do(
82
+ client: GreenSecurityCore,
83
+ request: operations.ListInvoicesRequest,
84
+ options?: RequestOptions,
85
+ ): Promise<
86
+ [
87
+ PageIterator<
88
+ Result<
89
+ operations.ListInvoicesResponse,
90
+ | errors.ApiErrorResponse
91
+ | GreenSecurityError
92
+ | ResponseValidationError
93
+ | ConnectionError
94
+ | RequestAbortedError
95
+ | RequestTimeoutError
96
+ | InvalidRequestError
97
+ | UnexpectedClientError
98
+ | SDKValidationError
99
+ >,
100
+ { page: number }
101
+ >,
102
+ APICall,
103
+ ]
104
+ > {
105
+ const parsed = safeParse(
106
+ request,
107
+ (value) => operations.ListInvoicesRequest$outboundSchema.parse(value),
108
+ "Input validation failed",
109
+ );
110
+ if (!parsed.ok) {
111
+ return [haltIterator(parsed), { status: "invalid" }];
112
+ }
113
+ const payload = parsed.value;
114
+ const body = null;
115
+
116
+ const path = pathToFunc("/invoices")();
117
+
118
+ const query = queryJoin(
119
+ encodeFormQuery({
120
+ "expand": payload.expand,
121
+ }, { explode: false }),
122
+ encodeFormQuery({
123
+ "company_id": payload.company_id,
124
+ "desc": payload.desc,
125
+ "facility_id": payload.facility_id,
126
+ "invoice_financial_status": payload.invoice_financial_status,
127
+ "invoice_number": payload.invoice_number,
128
+ "items_per_page": payload.items_per_page,
129
+ "page": payload.page,
130
+ "representative": payload.representative,
131
+ "sort": payload.sort,
132
+ "system_id": payload.system_id,
133
+ "vendor_id": payload.vendor_id,
134
+ }),
135
+ );
136
+
137
+ const headers = new Headers(compactMap({
138
+ Accept: "application/json",
139
+ }));
140
+
141
+ const securityInput = await extractSecurity(client._options.security);
142
+ const requestSecurity = resolveGlobalSecurity(securityInput);
143
+
144
+ const context = {
145
+ options: client._options,
146
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
147
+ operationID: "listInvoices",
148
+ oAuth2Scopes: null,
149
+
150
+ resolvedSecurity: requestSecurity,
151
+
152
+ securitySource: client._options.security,
153
+ retryConfig: options?.retries
154
+ || client._options.retryConfig
155
+ || { strategy: "none" },
156
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
157
+ };
158
+
159
+ const requestRes = client._createRequest(context, {
160
+ security: requestSecurity,
161
+ method: "GET",
162
+ baseURL: options?.serverURL,
163
+ path: path,
164
+ headers: headers,
165
+ query: query,
166
+ body: body,
167
+ userAgent: client._options.userAgent,
168
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
169
+ }, options);
170
+ if (!requestRes.ok) {
171
+ return [haltIterator(requestRes), { status: "invalid" }];
172
+ }
173
+ const req = requestRes.value;
174
+
175
+ const doResult = await client._do(req, {
176
+ context,
177
+ errorCodes: ["400", "401", "403", "4XX", "500", "5XX"],
178
+ retryConfig: context.retryConfig,
179
+ retryCodes: context.retryCodes,
180
+ });
181
+ if (!doResult.ok) {
182
+ return [haltIterator(doResult), { status: "request-error", request: req }];
183
+ }
184
+ const response = doResult.value;
185
+
186
+ const responseFields = {
187
+ HttpMeta: { Response: response, Request: req },
188
+ };
189
+
190
+ const [result, raw] = await M.match<
191
+ operations.ListInvoicesResponse,
192
+ | errors.ApiErrorResponse
193
+ | GreenSecurityError
194
+ | ResponseValidationError
195
+ | ConnectionError
196
+ | RequestAbortedError
197
+ | RequestTimeoutError
198
+ | InvalidRequestError
199
+ | UnexpectedClientError
200
+ | SDKValidationError
201
+ >(
202
+ M.json(200, operations.ListInvoicesResponse$inboundSchema, {
203
+ key: "Result",
204
+ }),
205
+ M.jsonErr([400, 401, 403], errors.ApiErrorResponse$inboundSchema),
206
+ M.fail("4XX"),
207
+ M.fail([500, "5XX"]),
208
+ )(response, req, { extraFields: responseFields });
209
+ if (!result.ok) {
210
+ return [haltIterator(result), {
211
+ status: "complete",
212
+ request: req,
213
+ response,
214
+ }];
215
+ }
216
+
217
+ const nextFunc = (
218
+ responseData: unknown,
219
+ ): {
220
+ next: Paginator<
221
+ Result<
222
+ operations.ListInvoicesResponse,
223
+ | errors.ApiErrorResponse
224
+ | GreenSecurityError
225
+ | ResponseValidationError
226
+ | ConnectionError
227
+ | RequestAbortedError
228
+ | RequestTimeoutError
229
+ | InvalidRequestError
230
+ | UnexpectedClientError
231
+ | SDKValidationError
232
+ >
233
+ >;
234
+ "~next"?: { page: number };
235
+ } => {
236
+ const page = request?.page ?? 1;
237
+ const nextPage = page + 1;
238
+
239
+ if (!responseData) {
240
+ return { next: () => null };
241
+ }
242
+ const results = dlv(responseData, "items");
243
+ if (!Array.isArray(results) || !results.length) {
244
+ return { next: () => null };
245
+ }
246
+ const limit = request?.itemsPerPage ?? 0;
247
+ if (results.length < limit) {
248
+ return { next: () => null };
249
+ }
250
+
251
+ const nextVal = () =>
252
+ invoicesListInvoices(
253
+ client,
254
+ {
255
+ ...request,
256
+ page: nextPage,
257
+ },
258
+ options,
259
+ );
260
+
261
+ return { next: nextVal, "~next": { page: nextPage } };
262
+ };
263
+
264
+ const page = { ...result, ...nextFunc(raw) };
265
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
266
+ status: "complete",
267
+ request: req,
268
+ response,
269
+ }];
270
+ }
package/src/lib/config.ts CHANGED
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
82
  openapiDocVersion: "0.0.11",
83
- sdkVersion: "0.43.1-beta.38",
83
+ sdkVersion: "0.43.1-beta.42",
84
84
  genVersion: "2.794.1",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.43.1-beta.38 2.794.1 0.0.11 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.43.1-beta.42 2.794.1 0.0.11 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -52,6 +52,7 @@ export const Expand = {
52
52
  SupportArticleSupportCategory: "support_article.support_category",
53
53
  InvoiceLineItems: "invoice.line_items",
54
54
  InvoiceInvoiceTransactions: "invoice.invoice_transactions",
55
+ InvoiceRepresentative: "invoice.representative",
55
56
  VendorCredentialCredential: "vendor_credential.credential",
56
57
  VendorCredentialVendor: "vendor_credential.vendor",
57
58
  VendorCredentialInvoice: "vendor_credential.invoice",
@@ -34,6 +34,7 @@ export * from "./financialstatus.js";
34
34
  export * from "./imageset.js";
35
35
  export * from "./invitee.js";
36
36
  export * from "./invoice.js";
37
+ export * from "./invoicefinancialstatus.js";
37
38
  export * from "./invoiceitem.js";
38
39
  export * from "./invoicetransaction.js";
39
40
  export * from "./loginemailandpassword.js";
@@ -33,6 +33,7 @@ export type Invoice = {
33
33
  discount?: number | undefined;
34
34
  lines?: Array<InvoiceItem | null> | null | undefined;
35
35
  transactions?: Array<InvoiceTransaction> | null | undefined;
36
+ representative?: string | null | undefined;
36
37
  };
37
38
 
38
39
  /** @internal */
@@ -55,6 +56,7 @@ export const Invoice$inboundSchema: z.ZodType<Invoice, z.ZodTypeDef, unknown> =
55
56
  .optional(),
56
57
  transactions: z.nullable(z.array(InvoiceTransaction$inboundSchema))
57
58
  .optional(),
59
+ representative: z.nullable(types.string()).optional(),
58
60
  }).transform((v) => {
59
61
  return remap$(v, {
60
62
  "invoice_number": "invoiceNumber",
@@ -0,0 +1,17 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { ClosedEnum } from "../../types/enums.js";
7
+
8
+ export const InvoiceFinancialStatus = {
9
+ Paid: "paid",
10
+ Unpaid: "unpaid",
11
+ } as const;
12
+ export type InvoiceFinancialStatus = ClosedEnum<typeof InvoiceFinancialStatus>;
13
+
14
+ /** @internal */
15
+ export const InvoiceFinancialStatus$outboundSchema: z.ZodNativeEnum<
16
+ typeof InvoiceFinancialStatus
17
+ > = z.nativeEnum(InvoiceFinancialStatus);
@@ -13,7 +13,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
13
13
  */
14
14
  export type Supervisor = {
15
15
  name?: string | null | undefined;
16
- email?: any | undefined;
16
+ email?: string | null | undefined;
17
17
  phone?: string | null | undefined;
18
18
  };
19
19
 
@@ -24,13 +24,13 @@ export const Supervisor$inboundSchema: z.ZodType<
24
24
  unknown
25
25
  > = z.object({
26
26
  name: z.nullable(types.string()).optional(),
27
- email: types.optional(z.any()),
27
+ email: z.nullable(types.string()).optional(),
28
28
  phone: z.nullable(types.string()).optional(),
29
29
  });
30
30
  /** @internal */
31
31
  export type Supervisor$Outbound = {
32
32
  name?: string | null | undefined;
33
- email?: any | undefined;
33
+ email?: string | null | undefined;
34
34
  phone?: string | null | undefined;
35
35
  };
36
36
 
@@ -41,7 +41,7 @@ export const Supervisor$outboundSchema: z.ZodType<
41
41
  Supervisor
42
42
  > = z.object({
43
43
  name: z.nullable(z.string()).optional(),
44
- email: z.any().optional(),
44
+ email: z.nullable(z.string()).optional(),
45
45
  phone: z.nullable(z.string()).optional(),
46
46
  });
47
47
 
@@ -35,7 +35,7 @@ import { VendorType, VendorType$inboundSchema } from "./vendortype.js";
35
35
  export type One = {
36
36
  id?: number | undefined;
37
37
  firstName?: string | null | undefined;
38
- lastName?: any | undefined;
38
+ lastName?: string | null | undefined;
39
39
  email?: string | null | undefined;
40
40
  phone?: string | null | undefined;
41
41
  mobilePhone?: string | null | undefined;
@@ -188,7 +188,7 @@ export const One$inboundSchema: z.ZodType<One, z.ZodTypeDef, unknown> = z
188
188
  .object({
189
189
  id: types.optional(types.number()),
190
190
  first_name: z.nullable(types.string()).optional(),
191
- last_name: types.optional(z.any()),
191
+ last_name: z.nullable(types.string()).optional(),
192
192
  email: z.nullable(types.string()).optional(),
193
193
  phone: z.nullable(types.string()).optional(),
194
194
  mobile_phone: z.nullable(types.string()).optional(),
@@ -44,6 +44,7 @@ export * from "./getwebhookendpoint.js";
44
44
  export * from "./listalerts.js";
45
45
  export * from "./listallwebhookendpoints.js";
46
46
  export * from "./listfeed.js";
47
+ export * from "./listinvoices.js";
47
48
  export * from "./listlocations.js";
48
49
  export * from "./listoffhirconfigurations.js";
49
50
  export * from "./listorsearchcompanies.js";
@@ -26,6 +26,10 @@ export type ListAlertsRequest = {
26
26
  * Number of items to show in a given page
27
27
  */
28
28
  itemsPerPage?: number | undefined;
29
+ /**
30
+ * Either the ID of the user rep or the keyword "me" to represent the current user.
31
+ */
32
+ userIdOrMe?: string | undefined;
29
33
  };
30
34
 
31
35
  /**
@@ -49,6 +53,7 @@ export type ListAlertsRequest$Outbound = {
49
53
  desc?: components.Desc$Outbound | undefined;
50
54
  page?: number | undefined;
51
55
  items_per_page?: number | undefined;
56
+ user_id_or_me?: string | undefined;
52
57
  };
53
58
 
54
59
  /** @internal */
@@ -61,9 +66,11 @@ export const ListAlertsRequest$outboundSchema: z.ZodType<
61
66
  desc: components.Desc$outboundSchema.optional(),
62
67
  page: z.number().int().optional(),
63
68
  itemsPerPage: z.number().int().optional(),
69
+ userIdOrMe: z.string().optional(),
64
70
  }).transform((v) => {
65
71
  return remap$(v, {
66
72
  itemsPerPage: "items_per_page",
73
+ userIdOrMe: "user_id_or_me",
67
74
  });
68
75
  });
69
76
 
@@ -0,0 +1,181 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
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 * as types from "../../types/primitives.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type ListInvoicesRequest = {
14
+ /**
15
+ * A comma-separated list of object attributes to sort on.
16
+ */
17
+ sort?: string | null | undefined;
18
+ /**
19
+ * Sort desc
20
+ */
21
+ desc?: components.Desc | undefined;
22
+ /**
23
+ * A 1-based offset for which page to request (defaults to 1)
24
+ */
25
+ page?: number | undefined;
26
+ /**
27
+ * Number of items to show in a given page
28
+ */
29
+ itemsPerPage?: number | undefined;
30
+ /**
31
+ * An array-style parameter to identify which sections of an object to expand. See documentation for the endpoint for a list of valid expansion values.
32
+ */
33
+ expand?: Array<components.Expand> | undefined;
34
+ /**
35
+ * Filter invoices by invoice number (digits or digits-digits)
36
+ */
37
+ invoiceNumber?: string | undefined;
38
+ /**
39
+ * Filter invoices by financial status
40
+ */
41
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
42
+ /**
43
+ * Filter by the representative's name.
44
+ */
45
+ representative?: string | undefined;
46
+ /**
47
+ * Filter by a specific authorized vendor ID.
48
+ */
49
+ vendorId?: number | undefined;
50
+ /**
51
+ * Filter by a specific authorized company ID.
52
+ */
53
+ companyId?: number | undefined;
54
+ /**
55
+ * Filter by a specific authorized facility ID.
56
+ */
57
+ facilityId?: number | undefined;
58
+ /**
59
+ * Filter by a specific authorized system ID.
60
+ */
61
+ systemId?: number | undefined;
62
+ };
63
+
64
+ /**
65
+ * The request was successful, and the server has returned the requested resource.
66
+ */
67
+ export type ListInvoicesListCompanyManagerInvoicesOk = {
68
+ items: Array<components.Invoice | null>;
69
+ /**
70
+ * Pagination information for a pageable list
71
+ */
72
+ pager: components.Pager;
73
+ };
74
+
75
+ export type ListInvoicesResponse = {
76
+ result: ListInvoicesListCompanyManagerInvoicesOk;
77
+ };
78
+
79
+ /** @internal */
80
+ export type ListInvoicesRequest$Outbound = {
81
+ sort?: string | null | undefined;
82
+ desc?: components.Desc$Outbound | undefined;
83
+ page?: number | undefined;
84
+ items_per_page?: number | undefined;
85
+ expand?: Array<string> | undefined;
86
+ invoice_number?: string | undefined;
87
+ invoice_financial_status?: string | undefined;
88
+ representative?: string | undefined;
89
+ vendor_id?: number | undefined;
90
+ company_id?: number | undefined;
91
+ facility_id?: number | undefined;
92
+ system_id?: number | undefined;
93
+ };
94
+
95
+ /** @internal */
96
+ export const ListInvoicesRequest$outboundSchema: z.ZodType<
97
+ ListInvoicesRequest$Outbound,
98
+ z.ZodTypeDef,
99
+ ListInvoicesRequest
100
+ > = z.object({
101
+ sort: z.nullable(z.string()).optional(),
102
+ desc: components.Desc$outboundSchema.optional(),
103
+ page: z.number().int().optional(),
104
+ itemsPerPage: z.number().int().optional(),
105
+ expand: z.array(components.Expand$outboundSchema).optional(),
106
+ invoiceNumber: z.string().optional(),
107
+ invoiceFinancialStatus: components.InvoiceFinancialStatus$outboundSchema
108
+ .optional(),
109
+ representative: z.string().optional(),
110
+ vendorId: z.number().int().optional(),
111
+ companyId: z.number().int().optional(),
112
+ facilityId: z.number().int().optional(),
113
+ systemId: z.number().int().optional(),
114
+ }).transform((v) => {
115
+ return remap$(v, {
116
+ itemsPerPage: "items_per_page",
117
+ invoiceNumber: "invoice_number",
118
+ invoiceFinancialStatus: "invoice_financial_status",
119
+ vendorId: "vendor_id",
120
+ companyId: "company_id",
121
+ facilityId: "facility_id",
122
+ systemId: "system_id",
123
+ });
124
+ });
125
+
126
+ export function listInvoicesRequestToJSON(
127
+ listInvoicesRequest: ListInvoicesRequest,
128
+ ): string {
129
+ return JSON.stringify(
130
+ ListInvoicesRequest$outboundSchema.parse(listInvoicesRequest),
131
+ );
132
+ }
133
+
134
+ /** @internal */
135
+ export const ListInvoicesListCompanyManagerInvoicesOk$inboundSchema: z.ZodType<
136
+ ListInvoicesListCompanyManagerInvoicesOk,
137
+ z.ZodTypeDef,
138
+ unknown
139
+ > = z.object({
140
+ items: z.array(types.nullable(components.Invoice$inboundSchema)),
141
+ pager: components.Pager$inboundSchema,
142
+ });
143
+
144
+ export function listInvoicesListCompanyManagerInvoicesOkFromJSON(
145
+ jsonString: string,
146
+ ): SafeParseResult<
147
+ ListInvoicesListCompanyManagerInvoicesOk,
148
+ SDKValidationError
149
+ > {
150
+ return safeParse(
151
+ jsonString,
152
+ (x) =>
153
+ ListInvoicesListCompanyManagerInvoicesOk$inboundSchema.parse(
154
+ JSON.parse(x),
155
+ ),
156
+ `Failed to parse 'ListInvoicesListCompanyManagerInvoicesOk' from JSON`,
157
+ );
158
+ }
159
+
160
+ /** @internal */
161
+ export const ListInvoicesResponse$inboundSchema: z.ZodType<
162
+ ListInvoicesResponse,
163
+ z.ZodTypeDef,
164
+ unknown
165
+ > = z.object({
166
+ Result: z.lazy(() => ListInvoicesListCompanyManagerInvoicesOk$inboundSchema),
167
+ }).transform((v) => {
168
+ return remap$(v, {
169
+ "Result": "result",
170
+ });
171
+ });
172
+
173
+ export function listInvoicesResponseFromJSON(
174
+ jsonString: string,
175
+ ): SafeParseResult<ListInvoicesResponse, SDKValidationError> {
176
+ return safeParse(
177
+ jsonString,
178
+ (x) => ListInvoicesResponse$inboundSchema.parse(JSON.parse(x)),
179
+ `Failed to parse 'ListInvoicesResponse' from JSON`,
180
+ );
181
+ }
@@ -5,24 +5,11 @@
5
5
  import * as z from "zod/v3";
6
6
  import { remap as remap$ } from "../../lib/primitives.js";
7
7
  import { safeParse } from "../../lib/schemas.js";
8
- import { ClosedEnum } from "../../types/enums.js";
9
8
  import { Result as SafeParseResult } from "../../types/fp.js";
10
9
  import * as types from "../../types/primitives.js";
11
10
  import * as components from "../components/index.js";
12
11
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
13
12
 
14
- /**
15
- * Filter invoices by financial_status
16
- */
17
- export const InvoiceFinancialStatus = {
18
- Paid: "paid",
19
- Unpaid: "unpaid",
20
- } as const;
21
- /**
22
- * Filter invoices by financial_status
23
- */
24
- export type InvoiceFinancialStatus = ClosedEnum<typeof InvoiceFinancialStatus>;
25
-
26
13
  export type ListVendorInvoicesRequest = {
27
14
  /**
28
15
  * A comma-separated list of object attributes to sort on.
@@ -49,13 +36,13 @@ export type ListVendorInvoicesRequest = {
49
36
  */
50
37
  vendorIdOrMe: string;
51
38
  /**
52
- * Filter invoices by invoice number
39
+ * Filter invoices by invoice number (digits or digits-digits)
53
40
  */
54
41
  invoiceNumber?: string | undefined;
55
42
  /**
56
- * Filter invoices by financial_status
43
+ * Filter invoices by financial status
57
44
  */
58
- invoiceFinancialStatus?: InvoiceFinancialStatus | undefined;
45
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
59
46
  };
60
47
 
61
48
  /**
@@ -73,11 +60,6 @@ export type ListVendorInvoicesResponse = {
73
60
  result: ListVendorInvoicesListVendorInvoicesOk;
74
61
  };
75
62
 
76
- /** @internal */
77
- export const InvoiceFinancialStatus$outboundSchema: z.ZodNativeEnum<
78
- typeof InvoiceFinancialStatus
79
- > = z.nativeEnum(InvoiceFinancialStatus);
80
-
81
63
  /** @internal */
82
64
  export type ListVendorInvoicesRequest$Outbound = {
83
65
  sort?: string | null | undefined;
@@ -103,7 +85,8 @@ export const ListVendorInvoicesRequest$outboundSchema: z.ZodType<
103
85
  expand: z.array(components.Expand$outboundSchema).optional(),
104
86
  vendorIdOrMe: z.string(),
105
87
  invoiceNumber: z.string().optional(),
106
- invoiceFinancialStatus: InvoiceFinancialStatus$outboundSchema.optional(),
88
+ invoiceFinancialStatus: components.InvoiceFinancialStatus$outboundSchema
89
+ .optional(),
107
90
  }).transform((v) => {
108
91
  return remap$(v, {
109
92
  itemsPerPage: "items_per_page",