@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
@@ -11,6 +11,12 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
11
 
12
12
  export type UpdateUserAlertsRequestBody = {
13
13
  alertIds?: Array<number> | undefined;
14
+ /**
15
+ * The ID of the user to update alerts for. Only authorized API Users can specify a user other than themselves.
16
+ *
17
+ * @remarks
18
+ */
19
+ userId?: number | undefined;
14
20
  };
15
21
 
16
22
  /**
@@ -23,6 +29,7 @@ export type UpdateUserAlertsUpdateUserAlertsOk = {
23
29
  /** @internal */
24
30
  export type UpdateUserAlertsRequestBody$Outbound = {
25
31
  alert_ids?: Array<number> | undefined;
32
+ user_id?: number | undefined;
26
33
  };
27
34
 
28
35
  /** @internal */
@@ -32,9 +39,11 @@ export const UpdateUserAlertsRequestBody$outboundSchema: z.ZodType<
32
39
  UpdateUserAlertsRequestBody
33
40
  > = z.object({
34
41
  alertIds: z.array(z.number().int()).optional(),
42
+ userId: z.number().int().optional(),
35
43
  }).transform((v) => {
36
44
  return remap$(v, {
37
45
  alertIds: "alert_ids",
46
+ userId: "user_id",
38
47
  });
39
48
  });
40
49
 
@@ -77,6 +77,7 @@ export function buildAlertsListAlertsQuery(
77
77
  desc: request.desc,
78
78
  page: request.page,
79
79
  itemsPerPage: request.itemsPerPage,
80
+ userIdOrMe: request.userIdOrMe,
80
81
  }),
81
82
  queryFn: async function alertsListAlertsQueryFn(
82
83
  ctx,
@@ -117,6 +118,7 @@ export function buildAlertsListAlertsInfiniteQuery(
117
118
  desc: request.desc,
118
119
  page: request.page,
119
120
  itemsPerPage: request.itemsPerPage,
121
+ userIdOrMe: request.userIdOrMe,
120
122
  }),
121
123
  queryFn: async function alertsListAlertsQuery(
122
124
  ctx,
@@ -154,6 +156,7 @@ export function queryKeyAlertsListAlerts(
154
156
  desc?: components.Desc | undefined;
155
157
  page?: number | undefined;
156
158
  itemsPerPage?: number | undefined;
159
+ userIdOrMe?: string | undefined;
157
160
  },
158
161
  ): QueryKey {
159
162
  return ["@greensecurity/javascript-sdk", "alerts", "listAlerts", parameters];
@@ -165,6 +168,7 @@ export function queryKeyAlertsListAlertsInfinite(
165
168
  desc?: components.Desc | undefined;
166
169
  page?: number | undefined;
167
170
  itemsPerPage?: number | undefined;
171
+ userIdOrMe?: string | undefined;
168
172
  },
169
173
  ): QueryKey {
170
174
  return [
@@ -163,6 +163,7 @@ export function setAlertsListAlertsData(
163
163
  desc?: components.Desc | undefined;
164
164
  page?: number | undefined;
165
165
  itemsPerPage?: number | undefined;
166
+ userIdOrMe?: string | undefined;
166
167
  },
167
168
  ],
168
169
  data: AlertsListAlertsQueryData,
@@ -180,6 +181,7 @@ export function invalidateAlertsListAlerts(
180
181
  desc?: components.Desc | undefined;
181
182
  page?: number | undefined;
182
183
  itemsPerPage?: number | undefined;
184
+ userIdOrMe?: string | undefined;
183
185
  }]
184
186
  >,
185
187
  filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
@@ -27,6 +27,7 @@ export * from "./fhirConfigsGetFhirConfig.js";
27
27
  export * from "./fhirConfigsListOfFhirConfigurations.js";
28
28
  export * from "./fhirConfigsUpdateFhirConfigById.js";
29
29
  export * from "./invoicesCreateInvoice.js";
30
+ export * from "./invoicesListInvoices.js";
30
31
  export * from "./invoicesMakePayment.js";
31
32
  export * from "./invoicesUpdateInvoice.js";
32
33
  export * from "./mobileDevicesAddMobileDevice.js";
@@ -0,0 +1,214 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ QueryClient,
7
+ QueryFunctionContext,
8
+ QueryKey,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { invoicesListInvoices } from "../funcs/invoicesListInvoices.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as components from "../models/components/index.js";
15
+ import * as operations from "../models/operations/index.js";
16
+ import { unwrapAsync } from "../types/fp.js";
17
+ import { PageIterator, unwrapResultIterator } from "../types/operations.js";
18
+ import { pageIteratorToJSON } from "./_types.js";
19
+ export type InvoicesListInvoicesQueryData = operations.ListInvoicesResponse;
20
+
21
+ export type InvoicesListInvoicesInfiniteQueryData = PageIterator<
22
+ operations.ListInvoicesResponse,
23
+ { page: number }
24
+ >;
25
+
26
+ export type InvoicesListInvoicesPageParams = PageIterator<
27
+ operations.ListInvoicesResponse,
28
+ { page: number }
29
+ >["~next"];
30
+
31
+ export function prefetchInvoicesListInvoices(
32
+ queryClient: QueryClient,
33
+ client$: GreenSecurityCore,
34
+ request: operations.ListInvoicesRequest,
35
+ options?: RequestOptions,
36
+ ): Promise<void> {
37
+ return queryClient.prefetchQuery({
38
+ ...buildInvoicesListInvoicesQuery(
39
+ client$,
40
+ request,
41
+ options,
42
+ ),
43
+ });
44
+ }
45
+
46
+ export function prefetchInvoicesListInvoicesInfinite(
47
+ queryClient: QueryClient,
48
+ client$: GreenSecurityCore,
49
+ request: operations.ListInvoicesRequest,
50
+ options?: RequestOptions,
51
+ ): Promise<void> {
52
+ return queryClient.prefetchInfiniteQuery({
53
+ ...buildInvoicesListInvoicesInfiniteQuery(
54
+ client$,
55
+ request,
56
+ options,
57
+ ),
58
+ initialPageParam: undefined as InvoicesListInvoicesPageParams,
59
+ getNextPageParam: (previousPage: InvoicesListInvoicesInfiniteQueryData) =>
60
+ previousPage["~next"],
61
+ });
62
+ }
63
+
64
+ export function buildInvoicesListInvoicesQuery(
65
+ client$: GreenSecurityCore,
66
+ request: operations.ListInvoicesRequest,
67
+ options?: RequestOptions,
68
+ ): {
69
+ queryKey: QueryKey;
70
+ queryFn: (
71
+ context: QueryFunctionContext,
72
+ ) => Promise<InvoicesListInvoicesQueryData>;
73
+ } {
74
+ return {
75
+ queryKey: queryKeyInvoicesListInvoices({
76
+ sort: request.sort,
77
+ desc: request.desc,
78
+ page: request.page,
79
+ itemsPerPage: request.itemsPerPage,
80
+ expand: request.expand,
81
+ invoiceNumber: request.invoiceNumber,
82
+ invoiceFinancialStatus: request.invoiceFinancialStatus,
83
+ representative: request.representative,
84
+ vendorId: request.vendorId,
85
+ companyId: request.companyId,
86
+ facilityId: request.facilityId,
87
+ systemId: request.systemId,
88
+ }),
89
+ queryFn: async function invoicesListInvoicesQueryFn(
90
+ ctx,
91
+ ): Promise<InvoicesListInvoicesQueryData> {
92
+ const sig = combineSignals(
93
+ ctx.signal,
94
+ options?.signal,
95
+ options?.fetchOptions?.signal,
96
+ );
97
+ const mergedOptions = {
98
+ ...options?.fetchOptions,
99
+ ...options,
100
+ signal: sig,
101
+ };
102
+
103
+ return unwrapAsync(invoicesListInvoices(
104
+ client$,
105
+ request,
106
+ mergedOptions,
107
+ ));
108
+ },
109
+ };
110
+ }
111
+
112
+ export function buildInvoicesListInvoicesInfiniteQuery(
113
+ client$: GreenSecurityCore,
114
+ request: operations.ListInvoicesRequest,
115
+ options?: RequestOptions,
116
+ ): {
117
+ queryKey: QueryKey;
118
+ queryFn: (
119
+ context: QueryFunctionContext<QueryKey, InvoicesListInvoicesPageParams>,
120
+ ) => Promise<InvoicesListInvoicesInfiniteQueryData>;
121
+ } {
122
+ return {
123
+ queryKey: queryKeyInvoicesListInvoicesInfinite({
124
+ sort: request.sort,
125
+ desc: request.desc,
126
+ page: request.page,
127
+ itemsPerPage: request.itemsPerPage,
128
+ expand: request.expand,
129
+ invoiceNumber: request.invoiceNumber,
130
+ invoiceFinancialStatus: request.invoiceFinancialStatus,
131
+ representative: request.representative,
132
+ vendorId: request.vendorId,
133
+ companyId: request.companyId,
134
+ facilityId: request.facilityId,
135
+ systemId: request.systemId,
136
+ }),
137
+ queryFn: async function invoicesListInvoicesQuery(
138
+ ctx,
139
+ ): Promise<InvoicesListInvoicesInfiniteQueryData> {
140
+ const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
141
+ const mergedOptions = {
142
+ ...options,
143
+ fetchOptions: { ...options?.fetchOptions, signal: sig },
144
+ };
145
+
146
+ if (!ctx.pageParam) {
147
+ const pageResult = await unwrapResultIterator(invoicesListInvoices(
148
+ client$,
149
+ request,
150
+ mergedOptions,
151
+ ));
152
+ return pageIteratorToJSON(pageResult);
153
+ }
154
+ const pageResult = await unwrapResultIterator(invoicesListInvoices(
155
+ client$,
156
+ {
157
+ ...request,
158
+ page: ctx.pageParam.page,
159
+ },
160
+ mergedOptions,
161
+ ));
162
+ return pageIteratorToJSON(pageResult);
163
+ },
164
+ };
165
+ }
166
+
167
+ export function queryKeyInvoicesListInvoices(
168
+ parameters: {
169
+ sort?: string | null | undefined;
170
+ desc?: components.Desc | undefined;
171
+ page?: number | undefined;
172
+ itemsPerPage?: number | undefined;
173
+ expand?: Array<components.Expand> | undefined;
174
+ invoiceNumber?: string | undefined;
175
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
176
+ representative?: string | undefined;
177
+ vendorId?: number | undefined;
178
+ companyId?: number | undefined;
179
+ facilityId?: number | undefined;
180
+ systemId?: number | undefined;
181
+ },
182
+ ): QueryKey {
183
+ return [
184
+ "@greensecurity/javascript-sdk",
185
+ "invoices",
186
+ "listInvoices",
187
+ parameters,
188
+ ];
189
+ }
190
+
191
+ export function queryKeyInvoicesListInvoicesInfinite(
192
+ parameters: {
193
+ sort?: string | null | undefined;
194
+ desc?: components.Desc | undefined;
195
+ page?: number | undefined;
196
+ itemsPerPage?: number | undefined;
197
+ expand?: Array<components.Expand> | undefined;
198
+ invoiceNumber?: string | undefined;
199
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
200
+ representative?: string | undefined;
201
+ vendorId?: number | undefined;
202
+ companyId?: number | undefined;
203
+ facilityId?: number | undefined;
204
+ systemId?: number | undefined;
205
+ },
206
+ ): QueryKey {
207
+ return [
208
+ "@greensecurity/javascript-sdk",
209
+ "invoices",
210
+ "listInvoices",
211
+ "infinite",
212
+ parameters,
213
+ ];
214
+ }
@@ -0,0 +1,284 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ InfiniteData,
7
+ InvalidateQueryFilters,
8
+ QueryClient,
9
+ QueryKey,
10
+ useInfiniteQuery,
11
+ UseInfiniteQueryResult,
12
+ useQuery,
13
+ UseQueryResult,
14
+ useSuspenseInfiniteQuery,
15
+ UseSuspenseInfiniteQueryResult,
16
+ useSuspenseQuery,
17
+ UseSuspenseQueryResult,
18
+ } from "@tanstack/react-query";
19
+ import * as components from "../models/components/index.js";
20
+ import * as operations from "../models/operations/index.js";
21
+ import { useGreenSecurityContext } from "./_context.js";
22
+ import {
23
+ InfiniteQueryHookOptions,
24
+ QueryHookOptions,
25
+ SuspenseInfiniteQueryHookOptions,
26
+ SuspenseQueryHookOptions,
27
+ TupleToPrefixes,
28
+ } from "./_types.js";
29
+ import {
30
+ buildInvoicesListInvoicesInfiniteQuery,
31
+ buildInvoicesListInvoicesQuery,
32
+ InvoicesListInvoicesInfiniteQueryData,
33
+ InvoicesListInvoicesPageParams,
34
+ InvoicesListInvoicesQueryData,
35
+ prefetchInvoicesListInvoices,
36
+ prefetchInvoicesListInvoicesInfinite,
37
+ queryKeyInvoicesListInvoices,
38
+ queryKeyInvoicesListInvoicesInfinite,
39
+ } from "./invoicesListInvoices.core.js";
40
+ export {
41
+ buildInvoicesListInvoicesInfiniteQuery,
42
+ buildInvoicesListInvoicesQuery,
43
+ type InvoicesListInvoicesInfiniteQueryData,
44
+ type InvoicesListInvoicesPageParams,
45
+ type InvoicesListInvoicesQueryData,
46
+ prefetchInvoicesListInvoices,
47
+ prefetchInvoicesListInvoicesInfinite,
48
+ queryKeyInvoicesListInvoices,
49
+ queryKeyInvoicesListInvoicesInfinite,
50
+ };
51
+
52
+ /**
53
+ * List invoices
54
+ *
55
+ * @remarks
56
+ * List invoices. The result set is automatically scoped based on the authenticated user's role.
57
+ * API users may filter results by **only one** of the following query parameters:
58
+ * - vendor_id
59
+ * - company_id
60
+ * - facility_id
61
+ * - system_id
62
+ * Supplying more than one will return `400 Bad Request`.
63
+ * If none are provided, the request falls back to all authorized resources.
64
+ *
65
+ * Available `expand` scopes are:
66
+ * - invoice.line_items
67
+ * - invoice.invoice_transactions
68
+ * - invoice.representative
69
+ */
70
+ export function useInvoicesListInvoices(
71
+ request: operations.ListInvoicesRequest,
72
+ options?: QueryHookOptions<InvoicesListInvoicesQueryData>,
73
+ ): UseQueryResult<InvoicesListInvoicesQueryData, Error> {
74
+ const client = useGreenSecurityContext();
75
+ return useQuery({
76
+ ...buildInvoicesListInvoicesQuery(
77
+ client,
78
+ request,
79
+ options,
80
+ ),
81
+ ...options,
82
+ });
83
+ }
84
+
85
+ /**
86
+ * List invoices
87
+ *
88
+ * @remarks
89
+ * List invoices. The result set is automatically scoped based on the authenticated user's role.
90
+ * API users may filter results by **only one** of the following query parameters:
91
+ * - vendor_id
92
+ * - company_id
93
+ * - facility_id
94
+ * - system_id
95
+ * Supplying more than one will return `400 Bad Request`.
96
+ * If none are provided, the request falls back to all authorized resources.
97
+ *
98
+ * Available `expand` scopes are:
99
+ * - invoice.line_items
100
+ * - invoice.invoice_transactions
101
+ * - invoice.representative
102
+ */
103
+ export function useInvoicesListInvoicesSuspense(
104
+ request: operations.ListInvoicesRequest,
105
+ options?: SuspenseQueryHookOptions<InvoicesListInvoicesQueryData>,
106
+ ): UseSuspenseQueryResult<InvoicesListInvoicesQueryData, Error> {
107
+ const client = useGreenSecurityContext();
108
+ return useSuspenseQuery({
109
+ ...buildInvoicesListInvoicesQuery(
110
+ client,
111
+ request,
112
+ options,
113
+ ),
114
+ ...options,
115
+ });
116
+ }
117
+
118
+ /**
119
+ * List invoices
120
+ *
121
+ * @remarks
122
+ * List invoices. The result set is automatically scoped based on the authenticated user's role.
123
+ * API users may filter results by **only one** of the following query parameters:
124
+ * - vendor_id
125
+ * - company_id
126
+ * - facility_id
127
+ * - system_id
128
+ * Supplying more than one will return `400 Bad Request`.
129
+ * If none are provided, the request falls back to all authorized resources.
130
+ *
131
+ * Available `expand` scopes are:
132
+ * - invoice.line_items
133
+ * - invoice.invoice_transactions
134
+ * - invoice.representative
135
+ */
136
+ export function useInvoicesListInvoicesInfinite(
137
+ request: operations.ListInvoicesRequest,
138
+ options?: InfiniteQueryHookOptions<InvoicesListInvoicesInfiniteQueryData>,
139
+ ): UseInfiniteQueryResult<
140
+ InfiniteData<
141
+ InvoicesListInvoicesInfiniteQueryData,
142
+ InvoicesListInvoicesPageParams
143
+ >,
144
+ Error
145
+ > {
146
+ const client = useGreenSecurityContext();
147
+ return useInfiniteQuery<
148
+ InvoicesListInvoicesInfiniteQueryData,
149
+ Error,
150
+ InfiniteData<
151
+ InvoicesListInvoicesInfiniteQueryData,
152
+ InvoicesListInvoicesPageParams
153
+ >,
154
+ QueryKey,
155
+ InvoicesListInvoicesPageParams
156
+ >({
157
+ ...buildInvoicesListInvoicesInfiniteQuery(
158
+ client,
159
+ request,
160
+ options,
161
+ ),
162
+ initialPageParam: options?.initialPageParam,
163
+ getNextPageParam: (previousPage) => previousPage["~next"],
164
+ ...options,
165
+ });
166
+ }
167
+
168
+ /**
169
+ * List invoices
170
+ *
171
+ * @remarks
172
+ * List invoices. The result set is automatically scoped based on the authenticated user's role.
173
+ * API users may filter results by **only one** of the following query parameters:
174
+ * - vendor_id
175
+ * - company_id
176
+ * - facility_id
177
+ * - system_id
178
+ * Supplying more than one will return `400 Bad Request`.
179
+ * If none are provided, the request falls back to all authorized resources.
180
+ *
181
+ * Available `expand` scopes are:
182
+ * - invoice.line_items
183
+ * - invoice.invoice_transactions
184
+ * - invoice.representative
185
+ */
186
+ export function useInvoicesListInvoicesInfiniteSuspense(
187
+ request: operations.ListInvoicesRequest,
188
+ options?: SuspenseInfiniteQueryHookOptions<
189
+ InvoicesListInvoicesInfiniteQueryData
190
+ >,
191
+ ): UseSuspenseInfiniteQueryResult<
192
+ InfiniteData<
193
+ InvoicesListInvoicesInfiniteQueryData,
194
+ InvoicesListInvoicesPageParams
195
+ >,
196
+ Error
197
+ > {
198
+ const client = useGreenSecurityContext();
199
+ return useSuspenseInfiniteQuery<
200
+ InvoicesListInvoicesInfiniteQueryData,
201
+ Error,
202
+ InfiniteData<
203
+ InvoicesListInvoicesInfiniteQueryData,
204
+ InvoicesListInvoicesPageParams
205
+ >,
206
+ QueryKey,
207
+ InvoicesListInvoicesPageParams
208
+ >({
209
+ ...buildInvoicesListInvoicesInfiniteQuery(
210
+ client,
211
+ request,
212
+ options,
213
+ ),
214
+ initialPageParam: options?.initialPageParam,
215
+ getNextPageParam: (previousPage) => previousPage["~next"],
216
+ ...options,
217
+ });
218
+ }
219
+
220
+ export function setInvoicesListInvoicesData(
221
+ client: QueryClient,
222
+ queryKeyBase: [
223
+ parameters: {
224
+ sort?: string | null | undefined;
225
+ desc?: components.Desc | undefined;
226
+ page?: number | undefined;
227
+ itemsPerPage?: number | undefined;
228
+ expand?: Array<components.Expand> | undefined;
229
+ invoiceNumber?: string | undefined;
230
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
231
+ representative?: string | undefined;
232
+ vendorId?: number | undefined;
233
+ companyId?: number | undefined;
234
+ facilityId?: number | undefined;
235
+ systemId?: number | undefined;
236
+ },
237
+ ],
238
+ data: InvoicesListInvoicesQueryData,
239
+ ): InvoicesListInvoicesQueryData | undefined {
240
+ const key = queryKeyInvoicesListInvoices(...queryKeyBase);
241
+
242
+ return client.setQueryData<InvoicesListInvoicesQueryData>(key, data);
243
+ }
244
+
245
+ export function invalidateInvoicesListInvoices(
246
+ client: QueryClient,
247
+ queryKeyBase: TupleToPrefixes<
248
+ [parameters: {
249
+ sort?: string | null | undefined;
250
+ desc?: components.Desc | undefined;
251
+ page?: number | undefined;
252
+ itemsPerPage?: number | undefined;
253
+ expand?: Array<components.Expand> | undefined;
254
+ invoiceNumber?: string | undefined;
255
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
256
+ representative?: string | undefined;
257
+ vendorId?: number | undefined;
258
+ companyId?: number | undefined;
259
+ facilityId?: number | undefined;
260
+ systemId?: number | undefined;
261
+ }]
262
+ >,
263
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
264
+ ): Promise<void> {
265
+ return client.invalidateQueries({
266
+ ...filters,
267
+ queryKey: [
268
+ "@greensecurity/javascript-sdk",
269
+ "invoices",
270
+ "listInvoices",
271
+ ...queryKeyBase,
272
+ ],
273
+ });
274
+ }
275
+
276
+ export function invalidateAllInvoicesListInvoices(
277
+ client: QueryClient,
278
+ filters?: Omit<InvalidateQueryFilters, "queryKey" | "predicate" | "exact">,
279
+ ): Promise<void> {
280
+ return client.invalidateQueries({
281
+ ...filters,
282
+ queryKey: ["@greensecurity/javascript-sdk", "invoices", "listInvoices"],
283
+ });
284
+ }
@@ -168,7 +168,7 @@ export function queryKeyVendorsListVendorInvoices(
168
168
  itemsPerPage?: number | undefined;
169
169
  expand?: Array<components.Expand> | undefined;
170
170
  invoiceNumber?: string | undefined;
171
- invoiceFinancialStatus?: operations.InvoiceFinancialStatus | undefined;
171
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
172
172
  },
173
173
  ): QueryKey {
174
174
  return [
@@ -189,7 +189,7 @@ export function queryKeyVendorsListVendorInvoicesInfinite(
189
189
  itemsPerPage?: number | undefined;
190
190
  expand?: Array<components.Expand> | undefined;
191
191
  invoiceNumber?: string | undefined;
192
- invoiceFinancialStatus?: operations.InvoiceFinancialStatus | undefined;
192
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
193
193
  },
194
194
  ): QueryKey {
195
195
  return [
@@ -198,7 +198,7 @@ export function setVendorsListVendorInvoicesData(
198
198
  itemsPerPage?: number | undefined;
199
199
  expand?: Array<components.Expand> | undefined;
200
200
  invoiceNumber?: string | undefined;
201
- invoiceFinancialStatus?: operations.InvoiceFinancialStatus | undefined;
201
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
202
202
  },
203
203
  ],
204
204
  data: VendorsListVendorInvoicesQueryData,
@@ -220,7 +220,7 @@ export function invalidateVendorsListVendorInvoices(
220
220
  itemsPerPage?: number | undefined;
221
221
  expand?: Array<components.Expand> | undefined;
222
222
  invoiceNumber?: string | undefined;
223
- invoiceFinancialStatus?: operations.InvoiceFinancialStatus | undefined;
223
+ invoiceFinancialStatus?: components.InvoiceFinancialStatus | undefined;
224
224
  },
225
225
  ]
226
226
  >,
@@ -3,13 +3,44 @@
3
3
  */
4
4
 
5
5
  import { invoicesCreateInvoice } from "../funcs/invoicesCreateInvoice.js";
6
+ import { invoicesListInvoices } from "../funcs/invoicesListInvoices.js";
6
7
  import { invoicesMakePayment } from "../funcs/invoicesMakePayment.js";
7
8
  import { invoicesUpdateInvoice } from "../funcs/invoicesUpdateInvoice.js";
8
9
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
9
10
  import * as operations from "../models/operations/index.js";
10
11
  import { unwrapAsync } from "../types/fp.js";
12
+ import { PageIterator, unwrapResultIterator } from "../types/operations.js";
11
13
 
12
14
  export class Invoices extends ClientSDK {
15
+ /**
16
+ * List invoices
17
+ *
18
+ * @remarks
19
+ * List invoices. The result set is automatically scoped based on the authenticated user's role.
20
+ * API users may filter results by **only one** of the following query parameters:
21
+ * - vendor_id
22
+ * - company_id
23
+ * - facility_id
24
+ * - system_id
25
+ * Supplying more than one will return `400 Bad Request`.
26
+ * If none are provided, the request falls back to all authorized resources.
27
+ *
28
+ * Available `expand` scopes are:
29
+ * - invoice.line_items
30
+ * - invoice.invoice_transactions
31
+ * - invoice.representative
32
+ */
33
+ async listInvoices(
34
+ request: operations.ListInvoicesRequest,
35
+ options?: RequestOptions,
36
+ ): Promise<PageIterator<operations.ListInvoicesResponse, { page: number }>> {
37
+ return unwrapResultIterator(invoicesListInvoices(
38
+ this,
39
+ request,
40
+ options,
41
+ ));
42
+ }
43
+
13
44
  /**
14
45
  * Create invoice
15
46
  *