@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
@@ -0,0 +1,174 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { encodeJSON } from "../lib/encodings.js";
7
+ import * as M from "../lib/matchers.js";
8
+ import { compactMap } from "../lib/primitives.js";
9
+ import { safeParse } from "../lib/schemas.js";
10
+ import { RequestOptions } from "../lib/sdks.js";
11
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
12
+ import { pathToFunc } from "../lib/url.js";
13
+ import { APIError } from "../models/errors/apierror.js";
14
+ import {
15
+ ConnectionError,
16
+ InvalidRequestError,
17
+ RequestAbortedError,
18
+ RequestTimeoutError,
19
+ UnexpectedClientError,
20
+ } from "../models/errors/httpclienterrors.js";
21
+ import * as errors from "../models/errors/index.js";
22
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
23
+ import * as operations from "../models/operations/index.js";
24
+ import { APICall, APIPromise } from "../types/async.js";
25
+ import { Result } from "../types/fp.js";
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 invoicesCreateInvoice(
43
+ client: GreenSecurityCore,
44
+ request: operations.CreateInvoiceRequestBody,
45
+ options?: RequestOptions,
46
+ ): APIPromise<
47
+ Result<
48
+ operations.CreateInvoiceResponseBody,
49
+ | errors.ApiErrorResponse
50
+ | APIError
51
+ | SDKValidationError
52
+ | UnexpectedClientError
53
+ | InvalidRequestError
54
+ | RequestAbortedError
55
+ | RequestTimeoutError
56
+ | ConnectionError
57
+ >
58
+ > {
59
+ return new APIPromise($do(
60
+ client,
61
+ request,
62
+ options,
63
+ ));
64
+ }
65
+
66
+ async function $do(
67
+ client: GreenSecurityCore,
68
+ request: operations.CreateInvoiceRequestBody,
69
+ options?: RequestOptions,
70
+ ): Promise<
71
+ [
72
+ Result<
73
+ operations.CreateInvoiceResponseBody,
74
+ | errors.ApiErrorResponse
75
+ | APIError
76
+ | SDKValidationError
77
+ | UnexpectedClientError
78
+ | InvalidRequestError
79
+ | RequestAbortedError
80
+ | RequestTimeoutError
81
+ | ConnectionError
82
+ >,
83
+ APICall,
84
+ ]
85
+ > {
86
+ const parsed = safeParse(
87
+ request,
88
+ (value) => operations.CreateInvoiceRequestBody$outboundSchema.parse(value),
89
+ "Input validation failed",
90
+ );
91
+ if (!parsed.ok) {
92
+ return [parsed, { status: "invalid" }];
93
+ }
94
+ const payload = parsed.value;
95
+ const body = encodeJSON("body", payload, { explode: true });
96
+
97
+ const path = pathToFunc("/invoices")();
98
+
99
+ const headers = new Headers(compactMap({
100
+ "Content-Type": "application/json",
101
+ Accept: "application/json",
102
+ }));
103
+
104
+ const securityInput = await extractSecurity(client._options.security);
105
+ const requestSecurity = resolveGlobalSecurity(securityInput);
106
+
107
+ const context = {
108
+ options: client._options,
109
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
110
+ operationID: "createInvoice",
111
+ oAuth2Scopes: [],
112
+
113
+ resolvedSecurity: requestSecurity,
114
+
115
+ securitySource: client._options.security,
116
+ retryConfig: options?.retries
117
+ || client._options.retryConfig
118
+ || { strategy: "none" },
119
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
120
+ };
121
+
122
+ const requestRes = client._createRequest(context, {
123
+ security: requestSecurity,
124
+ method: "POST",
125
+ baseURL: options?.serverURL,
126
+ path: path,
127
+ headers: headers,
128
+ body: body,
129
+ userAgent: client._options.userAgent,
130
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
131
+ }, options);
132
+ if (!requestRes.ok) {
133
+ return [requestRes, { status: "invalid" }];
134
+ }
135
+ const req = requestRes.value;
136
+
137
+ const doResult = await client._do(req, {
138
+ context,
139
+ errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
140
+ retryConfig: context.retryConfig,
141
+ retryCodes: context.retryCodes,
142
+ });
143
+ if (!doResult.ok) {
144
+ return [doResult, { status: "request-error", request: req }];
145
+ }
146
+ const response = doResult.value;
147
+
148
+ const responseFields = {
149
+ HttpMeta: { Response: response, Request: req },
150
+ };
151
+
152
+ const [result] = await M.match<
153
+ operations.CreateInvoiceResponseBody,
154
+ | errors.ApiErrorResponse
155
+ | APIError
156
+ | SDKValidationError
157
+ | UnexpectedClientError
158
+ | InvalidRequestError
159
+ | RequestAbortedError
160
+ | RequestTimeoutError
161
+ | ConnectionError
162
+ >(
163
+ M.json(200, operations.CreateInvoiceResponseBody$inboundSchema),
164
+ M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
165
+ M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
166
+ M.fail("4XX"),
167
+ M.fail("5XX"),
168
+ )(response, { extraFields: responseFields });
169
+ if (!result.ok) {
170
+ return [result, { status: "complete", request: req, response }];
171
+ }
172
+
173
+ return [result, { status: "complete", request: req, response }];
174
+ }
@@ -0,0 +1,182 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { GreenSecurityCore } from "../core.js";
7
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { APIError } from "../models/errors/apierror.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 { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Update invoice
30
+ *
31
+ * @remarks
32
+ * It will replace all the lines with the lines passed as parameter
33
+ * - 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:
34
+ * 1. for the 'vendor credential' and 'expedited credential' payment_handlers this should be a JSON
35
+ * with a key 'vendor_credential_id' and value as integer
36
+ * 2. for the 'credentialing subscription' payment handler this should be a JSON
37
+ * with the following keys and values:
38
+ * - old_vendor_type_id: required, must be nil or integer
39
+ * - new_vendor_type_id: required, must be integer
40
+ * - old_facility_ids: required, must be an array of integers (can be empty)
41
+ * - new_facility_ids: required, must be array of integers
42
+ */
43
+ export function invoicesUpdateInvoice(
44
+ client: GreenSecurityCore,
45
+ request: operations.UpdateInvoiceRequest,
46
+ options?: RequestOptions,
47
+ ): APIPromise<
48
+ Result<
49
+ boolean,
50
+ | errors.ApiErrorResponse
51
+ | APIError
52
+ | SDKValidationError
53
+ | UnexpectedClientError
54
+ | InvalidRequestError
55
+ | RequestAbortedError
56
+ | RequestTimeoutError
57
+ | ConnectionError
58
+ >
59
+ > {
60
+ return new APIPromise($do(
61
+ client,
62
+ request,
63
+ options,
64
+ ));
65
+ }
66
+
67
+ async function $do(
68
+ client: GreenSecurityCore,
69
+ request: operations.UpdateInvoiceRequest,
70
+ options?: RequestOptions,
71
+ ): Promise<
72
+ [
73
+ Result<
74
+ boolean,
75
+ | errors.ApiErrorResponse
76
+ | APIError
77
+ | SDKValidationError
78
+ | UnexpectedClientError
79
+ | InvalidRequestError
80
+ | RequestAbortedError
81
+ | RequestTimeoutError
82
+ | ConnectionError
83
+ >,
84
+ APICall,
85
+ ]
86
+ > {
87
+ const parsed = safeParse(
88
+ request,
89
+ (value) => operations.UpdateInvoiceRequest$outboundSchema.parse(value),
90
+ "Input validation failed",
91
+ );
92
+ if (!parsed.ok) {
93
+ return [parsed, { status: "invalid" }];
94
+ }
95
+ const payload = parsed.value;
96
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
97
+
98
+ const pathParams = {
99
+ id: encodeSimple("id", payload.id, {
100
+ explode: false,
101
+ charEncoding: "percent",
102
+ }),
103
+ };
104
+
105
+ const path = pathToFunc("/invoices/{id}")(pathParams);
106
+
107
+ const headers = new Headers(compactMap({
108
+ "Content-Type": "application/json",
109
+ Accept: "application/json",
110
+ }));
111
+
112
+ const securityInput = await extractSecurity(client._options.security);
113
+ const requestSecurity = resolveGlobalSecurity(securityInput);
114
+
115
+ const context = {
116
+ options: client._options,
117
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
118
+ operationID: "updateInvoice",
119
+ oAuth2Scopes: [],
120
+
121
+ resolvedSecurity: requestSecurity,
122
+
123
+ securitySource: client._options.security,
124
+ retryConfig: options?.retries
125
+ || client._options.retryConfig
126
+ || { strategy: "none" },
127
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
128
+ };
129
+
130
+ const requestRes = client._createRequest(context, {
131
+ security: requestSecurity,
132
+ method: "PUT",
133
+ baseURL: options?.serverURL,
134
+ path: path,
135
+ headers: headers,
136
+ body: body,
137
+ userAgent: client._options.userAgent,
138
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
139
+ }, options);
140
+ if (!requestRes.ok) {
141
+ return [requestRes, { status: "invalid" }];
142
+ }
143
+ const req = requestRes.value;
144
+
145
+ const doResult = await client._do(req, {
146
+ context,
147
+ errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
148
+ retryConfig: context.retryConfig,
149
+ retryCodes: context.retryCodes,
150
+ });
151
+ if (!doResult.ok) {
152
+ return [doResult, { status: "request-error", request: req }];
153
+ }
154
+ const response = doResult.value;
155
+
156
+ const responseFields = {
157
+ HttpMeta: { Response: response, Request: req },
158
+ };
159
+
160
+ const [result] = await M.match<
161
+ boolean,
162
+ | errors.ApiErrorResponse
163
+ | APIError
164
+ | SDKValidationError
165
+ | UnexpectedClientError
166
+ | InvalidRequestError
167
+ | RequestAbortedError
168
+ | RequestTimeoutError
169
+ | ConnectionError
170
+ >(
171
+ M.json(200, z.boolean()),
172
+ M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
173
+ M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
174
+ M.fail("4XX"),
175
+ M.fail("5XX"),
176
+ )(response, { extraFields: responseFields });
177
+ if (!result.ok) {
178
+ return [result, { status: "complete", request: req, response }];
179
+ }
180
+
181
+ return [result, { status: "complete", request: req, response }];
182
+ }
@@ -0,0 +1,176 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod";
6
+ import { GreenSecurityCore } from "../core.js";
7
+ import { encodeSimple } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { APIError } from "../models/errors/apierror.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 { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
24
+ import * as operations from "../models/operations/index.js";
25
+ import { APICall, APIPromise } from "../types/async.js";
26
+ import { Result } from "../types/fp.js";
27
+
28
+ /**
29
+ * Accept vendor credential
30
+ *
31
+ * @remarks
32
+ * It will accept vendor credential
33
+ */
34
+ export function vendorsAcceptVendorCredential(
35
+ client: GreenSecurityCore,
36
+ request: operations.AcceptVendorCredentialRequest,
37
+ options?: RequestOptions,
38
+ ): APIPromise<
39
+ Result<
40
+ boolean,
41
+ | errors.ApiErrorResponse
42
+ | APIError
43
+ | SDKValidationError
44
+ | UnexpectedClientError
45
+ | InvalidRequestError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | ConnectionError
49
+ >
50
+ > {
51
+ return new APIPromise($do(
52
+ client,
53
+ request,
54
+ options,
55
+ ));
56
+ }
57
+
58
+ async function $do(
59
+ client: GreenSecurityCore,
60
+ request: operations.AcceptVendorCredentialRequest,
61
+ options?: RequestOptions,
62
+ ): Promise<
63
+ [
64
+ Result<
65
+ boolean,
66
+ | errors.ApiErrorResponse
67
+ | APIError
68
+ | SDKValidationError
69
+ | UnexpectedClientError
70
+ | InvalidRequestError
71
+ | RequestAbortedError
72
+ | RequestTimeoutError
73
+ | ConnectionError
74
+ >,
75
+ APICall,
76
+ ]
77
+ > {
78
+ const parsed = safeParse(
79
+ request,
80
+ (value) =>
81
+ operations.AcceptVendorCredentialRequest$outboundSchema.parse(value),
82
+ "Input validation failed",
83
+ );
84
+ if (!parsed.ok) {
85
+ return [parsed, { status: "invalid" }];
86
+ }
87
+ const payload = parsed.value;
88
+ const body = null;
89
+
90
+ const pathParams = {
91
+ vendor_credential_id: encodeSimple(
92
+ "vendor_credential_id",
93
+ payload.vendor_credential_id,
94
+ { explode: false, charEncoding: "percent" },
95
+ ),
96
+ };
97
+
98
+ const path = pathToFunc(
99
+ "/vendors/credentials/{vendor_credential_id}/acceptance",
100
+ )(pathParams);
101
+
102
+ const headers = new Headers(compactMap({
103
+ Accept: "application/json",
104
+ }));
105
+
106
+ const securityInput = await extractSecurity(client._options.security);
107
+ const requestSecurity = resolveGlobalSecurity(securityInput);
108
+
109
+ const context = {
110
+ options: client._options,
111
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
112
+ operationID: "acceptVendorCredential",
113
+ oAuth2Scopes: [],
114
+
115
+ resolvedSecurity: requestSecurity,
116
+
117
+ securitySource: client._options.security,
118
+ retryConfig: options?.retries
119
+ || client._options.retryConfig
120
+ || { strategy: "none" },
121
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
122
+ };
123
+
124
+ const requestRes = client._createRequest(context, {
125
+ security: requestSecurity,
126
+ method: "POST",
127
+ baseURL: options?.serverURL,
128
+ path: path,
129
+ headers: headers,
130
+ body: body,
131
+ userAgent: client._options.userAgent,
132
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
133
+ }, options);
134
+ if (!requestRes.ok) {
135
+ return [requestRes, { status: "invalid" }];
136
+ }
137
+ const req = requestRes.value;
138
+
139
+ const doResult = await client._do(req, {
140
+ context,
141
+ errorCodes: ["400", "401", "403", "404", "4XX", "500", "5XX"],
142
+ retryConfig: context.retryConfig,
143
+ retryCodes: context.retryCodes,
144
+ });
145
+ if (!doResult.ok) {
146
+ return [doResult, { status: "request-error", request: req }];
147
+ }
148
+ const response = doResult.value;
149
+
150
+ const responseFields = {
151
+ HttpMeta: { Response: response, Request: req },
152
+ };
153
+
154
+ const [result] = await M.match<
155
+ boolean,
156
+ | errors.ApiErrorResponse
157
+ | APIError
158
+ | SDKValidationError
159
+ | UnexpectedClientError
160
+ | InvalidRequestError
161
+ | RequestAbortedError
162
+ | RequestTimeoutError
163
+ | ConnectionError
164
+ >(
165
+ M.json(200, z.boolean()),
166
+ M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
167
+ M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
168
+ M.fail("4XX"),
169
+ M.fail("5XX"),
170
+ )(response, { extraFields: responseFields });
171
+ if (!result.ok) {
172
+ return [result, { status: "complete", request: req, response }];
173
+ }
174
+
175
+ return [result, { status: "complete", request: req, response }];
176
+ }
package/src/lib/config.ts CHANGED
@@ -76,8 +76,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
76
76
  export const SDK_METADATA = {
77
77
  language: "typescript",
78
78
  openapiDocVersion: "0.0.3",
79
- sdkVersion: "0.35.27",
79
+ sdkVersion: "0.35.37",
80
80
  genVersion: "2.620.2",
81
81
  userAgent:
82
- "speakeasy-sdk/typescript 0.35.27 2.620.2 0.0.3 @greensecurity/javascript-sdk",
82
+ "speakeasy-sdk/typescript 0.35.37 2.620.2 0.0.3 @greensecurity/javascript-sdk",
83
83
  } as const;
@@ -19,7 +19,7 @@ const routes = buildRouteMap({
19
19
  export const app = buildApplication(routes, {
20
20
  name: "mcp",
21
21
  versionInfo: {
22
- currentVersion: "0.35.27",
22
+ currentVersion: "0.35.37",
23
23
  },
24
24
  });
25
25
 
@@ -17,7 +17,9 @@ import { tool$companiesListOrSearchCompanies } from "./tools/companiesListOrSear
17
17
  import { tool$dataRequestsAddDataRequestFile } from "./tools/dataRequestsAddDataRequestFile.js";
18
18
  import { tool$dataRequestsDeleteDataRequestFile } from "./tools/dataRequestsDeleteDataRequestFile.js";
19
19
  import { tool$dataRequestsUpdateDataRequest } from "./tools/dataRequestsUpdateDataRequest.js";
20
+ import { tool$invoicesCreateInvoice } from "./tools/invoicesCreateInvoice.js";
20
21
  import { tool$invoicesMakePayment } from "./tools/invoicesMakePayment.js";
22
+ import { tool$invoicesUpdateInvoice } from "./tools/invoicesUpdateInvoice.js";
21
23
  import { tool$organizationsGetFacility } from "./tools/organizationsGetFacility.js";
22
24
  import { tool$organizationsListOrSearchFacilities } from "./tools/organizationsListOrSearchFacilities.js";
23
25
  import { tool$supportArticlesGetSupportArticle } from "./tools/supportArticlesGetSupportArticle.js";
@@ -29,6 +31,7 @@ import { tool$usersMagiclink } from "./tools/usersMagiclink.js";
29
31
  import { tool$usersPassword } from "./tools/usersPassword.js";
30
32
  import { tool$usersPasswordResetRequest } from "./tools/usersPasswordResetRequest.js";
31
33
  import { tool$usersPostAuthenticate } from "./tools/usersPostAuthenticate.js";
34
+ import { tool$vendorsAcceptVendorCredential } from "./tools/vendorsAcceptVendorCredential.js";
32
35
  import { tool$vendorsAddVendorCredentialFile } from "./tools/vendorsAddVendorCredentialFile.js";
33
36
  import { tool$vendorsAddVendorManagedByCompany } from "./tools/vendorsAddVendorManagedByCompany.js";
34
37
  import { tool$vendorScansVendorScanOut } from "./tools/vendorScansVendorScanOut.js";
@@ -83,7 +86,7 @@ export function createMCPServer(deps: {
83
86
  }) {
84
87
  const server = new McpServer({
85
88
  name: "GreenSecurity",
86
- version: "0.35.27",
89
+ version: "0.35.37",
87
90
  });
88
91
 
89
92
  const client = new GreenSecurityCore({
@@ -123,6 +126,7 @@ export function createMCPServer(deps: {
123
126
  tool(tool$vendorsDeleteVendorCredentialFile);
124
127
  tool(tool$vendorsGetVendorLegalName);
125
128
  tool(tool$vendorsDeclineVendorCredential);
129
+ tool(tool$vendorsAcceptVendorCredential);
126
130
  tool(tool$vendorsCheckDownloadCode);
127
131
  tool(tool$vendorsSendDownloadCode);
128
132
  tool(tool$vendorsListVendorCredentialFiles);
@@ -171,6 +175,8 @@ export function createMCPServer(deps: {
171
175
  tool(tool$dataRequestsAddDataRequestFile);
172
176
  tool(tool$dataRequestsDeleteDataRequestFile);
173
177
  tool(tool$dataRequestsUpdateDataRequest);
178
+ tool(tool$invoicesCreateInvoice);
179
+ tool(tool$invoicesUpdateInvoice);
174
180
  tool(tool$invoicesMakePayment);
175
181
 
176
182
  return server;
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { invoicesCreateInvoice } from "../../funcs/invoicesCreateInvoice.js";
6
+ import * as operations from "../../models/operations/index.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: operations.CreateInvoiceRequestBody$inboundSchema,
11
+ };
12
+
13
+ export const tool$invoicesCreateInvoice: ToolDefinition<typeof args> = {
14
+ name: "invoices-create-invoice",
15
+ description: `Create invoice
16
+
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
+ args,
28
+ tool: async (client, args, ctx) => {
29
+ const [result, apiCall] = await invoicesCreateInvoice(
30
+ client,
31
+ args.request,
32
+ { fetchOptions: { signal: ctx.signal } },
33
+ ).$inspect();
34
+
35
+ if (!result.ok) {
36
+ return {
37
+ content: [{ type: "text", text: result.error.message }],
38
+ isError: true,
39
+ };
40
+ }
41
+
42
+ const value = result.value;
43
+
44
+ return formatResult(value, apiCall);
45
+ },
46
+ };
@@ -0,0 +1,46 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { invoicesUpdateInvoice } from "../../funcs/invoicesUpdateInvoice.js";
6
+ import * as operations from "../../models/operations/index.js";
7
+ import { formatResult, ToolDefinition } from "../tools.js";
8
+
9
+ const args = {
10
+ request: operations.UpdateInvoiceRequest$inboundSchema,
11
+ };
12
+
13
+ export const tool$invoicesUpdateInvoice: ToolDefinition<typeof args> = {
14
+ name: "invoices-update-invoice",
15
+ description: `Update invoice
16
+
17
+ It will replace all the lines with 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
+ args,
28
+ tool: async (client, args, ctx) => {
29
+ const [result, apiCall] = await invoicesUpdateInvoice(
30
+ client,
31
+ args.request,
32
+ { fetchOptions: { signal: ctx.signal } },
33
+ ).$inspect();
34
+
35
+ if (!result.ok) {
36
+ return {
37
+ content: [{ type: "text", text: result.error.message }],
38
+ isError: true,
39
+ };
40
+ }
41
+
42
+ const value = result.value;
43
+
44
+ return formatResult(value, apiCall);
45
+ },
46
+ };