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

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 (122) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/vendors.test.js +24 -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 +2 -30
  7. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  8. package/dist/commonjs/admin-funcs/notifyVendorCredentialFileUploaded.d.ts +3 -0
  9. package/dist/commonjs/admin-funcs/notifyVendorCredentialFileUploaded.d.ts.map +1 -0
  10. package/dist/commonjs/admin-funcs/notifyVendorCredentialFileUploaded.js +9 -0
  11. package/dist/commonjs/admin-funcs/notifyVendorCredentialFileUploaded.js.map +1 -0
  12. package/dist/commonjs/funcs/vendorsAddVendorCredentialFileForAutoClassification.d.ts +26 -0
  13. package/dist/commonjs/funcs/vendorsAddVendorCredentialFileForAutoClassification.d.ts.map +1 -0
  14. package/dist/commonjs/funcs/vendorsAddVendorCredentialFileForAutoClassification.js +135 -0
  15. package/dist/commonjs/funcs/vendorsAddVendorCredentialFileForAutoClassification.js.map +1 -0
  16. package/dist/commonjs/index.extras.d.ts +4 -0
  17. package/dist/commonjs/index.extras.d.ts.map +1 -1
  18. package/dist/commonjs/index.extras.js +4 -0
  19. package/dist/commonjs/index.extras.js.map +1 -1
  20. package/dist/commonjs/lib/config.d.ts +2 -2
  21. package/dist/commonjs/lib/config.js +2 -2
  22. package/dist/commonjs/models/components/index.d.ts +2 -0
  23. package/dist/commonjs/models/components/index.d.ts.map +1 -1
  24. package/dist/commonjs/models/components/index.js +2 -0
  25. package/dist/commonjs/models/components/index.js.map +1 -1
  26. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationok.d.ts +22 -0
  27. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationok.d.ts.map +1 -0
  28. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationok.js +62 -0
  29. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationok.js.map +1 -0
  30. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationrequest.d.ts +20 -0
  31. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationrequest.d.ts.map +1 -0
  32. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationrequest.js +56 -0
  33. package/dist/commonjs/models/components/vendorcredentialfileforautoclassificationrequest.js.map +1 -0
  34. package/dist/commonjs/models/operations/addvendorcredentialfileforautoclassification.d.ts +24 -0
  35. package/dist/commonjs/models/operations/addvendorcredentialfileforautoclassification.d.ts.map +1 -0
  36. package/dist/commonjs/models/operations/addvendorcredentialfileforautoclassification.js +59 -0
  37. package/dist/commonjs/models/operations/addvendorcredentialfileforautoclassification.js.map +1 -0
  38. package/dist/commonjs/models/operations/index.d.ts +1 -0
  39. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  40. package/dist/commonjs/models/operations/index.js +1 -0
  41. package/dist/commonjs/models/operations/index.js.map +1 -1
  42. package/dist/commonjs/react-query/index.d.ts +1 -0
  43. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  44. package/dist/commonjs/react-query/index.js +1 -0
  45. package/dist/commonjs/react-query/index.js.map +1 -1
  46. package/dist/commonjs/react-query/vendorsAddVendorCredentialFileForAutoClassification.d.ts +35 -0
  47. package/dist/commonjs/react-query/vendorsAddVendorCredentialFileForAutoClassification.d.ts.map +1 -0
  48. package/dist/commonjs/react-query/vendorsAddVendorCredentialFileForAutoClassification.js +57 -0
  49. package/dist/commonjs/react-query/vendorsAddVendorCredentialFileForAutoClassification.js.map +1 -0
  50. package/dist/commonjs/sdk/vendors.d.ts +12 -0
  51. package/dist/commonjs/sdk/vendors.d.ts.map +1 -1
  52. package/dist/commonjs/sdk/vendors.js +15 -0
  53. package/dist/commonjs/sdk/vendors.js.map +1 -1
  54. package/dist/esm/__tests__/vendors.test.js +24 -0
  55. package/dist/esm/__tests__/vendors.test.js.map +1 -1
  56. package/dist/esm/__tests__/webhooks.test.js +1 -1
  57. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  58. package/dist/esm/__tests__/zones.test.js +2 -30
  59. package/dist/esm/__tests__/zones.test.js.map +1 -1
  60. package/dist/esm/admin-funcs/notifyVendorCredentialFileUploaded.d.ts +3 -0
  61. package/dist/esm/admin-funcs/notifyVendorCredentialFileUploaded.d.ts.map +1 -0
  62. package/dist/esm/admin-funcs/notifyVendorCredentialFileUploaded.js +6 -0
  63. package/dist/esm/admin-funcs/notifyVendorCredentialFileUploaded.js.map +1 -0
  64. package/dist/esm/funcs/vendorsAddVendorCredentialFileForAutoClassification.d.ts +26 -0
  65. package/dist/esm/funcs/vendorsAddVendorCredentialFileForAutoClassification.d.ts.map +1 -0
  66. package/dist/esm/funcs/vendorsAddVendorCredentialFileForAutoClassification.js +99 -0
  67. package/dist/esm/funcs/vendorsAddVendorCredentialFileForAutoClassification.js.map +1 -0
  68. package/dist/esm/index.extras.d.ts +4 -0
  69. package/dist/esm/index.extras.d.ts.map +1 -1
  70. package/dist/esm/index.extras.js +4 -0
  71. package/dist/esm/index.extras.js.map +1 -1
  72. package/dist/esm/lib/config.d.ts +2 -2
  73. package/dist/esm/lib/config.js +2 -2
  74. package/dist/esm/models/components/index.d.ts +2 -0
  75. package/dist/esm/models/components/index.d.ts.map +1 -1
  76. package/dist/esm/models/components/index.js +2 -0
  77. package/dist/esm/models/components/index.js.map +1 -1
  78. package/dist/esm/models/components/vendorcredentialfileforautoclassificationok.d.ts +22 -0
  79. package/dist/esm/models/components/vendorcredentialfileforautoclassificationok.d.ts.map +1 -0
  80. package/dist/esm/models/components/vendorcredentialfileforautoclassificationok.js +25 -0
  81. package/dist/esm/models/components/vendorcredentialfileforautoclassificationok.js.map +1 -0
  82. package/dist/esm/models/components/vendorcredentialfileforautoclassificationrequest.d.ts +20 -0
  83. package/dist/esm/models/components/vendorcredentialfileforautoclassificationrequest.d.ts.map +1 -0
  84. package/dist/esm/models/components/vendorcredentialfileforautoclassificationrequest.js +19 -0
  85. package/dist/esm/models/components/vendorcredentialfileforautoclassificationrequest.js.map +1 -0
  86. package/dist/esm/models/operations/addvendorcredentialfileforautoclassification.d.ts +24 -0
  87. package/dist/esm/models/operations/addvendorcredentialfileforautoclassification.d.ts.map +1 -0
  88. package/dist/esm/models/operations/addvendorcredentialfileforautoclassification.js +22 -0
  89. package/dist/esm/models/operations/addvendorcredentialfileforautoclassification.js.map +1 -0
  90. package/dist/esm/models/operations/index.d.ts +1 -0
  91. package/dist/esm/models/operations/index.d.ts.map +1 -1
  92. package/dist/esm/models/operations/index.js +1 -0
  93. package/dist/esm/models/operations/index.js.map +1 -1
  94. package/dist/esm/react-query/index.d.ts +1 -0
  95. package/dist/esm/react-query/index.d.ts.map +1 -1
  96. package/dist/esm/react-query/index.js +1 -0
  97. package/dist/esm/react-query/index.js.map +1 -1
  98. package/dist/esm/react-query/vendorsAddVendorCredentialFileForAutoClassification.d.ts +35 -0
  99. package/dist/esm/react-query/vendorsAddVendorCredentialFileForAutoClassification.d.ts.map +1 -0
  100. package/dist/esm/react-query/vendorsAddVendorCredentialFileForAutoClassification.js +52 -0
  101. package/dist/esm/react-query/vendorsAddVendorCredentialFileForAutoClassification.js.map +1 -0
  102. package/dist/esm/sdk/vendors.d.ts +12 -0
  103. package/dist/esm/sdk/vendors.d.ts.map +1 -1
  104. package/dist/esm/sdk/vendors.js +15 -0
  105. package/dist/esm/sdk/vendors.js.map +1 -1
  106. package/jsr.json +1 -1
  107. package/package.json +1 -1
  108. package/src/__tests__/vendors.test.ts +29 -0
  109. package/src/__tests__/webhooks.test.ts +1 -1
  110. package/src/__tests__/zones.test.ts +2 -30
  111. package/src/admin-funcs/notifyVendorCredentialFileUploaded.ts +11 -0
  112. package/src/funcs/vendorsAddVendorCredentialFileForAutoClassification.ts +197 -0
  113. package/src/index.extras.ts +6 -0
  114. package/src/lib/config.ts +2 -2
  115. package/src/models/components/index.ts +2 -0
  116. package/src/models/components/vendorcredentialfileforautoclassificationok.ts +62 -0
  117. package/src/models/components/vendorcredentialfileforautoclassificationrequest.ts +50 -0
  118. package/src/models/operations/addvendorcredentialfileforautoclassification.ts +60 -0
  119. package/src/models/operations/index.ts +1 -0
  120. package/src/react-query/index.ts +1 -0
  121. package/src/react-query/vendorsAddVendorCredentialFileForAutoClassification.ts +131 -0
  122. package/src/sdk/vendors.ts +23 -0
@@ -0,0 +1,197 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: d99fb25efd2a
4
+ */
5
+
6
+ import { GreenSecurityCore } from "../core.js";
7
+ import { encodeJSON, encodeSimple } from "../lib/encodings.js";
8
+ import { matchStatusCode } from "../lib/http.js";
9
+ import * as M from "../lib/matchers.js";
10
+ import { compactMap } from "../lib/primitives.js";
11
+ import { safeParse } from "../lib/schemas.js";
12
+ import { RequestOptions } from "../lib/sdks.js";
13
+ import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
14
+ import { pathToFunc } from "../lib/url.js";
15
+ import * as components from "../models/components/index.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
+
31
+ /**
32
+ * Get a one-time URL for uploading a credential file for automatic classification (Emerald vendors only)
33
+ *
34
+ * @remarks
35
+ * This endpoint allows vendors on the Emerald plan to upload a series of
36
+ * documents and have them automatically ingested and routed to the proper
37
+ * credential. The endpoint will return a one-time-use URL where the file
38
+ * must be uploaded. Green Security will process the file asynchronously.
39
+ *
40
+ * Non-Emerald vendors must use `addVendorCredentialFile` instead.
41
+ *
42
+ * If set, this operation will use {@link Security.bearerJwt} from the global security.
43
+ */
44
+ export function vendorsAddVendorCredentialFileForAutoClassification(
45
+ client: GreenSecurityCore,
46
+ request: operations.AddVendorCredentialFileForAutoClassificationRequest,
47
+ options?: RequestOptions,
48
+ ): APIPromise<
49
+ Result<
50
+ components.VendorCredentialFileForAutoClassificationOk,
51
+ | errors.ApiErrorResponse
52
+ | GreenSecurityError
53
+ | ResponseValidationError
54
+ | ConnectionError
55
+ | RequestAbortedError
56
+ | RequestTimeoutError
57
+ | InvalidRequestError
58
+ | UnexpectedClientError
59
+ | SDKValidationError
60
+ >
61
+ > {
62
+ return new APIPromise($do(
63
+ client,
64
+ request,
65
+ options,
66
+ ));
67
+ }
68
+
69
+ async function $do(
70
+ client: GreenSecurityCore,
71
+ request: operations.AddVendorCredentialFileForAutoClassificationRequest,
72
+ options?: RequestOptions,
73
+ ): Promise<
74
+ [
75
+ Result<
76
+ components.VendorCredentialFileForAutoClassificationOk,
77
+ | errors.ApiErrorResponse
78
+ | GreenSecurityError
79
+ | ResponseValidationError
80
+ | ConnectionError
81
+ | RequestAbortedError
82
+ | RequestTimeoutError
83
+ | InvalidRequestError
84
+ | UnexpectedClientError
85
+ | SDKValidationError
86
+ >,
87
+ APICall,
88
+ ]
89
+ > {
90
+ const parsed = safeParse(
91
+ request,
92
+ (value) =>
93
+ operations
94
+ .AddVendorCredentialFileForAutoClassificationRequest$outboundSchema
95
+ .parse(value),
96
+ "Input validation failed",
97
+ );
98
+ if (!parsed.ok) {
99
+ return [parsed, { status: "invalid" }];
100
+ }
101
+ const payload = parsed.value;
102
+ const body = encodeJSON(
103
+ "body",
104
+ payload.VendorCredentialFileForAutoClassificationRequest,
105
+ { explode: true },
106
+ );
107
+
108
+ const pathParams = {
109
+ vendor_id_or_me: encodeSimple("vendor_id_or_me", payload.vendor_id_or_me, {
110
+ explode: false,
111
+ charEncoding: "percent",
112
+ }),
113
+ };
114
+ const path = pathToFunc("/vendors/{vendor_id_or_me}/credentials/files")(
115
+ pathParams,
116
+ );
117
+
118
+ const headers = new Headers(compactMap({
119
+ "Content-Type": "application/json",
120
+ Accept: "application/json",
121
+ }));
122
+
123
+ const securityInput = await extractSecurity(client._options.security);
124
+ const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
125
+
126
+ const context = {
127
+ options: client._options,
128
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
129
+ operationID: "addVendorCredentialFileForAutoClassification",
130
+ oAuth2Scopes: null,
131
+
132
+ resolvedSecurity: requestSecurity,
133
+
134
+ securitySource: client._options.security,
135
+ retryConfig: options?.retries
136
+ || client._options.retryConfig
137
+ || { strategy: "none" },
138
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
139
+ };
140
+
141
+ const requestRes = client._createRequest(context, {
142
+ security: requestSecurity,
143
+ method: "POST",
144
+ baseURL: options?.serverURL,
145
+ path: path,
146
+ headers: headers,
147
+ body: body,
148
+ userAgent: client._options.userAgent,
149
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
150
+ }, options);
151
+ if (!requestRes.ok) {
152
+ return [requestRes, { status: "invalid" }];
153
+ }
154
+ const req = requestRes.value;
155
+
156
+ const doResult = await client._do(req, {
157
+ context,
158
+ isErrorStatusCode: (statusCode: number) =>
159
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
160
+ retryConfig: context.retryConfig,
161
+ retryCodes: context.retryCodes,
162
+ });
163
+ if (!doResult.ok) {
164
+ return [doResult, { status: "request-error", request: req }];
165
+ }
166
+ const response = doResult.value;
167
+
168
+ const responseFields = {
169
+ HttpMeta: { Response: response, Request: req },
170
+ };
171
+
172
+ const [result] = await M.match<
173
+ components.VendorCredentialFileForAutoClassificationOk,
174
+ | errors.ApiErrorResponse
175
+ | GreenSecurityError
176
+ | ResponseValidationError
177
+ | ConnectionError
178
+ | RequestAbortedError
179
+ | RequestTimeoutError
180
+ | InvalidRequestError
181
+ | UnexpectedClientError
182
+ | SDKValidationError
183
+ >(
184
+ M.json(
185
+ 200,
186
+ components.VendorCredentialFileForAutoClassificationOk$inboundSchema,
187
+ ),
188
+ M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
189
+ M.fail("4XX"),
190
+ M.fail([500, "5XX"]),
191
+ )(response, req, { extraFields: responseFields });
192
+ if (!result.ok) {
193
+ return [result, { status: "complete", request: req, response }];
194
+ }
195
+
196
+ return [result, { status: "complete", request: req, response }];
197
+ }
@@ -32,6 +32,8 @@ import { submitCompany } from "./admin-funcs/registerCompanies.js";
32
32
  import {smartBadgePairBadge} from "./admin-funcs/smartBadgePairBadge.js";
33
33
  import {smartBadgeUnpairBadge} from "./admin-funcs/smartBadgeUnpairBadge.js";
34
34
 
35
+ import { notifyVendorCredentialFileUploaded } from "./admin-funcs/notifyVendorCredentialFileUploaded.js";
36
+
35
37
  export const __internal = {
36
38
  getInternalCore,
37
39
  initializeInternalCore,
@@ -76,5 +78,9 @@ export const __internal = {
76
78
  smartBadge: {
77
79
  pairBadge: smartBadgePairBadge,
78
80
  unpairBadge: smartBadgeUnpairBadge
81
+ },
82
+
83
+ vendorCredentialFile: {
84
+ notifyUploaded: notifyVendorCredentialFileUploaded
79
85
  }
80
86
  };
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.136",
84
+ sdkVersion: "0.43.1-beta.137",
85
85
  genVersion: "2.882.0",
86
86
  userAgent:
87
- "speakeasy-sdk/typescript 0.43.1-beta.136 2.882.0 0.0.11 @greensecurity/javascript-sdk",
87
+ "speakeasy-sdk/typescript 0.43.1-beta.137 2.882.0 0.0.11 @greensecurity/javascript-sdk",
88
88
  } as const;
@@ -73,6 +73,8 @@ export * from "./usersummary.js";
73
73
  export * from "./vendor.js";
74
74
  export * from "./vendorcredentialdatarequest.js";
75
75
  export * from "./vendorcredentialfile.js";
76
+ export * from "./vendorcredentialfileforautoclassificationok.js";
77
+ export * from "./vendorcredentialfileforautoclassificationrequest.js";
76
78
  export * from "./vendorcredentialscontainer.js";
77
79
  export * from "./vendorcredentialsummary.js";
78
80
  export * from "./vendorcustomfields.js";
@@ -0,0 +1,62 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: f91cc5a07bf0
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 VendorCredentialFileForAutoClassificationOk = {
14
+ success: boolean;
15
+ /**
16
+ * ID of the placeholder VendorCredential row.
17
+ */
18
+ vendorCredentialId: number;
19
+ /**
20
+ * ID of the paired VendorCredentialFile row.
21
+ */
22
+ vendorCredentialFileId: number;
23
+ /**
24
+ * Short-lived presigned PUT URL. Client uploads file body here.
25
+ */
26
+ presignedUrl: string;
27
+ };
28
+
29
+ /** @internal */
30
+ export const VendorCredentialFileForAutoClassificationOk$inboundSchema:
31
+ z.ZodType<
32
+ VendorCredentialFileForAutoClassificationOk,
33
+ z.ZodTypeDef,
34
+ unknown
35
+ > = z.object({
36
+ success: types.boolean(),
37
+ vendor_credential_id: types.number(),
38
+ vendor_credential_file_id: types.number(),
39
+ presigned_url: types.string(),
40
+ }).transform((v) => {
41
+ return remap$(v, {
42
+ "vendor_credential_id": "vendorCredentialId",
43
+ "vendor_credential_file_id": "vendorCredentialFileId",
44
+ "presigned_url": "presignedUrl",
45
+ });
46
+ });
47
+
48
+ export function vendorCredentialFileForAutoClassificationOkFromJSON(
49
+ jsonString: string,
50
+ ): SafeParseResult<
51
+ VendorCredentialFileForAutoClassificationOk,
52
+ SDKValidationError
53
+ > {
54
+ return safeParse(
55
+ jsonString,
56
+ (x) =>
57
+ VendorCredentialFileForAutoClassificationOk$inboundSchema.parse(
58
+ JSON.parse(x),
59
+ ),
60
+ `Failed to parse 'VendorCredentialFileForAutoClassificationOk' from JSON`,
61
+ );
62
+ }
@@ -0,0 +1,50 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 6d6bc55fb921
4
+ */
5
+
6
+ import * as z from "zod/v3";
7
+ import { remap as remap$ } from "../../lib/primitives.js";
8
+
9
+ export type VendorCredentialFileForAutoClassificationRequest = {
10
+ /**
11
+ * Original filename of the file the user is uploading.
12
+ */
13
+ filename: string;
14
+ /**
15
+ * MIME type. Defaults server-side to application/octet-stream.
16
+ */
17
+ contentType?: string | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export type VendorCredentialFileForAutoClassificationRequest$Outbound = {
22
+ filename: string;
23
+ content_type?: string | undefined;
24
+ };
25
+
26
+ /** @internal */
27
+ export const VendorCredentialFileForAutoClassificationRequest$outboundSchema:
28
+ z.ZodType<
29
+ VendorCredentialFileForAutoClassificationRequest$Outbound,
30
+ z.ZodTypeDef,
31
+ VendorCredentialFileForAutoClassificationRequest
32
+ > = z.object({
33
+ filename: z.string(),
34
+ contentType: z.string().optional(),
35
+ }).transform((v) => {
36
+ return remap$(v, {
37
+ contentType: "content_type",
38
+ });
39
+ });
40
+
41
+ export function vendorCredentialFileForAutoClassificationRequestToJSON(
42
+ vendorCredentialFileForAutoClassificationRequest:
43
+ VendorCredentialFileForAutoClassificationRequest,
44
+ ): string {
45
+ return JSON.stringify(
46
+ VendorCredentialFileForAutoClassificationRequest$outboundSchema.parse(
47
+ vendorCredentialFileForAutoClassificationRequest,
48
+ ),
49
+ );
50
+ }
@@ -0,0 +1,60 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: 56f8c3748c86
4
+ */
5
+
6
+ import * as z from "zod/v3";
7
+ import { remap as remap$ } from "../../lib/primitives.js";
8
+ import * as components from "../components/index.js";
9
+
10
+ export type AddVendorCredentialFileForAutoClassificationRequest = {
11
+ /**
12
+ * Vendor identifier. Depending on the endpoint, accepts one or more of:
13
+ *
14
+ * @remarks
15
+ * - A numeric vendor ID (positive integer, e.g. `42`)
16
+ * - The keyword `me` to represent the authenticated vendor
17
+ * - An active QR code (alphanumeric, hyphen-separated, e.g. `ABC-123-DEF`) —
18
+ * supported only on endpoints that explicitly document QR-code lookup
19
+ */
20
+ vendorIdOrMe: string;
21
+ vendorCredentialFileForAutoClassificationRequest:
22
+ components.VendorCredentialFileForAutoClassificationRequest;
23
+ };
24
+
25
+ /** @internal */
26
+ export type AddVendorCredentialFileForAutoClassificationRequest$Outbound = {
27
+ vendor_id_or_me: string;
28
+ VendorCredentialFileForAutoClassificationRequest:
29
+ components.VendorCredentialFileForAutoClassificationRequest$Outbound;
30
+ };
31
+
32
+ /** @internal */
33
+ export const AddVendorCredentialFileForAutoClassificationRequest$outboundSchema:
34
+ z.ZodType<
35
+ AddVendorCredentialFileForAutoClassificationRequest$Outbound,
36
+ z.ZodTypeDef,
37
+ AddVendorCredentialFileForAutoClassificationRequest
38
+ > = z.object({
39
+ vendorIdOrMe: z.string(),
40
+ vendorCredentialFileForAutoClassificationRequest:
41
+ components
42
+ .VendorCredentialFileForAutoClassificationRequest$outboundSchema,
43
+ }).transform((v) => {
44
+ return remap$(v, {
45
+ vendorIdOrMe: "vendor_id_or_me",
46
+ vendorCredentialFileForAutoClassificationRequest:
47
+ "VendorCredentialFileForAutoClassificationRequest",
48
+ });
49
+ });
50
+
51
+ export function addVendorCredentialFileForAutoClassificationRequestToJSON(
52
+ addVendorCredentialFileForAutoClassificationRequest:
53
+ AddVendorCredentialFileForAutoClassificationRequest,
54
+ ): string {
55
+ return JSON.stringify(
56
+ AddVendorCredentialFileForAutoClassificationRequest$outboundSchema.parse(
57
+ addVendorCredentialFileForAutoClassificationRequest,
58
+ ),
59
+ );
60
+ }
@@ -9,6 +9,7 @@ export * from "./addcompanymanager.js";
9
9
  export * from "./adddatarequestfile.js";
10
10
  export * from "./addmobiledevice.js";
11
11
  export * from "./addvendorcredentialfile.js";
12
+ export * from "./addvendorcredentialfileforautoclassification.js";
12
13
  export * from "./addvendormanagedbycompany.js";
13
14
  export * from "./calculatesubscriptionprice.js";
14
15
  export * from "./cancelhandoff.js";
@@ -67,6 +67,7 @@ export * from "./vendorFieldsCreateVendorField.js";
67
67
  export * from "./vendorFieldsUpdateVendorField.js";
68
68
  export * from "./vendorsAcceptVendorCredential.js";
69
69
  export * from "./vendorsAddVendorCredentialFile.js";
70
+ export * from "./vendorsAddVendorCredentialFileForAutoClassification.js";
70
71
  export * from "./vendorsAddVendorManagedByCompany.js";
71
72
  export * from "./vendorsCalculateSubscriptionPrice.js";
72
73
  export * from "./vendorsCancelHandoff.js";
@@ -0,0 +1,131 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ * @generated-id: d4372147bc16
4
+ */
5
+
6
+ import {
7
+ MutationKey,
8
+ useMutation,
9
+ UseMutationResult,
10
+ } from "@tanstack/react-query";
11
+ import { GreenSecurityCore } from "../core.js";
12
+ import { vendorsAddVendorCredentialFileForAutoClassification } from "../funcs/vendorsAddVendorCredentialFileForAutoClassification.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 { 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 { unwrapAsync } from "../types/fp.js";
29
+ import { useGreenSecurityContext } from "./_context.js";
30
+ import { MutationHookOptions } from "./_types.js";
31
+
32
+ export type VendorsAddVendorCredentialFileForAutoClassificationMutationVariables =
33
+ {
34
+ request: operations.AddVendorCredentialFileForAutoClassificationRequest;
35
+ options?: RequestOptions;
36
+ };
37
+
38
+ export type VendorsAddVendorCredentialFileForAutoClassificationMutationData =
39
+ components.VendorCredentialFileForAutoClassificationOk;
40
+
41
+ export type VendorsAddVendorCredentialFileForAutoClassificationMutationError =
42
+ | errors.ApiErrorResponse
43
+ | GreenSecurityError
44
+ | ResponseValidationError
45
+ | ConnectionError
46
+ | RequestAbortedError
47
+ | RequestTimeoutError
48
+ | InvalidRequestError
49
+ | UnexpectedClientError
50
+ | SDKValidationError;
51
+
52
+ /**
53
+ * Get a one-time URL for uploading a credential file for automatic classification (Emerald vendors only)
54
+ *
55
+ * @remarks
56
+ * This endpoint allows vendors on the Emerald plan to upload a series of
57
+ * documents and have them automatically ingested and routed to the proper
58
+ * credential. The endpoint will return a one-time-use URL where the file
59
+ * must be uploaded. Green Security will process the file asynchronously.
60
+ *
61
+ * Non-Emerald vendors must use `addVendorCredentialFile` instead.
62
+ */
63
+ export function useVendorsAddVendorCredentialFileForAutoClassificationMutation(
64
+ options?: MutationHookOptions<
65
+ VendorsAddVendorCredentialFileForAutoClassificationMutationData,
66
+ VendorsAddVendorCredentialFileForAutoClassificationMutationError,
67
+ VendorsAddVendorCredentialFileForAutoClassificationMutationVariables
68
+ >,
69
+ ): UseMutationResult<
70
+ VendorsAddVendorCredentialFileForAutoClassificationMutationData,
71
+ VendorsAddVendorCredentialFileForAutoClassificationMutationError,
72
+ VendorsAddVendorCredentialFileForAutoClassificationMutationVariables
73
+ > {
74
+ const client = useGreenSecurityContext();
75
+ return useMutation({
76
+ ...buildVendorsAddVendorCredentialFileForAutoClassificationMutation(
77
+ client,
78
+ options,
79
+ ),
80
+ ...options,
81
+ });
82
+ }
83
+
84
+ export function mutationKeyVendorsAddVendorCredentialFileForAutoClassification(): MutationKey {
85
+ return [
86
+ "@greensecurity/javascript-sdk",
87
+ "vendors",
88
+ "addVendorCredentialFileForAutoClassification",
89
+ ];
90
+ }
91
+
92
+ export function buildVendorsAddVendorCredentialFileForAutoClassificationMutation(
93
+ client$: GreenSecurityCore,
94
+ hookOptions?: RequestOptions,
95
+ ): {
96
+ mutationKey: MutationKey;
97
+ mutationFn: (
98
+ variables:
99
+ VendorsAddVendorCredentialFileForAutoClassificationMutationVariables,
100
+ ) => Promise<VendorsAddVendorCredentialFileForAutoClassificationMutationData>;
101
+ } {
102
+ return {
103
+ mutationKey:
104
+ mutationKeyVendorsAddVendorCredentialFileForAutoClassification(),
105
+ mutationFn:
106
+ function vendorsAddVendorCredentialFileForAutoClassificationMutationFn({
107
+ request,
108
+ options,
109
+ }): Promise<
110
+ VendorsAddVendorCredentialFileForAutoClassificationMutationData
111
+ > {
112
+ const mergedOptions = {
113
+ ...hookOptions,
114
+ ...options,
115
+ fetchOptions: {
116
+ ...hookOptions?.fetchOptions,
117
+ ...options?.fetchOptions,
118
+ signal: combineSignals(
119
+ hookOptions?.fetchOptions?.signal,
120
+ options?.fetchOptions?.signal,
121
+ ),
122
+ },
123
+ };
124
+ return unwrapAsync(vendorsAddVendorCredentialFileForAutoClassification(
125
+ client$,
126
+ request,
127
+ mergedOptions,
128
+ ));
129
+ },
130
+ };
131
+ }
@@ -5,6 +5,7 @@
5
5
 
6
6
  import { vendorsAcceptVendorCredential } from "../funcs/vendorsAcceptVendorCredential.js";
7
7
  import { vendorsAddVendorCredentialFile } from "../funcs/vendorsAddVendorCredentialFile.js";
8
+ import { vendorsAddVendorCredentialFileForAutoClassification } from "../funcs/vendorsAddVendorCredentialFileForAutoClassification.js";
8
9
  import { vendorsAddVendorManagedByCompany } from "../funcs/vendorsAddVendorManagedByCompany.js";
9
10
  import { vendorsCalculateSubscriptionPrice } from "../funcs/vendorsCalculateSubscriptionPrice.js";
10
11
  import { vendorsCancelHandoff } from "../funcs/vendorsCancelHandoff.js";
@@ -1084,4 +1085,26 @@ export class Vendors extends ClientSDK {
1084
1085
  options,
1085
1086
  ));
1086
1087
  }
1088
+
1089
+ /**
1090
+ * Get a one-time URL for uploading a credential file for automatic classification (Emerald vendors only)
1091
+ *
1092
+ * @remarks
1093
+ * This endpoint allows vendors on the Emerald plan to upload a series of
1094
+ * documents and have them automatically ingested and routed to the proper
1095
+ * credential. The endpoint will return a one-time-use URL where the file
1096
+ * must be uploaded. Green Security will process the file asynchronously.
1097
+ *
1098
+ * Non-Emerald vendors must use `addVendorCredentialFile` instead.
1099
+ */
1100
+ async addVendorCredentialFileForAutoClassification(
1101
+ request: operations.AddVendorCredentialFileForAutoClassificationRequest,
1102
+ options?: RequestOptions,
1103
+ ): Promise<components.VendorCredentialFileForAutoClassificationOk> {
1104
+ return unwrapAsync(vendorsAddVendorCredentialFileForAutoClassification(
1105
+ this,
1106
+ request,
1107
+ options,
1108
+ ));
1109
+ }
1087
1110
  }