@greensecurity/javascript-sdk 0.43.1-beta.137 → 0.43.1-beta.139

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 (104) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/vendors.test.js +36 -0
  3. package/dist/commonjs/__tests__/vendors.test.js.map +1 -1
  4. package/dist/commonjs/__tests__/webhooks.test.js +1 -1
  5. package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
  6. package/dist/commonjs/__tests__/zones.test.js +32 -3
  7. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  8. package/dist/commonjs/funcs/vendorsGetVendorUploadHistory.d.ts +23 -0
  9. package/dist/commonjs/funcs/vendorsGetVendorUploadHistory.d.ts.map +1 -0
  10. package/dist/commonjs/funcs/vendorsGetVendorUploadHistory.js +166 -0
  11. package/dist/commonjs/funcs/vendorsGetVendorUploadHistory.js.map +1 -0
  12. package/dist/commonjs/lib/config.d.ts +2 -2
  13. package/dist/commonjs/lib/config.js +2 -2
  14. package/dist/commonjs/models/components/index.d.ts +1 -0
  15. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  16. package/dist/commonjs/models/components/index.js +1 -0
  17. package/dist/commonjs/models/components/index.js.map +1 -1
  18. package/dist/commonjs/models/components/uploadhistoryitem.d.ts +14 -0
  19. package/dist/commonjs/models/components/uploadhistoryitem.d.ts.map +1 -0
  20. package/dist/commonjs/models/components/uploadhistoryitem.js +63 -0
  21. package/dist/commonjs/models/components/uploadhistoryitem.js.map +1 -0
  22. package/dist/commonjs/models/operations/getvendoruploadhistory.d.ts +63 -0
  23. package/dist/commonjs/models/operations/getvendoruploadhistory.d.ts.map +1 -0
  24. package/dist/commonjs/models/operations/getvendoruploadhistory.js +83 -0
  25. package/dist/commonjs/models/operations/getvendoruploadhistory.js.map +1 -0
  26. package/dist/commonjs/models/operations/index.d.ts +1 -0
  27. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  28. package/dist/commonjs/models/operations/index.js +1 -0
  29. package/dist/commonjs/models/operations/index.js.map +1 -1
  30. package/dist/commonjs/react-query/index.d.ts +1 -0
  31. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  32. package/dist/commonjs/react-query/index.js +1 -0
  33. package/dist/commonjs/react-query/index.js.map +1 -1
  34. package/dist/commonjs/react-query/vendorsGetVendorUploadHistory.core.d.ts +36 -0
  35. package/dist/commonjs/react-query/vendorsGetVendorUploadHistory.core.d.ts.map +1 -0
  36. package/dist/commonjs/react-query/vendorsGetVendorUploadHistory.core.js +94 -0
  37. package/dist/commonjs/react-query/vendorsGetVendorUploadHistory.core.js.map +1 -0
  38. package/dist/commonjs/react-query/vendorsGetVendorUploadHistory.d.ts +60 -0
  39. package/dist/commonjs/react-query/vendorsGetVendorUploadHistory.d.ts.map +1 -0
  40. package/dist/commonjs/react-query/vendorsGetVendorUploadHistory.js +105 -0
  41. package/dist/commonjs/react-query/vendorsGetVendorUploadHistory.js.map +1 -0
  42. package/dist/commonjs/sdk/vendors.d.ts +9 -0
  43. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  44. package/dist/commonjs/sdk/vendors.js +10 -0
  45. package/dist/commonjs/sdk/vendors.js.map +1 -1
  46. package/dist/esm/__tests__/vendors.test.js +36 -0
  47. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  48. package/dist/esm/__tests__/webhooks.test.js +1 -1
  49. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  50. package/dist/esm/__tests__/zones.test.js +32 -3
  51. package/dist/esm/__tests__/zones.test.js.map +1 -1
  52. package/dist/esm/funcs/vendorsGetVendorUploadHistory.d.ts +23 -0
  53. package/dist/esm/funcs/vendorsGetVendorUploadHistory.d.ts.map +1 -0
  54. package/dist/esm/funcs/vendorsGetVendorUploadHistory.js +130 -0
  55. package/dist/esm/funcs/vendorsGetVendorUploadHistory.js.map +1 -0
  56. package/dist/esm/lib/config.d.ts +2 -2
  57. package/dist/esm/lib/config.js +2 -2
  58. package/dist/esm/models/components/index.d.ts +1 -0
  59. package/dist/esm/models/components/index.d.ts.map +1 -1
  60. package/dist/esm/models/components/index.js +1 -0
  61. package/dist/esm/models/components/index.js.map +1 -1
  62. package/dist/esm/models/components/uploadhistoryitem.d.ts +14 -0
  63. package/dist/esm/models/components/uploadhistoryitem.d.ts.map +1 -0
  64. package/dist/esm/models/components/uploadhistoryitem.js +26 -0
  65. package/dist/esm/models/components/uploadhistoryitem.js.map +1 -0
  66. package/dist/esm/models/operations/getvendoruploadhistory.d.ts +63 -0
  67. package/dist/esm/models/operations/getvendoruploadhistory.d.ts.map +1 -0
  68. package/dist/esm/models/operations/getvendoruploadhistory.js +44 -0
  69. package/dist/esm/models/operations/getvendoruploadhistory.js.map +1 -0
  70. package/dist/esm/models/operations/index.d.ts +1 -0
  71. package/dist/esm/models/operations/index.d.ts.map +1 -1
  72. package/dist/esm/models/operations/index.js +1 -0
  73. package/dist/esm/models/operations/index.js.map +1 -1
  74. package/dist/esm/react-query/index.d.ts +1 -0
  75. package/dist/esm/react-query/index.d.ts.map +1 -1
  76. package/dist/esm/react-query/index.js +1 -0
  77. package/dist/esm/react-query/index.js.map +1 -1
  78. package/dist/esm/react-query/vendorsGetVendorUploadHistory.core.d.ts +36 -0
  79. package/dist/esm/react-query/vendorsGetVendorUploadHistory.core.d.ts.map +1 -0
  80. package/dist/esm/react-query/vendorsGetVendorUploadHistory.core.js +86 -0
  81. package/dist/esm/react-query/vendorsGetVendorUploadHistory.core.js.map +1 -0
  82. package/dist/esm/react-query/vendorsGetVendorUploadHistory.d.ts +60 -0
  83. package/dist/esm/react-query/vendorsGetVendorUploadHistory.d.ts.map +1 -0
  84. package/dist/esm/react-query/vendorsGetVendorUploadHistory.js +90 -0
  85. package/dist/esm/react-query/vendorsGetVendorUploadHistory.js.map +1 -0
  86. package/dist/esm/sdk/vendors.d.ts +9 -0
  87. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  88. package/dist/esm/sdk/vendors.js +10 -0
  89. package/dist/esm/sdk/vendors.js.map +1 -1
  90. package/jsr.json +1 -1
  91. package/package.json +1 -1
  92. package/src/__tests__/vendors.test.ts +39 -0
  93. package/src/__tests__/webhooks.test.ts +1 -1
  94. package/src/__tests__/zones.test.ts +32 -3
  95. package/src/funcs/vendorsGetVendorUploadHistory.ts +260 -0
  96. package/src/lib/config.ts +2 -2
  97. package/src/models/components/index.ts +1 -0
  98. package/src/models/components/uploadhistoryitem.ts +48 -0
  99. package/src/models/operations/getvendoruploadhistory.ts +144 -0
  100. package/src/models/operations/index.ts +1 -0
  101. package/src/react-query/index.ts +1 -0
  102. package/src/react-query/vendorsGetVendorUploadHistory.core.ts +199 -0
  103. package/src/react-query/vendorsGetVendorUploadHistory.ts +267 -0
  104. package/src/sdk/vendors.ts +20 -0
@@ -0,0 +1,260 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: abdc070ccf3f
4
+ */
5
+
6
+ import { GreenSecurityCore } from "../core.js";
7
+ import { dlv } from "../lib/dlv.js";
8
+ import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
9
+ import { matchStatusCode } from "../lib/http.js";
10
+ import * as M from "../lib/matchers.js";
11
+ import { compactMap } from "../lib/primitives.js";
12
+ import { safeParse } from "../lib/schemas.js";
13
+ import { RequestOptions } from "../lib/sdks.js";
14
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
15
+ import { pathToFunc } from "../lib/url.js";
16
+ import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
17
+ import {
18
+ ConnectionError,
19
+ InvalidRequestError,
20
+ RequestAbortedError,
21
+ RequestTimeoutError,
22
+ UnexpectedClientError,
23
+ } from "../models/errors/httpclienterrors.js";
24
+ import * as errors from "../models/errors/index.js";
25
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
26
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
27
+ import * as operations from "../models/operations/index.js";
28
+ import { APICall, APIPromise } from "../types/async.js";
29
+ import { Result } from "../types/fp.js";
30
+ import {
31
+ createPageIterator,
32
+ haltIterator,
33
+ PageIterator,
34
+ Paginator,
35
+ } from "../types/operations.js";
36
+
37
+ /**
38
+ * Get vendor upload history
39
+ *
40
+ * @remarks
41
+ * Lists files the vendor has uploaded across all their credentials, ordered by upload date descending. Excludes decline-document uploads.
42
+ *
43
+ * If set, this operation will use {@link Security.bearerJwt} from the global security.
44
+ */
45
+ export function vendorsGetVendorUploadHistory(
46
+ client: GreenSecurityCore,
47
+ request: operations.GetVendorUploadHistoryRequest,
48
+ options?: RequestOptions,
49
+ ): APIPromise<
50
+ PageIterator<
51
+ Result<
52
+ operations.GetVendorUploadHistoryResponse,
53
+ | errors.ApiErrorResponse
54
+ | GreenSecurityError
55
+ | ResponseValidationError
56
+ | ConnectionError
57
+ | RequestAbortedError
58
+ | RequestTimeoutError
59
+ | InvalidRequestError
60
+ | UnexpectedClientError
61
+ | SDKValidationError
62
+ >,
63
+ { page: number }
64
+ >
65
+ > {
66
+ return new APIPromise($do(
67
+ client,
68
+ request,
69
+ options,
70
+ ));
71
+ }
72
+
73
+ async function $do(
74
+ client: GreenSecurityCore,
75
+ request: operations.GetVendorUploadHistoryRequest,
76
+ options?: RequestOptions,
77
+ ): Promise<
78
+ [
79
+ PageIterator<
80
+ Result<
81
+ operations.GetVendorUploadHistoryResponse,
82
+ | errors.ApiErrorResponse
83
+ | GreenSecurityError
84
+ | ResponseValidationError
85
+ | ConnectionError
86
+ | RequestAbortedError
87
+ | RequestTimeoutError
88
+ | InvalidRequestError
89
+ | UnexpectedClientError
90
+ | SDKValidationError
91
+ >,
92
+ { page: number }
93
+ >,
94
+ APICall,
95
+ ]
96
+ > {
97
+ const parsed = safeParse(
98
+ request,
99
+ (value) =>
100
+ operations.GetVendorUploadHistoryRequest$outboundSchema.parse(value),
101
+ "Input validation failed",
102
+ );
103
+ if (!parsed.ok) {
104
+ return [haltIterator(parsed), { status: "invalid" }];
105
+ }
106
+ const payload = parsed.value;
107
+ const body = null;
108
+
109
+ const pathParams = {
110
+ vendor_id_or_me: encodeSimple("vendor_id_or_me", payload.vendor_id_or_me, {
111
+ explode: false,
112
+ charEncoding: "percent",
113
+ }),
114
+ };
115
+ const path = pathToFunc("/vendors/{vendor_id_or_me}/credentials/files")(
116
+ pathParams,
117
+ );
118
+
119
+ const query = encodeFormQuery({
120
+ "desc": payload.desc,
121
+ "items_per_page": payload.items_per_page,
122
+ "page": payload.page,
123
+ "sort": payload.sort,
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, [1]);
132
+
133
+ const context = {
134
+ options: client._options,
135
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
136
+ operationID: "getVendorUploadHistory",
137
+ oAuth2Scopes: null,
138
+
139
+ resolvedSecurity: requestSecurity,
140
+
141
+ securitySource: client._options.security,
142
+ retryConfig: options?.retries
143
+ || client._options.retryConfig
144
+ || { strategy: "none" },
145
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
146
+ };
147
+
148
+ const requestRes = client._createRequest(context, {
149
+ security: requestSecurity,
150
+ method: "GET",
151
+ baseURL: options?.serverURL,
152
+ path: path,
153
+ headers: headers,
154
+ query: query,
155
+ body: body,
156
+ userAgent: client._options.userAgent,
157
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
158
+ }, options);
159
+ if (!requestRes.ok) {
160
+ return [haltIterator(requestRes), { status: "invalid" }];
161
+ }
162
+ const req = requestRes.value;
163
+
164
+ const doResult = await client._do(req, {
165
+ context,
166
+ isErrorStatusCode: (statusCode: number) =>
167
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
168
+ retryConfig: context.retryConfig,
169
+ retryCodes: context.retryCodes,
170
+ });
171
+ if (!doResult.ok) {
172
+ return [haltIterator(doResult), { status: "request-error", request: req }];
173
+ }
174
+ const response = doResult.value;
175
+
176
+ const responseFields = {
177
+ HttpMeta: { Response: response, Request: req },
178
+ };
179
+
180
+ const [result, raw] = await M.match<
181
+ operations.GetVendorUploadHistoryResponse,
182
+ | errors.ApiErrorResponse
183
+ | GreenSecurityError
184
+ | ResponseValidationError
185
+ | ConnectionError
186
+ | RequestAbortedError
187
+ | RequestTimeoutError
188
+ | InvalidRequestError
189
+ | UnexpectedClientError
190
+ | SDKValidationError
191
+ >(
192
+ M.json(200, operations.GetVendorUploadHistoryResponse$inboundSchema, {
193
+ key: "Result",
194
+ }),
195
+ M.jsonErr([400, 401, 403, 404], errors.ApiErrorResponse$inboundSchema),
196
+ M.fail("4XX"),
197
+ M.fail([500, "5XX"]),
198
+ )(response, req, { extraFields: responseFields });
199
+ if (!result.ok) {
200
+ return [haltIterator(result), {
201
+ status: "complete",
202
+ request: req,
203
+ response,
204
+ }];
205
+ }
206
+
207
+ const nextFunc = (
208
+ responseData: unknown,
209
+ ): {
210
+ next: Paginator<
211
+ Result<
212
+ operations.GetVendorUploadHistoryResponse,
213
+ | errors.ApiErrorResponse
214
+ | GreenSecurityError
215
+ | ResponseValidationError
216
+ | ConnectionError
217
+ | RequestAbortedError
218
+ | RequestTimeoutError
219
+ | InvalidRequestError
220
+ | UnexpectedClientError
221
+ | SDKValidationError
222
+ >
223
+ >;
224
+ "~next"?: { page: number };
225
+ } => {
226
+ const page = request?.page ?? 1;
227
+ const nextPage = page + 1;
228
+
229
+ if (!responseData) {
230
+ return { next: () => null };
231
+ }
232
+ const results = dlv(responseData, "items");
233
+ if (!Array.isArray(results) || !results.length) {
234
+ return { next: () => null };
235
+ }
236
+ const limit = request?.itemsPerPage ?? 0;
237
+ if (results.length < limit) {
238
+ return { next: () => null };
239
+ }
240
+
241
+ const nextVal = () =>
242
+ vendorsGetVendorUploadHistory(
243
+ client,
244
+ {
245
+ ...request,
246
+ page: nextPage,
247
+ },
248
+ options,
249
+ );
250
+
251
+ return { next: nextVal, "~next": { page: nextPage } };
252
+ };
253
+
254
+ const page = { ...result, ...nextFunc(raw) };
255
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
256
+ status: "complete",
257
+ request: req,
258
+ response,
259
+ }];
260
+ }
package/src/lib/config.ts CHANGED
@@ -81,8 +81,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
81
81
  export const SDK_METADATA = {
82
82
  language: "typescript",
83
83
  openapiDocVersion: "0.0.11",
84
- sdkVersion: "0.43.1-beta.137",
84
+ sdkVersion: "0.43.1-beta.139",
85
85
  genVersion: "2.882.0",
86
86
  userAgent:
87
- "speakeasy-sdk/typescript 0.43.1-beta.137 2.882.0 0.0.11 @greensecurity/javascript-sdk",
87
+ "speakeasy-sdk/typescript 0.43.1-beta.139 2.882.0 0.0.11 @greensecurity/javascript-sdk",
88
88
  } as const;
@@ -66,6 +66,7 @@ export * from "./subscription.js";
66
66
  export * from "./supervisor.js";
67
67
  export * from "./supportarticle.js";
68
68
  export * from "./systemsummary.js";
69
+ export * from "./uploadhistoryitem.js";
69
70
  export * from "./user.js";
70
71
  export * from "./userdetails.js";
71
72
  export * from "./userlocation.js";
@@ -0,0 +1,48 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: a1eae6e10877
4
+ */
5
+
6
+ import * as z from "zod/v3";
7
+ import { remap as remap$ } from "../../lib/primitives.js";
8
+ import { safeParse } from "../../lib/schemas.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import * as types from "../../types/primitives.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type UploadHistoryItem = {
14
+ id: number;
15
+ filename: string;
16
+ dateUploaded?: Date | null | undefined;
17
+ vendorCredentialId: number;
18
+ credentialName?: string | null | undefined;
19
+ };
20
+
21
+ /** @internal */
22
+ export const UploadHistoryItem$inboundSchema: z.ZodType<
23
+ UploadHistoryItem,
24
+ z.ZodTypeDef,
25
+ unknown
26
+ > = z.object({
27
+ id: types.number(),
28
+ filename: types.string(),
29
+ date_uploaded: z.nullable(types.date()).optional(),
30
+ vendor_credential_id: types.number(),
31
+ credential_name: z.nullable(types.string()).optional(),
32
+ }).transform((v) => {
33
+ return remap$(v, {
34
+ "date_uploaded": "dateUploaded",
35
+ "vendor_credential_id": "vendorCredentialId",
36
+ "credential_name": "credentialName",
37
+ });
38
+ });
39
+
40
+ export function uploadHistoryItemFromJSON(
41
+ jsonString: string,
42
+ ): SafeParseResult<UploadHistoryItem, SDKValidationError> {
43
+ return safeParse(
44
+ jsonString,
45
+ (x) => UploadHistoryItem$inboundSchema.parse(JSON.parse(x)),
46
+ `Failed to parse 'UploadHistoryItem' from JSON`,
47
+ );
48
+ }
@@ -0,0 +1,144 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: a5888855de07
4
+ */
5
+
6
+ import * as z from "zod/v3";
7
+ import { remap as remap$ } from "../../lib/primitives.js";
8
+ import { safeParse } from "../../lib/schemas.js";
9
+ import { Result as SafeParseResult } from "../../types/fp.js";
10
+ import * as components from "../components/index.js";
11
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
12
+
13
+ export type GetVendorUploadHistoryRequest = {
14
+ /**
15
+ * A comma-separated list of object attributes to sort on.
16
+ */
17
+ sort?: string | null | undefined;
18
+ /**
19
+ * Sort desc
20
+ */
21
+ desc?: components.Desc | undefined;
22
+ /**
23
+ * A 1-based offset for which page to request (defaults to 1)
24
+ */
25
+ page?: number | undefined;
26
+ /**
27
+ * Number of items to show in a given page
28
+ */
29
+ itemsPerPage?: number | undefined;
30
+ /**
31
+ * Vendor identifier. Depending on the endpoint, accepts one or more of:
32
+ *
33
+ * @remarks
34
+ * - A numeric vendor ID (positive integer, e.g. `42`)
35
+ * - The keyword `me` to represent the authenticated vendor
36
+ * - An active QR code (alphanumeric, hyphen-separated, e.g. `ABC-123-DEF`) —
37
+ * supported only on endpoints that explicitly document QR-code lookup
38
+ */
39
+ vendorIdOrMe: string;
40
+ };
41
+
42
+ /**
43
+ * The request was successful, and the server has returned the requested resource in the response body.
44
+ */
45
+ export type GetVendorUploadHistoryGetVendorUploadHistoryOk = {
46
+ /**
47
+ * Pagination information for a pageable list
48
+ */
49
+ pager: components.Pager;
50
+ items: Array<components.UploadHistoryItem>;
51
+ };
52
+
53
+ export type GetVendorUploadHistoryResponse = {
54
+ result: GetVendorUploadHistoryGetVendorUploadHistoryOk;
55
+ };
56
+
57
+ /** @internal */
58
+ export type GetVendorUploadHistoryRequest$Outbound = {
59
+ sort?: string | null | undefined;
60
+ desc?: components.Desc$Outbound | undefined;
61
+ page?: number | undefined;
62
+ items_per_page?: number | undefined;
63
+ vendor_id_or_me: string;
64
+ };
65
+
66
+ /** @internal */
67
+ export const GetVendorUploadHistoryRequest$outboundSchema: z.ZodType<
68
+ GetVendorUploadHistoryRequest$Outbound,
69
+ z.ZodTypeDef,
70
+ GetVendorUploadHistoryRequest
71
+ > = z.object({
72
+ sort: z.nullable(z.string()).optional(),
73
+ desc: components.Desc$outboundSchema.optional(),
74
+ page: z.number().int().optional(),
75
+ itemsPerPage: z.number().int().optional(),
76
+ vendorIdOrMe: z.string(),
77
+ }).transform((v) => {
78
+ return remap$(v, {
79
+ itemsPerPage: "items_per_page",
80
+ vendorIdOrMe: "vendor_id_or_me",
81
+ });
82
+ });
83
+
84
+ export function getVendorUploadHistoryRequestToJSON(
85
+ getVendorUploadHistoryRequest: GetVendorUploadHistoryRequest,
86
+ ): string {
87
+ return JSON.stringify(
88
+ GetVendorUploadHistoryRequest$outboundSchema.parse(
89
+ getVendorUploadHistoryRequest,
90
+ ),
91
+ );
92
+ }
93
+
94
+ /** @internal */
95
+ export const GetVendorUploadHistoryGetVendorUploadHistoryOk$inboundSchema:
96
+ z.ZodType<
97
+ GetVendorUploadHistoryGetVendorUploadHistoryOk,
98
+ z.ZodTypeDef,
99
+ unknown
100
+ > = z.object({
101
+ pager: components.Pager$inboundSchema,
102
+ items: z.array(components.UploadHistoryItem$inboundSchema),
103
+ });
104
+
105
+ export function getVendorUploadHistoryGetVendorUploadHistoryOkFromJSON(
106
+ jsonString: string,
107
+ ): SafeParseResult<
108
+ GetVendorUploadHistoryGetVendorUploadHistoryOk,
109
+ SDKValidationError
110
+ > {
111
+ return safeParse(
112
+ jsonString,
113
+ (x) =>
114
+ GetVendorUploadHistoryGetVendorUploadHistoryOk$inboundSchema.parse(
115
+ JSON.parse(x),
116
+ ),
117
+ `Failed to parse 'GetVendorUploadHistoryGetVendorUploadHistoryOk' from JSON`,
118
+ );
119
+ }
120
+
121
+ /** @internal */
122
+ export const GetVendorUploadHistoryResponse$inboundSchema: z.ZodType<
123
+ GetVendorUploadHistoryResponse,
124
+ z.ZodTypeDef,
125
+ unknown
126
+ > = z.object({
127
+ Result: z.lazy(() =>
128
+ GetVendorUploadHistoryGetVendorUploadHistoryOk$inboundSchema
129
+ ),
130
+ }).transform((v) => {
131
+ return remap$(v, {
132
+ "Result": "result",
133
+ });
134
+ });
135
+
136
+ export function getVendorUploadHistoryResponseFromJSON(
137
+ jsonString: string,
138
+ ): SafeParseResult<GetVendorUploadHistoryResponse, SDKValidationError> {
139
+ return safeParse(
140
+ jsonString,
141
+ (x) => GetVendorUploadHistoryResponse$inboundSchema.parse(JSON.parse(x)),
142
+ `Failed to parse 'GetVendorUploadHistoryResponse' from JSON`,
143
+ );
144
+ }
@@ -55,6 +55,7 @@ export * from "./getvendorinvoicereceipt.js";
55
55
  export * from "./getvendorlegalname.js";
56
56
  export * from "./getvendorscan.js";
57
57
  export * from "./getvendorsdetails.js";
58
+ export * from "./getvendoruploadhistory.js";
58
59
  export * from "./getwebhookendpoint.js";
59
60
  export * from "./invoicesexport.js";
60
61
  export * from "./listalerts.js";
@@ -95,6 +95,7 @@ export * from "./vendorsGetVendorInvoiceDetails.js";
95
95
  export * from "./vendorsGetVendorInvoiceReceipt.js";
96
96
  export * from "./vendorsGetVendorLegalName.js";
97
97
  export * from "./vendorsGetVendorsDetails.js";
98
+ export * from "./vendorsGetVendorUploadHistory.js";
98
99
  export * from "./vendorsListVendorAdditionalFacilityFields.js";
99
100
  export * from "./vendorsListVendorCredentialDataRequests.js";
100
101
  export * from "./vendorsListVendorCredentialFiles.js";
@@ -0,0 +1,199 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: e3ca8c943345
4
+ */
5
+
6
+ import {
7
+ QueryClient,
8
+ QueryFunctionContext,
9
+ QueryKey,
10
+ } from "@tanstack/react-query";
11
+ import { GreenSecurityCore } from "../core.js";
12
+ import { vendorsGetVendorUploadHistory } from "../funcs/vendorsGetVendorUploadHistory.js";
13
+ import { combineSignals } from "../lib/primitives.js";
14
+ import { RequestOptions } from "../lib/sdks.js";
15
+ import * as components from "../models/components/index.js";
16
+ import * as operations from "../models/operations/index.js";
17
+ import { unwrapAsync } from "../types/fp.js";
18
+ import { PageIterator, unwrapResultIterator } from "../types/operations.js";
19
+ import { pageIteratorToJSON } from "./_types.js";
20
+ export type VendorsGetVendorUploadHistoryQueryData =
21
+ operations.GetVendorUploadHistoryResponse;
22
+
23
+ export type VendorsGetVendorUploadHistoryInfiniteQueryData = PageIterator<
24
+ operations.GetVendorUploadHistoryResponse,
25
+ { page: number }
26
+ >;
27
+
28
+ export type VendorsGetVendorUploadHistoryPageParams = PageIterator<
29
+ operations.GetVendorUploadHistoryResponse,
30
+ { page: number }
31
+ >["~next"];
32
+
33
+ export function prefetchVendorsGetVendorUploadHistory(
34
+ queryClient: QueryClient,
35
+ client$: GreenSecurityCore,
36
+ request: operations.GetVendorUploadHistoryRequest,
37
+ options?: RequestOptions,
38
+ ): Promise<void> {
39
+ return queryClient.prefetchQuery({
40
+ ...buildVendorsGetVendorUploadHistoryQuery(
41
+ client$,
42
+ request,
43
+ options,
44
+ ),
45
+ });
46
+ }
47
+
48
+ export function prefetchVendorsGetVendorUploadHistoryInfinite(
49
+ queryClient: QueryClient,
50
+ client$: GreenSecurityCore,
51
+ request: operations.GetVendorUploadHistoryRequest,
52
+ options?: RequestOptions,
53
+ ): Promise<void> {
54
+ return queryClient.prefetchInfiniteQuery({
55
+ ...buildVendorsGetVendorUploadHistoryInfiniteQuery(
56
+ client$,
57
+ request,
58
+ options,
59
+ ),
60
+ initialPageParam: undefined as VendorsGetVendorUploadHistoryPageParams,
61
+ getNextPageParam: (
62
+ previousPage: VendorsGetVendorUploadHistoryInfiniteQueryData,
63
+ ) => previousPage["~next"],
64
+ });
65
+ }
66
+
67
+ export function buildVendorsGetVendorUploadHistoryQuery(
68
+ client$: GreenSecurityCore,
69
+ request: operations.GetVendorUploadHistoryRequest,
70
+ options?: RequestOptions,
71
+ ): {
72
+ queryKey: QueryKey;
73
+ queryFn: (
74
+ context: QueryFunctionContext,
75
+ ) => Promise<VendorsGetVendorUploadHistoryQueryData>;
76
+ } {
77
+ return {
78
+ queryKey: queryKeyVendorsGetVendorUploadHistory(request.vendorIdOrMe, {
79
+ sort: request.sort,
80
+ desc: request.desc,
81
+ page: request.page,
82
+ itemsPerPage: request.itemsPerPage,
83
+ }),
84
+ queryFn: async function vendorsGetVendorUploadHistoryQueryFn(
85
+ ctx,
86
+ ): Promise<VendorsGetVendorUploadHistoryQueryData> {
87
+ const sig = combineSignals(
88
+ ctx.signal,
89
+ options?.signal,
90
+ options?.fetchOptions?.signal,
91
+ );
92
+ const mergedOptions = {
93
+ ...options?.fetchOptions,
94
+ ...options,
95
+ signal: sig,
96
+ };
97
+
98
+ return unwrapAsync(vendorsGetVendorUploadHistory(
99
+ client$,
100
+ request,
101
+ mergedOptions,
102
+ ));
103
+ },
104
+ };
105
+ }
106
+
107
+ export function buildVendorsGetVendorUploadHistoryInfiniteQuery(
108
+ client$: GreenSecurityCore,
109
+ request: operations.GetVendorUploadHistoryRequest,
110
+ options?: RequestOptions,
111
+ ): {
112
+ queryKey: QueryKey;
113
+ queryFn: (
114
+ context: QueryFunctionContext<
115
+ QueryKey,
116
+ VendorsGetVendorUploadHistoryPageParams
117
+ >,
118
+ ) => Promise<VendorsGetVendorUploadHistoryInfiniteQueryData>;
119
+ } {
120
+ return {
121
+ queryKey: queryKeyVendorsGetVendorUploadHistoryInfinite(
122
+ request.vendorIdOrMe,
123
+ {
124
+ sort: request.sort,
125
+ desc: request.desc,
126
+ page: request.page,
127
+ itemsPerPage: request.itemsPerPage,
128
+ },
129
+ ),
130
+ queryFn: async function vendorsGetVendorUploadHistoryQuery(
131
+ ctx,
132
+ ): Promise<VendorsGetVendorUploadHistoryInfiniteQueryData> {
133
+ const sig = combineSignals(ctx.signal, options?.fetchOptions?.signal);
134
+ const mergedOptions = {
135
+ ...options,
136
+ fetchOptions: { ...options?.fetchOptions, signal: sig },
137
+ };
138
+
139
+ if (!ctx.pageParam) {
140
+ const pageResult = await unwrapResultIterator(
141
+ vendorsGetVendorUploadHistory(
142
+ client$,
143
+ request,
144
+ mergedOptions,
145
+ ),
146
+ );
147
+ return pageIteratorToJSON(pageResult);
148
+ }
149
+ const pageResult = await unwrapResultIterator(
150
+ vendorsGetVendorUploadHistory(
151
+ client$,
152
+ {
153
+ ...request,
154
+ page: ctx.pageParam.page,
155
+ },
156
+ mergedOptions,
157
+ ),
158
+ );
159
+ return pageIteratorToJSON(pageResult);
160
+ },
161
+ };
162
+ }
163
+
164
+ export function queryKeyVendorsGetVendorUploadHistory(
165
+ vendorIdOrMe: string,
166
+ parameters: {
167
+ sort?: string | null | undefined;
168
+ desc?: components.Desc | undefined;
169
+ page?: number | undefined;
170
+ itemsPerPage?: number | undefined;
171
+ },
172
+ ): QueryKey {
173
+ return [
174
+ "@greensecurity/javascript-sdk",
175
+ "vendors",
176
+ "getVendorUploadHistory",
177
+ vendorIdOrMe,
178
+ parameters,
179
+ ];
180
+ }
181
+
182
+ export function queryKeyVendorsGetVendorUploadHistoryInfinite(
183
+ vendorIdOrMe: string,
184
+ parameters: {
185
+ sort?: string | null | undefined;
186
+ desc?: components.Desc | undefined;
187
+ page?: number | undefined;
188
+ itemsPerPage?: number | undefined;
189
+ },
190
+ ): QueryKey {
191
+ return [
192
+ "@greensecurity/javascript-sdk",
193
+ "vendors",
194
+ "getVendorUploadHistory",
195
+ "infinite",
196
+ vendorIdOrMe,
197
+ parameters,
198
+ ];
199
+ }