@greensecurity/javascript-sdk 0.43.1-beta.104 → 0.43.1-beta.107

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 (169) hide show
  1. package/FUNCTIONS.md +10 -10
  2. package/REACT_QUERY.md +6 -10
  3. package/README.md +54 -52
  4. package/dist/commonjs/__tests__/vendorfields.test.d.ts +2 -0
  5. package/dist/commonjs/__tests__/vendorfields.test.d.ts.map +1 -0
  6. package/dist/commonjs/__tests__/vendorfields.test.js +43 -0
  7. package/dist/commonjs/__tests__/vendorfields.test.js.map +1 -0
  8. package/dist/commonjs/__tests__/zones.test.js +12 -9
  9. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  10. package/dist/commonjs/funcs/usersGetCurrentUser.d.ts +4 -2
  11. package/dist/commonjs/funcs/usersGetCurrentUser.d.ts.map +1 -1
  12. package/dist/commonjs/funcs/usersGetCurrentUser.js +19 -4
  13. package/dist/commonjs/funcs/usersGetCurrentUser.js.map +1 -1
  14. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts +23 -0
  15. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -0
  16. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js +122 -0
  17. package/dist/commonjs/funcs/vendorFieldsCreateVendorField.js.map +1 -0
  18. package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.d.ts +21 -0
  19. package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.d.ts.map +1 -0
  20. package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.js +126 -0
  21. package/dist/commonjs/funcs/vendorFieldsUpdateVendorField.js.map +1 -0
  22. package/dist/commonjs/lib/config.d.ts +3 -3
  23. package/dist/commonjs/lib/config.js +3 -3
  24. package/dist/commonjs/models/components/productvariant.d.ts +10 -0
  25. package/dist/commonjs/models/components/productvariant.d.ts.map +1 -1
  26. package/dist/commonjs/models/components/productvariant.js +10 -1
  27. package/dist/commonjs/models/components/productvariant.js.map +1 -1
  28. package/dist/commonjs/models/operations/createvendorfield.d.ts +39 -0
  29. package/dist/commonjs/models/operations/createvendorfield.d.ts.map +1 -0
  30. package/dist/commonjs/models/operations/createvendorfield.js +67 -0
  31. package/dist/commonjs/models/operations/createvendorfield.js.map +1 -0
  32. package/dist/commonjs/models/operations/getcurrentuser.d.ts +16 -0
  33. package/dist/commonjs/models/operations/getcurrentuser.d.ts.map +1 -0
  34. package/dist/commonjs/models/operations/getcurrentuser.js +50 -0
  35. package/dist/commonjs/models/operations/getcurrentuser.js.map +1 -0
  36. package/dist/commonjs/models/operations/index.d.ts +3 -0
  37. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  38. package/dist/commonjs/models/operations/index.js +3 -0
  39. package/dist/commonjs/models/operations/index.js.map +1 -1
  40. package/dist/commonjs/models/operations/updatevendorfield.d.ts +49 -0
  41. package/dist/commonjs/models/operations/updatevendorfield.d.ts.map +1 -0
  42. package/dist/commonjs/models/operations/updatevendorfield.js +84 -0
  43. package/dist/commonjs/models/operations/updatevendorfield.js.map +1 -0
  44. package/dist/commonjs/react-query/index.d.ts +2 -0
  45. package/dist/commonjs/react-query/index.d.ts.map +1 -1
  46. package/dist/commonjs/react-query/index.js +2 -0
  47. package/dist/commonjs/react-query/index.js.map +1 -1
  48. package/dist/commonjs/react-query/usersGetCurrentUser.core.d.ts +6 -3
  49. package/dist/commonjs/react-query/usersGetCurrentUser.core.d.ts.map +1 -1
  50. package/dist/commonjs/react-query/usersGetCurrentUser.core.js +12 -7
  51. package/dist/commonjs/react-query/usersGetCurrentUser.core.js.map +1 -1
  52. package/dist/commonjs/react-query/usersGetCurrentUser.d.ts +17 -6
  53. package/dist/commonjs/react-query/usersGetCurrentUser.d.ts.map +1 -1
  54. package/dist/commonjs/react-query/usersGetCurrentUser.js +22 -8
  55. package/dist/commonjs/react-query/usersGetCurrentUser.js.map +1 -1
  56. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts +34 -0
  57. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -0
  58. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js +56 -0
  59. package/dist/commonjs/react-query/vendorFieldsCreateVendorField.js.map +1 -0
  60. package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.d.ts +32 -0
  61. package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.d.ts.map +1 -0
  62. package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.js +54 -0
  63. package/dist/commonjs/react-query/vendorFieldsUpdateVendorField.js.map +1 -0
  64. package/dist/commonjs/sdk/sdk.d.ts +3 -0
  65. package/dist/commonjs/sdk/sdk.d.ts.map +1 -1
  66. package/dist/commonjs/sdk/sdk.js +4 -0
  67. package/dist/commonjs/sdk/sdk.js.map +1 -1
  68. package/dist/commonjs/sdk/users.d.ts +3 -2
  69. package/dist/commonjs/sdk/users.d.ts.map +1 -1
  70. package/dist/commonjs/sdk/users.js +4 -3
  71. package/dist/commonjs/sdk/users.js.map +1 -1
  72. package/dist/commonjs/sdk/vendorfields.d.ts +27 -0
  73. package/dist/commonjs/sdk/vendorfields.d.ts.map +1 -0
  74. package/dist/commonjs/sdk/vendorfields.js +40 -0
  75. package/dist/commonjs/sdk/vendorfields.js.map +1 -0
  76. package/dist/esm/__tests__/vendorfields.test.d.ts +2 -0
  77. package/dist/esm/__tests__/vendorfields.test.d.ts.map +1 -0
  78. package/dist/esm/__tests__/vendorfields.test.js +41 -0
  79. package/dist/esm/__tests__/vendorfields.test.js.map +1 -0
  80. package/dist/esm/__tests__/zones.test.js +12 -9
  81. package/dist/esm/__tests__/zones.test.js.map +1 -1
  82. package/dist/esm/funcs/usersGetCurrentUser.d.ts +4 -2
  83. package/dist/esm/funcs/usersGetCurrentUser.d.ts.map +1 -1
  84. package/dist/esm/funcs/usersGetCurrentUser.js +19 -4
  85. package/dist/esm/funcs/usersGetCurrentUser.js.map +1 -1
  86. package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts +23 -0
  87. package/dist/esm/funcs/vendorFieldsCreateVendorField.d.ts.map +1 -0
  88. package/dist/esm/funcs/vendorFieldsCreateVendorField.js +86 -0
  89. package/dist/esm/funcs/vendorFieldsCreateVendorField.js.map +1 -0
  90. package/dist/esm/funcs/vendorFieldsUpdateVendorField.d.ts +21 -0
  91. package/dist/esm/funcs/vendorFieldsUpdateVendorField.d.ts.map +1 -0
  92. package/dist/esm/funcs/vendorFieldsUpdateVendorField.js +90 -0
  93. package/dist/esm/funcs/vendorFieldsUpdateVendorField.js.map +1 -0
  94. package/dist/esm/lib/config.d.ts +3 -3
  95. package/dist/esm/lib/config.js +3 -3
  96. package/dist/esm/models/components/productvariant.d.ts +10 -0
  97. package/dist/esm/models/components/productvariant.d.ts.map +1 -1
  98. package/dist/esm/models/components/productvariant.js +9 -0
  99. package/dist/esm/models/components/productvariant.js.map +1 -1
  100. package/dist/esm/models/operations/createvendorfield.d.ts +39 -0
  101. package/dist/esm/models/operations/createvendorfield.d.ts.map +1 -0
  102. package/dist/esm/models/operations/createvendorfield.js +29 -0
  103. package/dist/esm/models/operations/createvendorfield.js.map +1 -0
  104. package/dist/esm/models/operations/getcurrentuser.d.ts +16 -0
  105. package/dist/esm/models/operations/getcurrentuser.d.ts.map +1 -0
  106. package/dist/esm/models/operations/getcurrentuser.js +13 -0
  107. package/dist/esm/models/operations/getcurrentuser.js.map +1 -0
  108. package/dist/esm/models/operations/index.d.ts +3 -0
  109. package/dist/esm/models/operations/index.d.ts.map +1 -1
  110. package/dist/esm/models/operations/index.js +3 -0
  111. package/dist/esm/models/operations/index.js.map +1 -1
  112. package/dist/esm/models/operations/updatevendorfield.d.ts +49 -0
  113. package/dist/esm/models/operations/updatevendorfield.d.ts.map +1 -0
  114. package/dist/esm/models/operations/updatevendorfield.js +45 -0
  115. package/dist/esm/models/operations/updatevendorfield.js.map +1 -0
  116. package/dist/esm/react-query/index.d.ts +2 -0
  117. package/dist/esm/react-query/index.d.ts.map +1 -1
  118. package/dist/esm/react-query/index.js +2 -0
  119. package/dist/esm/react-query/index.js.map +1 -1
  120. package/dist/esm/react-query/usersGetCurrentUser.core.d.ts +6 -3
  121. package/dist/esm/react-query/usersGetCurrentUser.core.d.ts.map +1 -1
  122. package/dist/esm/react-query/usersGetCurrentUser.core.js +12 -7
  123. package/dist/esm/react-query/usersGetCurrentUser.core.js.map +1 -1
  124. package/dist/esm/react-query/usersGetCurrentUser.d.ts +17 -6
  125. package/dist/esm/react-query/usersGetCurrentUser.d.ts.map +1 -1
  126. package/dist/esm/react-query/usersGetCurrentUser.js +21 -8
  127. package/dist/esm/react-query/usersGetCurrentUser.js.map +1 -1
  128. package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts +34 -0
  129. package/dist/esm/react-query/vendorFieldsCreateVendorField.d.ts.map +1 -0
  130. package/dist/esm/react-query/vendorFieldsCreateVendorField.js +51 -0
  131. package/dist/esm/react-query/vendorFieldsCreateVendorField.js.map +1 -0
  132. package/dist/esm/react-query/vendorFieldsUpdateVendorField.d.ts +32 -0
  133. package/dist/esm/react-query/vendorFieldsUpdateVendorField.d.ts.map +1 -0
  134. package/dist/esm/react-query/vendorFieldsUpdateVendorField.js +49 -0
  135. package/dist/esm/react-query/vendorFieldsUpdateVendorField.js.map +1 -0
  136. package/dist/esm/sdk/sdk.d.ts +3 -0
  137. package/dist/esm/sdk/sdk.d.ts.map +1 -1
  138. package/dist/esm/sdk/sdk.js +4 -0
  139. package/dist/esm/sdk/sdk.js.map +1 -1
  140. package/dist/esm/sdk/users.d.ts +3 -2
  141. package/dist/esm/sdk/users.d.ts.map +1 -1
  142. package/dist/esm/sdk/users.js +4 -3
  143. package/dist/esm/sdk/users.js.map +1 -1
  144. package/dist/esm/sdk/vendorfields.d.ts +27 -0
  145. package/dist/esm/sdk/vendorfields.d.ts.map +1 -0
  146. package/dist/esm/sdk/vendorfields.js +36 -0
  147. package/dist/esm/sdk/vendorfields.js.map +1 -0
  148. package/examples/{vendorsCreateVendorRegistration.example.ts → vendorFieldsCreateVendorField.example.ts} +9 -9
  149. package/jsr.json +1 -1
  150. package/package.json +1 -1
  151. package/src/__tests__/vendorfields.test.ts +47 -0
  152. package/src/__tests__/zones.test.ts +12 -9
  153. package/src/funcs/usersGetCurrentUser.ts +25 -1
  154. package/src/funcs/vendorFieldsCreateVendorField.ts +174 -0
  155. package/src/funcs/vendorFieldsUpdateVendorField.ts +177 -0
  156. package/src/lib/config.ts +3 -3
  157. package/src/models/components/productvariant.ts +18 -0
  158. package/src/models/operations/createvendorfield.ts +87 -0
  159. package/src/models/operations/getcurrentuser.ts +35 -0
  160. package/src/models/operations/index.ts +3 -0
  161. package/src/models/operations/updatevendorfield.ts +122 -0
  162. package/src/react-query/index.ts +2 -0
  163. package/src/react-query/usersGetCurrentUser.core.ts +15 -3
  164. package/src/react-query/usersGetCurrentUser.ts +35 -4
  165. package/src/react-query/vendorFieldsCreateVendorField.ts +120 -0
  166. package/src/react-query/vendorFieldsUpdateVendorField.ts +118 -0
  167. package/src/sdk/sdk.ts +6 -0
  168. package/src/sdk/users.ts +4 -1
  169. package/src/sdk/vendorfields.ts +53 -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 { GreenSecurityError } from "../models/errors/greensecurityerror.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 { ResponseValidationError } from "../models/errors/responsevalidationerror.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
+ * Create vendor field
30
+ *
31
+ * @remarks
32
+ * Create a new vendor field for a company. The name can only be set on creation;
33
+ * once created, only the show_to_vendor flag can be updated via PATCH.
34
+ * Requires access to the company (company manager, admin, or API user with company scope).
35
+ *
36
+ * For API users: source_user_id is required. The API user acts on behalf of that user
37
+ * (e.g. a company manager). The app must be activated for that user via MarketplaceAppActivation.
38
+ */
39
+ export function vendorFieldsCreateVendorField(
40
+ client: GreenSecurityCore,
41
+ request: operations.CreateVendorFieldRequestBody,
42
+ options?: RequestOptions,
43
+ ): APIPromise<
44
+ Result<
45
+ operations.CreateVendorFieldResponseBody,
46
+ | errors.ApiErrorResponse
47
+ | GreenSecurityError
48
+ | ResponseValidationError
49
+ | ConnectionError
50
+ | RequestAbortedError
51
+ | RequestTimeoutError
52
+ | InvalidRequestError
53
+ | UnexpectedClientError
54
+ | SDKValidationError
55
+ >
56
+ > {
57
+ return new APIPromise($do(
58
+ client,
59
+ request,
60
+ options,
61
+ ));
62
+ }
63
+
64
+ async function $do(
65
+ client: GreenSecurityCore,
66
+ request: operations.CreateVendorFieldRequestBody,
67
+ options?: RequestOptions,
68
+ ): Promise<
69
+ [
70
+ Result<
71
+ operations.CreateVendorFieldResponseBody,
72
+ | errors.ApiErrorResponse
73
+ | GreenSecurityError
74
+ | ResponseValidationError
75
+ | ConnectionError
76
+ | RequestAbortedError
77
+ | RequestTimeoutError
78
+ | InvalidRequestError
79
+ | UnexpectedClientError
80
+ | SDKValidationError
81
+ >,
82
+ APICall,
83
+ ]
84
+ > {
85
+ const parsed = safeParse(
86
+ request,
87
+ (value) =>
88
+ operations.CreateVendorFieldRequestBody$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("/vendor-fields")();
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: "createVendorField",
111
+ oAuth2Scopes: null,
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", "422", "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.CreateVendorFieldResponseBody,
154
+ | errors.ApiErrorResponse
155
+ | GreenSecurityError
156
+ | ResponseValidationError
157
+ | ConnectionError
158
+ | RequestAbortedError
159
+ | RequestTimeoutError
160
+ | InvalidRequestError
161
+ | UnexpectedClientError
162
+ | SDKValidationError
163
+ >(
164
+ M.json(201, operations.CreateVendorFieldResponseBody$inboundSchema),
165
+ M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
166
+ M.fail("4XX"),
167
+ M.fail([500, "5XX"]),
168
+ )(response, req, { 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,177 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { encodeJSON, 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 { GreenSecurityError } from "../models/errors/greensecurityerror.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 { ResponseValidationError } from "../models/errors/responsevalidationerror.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 vendor field
30
+ *
31
+ * @remarks
32
+ * Update a vendor field. Only the show_to_vendor flag can be changed;
33
+ * the name cannot be modified after creation.
34
+ *
35
+ * For API users: source_user_id is required. The API user acts on behalf of that user.
36
+ */
37
+ export function vendorFieldsUpdateVendorField(
38
+ client: GreenSecurityCore,
39
+ request: operations.UpdateVendorFieldRequest,
40
+ options?: RequestOptions,
41
+ ): APIPromise<
42
+ Result<
43
+ operations.UpdateVendorFieldResponseBody,
44
+ | errors.ApiErrorResponse
45
+ | GreenSecurityError
46
+ | ResponseValidationError
47
+ | ConnectionError
48
+ | RequestAbortedError
49
+ | RequestTimeoutError
50
+ | InvalidRequestError
51
+ | UnexpectedClientError
52
+ | SDKValidationError
53
+ >
54
+ > {
55
+ return new APIPromise($do(
56
+ client,
57
+ request,
58
+ options,
59
+ ));
60
+ }
61
+
62
+ async function $do(
63
+ client: GreenSecurityCore,
64
+ request: operations.UpdateVendorFieldRequest,
65
+ options?: RequestOptions,
66
+ ): Promise<
67
+ [
68
+ Result<
69
+ operations.UpdateVendorFieldResponseBody,
70
+ | errors.ApiErrorResponse
71
+ | GreenSecurityError
72
+ | ResponseValidationError
73
+ | ConnectionError
74
+ | RequestAbortedError
75
+ | RequestTimeoutError
76
+ | InvalidRequestError
77
+ | UnexpectedClientError
78
+ | SDKValidationError
79
+ >,
80
+ APICall,
81
+ ]
82
+ > {
83
+ const parsed = safeParse(
84
+ request,
85
+ (value) => operations.UpdateVendorFieldRequest$outboundSchema.parse(value),
86
+ "Input validation failed",
87
+ );
88
+ if (!parsed.ok) {
89
+ return [parsed, { status: "invalid" }];
90
+ }
91
+ const payload = parsed.value;
92
+ const body = encodeJSON("body", payload.RequestBody, { explode: true });
93
+
94
+ const pathParams = {
95
+ id: encodeSimple("id", payload.id, {
96
+ explode: false,
97
+ charEncoding: "percent",
98
+ }),
99
+ };
100
+ const path = pathToFunc("/vendor-fields/{id}")(pathParams);
101
+
102
+ const headers = new Headers(compactMap({
103
+ "Content-Type": "application/json",
104
+ Accept: "application/json",
105
+ }));
106
+
107
+ const securityInput = await extractSecurity(client._options.security);
108
+ const requestSecurity = resolveGlobalSecurity(securityInput);
109
+
110
+ const context = {
111
+ options: client._options,
112
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
113
+ operationID: "updateVendorField",
114
+ oAuth2Scopes: null,
115
+
116
+ resolvedSecurity: requestSecurity,
117
+
118
+ securitySource: client._options.security,
119
+ retryConfig: options?.retries
120
+ || client._options.retryConfig
121
+ || { strategy: "none" },
122
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
123
+ };
124
+
125
+ const requestRes = client._createRequest(context, {
126
+ security: requestSecurity,
127
+ method: "PATCH",
128
+ baseURL: options?.serverURL,
129
+ path: path,
130
+ headers: headers,
131
+ body: body,
132
+ userAgent: client._options.userAgent,
133
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
134
+ }, options);
135
+ if (!requestRes.ok) {
136
+ return [requestRes, { status: "invalid" }];
137
+ }
138
+ const req = requestRes.value;
139
+
140
+ const doResult = await client._do(req, {
141
+ context,
142
+ errorCodes: ["400", "401", "403", "404", "422", "4XX", "500", "5XX"],
143
+ retryConfig: context.retryConfig,
144
+ retryCodes: context.retryCodes,
145
+ });
146
+ if (!doResult.ok) {
147
+ return [doResult, { status: "request-error", request: req }];
148
+ }
149
+ const response = doResult.value;
150
+
151
+ const responseFields = {
152
+ HttpMeta: { Response: response, Request: req },
153
+ };
154
+
155
+ const [result] = await M.match<
156
+ operations.UpdateVendorFieldResponseBody,
157
+ | errors.ApiErrorResponse
158
+ | GreenSecurityError
159
+ | ResponseValidationError
160
+ | ConnectionError
161
+ | RequestAbortedError
162
+ | RequestTimeoutError
163
+ | InvalidRequestError
164
+ | UnexpectedClientError
165
+ | SDKValidationError
166
+ >(
167
+ M.json(200, operations.UpdateVendorFieldResponseBody$inboundSchema),
168
+ M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
169
+ M.fail("4XX"),
170
+ M.fail([500, "5XX"]),
171
+ )(response, req, { extraFields: responseFields });
172
+ if (!result.ok) {
173
+ return [result, { status: "complete", request: req, response }];
174
+ }
175
+
176
+ return [result, { status: "complete", request: req, response }];
177
+ }
package/src/lib/config.ts CHANGED
@@ -80,8 +80,8 @@ export function serverURLFromOptions(options: SDKOptions): URL | null {
80
80
  export const SDK_METADATA = {
81
81
  language: "typescript",
82
82
  openapiDocVersion: "0.0.11",
83
- sdkVersion: "0.43.1-beta.102",
84
- genVersion: "2.869.23",
83
+ sdkVersion: "0.43.1-beta.106",
84
+ genVersion: "2.869.25",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.43.1-beta.102 2.869.23 0.0.11 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.43.1-beta.106 2.869.25 0.0.11 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -4,10 +4,19 @@
4
4
 
5
5
  import * as z from "zod/v3";
6
6
  import { safeParse } from "../../lib/schemas.js";
7
+ import * as openEnums from "../../types/enums.js";
8
+ import { OpenEnum } from "../../types/enums.js";
7
9
  import { Result as SafeParseResult } from "../../types/fp.js";
8
10
  import * as types from "../../types/primitives.js";
9
11
  import { SDKValidationError } from "../errors/sdkvalidationerror.js";
10
12
 
13
+ export const Recurrence = {
14
+ Monthly: "monthly",
15
+ Yearly: "yearly",
16
+ Once: "once",
17
+ } as const;
18
+ export type Recurrence = OpenEnum<typeof Recurrence>;
19
+
11
20
  /**
12
21
  * Reduced list of attributes of Variant record
13
22
  */
@@ -15,8 +24,16 @@ export type ProductVariant = {
15
24
  id?: number | undefined;
16
25
  price?: number | undefined;
17
26
  title?: string | null | undefined;
27
+ recurrence?: Recurrence | null | undefined;
18
28
  };
19
29
 
30
+ /** @internal */
31
+ export const Recurrence$inboundSchema: z.ZodType<
32
+ Recurrence,
33
+ z.ZodTypeDef,
34
+ unknown
35
+ > = openEnums.inboundSchema(Recurrence);
36
+
20
37
  /** @internal */
21
38
  export const ProductVariant$inboundSchema: z.ZodType<
22
39
  ProductVariant,
@@ -26,6 +43,7 @@ export const ProductVariant$inboundSchema: z.ZodType<
26
43
  id: types.optional(types.number()),
27
44
  price: types.optional(types.number()),
28
45
  title: z.nullable(types.string()).optional(),
46
+ recurrence: z.nullable(Recurrence$inboundSchema).optional(),
29
47
  });
30
48
 
31
49
  export function productVariantFromJSON(
@@ -0,0 +1,87 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export type CreateVendorFieldRequestBody = {
13
+ /**
14
+ * The company ID for this vendor field
15
+ */
16
+ companyId: number;
17
+ /**
18
+ * Display name for the vendor field
19
+ */
20
+ name: string;
21
+ /**
22
+ * Required for API users. The user ID to act on behalf of (e.g. company manager).
23
+ *
24
+ * @remarks
25
+ * The marketplace app must be activated for this user.
26
+ */
27
+ sourceUserId?: number | undefined;
28
+ };
29
+
30
+ /**
31
+ * The vendor field was created successfully.
32
+ */
33
+ export type CreateVendorFieldResponseBody = {
34
+ id?: number | undefined;
35
+ };
36
+
37
+ /** @internal */
38
+ export type CreateVendorFieldRequestBody$Outbound = {
39
+ company_id: number;
40
+ name: string;
41
+ source_user_id?: number | undefined;
42
+ };
43
+
44
+ /** @internal */
45
+ export const CreateVendorFieldRequestBody$outboundSchema: z.ZodType<
46
+ CreateVendorFieldRequestBody$Outbound,
47
+ z.ZodTypeDef,
48
+ CreateVendorFieldRequestBody
49
+ > = z.object({
50
+ companyId: z.number().int(),
51
+ name: z.string(),
52
+ sourceUserId: z.number().int().optional(),
53
+ }).transform((v) => {
54
+ return remap$(v, {
55
+ companyId: "company_id",
56
+ sourceUserId: "source_user_id",
57
+ });
58
+ });
59
+
60
+ export function createVendorFieldRequestBodyToJSON(
61
+ createVendorFieldRequestBody: CreateVendorFieldRequestBody,
62
+ ): string {
63
+ return JSON.stringify(
64
+ CreateVendorFieldRequestBody$outboundSchema.parse(
65
+ createVendorFieldRequestBody,
66
+ ),
67
+ );
68
+ }
69
+
70
+ /** @internal */
71
+ export const CreateVendorFieldResponseBody$inboundSchema: z.ZodType<
72
+ CreateVendorFieldResponseBody,
73
+ z.ZodTypeDef,
74
+ unknown
75
+ > = z.object({
76
+ id: types.optional(types.number()),
77
+ });
78
+
79
+ export function createVendorFieldResponseBodyFromJSON(
80
+ jsonString: string,
81
+ ): SafeParseResult<CreateVendorFieldResponseBody, SDKValidationError> {
82
+ return safeParse(
83
+ jsonString,
84
+ (x) => CreateVendorFieldResponseBody$inboundSchema.parse(JSON.parse(x)),
85
+ `Failed to parse 'CreateVendorFieldResponseBody' from JSON`,
86
+ );
87
+ }
@@ -0,0 +1,35 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import * as components from "../components/index.js";
7
+
8
+ export type GetCurrentUserRequest = {
9
+ /**
10
+ * An array-style parameter to identify which sections of an object to expand. See documentation for the endpoint for a list of valid expansion values.
11
+ */
12
+ expand?: Array<components.Expand> | undefined;
13
+ };
14
+
15
+ /** @internal */
16
+ export type GetCurrentUserRequest$Outbound = {
17
+ expand?: Array<string> | undefined;
18
+ };
19
+
20
+ /** @internal */
21
+ export const GetCurrentUserRequest$outboundSchema: z.ZodType<
22
+ GetCurrentUserRequest$Outbound,
23
+ z.ZodTypeDef,
24
+ GetCurrentUserRequest
25
+ > = z.object({
26
+ expand: z.array(components.Expand$outboundSchema).optional(),
27
+ });
28
+
29
+ export function getCurrentUserRequestToJSON(
30
+ getCurrentUserRequest: GetCurrentUserRequest,
31
+ ): string {
32
+ return JSON.stringify(
33
+ GetCurrentUserRequest$outboundSchema.parse(getCurrentUserRequest),
34
+ );
35
+ }
@@ -17,6 +17,7 @@ export * from "./createinvoice.js";
17
17
  export * from "./createnewvendorcredentialversion.js";
18
18
  export * from "./createorupdatebcr.js";
19
19
  export * from "./createvendorcompany.js";
20
+ export * from "./createvendorfield.js";
20
21
  export * from "./createvendorregistration.js";
21
22
  export * from "./declineinvitation.js";
22
23
  export * from "./declinevendorcredential.js";
@@ -28,6 +29,7 @@ export * from "./deletevendormanagedbycompany.js";
28
29
  export * from "./downloadinvoicesexport.js";
29
30
  export * from "./expeditetimeremaining.js";
30
31
  export * from "./getcompany.js";
32
+ export * from "./getcurrentuser.js";
31
33
  export * from "./getfacility.js";
32
34
  export * from "./getfhirconfig.js";
33
35
  export * from "./getinvoicesexportstatus.js";
@@ -99,6 +101,7 @@ export * from "./updateuseralerts.js";
99
101
  export * from "./updatevendorcredentialdata.js";
100
102
  export * from "./updatevendorcredentialfile.js";
101
103
  export * from "./updatevendordetails.js";
104
+ export * from "./updatevendorfield.js";
102
105
  export * from "./updatevendormanagedbycompany.js";
103
106
  export * from "./updatevendorscrubdetails.js";
104
107
  export * from "./vendorscanout.js";
@@ -0,0 +1,122 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import * as z from "zod/v3";
6
+ import { remap as remap$ } from "../../lib/primitives.js";
7
+ import { safeParse } from "../../lib/schemas.js";
8
+ import { Result as SafeParseResult } from "../../types/fp.js";
9
+ import * as types from "../../types/primitives.js";
10
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
11
+
12
+ export type UpdateVendorFieldRequestBody = {
13
+ /**
14
+ * Whether to show this field to vendors
15
+ */
16
+ showToVendor: boolean;
17
+ /**
18
+ * Required for API users. The user ID to act on behalf of.
19
+ *
20
+ * @remarks
21
+ */
22
+ sourceUserId?: number | undefined;
23
+ };
24
+
25
+ export type UpdateVendorFieldRequest = {
26
+ /**
27
+ * The identifier of the object
28
+ */
29
+ id: number;
30
+ requestBody: UpdateVendorFieldRequestBody;
31
+ };
32
+
33
+ /**
34
+ * The vendor field was updated successfully.
35
+ */
36
+ export type UpdateVendorFieldResponseBody = {
37
+ id?: number | undefined;
38
+ showToVendor?: boolean | undefined;
39
+ };
40
+
41
+ /** @internal */
42
+ export type UpdateVendorFieldRequestBody$Outbound = {
43
+ show_to_vendor: boolean;
44
+ source_user_id?: number | undefined;
45
+ };
46
+
47
+ /** @internal */
48
+ export const UpdateVendorFieldRequestBody$outboundSchema: z.ZodType<
49
+ UpdateVendorFieldRequestBody$Outbound,
50
+ z.ZodTypeDef,
51
+ UpdateVendorFieldRequestBody
52
+ > = z.object({
53
+ showToVendor: z.boolean(),
54
+ sourceUserId: z.number().int().optional(),
55
+ }).transform((v) => {
56
+ return remap$(v, {
57
+ showToVendor: "show_to_vendor",
58
+ sourceUserId: "source_user_id",
59
+ });
60
+ });
61
+
62
+ export function updateVendorFieldRequestBodyToJSON(
63
+ updateVendorFieldRequestBody: UpdateVendorFieldRequestBody,
64
+ ): string {
65
+ return JSON.stringify(
66
+ UpdateVendorFieldRequestBody$outboundSchema.parse(
67
+ updateVendorFieldRequestBody,
68
+ ),
69
+ );
70
+ }
71
+
72
+ /** @internal */
73
+ export type UpdateVendorFieldRequest$Outbound = {
74
+ id: number;
75
+ RequestBody: UpdateVendorFieldRequestBody$Outbound;
76
+ };
77
+
78
+ /** @internal */
79
+ export const UpdateVendorFieldRequest$outboundSchema: z.ZodType<
80
+ UpdateVendorFieldRequest$Outbound,
81
+ z.ZodTypeDef,
82
+ UpdateVendorFieldRequest
83
+ > = z.object({
84
+ id: z.number().int(),
85
+ requestBody: z.lazy(() => UpdateVendorFieldRequestBody$outboundSchema),
86
+ }).transform((v) => {
87
+ return remap$(v, {
88
+ requestBody: "RequestBody",
89
+ });
90
+ });
91
+
92
+ export function updateVendorFieldRequestToJSON(
93
+ updateVendorFieldRequest: UpdateVendorFieldRequest,
94
+ ): string {
95
+ return JSON.stringify(
96
+ UpdateVendorFieldRequest$outboundSchema.parse(updateVendorFieldRequest),
97
+ );
98
+ }
99
+
100
+ /** @internal */
101
+ export const UpdateVendorFieldResponseBody$inboundSchema: z.ZodType<
102
+ UpdateVendorFieldResponseBody,
103
+ z.ZodTypeDef,
104
+ unknown
105
+ > = z.object({
106
+ id: types.optional(types.number()),
107
+ show_to_vendor: types.optional(types.boolean()),
108
+ }).transform((v) => {
109
+ return remap$(v, {
110
+ "show_to_vendor": "showToVendor",
111
+ });
112
+ });
113
+
114
+ export function updateVendorFieldResponseBodyFromJSON(
115
+ jsonString: string,
116
+ ): SafeParseResult<UpdateVendorFieldResponseBody, SDKValidationError> {
117
+ return safeParse(
118
+ jsonString,
119
+ (x) => UpdateVendorFieldResponseBody$inboundSchema.parse(JSON.parse(x)),
120
+ `Failed to parse 'UpdateVendorFieldResponseBody' from JSON`,
121
+ );
122
+ }
@@ -54,6 +54,8 @@ export * from "./usersPasswordResetRequest.js";
54
54
  export * from "./usersPostAuthenticate.js";
55
55
  export * from "./usersRotateApiKey.js";
56
56
  export * from "./usersSwitchAccount.js";
57
+ export * from "./vendorFieldsCreateVendorField.js";
58
+ export * from "./vendorFieldsUpdateVendorField.js";
57
59
  export * from "./vendorsAcceptVendorCredential.js";
58
60
  export * from "./vendorsAddVendorCredentialFile.js";
59
61
  export * from "./vendorsAddVendorManagedByCompany.js";