@greensecurity/javascript-sdk 0.35.27 → 0.35.37

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 (179) hide show
  1. package/README.md +9 -0
  2. package/bin/mcp-server.js +1495 -405
  3. package/bin/mcp-server.js.map +16 -7
  4. package/dist/commonjs/__tests__/invoices.test.js +33 -0
  5. package/dist/commonjs/__tests__/invoices.test.js.map +1 -1
  6. package/dist/commonjs/__tests__/vendors.test.js +15 -0
  7. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  8. package/dist/commonjs/__tests__/zones.test.js +33 -7
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/invoicesCreateInvoice.d.ts +26 -0
  11. package/dist/commonjs/funcs/invoicesCreateInvoice.d.ts.map +1 -0
  12. package/dist/commonjs/funcs/invoicesCreateInvoice.js +126 -0
  13. package/dist/commonjs/funcs/invoicesCreateInvoice.js.map +1 -0
  14. package/dist/commonjs/funcs/invoicesUpdateInvoice.d.ts +26 -0
  15. package/dist/commonjs/funcs/invoicesUpdateInvoice.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/invoicesUpdateInvoice.js +133 -0
  17. package/dist/commonjs/funcs/invoicesUpdateInvoice.js.map +1 -0
  18. package/dist/commonjs/funcs/vendorsAcceptVendorCredential.d.ts +17 -0
  19. package/dist/commonjs/funcs/vendorsAcceptVendorCredential.d.ts.map +1 -0
  20. package/dist/commonjs/funcs/vendorsAcceptVendorCredential.js +120 -0
  21. package/dist/commonjs/funcs/vendorsAcceptVendorCredential.js.map +1 -0
  22. package/dist/commonjs/lib/config.d.ts +2 -2
  23. package/dist/commonjs/lib/config.js +2 -2
  24. package/dist/commonjs/mcp-server/mcp-server.js +1 -1
  25. package/dist/commonjs/mcp-server/server.d.ts.map +1 -1
  26. package/dist/commonjs/mcp-server/server.js +7 -1
  27. package/dist/commonjs/mcp-server/server.js.map +1 -1
  28. package/dist/commonjs/mcp-server/tools/invoicesCreateInvoice.d.ts +8 -0
  29. package/dist/commonjs/mcp-server/tools/invoicesCreateInvoice.d.ts.map +1 -0
  30. package/dist/commonjs/mcp-server/tools/invoicesCreateInvoice.js +73 -0
  31. package/dist/commonjs/mcp-server/tools/invoicesCreateInvoice.js.map +1 -0
  32. package/dist/commonjs/mcp-server/tools/invoicesUpdateInvoice.d.ts +8 -0
  33. package/dist/commonjs/mcp-server/tools/invoicesUpdateInvoice.d.ts.map +1 -0
  34. package/dist/commonjs/mcp-server/tools/invoicesUpdateInvoice.js +73 -0
  35. package/dist/commonjs/mcp-server/tools/invoicesUpdateInvoice.js.map +1 -0
  36. package/dist/commonjs/mcp-server/tools/vendorsAcceptVendorCredential.d.ts +8 -0
  37. package/dist/commonjs/mcp-server/tools/vendorsAcceptVendorCredential.d.ts.map +1 -0
  38. package/dist/commonjs/mcp-server/tools/vendorsAcceptVendorCredential.js +64 -0
  39. package/dist/commonjs/mcp-server/tools/vendorsAcceptVendorCredential.js.map +1 -0
  40. package/dist/commonjs/models/operations/acceptvendorcredential.d.ts +32 -0
  41. package/dist/commonjs/models/operations/acceptvendorcredential.d.ts.map +1 -0
  42. package/dist/commonjs/models/operations/acceptvendorcredential.js +78 -0
  43. package/dist/commonjs/models/operations/acceptvendorcredential.js.map +1 -0
  44. package/dist/commonjs/models/operations/createinvoice.d.ts +441 -0
  45. package/dist/commonjs/models/operations/createinvoice.d.ts.map +1 -0
  46. package/dist/commonjs/models/operations/createinvoice.js +604 -0
  47. package/dist/commonjs/models/operations/createinvoice.js.map +1 -0
  48. package/dist/commonjs/models/operations/index.d.ts +3 -0
  49. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  50. package/dist/commonjs/models/operations/index.js +3 -0
  51. package/dist/commonjs/models/operations/index.js.map +1 -1
  52. package/dist/commonjs/models/operations/updateinvoice.d.ts +441 -0
  53. package/dist/commonjs/models/operations/updateinvoice.d.ts.map +1 -0
  54. package/dist/commonjs/models/operations/updateinvoice.js +623 -0
  55. package/dist/commonjs/models/operations/updateinvoice.js.map +1 -0
  56. package/dist/commonjs/react-query/index.d.ts +3 -0
  57. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  58. package/dist/commonjs/react-query/index.js +3 -0
  59. package/dist/commonjs/react-query/index.js.map +1 -1
  60. package/dist/commonjs/react-query/invoicesCreateInvoice.d.ts +32 -0
  61. package/dist/commonjs/react-query/invoicesCreateInvoice.d.ts.map +1 -0
  62. package/dist/commonjs/react-query/invoicesCreateInvoice.js +56 -0
  63. package/dist/commonjs/react-query/invoicesCreateInvoice.js.map +1 -0
  64. package/dist/commonjs/react-query/invoicesUpdateInvoice.d.ts +32 -0
  65. package/dist/commonjs/react-query/invoicesUpdateInvoice.d.ts.map +1 -0
  66. package/dist/commonjs/react-query/invoicesUpdateInvoice.js +56 -0
  67. package/dist/commonjs/react-query/invoicesUpdateInvoice.js.map +1 -0
  68. package/dist/commonjs/react-query/vendorsAcceptVendorCredential.d.ts +23 -0
  69. package/dist/commonjs/react-query/vendorsAcceptVendorCredential.d.ts.map +1 -0
  70. package/dist/commonjs/react-query/vendorsAcceptVendorCredential.js +47 -0
  71. package/dist/commonjs/react-query/vendorsAcceptVendorCredential.js.map +1 -0
  72. package/dist/commonjs/sdk/invoices.d.ts +32 -0
  73. package/dist/commonjs/sdk/invoices.d.ts.map +1 -1
  74. package/dist/commonjs/sdk/invoices.js +38 -0
  75. package/dist/commonjs/sdk/invoices.js.map +1 -1
  76. package/dist/commonjs/sdk/vendors.d.ts +7 -0
  77. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  78. package/dist/commonjs/sdk/vendors.js +10 -0
  79. package/dist/commonjs/sdk/vendors.js.map +1 -1
  80. package/dist/esm/__tests__/invoices.test.js +33 -0
  81. package/dist/esm/__tests__/invoices.test.js.map +1 -1
  82. package/dist/esm/__tests__/vendors.test.js +15 -0
  83. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  84. package/dist/esm/__tests__/zones.test.js +33 -7
  85. package/dist/esm/__tests__/zones.test.js.map +1 -1
  86. package/dist/esm/funcs/invoicesCreateInvoice.d.ts +26 -0
  87. package/dist/esm/funcs/invoicesCreateInvoice.d.ts.map +1 -0
  88. package/dist/esm/funcs/invoicesCreateInvoice.js +90 -0
  89. package/dist/esm/funcs/invoicesCreateInvoice.js.map +1 -0
  90. package/dist/esm/funcs/invoicesUpdateInvoice.d.ts +26 -0
  91. package/dist/esm/funcs/invoicesUpdateInvoice.d.ts.map +1 -0
  92. package/dist/esm/funcs/invoicesUpdateInvoice.js +97 -0
  93. package/dist/esm/funcs/invoicesUpdateInvoice.js.map +1 -0
  94. package/dist/esm/funcs/vendorsAcceptVendorCredential.d.ts +17 -0
  95. package/dist/esm/funcs/vendorsAcceptVendorCredential.d.ts.map +1 -0
  96. package/dist/esm/funcs/vendorsAcceptVendorCredential.js +84 -0
  97. package/dist/esm/funcs/vendorsAcceptVendorCredential.js.map +1 -0
  98. package/dist/esm/lib/config.d.ts +2 -2
  99. package/dist/esm/lib/config.js +2 -2
  100. package/dist/esm/mcp-server/mcp-server.js +1 -1
  101. package/dist/esm/mcp-server/server.d.ts.map +1 -1
  102. package/dist/esm/mcp-server/server.js +7 -1
  103. package/dist/esm/mcp-server/server.js.map +1 -1
  104. package/dist/esm/mcp-server/tools/invoicesCreateInvoice.d.ts +8 -0
  105. package/dist/esm/mcp-server/tools/invoicesCreateInvoice.d.ts.map +1 -0
  106. package/dist/esm/mcp-server/tools/invoicesCreateInvoice.js +37 -0
  107. package/dist/esm/mcp-server/tools/invoicesCreateInvoice.js.map +1 -0
  108. package/dist/esm/mcp-server/tools/invoicesUpdateInvoice.d.ts +8 -0
  109. package/dist/esm/mcp-server/tools/invoicesUpdateInvoice.d.ts.map +1 -0
  110. package/dist/esm/mcp-server/tools/invoicesUpdateInvoice.js +37 -0
  111. package/dist/esm/mcp-server/tools/invoicesUpdateInvoice.js.map +1 -0
  112. package/dist/esm/mcp-server/tools/vendorsAcceptVendorCredential.d.ts +8 -0
  113. package/dist/esm/mcp-server/tools/vendorsAcceptVendorCredential.d.ts.map +1 -0
  114. package/dist/esm/mcp-server/tools/vendorsAcceptVendorCredential.js +28 -0
  115. package/dist/esm/mcp-server/tools/vendorsAcceptVendorCredential.js.map +1 -0
  116. package/dist/esm/models/operations/acceptvendorcredential.d.ts +32 -0
  117. package/dist/esm/models/operations/acceptvendorcredential.d.ts.map +1 -0
  118. package/dist/esm/models/operations/acceptvendorcredential.js +40 -0
  119. package/dist/esm/models/operations/acceptvendorcredential.js.map +1 -0
  120. package/dist/esm/models/operations/createinvoice.d.ts +441 -0
  121. package/dist/esm/models/operations/createinvoice.d.ts.map +1 -0
  122. package/dist/esm/models/operations/createinvoice.js +548 -0
  123. package/dist/esm/models/operations/createinvoice.js.map +1 -0
  124. package/dist/esm/models/operations/index.d.ts +3 -0
  125. package/dist/esm/models/operations/index.d.ts.map +1 -1
  126. package/dist/esm/models/operations/index.js +3 -0
  127. package/dist/esm/models/operations/index.js.map +1 -1
  128. package/dist/esm/models/operations/updateinvoice.d.ts +441 -0
  129. package/dist/esm/models/operations/updateinvoice.d.ts.map +1 -0
  130. package/dist/esm/models/operations/updateinvoice.js +567 -0
  131. package/dist/esm/models/operations/updateinvoice.js.map +1 -0
  132. package/dist/esm/react-query/index.d.ts +3 -0
  133. package/dist/esm/react-query/index.d.ts.map +1 -1
  134. package/dist/esm/react-query/index.js +3 -0
  135. package/dist/esm/react-query/index.js.map +1 -1
  136. package/dist/esm/react-query/invoicesCreateInvoice.d.ts +32 -0
  137. package/dist/esm/react-query/invoicesCreateInvoice.d.ts.map +1 -0
  138. package/dist/esm/react-query/invoicesCreateInvoice.js +51 -0
  139. package/dist/esm/react-query/invoicesCreateInvoice.js.map +1 -0
  140. package/dist/esm/react-query/invoicesUpdateInvoice.d.ts +32 -0
  141. package/dist/esm/react-query/invoicesUpdateInvoice.d.ts.map +1 -0
  142. package/dist/esm/react-query/invoicesUpdateInvoice.js +51 -0
  143. package/dist/esm/react-query/invoicesUpdateInvoice.js.map +1 -0
  144. package/dist/esm/react-query/vendorsAcceptVendorCredential.d.ts +23 -0
  145. package/dist/esm/react-query/vendorsAcceptVendorCredential.d.ts.map +1 -0
  146. package/dist/esm/react-query/vendorsAcceptVendorCredential.js +42 -0
  147. package/dist/esm/react-query/vendorsAcceptVendorCredential.js.map +1 -0
  148. package/dist/esm/sdk/invoices.d.ts +32 -0
  149. package/dist/esm/sdk/invoices.d.ts.map +1 -1
  150. package/dist/esm/sdk/invoices.js +38 -0
  151. package/dist/esm/sdk/invoices.js.map +1 -1
  152. package/dist/esm/sdk/vendors.d.ts +7 -0
  153. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  154. package/dist/esm/sdk/vendors.js +10 -0
  155. package/dist/esm/sdk/vendors.js.map +1 -1
  156. package/jsr.json +1 -1
  157. package/package.json +1 -1
  158. package/src/__tests__/invoices.test.ts +39 -0
  159. package/src/__tests__/vendors.test.ts +18 -0
  160. package/src/__tests__/zones.test.ts +33 -7
  161. package/src/funcs/invoicesCreateInvoice.ts +174 -0
  162. package/src/funcs/invoicesUpdateInvoice.ts +182 -0
  163. package/src/funcs/vendorsAcceptVendorCredential.ts +176 -0
  164. package/src/lib/config.ts +2 -2
  165. package/src/mcp-server/mcp-server.ts +1 -1
  166. package/src/mcp-server/server.ts +7 -1
  167. package/src/mcp-server/tools/invoicesCreateInvoice.ts +46 -0
  168. package/src/mcp-server/tools/invoicesUpdateInvoice.ts +46 -0
  169. package/src/mcp-server/tools/vendorsAcceptVendorCredential.ts +37 -0
  170. package/src/models/operations/acceptvendorcredential.ts +80 -0
  171. package/src/models/operations/createinvoice.ts +980 -0
  172. package/src/models/operations/index.ts +3 -0
  173. package/src/models/operations/updateinvoice.ts +1090 -0
  174. package/src/react-query/index.ts +3 -0
  175. package/src/react-query/invoicesCreateInvoice.ts +98 -0
  176. package/src/react-query/invoicesUpdateInvoice.ts +97 -0
  177. package/src/react-query/vendorsAcceptVendorCredential.ts +88 -0
  178. package/src/sdk/invoices.ts +54 -0
  179. package/src/sdk/vendors.ts +18 -0
@@ -9,7 +9,9 @@ export * from "./companiesListOrSearchCompanies.js";
9
9
  export * from "./dataRequestsAddDataRequestFile.js";
10
10
  export * from "./dataRequestsDeleteDataRequestFile.js";
11
11
  export * from "./dataRequestsUpdateDataRequest.js";
12
+ export * from "./invoicesCreateInvoice.js";
12
13
  export * from "./invoicesMakePayment.js";
14
+ export * from "./invoicesUpdateInvoice.js";
13
15
  export * from "./organizationsGetFacility.js";
14
16
  export * from "./organizationsListOrSearchFacilities.js";
15
17
  export * from "./supportArticlesGetSupportArticle.js";
@@ -21,6 +23,7 @@ export * from "./usersMagiclink.js";
21
23
  export * from "./usersPassword.js";
22
24
  export * from "./usersPasswordResetRequest.js";
23
25
  export * from "./usersPostAuthenticate.js";
26
+ export * from "./vendorsAcceptVendorCredential.js";
24
27
  export * from "./vendorsAddVendorCredentialFile.js";
25
28
  export * from "./vendorsAddVendorManagedByCompany.js";
26
29
  export * from "./vendorScansVendorScanOut.js";
@@ -0,0 +1,98 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ MutationKey,
7
+ useMutation,
8
+ UseMutationResult,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { invoicesCreateInvoice } from "../funcs/invoicesCreateInvoice.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { unwrapAsync } from "../types/fp.js";
16
+ import { useGreenSecurityContext } from "./_context.js";
17
+ import { MutationHookOptions } from "./_types.js";
18
+
19
+ export type InvoicesCreateInvoiceMutationVariables = {
20
+ request: operations.CreateInvoiceRequestBody;
21
+ options?: RequestOptions;
22
+ };
23
+
24
+ export type InvoicesCreateInvoiceMutationData =
25
+ operations.CreateInvoiceResponseBody;
26
+
27
+ /**
28
+ * Create invoice
29
+ *
30
+ * @remarks
31
+ * It will create an invoice based on the lines passed as parameter.
32
+ * - Exactly one of vendor_id, company_id, facility_id, or system_id must be provided. - variant_id is required for the line - payment_handler_data must be set in the following format:
33
+ * 1. for the 'vendor credential' and 'expedited credential' payment_handlers this should be a JSON
34
+ * with a key 'vendor_credential_id' and value as integer
35
+ * 2. for the 'credentialing subscription' payment handler this should be a JSON
36
+ * with the following keys and values:
37
+ * - old_vendor_type_id: required, must be nil or integer
38
+ * - new_vendor_type_id: required, must be integer
39
+ * - old_facility_ids: required, must be an array of integers (can be empty)
40
+ * - new_facility_ids: required, must be array of integers
41
+ */
42
+ export function useInvoicesCreateInvoiceMutation(
43
+ options?: MutationHookOptions<
44
+ InvoicesCreateInvoiceMutationData,
45
+ Error,
46
+ InvoicesCreateInvoiceMutationVariables
47
+ >,
48
+ ): UseMutationResult<
49
+ InvoicesCreateInvoiceMutationData,
50
+ Error,
51
+ InvoicesCreateInvoiceMutationVariables
52
+ > {
53
+ const client = useGreenSecurityContext();
54
+ return useMutation({
55
+ ...buildInvoicesCreateInvoiceMutation(client, options),
56
+ ...options,
57
+ });
58
+ }
59
+
60
+ export function mutationKeyInvoicesCreateInvoice(): MutationKey {
61
+ return ["@greensecurity/javascript-sdk", "invoices", "createInvoice"];
62
+ }
63
+
64
+ export function buildInvoicesCreateInvoiceMutation(
65
+ client$: GreenSecurityCore,
66
+ hookOptions?: RequestOptions,
67
+ ): {
68
+ mutationKey: MutationKey;
69
+ mutationFn: (
70
+ variables: InvoicesCreateInvoiceMutationVariables,
71
+ ) => Promise<InvoicesCreateInvoiceMutationData>;
72
+ } {
73
+ return {
74
+ mutationKey: mutationKeyInvoicesCreateInvoice(),
75
+ mutationFn: function invoicesCreateInvoiceMutationFn({
76
+ request,
77
+ options,
78
+ }): Promise<InvoicesCreateInvoiceMutationData> {
79
+ const mergedOptions = {
80
+ ...hookOptions,
81
+ ...options,
82
+ fetchOptions: {
83
+ ...hookOptions?.fetchOptions,
84
+ ...options?.fetchOptions,
85
+ signal: combineSignals(
86
+ hookOptions?.fetchOptions?.signal,
87
+ options?.fetchOptions?.signal,
88
+ ),
89
+ },
90
+ };
91
+ return unwrapAsync(invoicesCreateInvoice(
92
+ client$,
93
+ request,
94
+ mergedOptions,
95
+ ));
96
+ },
97
+ };
98
+ }
@@ -0,0 +1,97 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ MutationKey,
7
+ useMutation,
8
+ UseMutationResult,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { invoicesUpdateInvoice } from "../funcs/invoicesUpdateInvoice.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { unwrapAsync } from "../types/fp.js";
16
+ import { useGreenSecurityContext } from "./_context.js";
17
+ import { MutationHookOptions } from "./_types.js";
18
+
19
+ export type InvoicesUpdateInvoiceMutationVariables = {
20
+ request: operations.UpdateInvoiceRequest;
21
+ options?: RequestOptions;
22
+ };
23
+
24
+ export type InvoicesUpdateInvoiceMutationData = boolean;
25
+
26
+ /**
27
+ * Update invoice
28
+ *
29
+ * @remarks
30
+ * It will replace all the lines with the lines passed as parameter
31
+ * - Exactly one of vendor_id, company_id, facility_id, or system_id must be provided. - variant_id is required for the line - payment_handler_data must be set in the following format:
32
+ * 1. for the 'vendor credential' and 'expedited credential' payment_handlers this should be a JSON
33
+ * with a key 'vendor_credential_id' and value as integer
34
+ * 2. for the 'credentialing subscription' payment handler this should be a JSON
35
+ * with the following keys and values:
36
+ * - old_vendor_type_id: required, must be nil or integer
37
+ * - new_vendor_type_id: required, must be integer
38
+ * - old_facility_ids: required, must be an array of integers (can be empty)
39
+ * - new_facility_ids: required, must be array of integers
40
+ */
41
+ export function useInvoicesUpdateInvoiceMutation(
42
+ options?: MutationHookOptions<
43
+ InvoicesUpdateInvoiceMutationData,
44
+ Error,
45
+ InvoicesUpdateInvoiceMutationVariables
46
+ >,
47
+ ): UseMutationResult<
48
+ InvoicesUpdateInvoiceMutationData,
49
+ Error,
50
+ InvoicesUpdateInvoiceMutationVariables
51
+ > {
52
+ const client = useGreenSecurityContext();
53
+ return useMutation({
54
+ ...buildInvoicesUpdateInvoiceMutation(client, options),
55
+ ...options,
56
+ });
57
+ }
58
+
59
+ export function mutationKeyInvoicesUpdateInvoice(): MutationKey {
60
+ return ["@greensecurity/javascript-sdk", "invoices", "updateInvoice"];
61
+ }
62
+
63
+ export function buildInvoicesUpdateInvoiceMutation(
64
+ client$: GreenSecurityCore,
65
+ hookOptions?: RequestOptions,
66
+ ): {
67
+ mutationKey: MutationKey;
68
+ mutationFn: (
69
+ variables: InvoicesUpdateInvoiceMutationVariables,
70
+ ) => Promise<InvoicesUpdateInvoiceMutationData>;
71
+ } {
72
+ return {
73
+ mutationKey: mutationKeyInvoicesUpdateInvoice(),
74
+ mutationFn: function invoicesUpdateInvoiceMutationFn({
75
+ request,
76
+ options,
77
+ }): Promise<InvoicesUpdateInvoiceMutationData> {
78
+ const mergedOptions = {
79
+ ...hookOptions,
80
+ ...options,
81
+ fetchOptions: {
82
+ ...hookOptions?.fetchOptions,
83
+ ...options?.fetchOptions,
84
+ signal: combineSignals(
85
+ hookOptions?.fetchOptions?.signal,
86
+ options?.fetchOptions?.signal,
87
+ ),
88
+ },
89
+ };
90
+ return unwrapAsync(invoicesUpdateInvoice(
91
+ client$,
92
+ request,
93
+ mergedOptions,
94
+ ));
95
+ },
96
+ };
97
+ }
@@ -0,0 +1,88 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import {
6
+ MutationKey,
7
+ useMutation,
8
+ UseMutationResult,
9
+ } from "@tanstack/react-query";
10
+ import { GreenSecurityCore } from "../core.js";
11
+ import { vendorsAcceptVendorCredential } from "../funcs/vendorsAcceptVendorCredential.js";
12
+ import { combineSignals } from "../lib/primitives.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import * as operations from "../models/operations/index.js";
15
+ import { unwrapAsync } from "../types/fp.js";
16
+ import { useGreenSecurityContext } from "./_context.js";
17
+ import { MutationHookOptions } from "./_types.js";
18
+
19
+ export type VendorsAcceptVendorCredentialMutationVariables = {
20
+ request: operations.AcceptVendorCredentialRequest;
21
+ options?: RequestOptions;
22
+ };
23
+
24
+ export type VendorsAcceptVendorCredentialMutationData = boolean;
25
+
26
+ /**
27
+ * Accept vendor credential
28
+ *
29
+ * @remarks
30
+ * It will accept vendor credential
31
+ */
32
+ export function useVendorsAcceptVendorCredentialMutation(
33
+ options?: MutationHookOptions<
34
+ VendorsAcceptVendorCredentialMutationData,
35
+ Error,
36
+ VendorsAcceptVendorCredentialMutationVariables
37
+ >,
38
+ ): UseMutationResult<
39
+ VendorsAcceptVendorCredentialMutationData,
40
+ Error,
41
+ VendorsAcceptVendorCredentialMutationVariables
42
+ > {
43
+ const client = useGreenSecurityContext();
44
+ return useMutation({
45
+ ...buildVendorsAcceptVendorCredentialMutation(client, options),
46
+ ...options,
47
+ });
48
+ }
49
+
50
+ export function mutationKeyVendorsAcceptVendorCredential(): MutationKey {
51
+ return ["@greensecurity/javascript-sdk", "vendors", "acceptVendorCredential"];
52
+ }
53
+
54
+ export function buildVendorsAcceptVendorCredentialMutation(
55
+ client$: GreenSecurityCore,
56
+ hookOptions?: RequestOptions,
57
+ ): {
58
+ mutationKey: MutationKey;
59
+ mutationFn: (
60
+ variables: VendorsAcceptVendorCredentialMutationVariables,
61
+ ) => Promise<VendorsAcceptVendorCredentialMutationData>;
62
+ } {
63
+ return {
64
+ mutationKey: mutationKeyVendorsAcceptVendorCredential(),
65
+ mutationFn: function vendorsAcceptVendorCredentialMutationFn({
66
+ request,
67
+ options,
68
+ }): Promise<VendorsAcceptVendorCredentialMutationData> {
69
+ const mergedOptions = {
70
+ ...hookOptions,
71
+ ...options,
72
+ fetchOptions: {
73
+ ...hookOptions?.fetchOptions,
74
+ ...options?.fetchOptions,
75
+ signal: combineSignals(
76
+ hookOptions?.fetchOptions?.signal,
77
+ options?.fetchOptions?.signal,
78
+ ),
79
+ },
80
+ };
81
+ return unwrapAsync(vendorsAcceptVendorCredential(
82
+ client$,
83
+ request,
84
+ mergedOptions,
85
+ ));
86
+ },
87
+ };
88
+ }
@@ -2,12 +2,66 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { invoicesCreateInvoice } from "../funcs/invoicesCreateInvoice.js";
5
6
  import { invoicesMakePayment } from "../funcs/invoicesMakePayment.js";
7
+ import { invoicesUpdateInvoice } from "../funcs/invoicesUpdateInvoice.js";
6
8
  import { ClientSDK, RequestOptions } from "../lib/sdks.js";
7
9
  import * as operations from "../models/operations/index.js";
8
10
  import { unwrapAsync } from "../types/fp.js";
9
11
 
10
12
  export class Invoices extends ClientSDK {
13
+ /**
14
+ * Create invoice
15
+ *
16
+ * @remarks
17
+ * It will create an invoice based on the lines passed as parameter.
18
+ * - Exactly one of vendor_id, company_id, facility_id, or system_id must be provided. - variant_id is required for the line - payment_handler_data must be set in the following format:
19
+ * 1. for the 'vendor credential' and 'expedited credential' payment_handlers this should be a JSON
20
+ * with a key 'vendor_credential_id' and value as integer
21
+ * 2. for the 'credentialing subscription' payment handler this should be a JSON
22
+ * with the following keys and values:
23
+ * - old_vendor_type_id: required, must be nil or integer
24
+ * - new_vendor_type_id: required, must be integer
25
+ * - old_facility_ids: required, must be an array of integers (can be empty)
26
+ * - new_facility_ids: required, must be array of integers
27
+ */
28
+ async createInvoice(
29
+ request: operations.CreateInvoiceRequestBody,
30
+ options?: RequestOptions,
31
+ ): Promise<operations.CreateInvoiceResponseBody> {
32
+ return unwrapAsync(invoicesCreateInvoice(
33
+ this,
34
+ request,
35
+ options,
36
+ ));
37
+ }
38
+
39
+ /**
40
+ * Update invoice
41
+ *
42
+ * @remarks
43
+ * It will replace all the lines with the lines passed as parameter
44
+ * - Exactly one of vendor_id, company_id, facility_id, or system_id must be provided. - variant_id is required for the line - payment_handler_data must be set in the following format:
45
+ * 1. for the 'vendor credential' and 'expedited credential' payment_handlers this should be a JSON
46
+ * with a key 'vendor_credential_id' and value as integer
47
+ * 2. for the 'credentialing subscription' payment handler this should be a JSON
48
+ * with the following keys and values:
49
+ * - old_vendor_type_id: required, must be nil or integer
50
+ * - new_vendor_type_id: required, must be integer
51
+ * - old_facility_ids: required, must be an array of integers (can be empty)
52
+ * - new_facility_ids: required, must be array of integers
53
+ */
54
+ async updateInvoice(
55
+ request: operations.UpdateInvoiceRequest,
56
+ options?: RequestOptions,
57
+ ): Promise<boolean> {
58
+ return unwrapAsync(invoicesUpdateInvoice(
59
+ this,
60
+ request,
61
+ options,
62
+ ));
63
+ }
64
+
11
65
  /**
12
66
  * Make payment for the invoice
13
67
  *
@@ -2,6 +2,7 @@
2
2
  * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
3
  */
4
4
 
5
+ import { vendorsAcceptVendorCredential } from "../funcs/vendorsAcceptVendorCredential.js";
5
6
  import { vendorsAddVendorCredentialFile } from "../funcs/vendorsAddVendorCredentialFile.js";
6
7
  import { vendorsAddVendorManagedByCompany } from "../funcs/vendorsAddVendorManagedByCompany.js";
7
8
  import { vendorsCheckDownloadCode } from "../funcs/vendorsCheckDownloadCode.js";
@@ -243,6 +244,23 @@ export class Vendors extends ClientSDK {
243
244
  ));
244
245
  }
245
246
 
247
+ /**
248
+ * Accept vendor credential
249
+ *
250
+ * @remarks
251
+ * It will accept vendor credential
252
+ */
253
+ async acceptVendorCredential(
254
+ request: operations.AcceptVendorCredentialRequest,
255
+ options?: RequestOptions,
256
+ ): Promise<boolean> {
257
+ return unwrapAsync(vendorsAcceptVendorCredential(
258
+ this,
259
+ request,
260
+ options,
261
+ ));
262
+ }
263
+
246
264
  /**
247
265
  * Check download code for vendor credential
248
266
  *