@greensecurity/javascript-sdk 0.16.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (159) hide show
  1. package/REACT_QUERY.md +68 -30
  2. package/README.md +43 -0
  3. package/bin/mcp-server.js +694 -51
  4. package/bin/mcp-server.js.map +28 -19
  5. package/funcs/organizationsListOrSearchFacilities.d.ts +4 -1
  6. package/funcs/organizationsListOrSearchFacilities.d.ts.map +1 -1
  7. package/funcs/organizationsListOrSearchFacilities.js +46 -9
  8. package/funcs/organizationsListOrSearchFacilities.js.map +1 -1
  9. package/funcs/supportArticlesGetSupportArticle.js +1 -1
  10. package/funcs/supportArticlesGetSupportArticle.js.map +1 -1
  11. package/funcs/supportArticlesListOrSearchSupportArticles.d.ts +4 -1
  12. package/funcs/supportArticlesListOrSearchSupportArticles.d.ts.map +1 -1
  13. package/funcs/supportArticlesListOrSearchSupportArticles.js +42 -7
  14. package/funcs/supportArticlesListOrSearchSupportArticles.js.map +1 -1
  15. package/funcs/vendorsExpediteTimeRemaining.d.ts +17 -0
  16. package/funcs/vendorsExpediteTimeRemaining.d.ts.map +1 -0
  17. package/funcs/vendorsExpediteTimeRemaining.js +120 -0
  18. package/funcs/vendorsExpediteTimeRemaining.js.map +1 -0
  19. package/funcs/vendorsListVendorInvoices.d.ts +24 -0
  20. package/funcs/vendorsListVendorInvoices.d.ts.map +1 -0
  21. package/funcs/vendorsListVendorInvoices.js +166 -0
  22. package/funcs/vendorsListVendorInvoices.js.map +1 -0
  23. package/funcs/vendorsListVendorJobTitles.d.ts +4 -1
  24. package/funcs/vendorsListVendorJobTitles.d.ts.map +1 -1
  25. package/funcs/vendorsListVendorJobTitles.js +39 -6
  26. package/funcs/vendorsListVendorJobTitles.js.map +1 -1
  27. package/jsr.json +1 -1
  28. package/lib/config.d.ts +2 -2
  29. package/lib/config.js +2 -2
  30. package/mcp-server/mcp-server.js +1 -1
  31. package/mcp-server/server.d.ts.map +1 -1
  32. package/mcp-server/server.js +5 -1
  33. package/mcp-server/server.js.map +1 -1
  34. package/mcp-server/tools/organizationsListOrSearchFacilities.js +1 -1
  35. package/mcp-server/tools/organizationsListOrSearchFacilities.js.map +1 -1
  36. package/mcp-server/tools/supportArticlesListOrSearchSupportArticles.js +1 -1
  37. package/mcp-server/tools/supportArticlesListOrSearchSupportArticles.js.map +1 -1
  38. package/mcp-server/tools/vendorsExpediteTimeRemaining.d.ts +8 -0
  39. package/mcp-server/tools/vendorsExpediteTimeRemaining.d.ts.map +1 -0
  40. package/mcp-server/tools/vendorsExpediteTimeRemaining.js +64 -0
  41. package/mcp-server/tools/vendorsExpediteTimeRemaining.js.map +1 -0
  42. package/mcp-server/tools/vendorsListVendorInvoices.d.ts +8 -0
  43. package/mcp-server/tools/vendorsListVendorInvoices.d.ts.map +1 -0
  44. package/mcp-server/tools/vendorsListVendorInvoices.js +68 -0
  45. package/mcp-server/tools/vendorsListVendorInvoices.js.map +1 -0
  46. package/mcp-server/tools/vendorsListVendorJobTitles.js +1 -1
  47. package/mcp-server/tools/vendorsListVendorJobTitles.js.map +1 -1
  48. package/models/components/expand.d.ts +3 -0
  49. package/models/components/expand.d.ts.map +1 -1
  50. package/models/components/expand.js +1 -0
  51. package/models/components/expand.js.map +1 -1
  52. package/models/components/index.d.ts +2 -0
  53. package/models/components/index.d.ts.map +1 -1
  54. package/models/components/index.js +2 -0
  55. package/models/components/index.js.map +1 -1
  56. package/models/components/invoice.d.ts +43 -0
  57. package/models/components/invoice.d.ts.map +1 -0
  58. package/models/components/invoice.js +91 -0
  59. package/models/components/invoice.js.map +1 -0
  60. package/models/components/invoiceitem.d.ts +40 -0
  61. package/models/components/invoiceitem.d.ts.map +1 -0
  62. package/models/components/invoiceitem.js +94 -0
  63. package/models/components/invoiceitem.js.map +1 -0
  64. package/models/operations/expeditetimeremaining.d.ts +60 -0
  65. package/models/operations/expeditetimeremaining.d.ts.map +1 -0
  66. package/models/operations/expeditetimeremaining.js +113 -0
  67. package/models/operations/expeditetimeremaining.js.map +1 -0
  68. package/models/operations/index.d.ts +2 -0
  69. package/models/operations/index.d.ts.map +1 -1
  70. package/models/operations/index.js +2 -0
  71. package/models/operations/index.js.map +1 -1
  72. package/models/operations/listorsearchfacilities.d.ts +25 -0
  73. package/models/operations/listorsearchfacilities.d.ts.map +1 -1
  74. package/models/operations/listorsearchfacilities.js +36 -1
  75. package/models/operations/listorsearchfacilities.js.map +1 -1
  76. package/models/operations/listorsearchsupportarticles.d.ts +25 -0
  77. package/models/operations/listorsearchsupportarticles.d.ts.map +1 -1
  78. package/models/operations/listorsearchsupportarticles.js +36 -1
  79. package/models/operations/listorsearchsupportarticles.js.map +1 -1
  80. package/models/operations/listvendorinvoices.d.ts +116 -0
  81. package/models/operations/listvendorinvoices.d.ts.map +1 -0
  82. package/models/operations/listvendorinvoices.js +155 -0
  83. package/models/operations/listvendorinvoices.js.map +1 -0
  84. package/models/operations/listvendorjobtitles.d.ts +25 -0
  85. package/models/operations/listvendorjobtitles.d.ts.map +1 -1
  86. package/models/operations/listvendorjobtitles.js +36 -1
  87. package/models/operations/listvendorjobtitles.js.map +1 -1
  88. package/package.json +1 -1
  89. package/react-query/index.d.ts +2 -0
  90. package/react-query/index.d.ts.map +1 -1
  91. package/react-query/index.js +2 -0
  92. package/react-query/index.js.map +1 -1
  93. package/react-query/organizationsListOrSearchFacilities.d.ts +54 -3
  94. package/react-query/organizationsListOrSearchFacilities.d.ts.map +1 -1
  95. package/react-query/organizationsListOrSearchFacilities.js +89 -0
  96. package/react-query/organizationsListOrSearchFacilities.js.map +1 -1
  97. package/react-query/supportArticlesListOrSearchSupportArticles.d.ts +28 -3
  98. package/react-query/supportArticlesListOrSearchSupportArticles.d.ts.map +1 -1
  99. package/react-query/supportArticlesListOrSearchSupportArticles.js +58 -0
  100. package/react-query/supportArticlesListOrSearchSupportArticles.js.map +1 -1
  101. package/react-query/vendorsExpediteTimeRemaining.d.ts +30 -0
  102. package/react-query/vendorsExpediteTimeRemaining.d.ts.map +1 -0
  103. package/react-query/vendorsExpediteTimeRemaining.js +96 -0
  104. package/react-query/vendorsExpediteTimeRemaining.js.map +1 -0
  105. package/react-query/vendorsListVendorInvoices.d.ts +96 -0
  106. package/react-query/vendorsListVendorInvoices.d.ts.map +1 -0
  107. package/react-query/vendorsListVendorInvoices.js +178 -0
  108. package/react-query/vendorsListVendorInvoices.js.map +1 -0
  109. package/react-query/vendorsListVendorJobTitles.d.ts +28 -3
  110. package/react-query/vendorsListVendorJobTitles.d.ts.map +1 -1
  111. package/react-query/vendorsListVendorJobTitles.js +59 -0
  112. package/react-query/vendorsListVendorJobTitles.js.map +1 -1
  113. package/sdk/organizations.d.ts +4 -1
  114. package/sdk/organizations.d.ts.map +1 -1
  115. package/sdk/organizations.js +2 -1
  116. package/sdk/organizations.js.map +1 -1
  117. package/sdk/supportarticles.d.ts +4 -1
  118. package/sdk/supportarticles.d.ts.map +1 -1
  119. package/sdk/supportarticles.js +2 -1
  120. package/sdk/supportarticles.js.map +1 -1
  121. package/sdk/vendors.d.ts +24 -1
  122. package/sdk/vendors.d.ts.map +1 -1
  123. package/sdk/vendors.js +26 -1
  124. package/sdk/vendors.js.map +1 -1
  125. package/src/__tests__/supportarticles.test.ts +2 -1
  126. package/src/__tests__/vendors.test.ts +58 -1
  127. package/src/funcs/organizationsListOrSearchFacilities.ts +116 -42
  128. package/src/funcs/supportArticlesGetSupportArticle.ts +1 -1
  129. package/src/funcs/supportArticlesListOrSearchSupportArticles.ts +100 -31
  130. package/src/funcs/vendorsExpediteTimeRemaining.ts +171 -0
  131. package/src/funcs/vendorsListVendorInvoices.ts +255 -0
  132. package/src/funcs/vendorsListVendorJobTitles.ts +101 -33
  133. package/src/lib/config.ts +2 -2
  134. package/src/mcp-server/mcp-server.ts +1 -1
  135. package/src/mcp-server/server.ts +5 -1
  136. package/src/mcp-server/tools/organizationsListOrSearchFacilities.ts +1 -1
  137. package/src/mcp-server/tools/supportArticlesListOrSearchSupportArticles.ts +1 -1
  138. package/src/mcp-server/tools/vendorsExpediteTimeRemaining.ts +37 -0
  139. package/src/mcp-server/tools/vendorsListVendorInvoices.ts +41 -0
  140. package/src/mcp-server/tools/vendorsListVendorJobTitles.ts +1 -1
  141. package/src/models/components/expand.ts +1 -0
  142. package/src/models/components/index.ts +2 -0
  143. package/src/models/components/invoice.ts +99 -0
  144. package/src/models/components/invoiceitem.ts +98 -0
  145. package/src/models/operations/expeditetimeremaining.ts +152 -0
  146. package/src/models/operations/index.ts +2 -0
  147. package/src/models/operations/listorsearchfacilities.ts +72 -0
  148. package/src/models/operations/listorsearchsupportarticles.ts +75 -0
  149. package/src/models/operations/listvendorinvoices.ts +252 -0
  150. package/src/models/operations/listvendorjobtitles.ts +68 -0
  151. package/src/react-query/index.ts +2 -0
  152. package/src/react-query/organizationsListOrSearchFacilities.ts +179 -1
  153. package/src/react-query/supportArticlesListOrSearchSupportArticles.ts +149 -1
  154. package/src/react-query/vendorsExpediteTimeRemaining.ts +165 -0
  155. package/src/react-query/vendorsListVendorInvoices.ts +364 -0
  156. package/src/react-query/vendorsListVendorJobTitles.ts +149 -1
  157. package/src/sdk/organizations.ts +5 -2
  158. package/src/sdk/supportarticles.ts +8 -2
  159. package/src/sdk/vendors.ts +47 -2
@@ -0,0 +1,171 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { encodeSimple } 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
+ * Expedite time remaining
29
+ *
30
+ * @remarks
31
+ * For vendors who have a paid 24-hour expedite credentials invoice, get the remaining time (in seconds) for which submitted credentials will be expedited.
32
+ */
33
+ export function vendorsExpediteTimeRemaining(
34
+ client: GreenSecurityCore,
35
+ request: operations.ExpediteTimeRemainingRequest,
36
+ options?: RequestOptions,
37
+ ): APIPromise<
38
+ Result<
39
+ operations.ExpediteTimeRemainingResponseBody,
40
+ | errors.ApiErrorResponse
41
+ | APIError
42
+ | SDKValidationError
43
+ | UnexpectedClientError
44
+ | InvalidRequestError
45
+ | RequestAbortedError
46
+ | RequestTimeoutError
47
+ | ConnectionError
48
+ >
49
+ > {
50
+ return new APIPromise($do(
51
+ client,
52
+ request,
53
+ options,
54
+ ));
55
+ }
56
+
57
+ async function $do(
58
+ client: GreenSecurityCore,
59
+ request: operations.ExpediteTimeRemainingRequest,
60
+ options?: RequestOptions,
61
+ ): Promise<
62
+ [
63
+ Result<
64
+ operations.ExpediteTimeRemainingResponseBody,
65
+ | errors.ApiErrorResponse
66
+ | APIError
67
+ | SDKValidationError
68
+ | UnexpectedClientError
69
+ | InvalidRequestError
70
+ | RequestAbortedError
71
+ | RequestTimeoutError
72
+ | ConnectionError
73
+ >,
74
+ APICall,
75
+ ]
76
+ > {
77
+ const parsed = safeParse(
78
+ request,
79
+ (value) =>
80
+ operations.ExpediteTimeRemainingRequest$outboundSchema.parse(value),
81
+ "Input validation failed",
82
+ );
83
+ if (!parsed.ok) {
84
+ return [parsed, { status: "invalid" }];
85
+ }
86
+ const payload = parsed.value;
87
+ const body = null;
88
+
89
+ const pathParams = {
90
+ vendor_id_or_me: encodeSimple("vendor_id_or_me", payload.vendor_id_or_me, {
91
+ explode: false,
92
+ charEncoding: "percent",
93
+ }),
94
+ };
95
+
96
+ const path = pathToFunc("/vendors/{vendor_id_or_me}/expedite-time-remaining")(
97
+ pathParams,
98
+ );
99
+
100
+ const headers = new Headers(compactMap({
101
+ Accept: "application/json",
102
+ }));
103
+
104
+ const securityInput = await extractSecurity(client._options.security);
105
+ const requestSecurity = resolveGlobalSecurity(securityInput);
106
+
107
+ const context = {
108
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
109
+ operationID: "expediteTimeRemaining",
110
+ oAuth2Scopes: [],
111
+
112
+ resolvedSecurity: requestSecurity,
113
+
114
+ securitySource: client._options.security,
115
+ retryConfig: options?.retries
116
+ || client._options.retryConfig
117
+ || { strategy: "none" },
118
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
119
+ };
120
+
121
+ const requestRes = client._createRequest(context, {
122
+ security: requestSecurity,
123
+ method: "GET",
124
+ baseURL: options?.serverURL,
125
+ path: path,
126
+ headers: headers,
127
+ body: body,
128
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
129
+ }, options);
130
+ if (!requestRes.ok) {
131
+ return [requestRes, { status: "invalid" }];
132
+ }
133
+ const req = requestRes.value;
134
+
135
+ const doResult = await client._do(req, {
136
+ context,
137
+ errorCodes: ["400", "401", "4XX", "5XX"],
138
+ retryConfig: context.retryConfig,
139
+ retryCodes: context.retryCodes,
140
+ });
141
+ if (!doResult.ok) {
142
+ return [doResult, { status: "request-error", request: req }];
143
+ }
144
+ const response = doResult.value;
145
+
146
+ const responseFields = {
147
+ HttpMeta: { Response: response, Request: req },
148
+ };
149
+
150
+ const [result] = await M.match<
151
+ operations.ExpediteTimeRemainingResponseBody,
152
+ | errors.ApiErrorResponse
153
+ | APIError
154
+ | SDKValidationError
155
+ | UnexpectedClientError
156
+ | InvalidRequestError
157
+ | RequestAbortedError
158
+ | RequestTimeoutError
159
+ | ConnectionError
160
+ >(
161
+ M.json(200, operations.ExpediteTimeRemainingResponseBody$inboundSchema),
162
+ M.jsonErr([400, 401], errors.ApiErrorResponse$inboundSchema),
163
+ M.fail("4XX"),
164
+ M.fail("5XX"),
165
+ )(response, { extraFields: responseFields });
166
+ if (!result.ok) {
167
+ return [result, { status: "complete", request: req, response }];
168
+ }
169
+
170
+ return [result, { status: "complete", request: req, response }];
171
+ }
@@ -0,0 +1,255 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { dlv } from "../lib/dlv.js";
7
+ import { encodeFormQuery, encodeSimple, queryJoin } from "../lib/encodings.js";
8
+ import * as M from "../lib/matchers.js";
9
+ import { compactMap } from "../lib/primitives.js";
10
+ import { safeParse } from "../lib/schemas.js";
11
+ import { RequestOptions } from "../lib/sdks.js";
12
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
13
+ import { pathToFunc } from "../lib/url.js";
14
+ import { 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
+ import {
28
+ createPageIterator,
29
+ haltIterator,
30
+ PageIterator,
31
+ Paginator,
32
+ } from "../types/operations.js";
33
+
34
+ /**
35
+ * List vendor invoices
36
+ *
37
+ * @remarks
38
+ * List invoices for Vendors
39
+ *
40
+ * Available `expand` scopes are:
41
+ *
42
+ * invoice.line_items
43
+ */
44
+ export function vendorsListVendorInvoices(
45
+ client: GreenSecurityCore,
46
+ request: operations.ListVendorInvoicesRequest,
47
+ options?: RequestOptions,
48
+ ): APIPromise<
49
+ PageIterator<
50
+ Result<
51
+ operations.ListVendorInvoicesResponse,
52
+ | errors.ApiErrorResponse
53
+ | APIError
54
+ | SDKValidationError
55
+ | UnexpectedClientError
56
+ | InvalidRequestError
57
+ | RequestAbortedError
58
+ | RequestTimeoutError
59
+ | ConnectionError
60
+ >,
61
+ { page: number }
62
+ >
63
+ > {
64
+ return new APIPromise($do(
65
+ client,
66
+ request,
67
+ options,
68
+ ));
69
+ }
70
+
71
+ async function $do(
72
+ client: GreenSecurityCore,
73
+ request: operations.ListVendorInvoicesRequest,
74
+ options?: RequestOptions,
75
+ ): Promise<
76
+ [
77
+ PageIterator<
78
+ Result<
79
+ operations.ListVendorInvoicesResponse,
80
+ | errors.ApiErrorResponse
81
+ | APIError
82
+ | SDKValidationError
83
+ | UnexpectedClientError
84
+ | InvalidRequestError
85
+ | RequestAbortedError
86
+ | RequestTimeoutError
87
+ | ConnectionError
88
+ >,
89
+ { page: number }
90
+ >,
91
+ APICall,
92
+ ]
93
+ > {
94
+ const parsed = safeParse(
95
+ request,
96
+ (value) => operations.ListVendorInvoicesRequest$outboundSchema.parse(value),
97
+ "Input validation failed",
98
+ );
99
+ if (!parsed.ok) {
100
+ return [haltIterator(parsed), { status: "invalid" }];
101
+ }
102
+ const payload = parsed.value;
103
+ const body = null;
104
+
105
+ const pathParams = {
106
+ vendor_id_or_me: encodeSimple("vendor_id_or_me", payload.vendor_id_or_me, {
107
+ explode: false,
108
+ charEncoding: "percent",
109
+ }),
110
+ };
111
+
112
+ const path = pathToFunc("/vendors/{vendor_id_or_me}/invoices")(pathParams);
113
+
114
+ const query = queryJoin(
115
+ encodeFormQuery({
116
+ "expand": payload.expand,
117
+ }, { explode: false }),
118
+ encodeFormQuery({
119
+ "desc": payload.desc,
120
+ "items_per_page": payload.items_per_page,
121
+ "page": payload.page,
122
+ "sort": payload.sort,
123
+ }),
124
+ );
125
+
126
+ const headers = new Headers(compactMap({
127
+ Accept: "application/json",
128
+ }));
129
+
130
+ const securityInput = await extractSecurity(client._options.security);
131
+ const requestSecurity = resolveGlobalSecurity(securityInput);
132
+
133
+ const context = {
134
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
135
+ operationID: "listVendorInvoices",
136
+ oAuth2Scopes: [],
137
+
138
+ resolvedSecurity: requestSecurity,
139
+
140
+ securitySource: client._options.security,
141
+ retryConfig: options?.retries
142
+ || client._options.retryConfig
143
+ || { strategy: "none" },
144
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
145
+ };
146
+
147
+ const requestRes = client._createRequest(context, {
148
+ security: requestSecurity,
149
+ method: "GET",
150
+ baseURL: options?.serverURL,
151
+ path: path,
152
+ headers: headers,
153
+ query: query,
154
+ body: body,
155
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
156
+ }, options);
157
+ if (!requestRes.ok) {
158
+ return [haltIterator(requestRes), { status: "invalid" }];
159
+ }
160
+ const req = requestRes.value;
161
+
162
+ const doResult = await client._do(req, {
163
+ context,
164
+ errorCodes: ["400", "401", "4XX", "5XX"],
165
+ retryConfig: context.retryConfig,
166
+ retryCodes: context.retryCodes,
167
+ });
168
+ if (!doResult.ok) {
169
+ return [haltIterator(doResult), { status: "request-error", request: req }];
170
+ }
171
+ const response = doResult.value;
172
+
173
+ const responseFields = {
174
+ HttpMeta: { Response: response, Request: req },
175
+ };
176
+
177
+ const [result, raw] = await M.match<
178
+ operations.ListVendorInvoicesResponse,
179
+ | errors.ApiErrorResponse
180
+ | APIError
181
+ | SDKValidationError
182
+ | UnexpectedClientError
183
+ | InvalidRequestError
184
+ | RequestAbortedError
185
+ | RequestTimeoutError
186
+ | ConnectionError
187
+ >(
188
+ M.json(200, operations.ListVendorInvoicesResponse$inboundSchema, {
189
+ key: "Result",
190
+ }),
191
+ M.jsonErr([400, 401], errors.ApiErrorResponse$inboundSchema),
192
+ M.fail("4XX"),
193
+ M.fail("5XX"),
194
+ )(response, { extraFields: responseFields });
195
+ if (!result.ok) {
196
+ return [haltIterator(result), {
197
+ status: "complete",
198
+ request: req,
199
+ response,
200
+ }];
201
+ }
202
+
203
+ const nextFunc = (
204
+ responseData: unknown,
205
+ ): {
206
+ next: Paginator<
207
+ Result<
208
+ operations.ListVendorInvoicesResponse,
209
+ | errors.ApiErrorResponse
210
+ | APIError
211
+ | SDKValidationError
212
+ | UnexpectedClientError
213
+ | InvalidRequestError
214
+ | RequestAbortedError
215
+ | RequestTimeoutError
216
+ | ConnectionError
217
+ >
218
+ >;
219
+ "~next"?: { page: number };
220
+ } => {
221
+ const page = request?.page ?? 1;
222
+ const nextPage = page + 1;
223
+
224
+ if (!responseData) {
225
+ return { next: () => null };
226
+ }
227
+ const results = dlv(responseData, "items");
228
+ if (!Array.isArray(results) || !results.length) {
229
+ return { next: () => null };
230
+ }
231
+ const limit = request?.itemsPerPage ?? 0;
232
+ if (results.length < limit) {
233
+ return { next: () => null };
234
+ }
235
+
236
+ const nextVal = () =>
237
+ vendorsListVendorInvoices(
238
+ client,
239
+ {
240
+ ...request,
241
+ page: nextPage,
242
+ },
243
+ options,
244
+ );
245
+
246
+ return { next: nextVal, "~next": { page: nextPage } };
247
+ };
248
+
249
+ const page = { ...result, ...nextFunc(raw) };
250
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
251
+ status: "complete",
252
+ request: req,
253
+ response,
254
+ }];
255
+ }
@@ -3,6 +3,7 @@
3
3
  */
4
4
 
5
5
  import { GreenSecurityCore } from "../core.js";
6
+ import { dlv } from "../lib/dlv.js";
6
7
  import { encodeFormQuery } from "../lib/encodings.js";
7
8
  import * as M from "../lib/matchers.js";
8
9
  import { compactMap } from "../lib/primitives.js";
@@ -22,6 +23,12 @@ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
22
23
  import * as operations from "../models/operations/index.js";
23
24
  import { APICall, APIPromise } from "../types/async.js";
24
25
  import { Result } from "../types/fp.js";
26
+ import {
27
+ createPageIterator,
28
+ haltIterator,
29
+ PageIterator,
30
+ Paginator,
31
+ } from "../types/operations.js";
25
32
 
26
33
  /**
27
34
  * List vendor job titles
@@ -34,17 +41,20 @@ export function vendorsListVendorJobTitles(
34
41
  request: operations.ListVendorJobTitlesRequest,
35
42
  options?: RequestOptions,
36
43
  ): APIPromise<
37
- Result<
38
- operations.ListVendorJobTitlesListVendorJobTitlesOk,
39
- | errors.ApiErrorResponse
40
- | errors.ApiErrorResponse
41
- | APIError
42
- | SDKValidationError
43
- | UnexpectedClientError
44
- | InvalidRequestError
45
- | RequestAbortedError
46
- | RequestTimeoutError
47
- | ConnectionError
44
+ PageIterator<
45
+ Result<
46
+ operations.ListVendorJobTitlesResponse,
47
+ | errors.ApiErrorResponse
48
+ | errors.ApiErrorResponse
49
+ | APIError
50
+ | SDKValidationError
51
+ | UnexpectedClientError
52
+ | InvalidRequestError
53
+ | RequestAbortedError
54
+ | RequestTimeoutError
55
+ | ConnectionError
56
+ >,
57
+ { page: number }
48
58
  >
49
59
  > {
50
60
  return new APIPromise($do(
@@ -60,17 +70,20 @@ async function $do(
60
70
  options?: RequestOptions,
61
71
  ): Promise<
62
72
  [
63
- Result<
64
- operations.ListVendorJobTitlesListVendorJobTitlesOk,
65
- | errors.ApiErrorResponse
66
- | errors.ApiErrorResponse
67
- | APIError
68
- | SDKValidationError
69
- | UnexpectedClientError
70
- | InvalidRequestError
71
- | RequestAbortedError
72
- | RequestTimeoutError
73
- | ConnectionError
73
+ PageIterator<
74
+ Result<
75
+ operations.ListVendorJobTitlesResponse,
76
+ | errors.ApiErrorResponse
77
+ | errors.ApiErrorResponse
78
+ | APIError
79
+ | SDKValidationError
80
+ | UnexpectedClientError
81
+ | InvalidRequestError
82
+ | RequestAbortedError
83
+ | RequestTimeoutError
84
+ | ConnectionError
85
+ >,
86
+ { page: number }
74
87
  >,
75
88
  APICall,
76
89
  ]
@@ -82,7 +95,7 @@ async function $do(
82
95
  "Input validation failed",
83
96
  );
84
97
  if (!parsed.ok) {
85
- return [parsed, { status: "invalid" }];
98
+ return [haltIterator(parsed), { status: "invalid" }];
86
99
  }
87
100
  const payload = parsed.value;
88
101
  const body = null;
@@ -125,7 +138,7 @@ async function $do(
125
138
  timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
126
139
  }, options);
127
140
  if (!requestRes.ok) {
128
- return [requestRes, { status: "invalid" }];
141
+ return [haltIterator(requestRes), { status: "invalid" }];
129
142
  }
130
143
  const req = requestRes.value;
131
144
 
@@ -136,7 +149,7 @@ async function $do(
136
149
  retryCodes: context.retryCodes,
137
150
  });
138
151
  if (!doResult.ok) {
139
- return [doResult, { status: "request-error", request: req }];
152
+ return [haltIterator(doResult), { status: "request-error", request: req }];
140
153
  }
141
154
  const response = doResult.value;
142
155
 
@@ -144,8 +157,8 @@ async function $do(
144
157
  HttpMeta: { Response: response, Request: req },
145
158
  };
146
159
 
147
- const [result] = await M.match<
148
- operations.ListVendorJobTitlesListVendorJobTitlesOk,
160
+ const [result, raw] = await M.match<
161
+ operations.ListVendorJobTitlesResponse,
149
162
  | errors.ApiErrorResponse
150
163
  | errors.ApiErrorResponse
151
164
  | APIError
@@ -156,18 +169,73 @@ async function $do(
156
169
  | RequestTimeoutError
157
170
  | ConnectionError
158
171
  >(
159
- M.json(
160
- 200,
161
- operations.ListVendorJobTitlesListVendorJobTitlesOk$inboundSchema,
162
- ),
172
+ M.json(200, operations.ListVendorJobTitlesResponse$inboundSchema, {
173
+ key: "Result",
174
+ }),
163
175
  M.jsonErr(403, errors.ApiErrorResponse$inboundSchema),
164
176
  M.jsonErr(500, errors.ApiErrorResponse$inboundSchema),
165
177
  M.fail("4XX"),
166
178
  M.fail("5XX"),
167
179
  )(response, { extraFields: responseFields });
168
180
  if (!result.ok) {
169
- return [result, { status: "complete", request: req, response }];
181
+ return [haltIterator(result), {
182
+ status: "complete",
183
+ request: req,
184
+ response,
185
+ }];
170
186
  }
171
187
 
172
- return [result, { status: "complete", request: req, response }];
188
+ const nextFunc = (
189
+ responseData: unknown,
190
+ ): {
191
+ next: Paginator<
192
+ Result<
193
+ operations.ListVendorJobTitlesResponse,
194
+ | errors.ApiErrorResponse
195
+ | errors.ApiErrorResponse
196
+ | APIError
197
+ | SDKValidationError
198
+ | UnexpectedClientError
199
+ | InvalidRequestError
200
+ | RequestAbortedError
201
+ | RequestTimeoutError
202
+ | ConnectionError
203
+ >
204
+ >;
205
+ "~next"?: { page: number };
206
+ } => {
207
+ const page = request?.page ?? 1;
208
+ const nextPage = page + 1;
209
+
210
+ if (!responseData) {
211
+ return { next: () => null };
212
+ }
213
+ const results = dlv(responseData, "items");
214
+ if (!Array.isArray(results) || !results.length) {
215
+ return { next: () => null };
216
+ }
217
+ const limit = request?.itemsPerPage ?? 0;
218
+ if (results.length < limit) {
219
+ return { next: () => null };
220
+ }
221
+
222
+ const nextVal = () =>
223
+ vendorsListVendorJobTitles(
224
+ client,
225
+ {
226
+ ...request,
227
+ page: nextPage,
228
+ },
229
+ options,
230
+ );
231
+
232
+ return { next: nextVal, "~next": { page: nextPage } };
233
+ };
234
+
235
+ const page = { ...result, ...nextFunc(raw) };
236
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
237
+ status: "complete",
238
+ request: req,
239
+ response,
240
+ }];
173
241
  }
package/src/lib/config.ts CHANGED
@@ -72,8 +72,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
72
72
  export const SDK_METADATA = {
73
73
  language: "typescript",
74
74
  openapiDocVersion: "0.0.3",
75
- sdkVersion: "0.16.0",
75
+ sdkVersion: "0.17.0",
76
76
  genVersion: "2.541.0",
77
77
  userAgent:
78
- "speakeasy-sdk/typescript 0.16.0 2.541.0 0.0.3 @greensecurity/javascript-sdk",
78
+ "speakeasy-sdk/typescript 0.17.0 2.541.0 0.0.3 @greensecurity/javascript-sdk",
79
79
  } 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.16.0",
22
+ currentVersion: "0.17.0",
23
23
  },
24
24
  });
25
25
 
@@ -19,7 +19,9 @@ import { tool$usersMagiclink } from "./tools/usersMagiclink.js";
19
19
  import { tool$usersPassword } from "./tools/usersPassword.js";
20
20
  import { tool$usersPasswordResetRequest } from "./tools/usersPasswordResetRequest.js";
21
21
  import { tool$vendorsCreateVendorRegistration } from "./tools/vendorsCreateVendorRegistration.js";
22
+ import { tool$vendorsExpediteTimeRemaining } from "./tools/vendorsExpediteTimeRemaining.js";
22
23
  import { tool$vendorsListVendorCredentials } from "./tools/vendorsListVendorCredentials.js";
24
+ import { tool$vendorsListVendorInvoices } from "./tools/vendorsListVendorInvoices.js";
23
25
  import { tool$vendorsListVendorJobTitles } from "./tools/vendorsListVendorJobTitles.js";
24
26
 
25
27
  export function createMCPServer(deps: {
@@ -32,7 +34,7 @@ export function createMCPServer(deps: {
32
34
  }) {
33
35
  const server = new McpServer({
34
36
  name: "GreenSecurity",
35
- version: "0.16.0",
37
+ version: "0.17.0",
36
38
  });
37
39
 
38
40
  const client = new GreenSecurityCore({
@@ -53,6 +55,8 @@ export function createMCPServer(deps: {
53
55
  tool(tool$vendorsCreateVendorRegistration);
54
56
  tool(tool$vendorsListVendorJobTitles);
55
57
  tool(tool$vendorsListVendorCredentials);
58
+ tool(tool$vendorsExpediteTimeRemaining);
59
+ tool(tool$vendorsListVendorInvoices);
56
60
  tool(tool$usersGetCurrentUser);
57
61
  tool(tool$usersGetUserById);
58
62
  tool(tool$usersLogsUserIntoTheSystem);
@@ -45,7 +45,7 @@ Available \`expand\` scopes are:
45
45
  };
46
46
  }
47
47
 
48
- const value = result.value;
48
+ const value = result.value.result;
49
49
 
50
50
  return formatResult(value, apiCall);
51
51
  },
@@ -32,7 +32,7 @@ List or search support articles for FAQ.`,
32
32
  };
33
33
  }
34
34
 
35
- const value = result.value;
35
+ const value = result.value.result;
36
36
 
37
37
  return formatResult(value, apiCall);
38
38
  },