@greensecurity/javascript-sdk 0.44.0-beta.13 → 0.44.0-beta.14

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 (145) hide show
  1. package/README.md +3 -0
  2. package/dist/commonjs/__tests__/organizations.test.js +29 -0
  3. package/dist/commonjs/__tests__/organizations.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 +7 -8
  7. package/dist/commonjs/__tests__/zones.test.js.map +1 -1
  8. package/dist/commonjs/admin-funcs/companyManagerGetPaymentForm.d.ts +3 -0
  9. package/dist/commonjs/admin-funcs/companyManagerGetPaymentForm.d.ts.map +1 -0
  10. package/dist/commonjs/admin-funcs/companyManagerGetPaymentForm.js +9 -0
  11. package/dist/commonjs/admin-funcs/companyManagerGetPaymentForm.js.map +1 -0
  12. package/dist/commonjs/admin-funcs/vendorGetPaymentForm.d.ts +3 -0
  13. package/dist/commonjs/admin-funcs/vendorGetPaymentForm.d.ts.map +1 -0
  14. package/dist/commonjs/admin-funcs/vendorGetPaymentForm.js +9 -0
  15. package/dist/commonjs/admin-funcs/vendorGetPaymentForm.js.map +1 -0
  16. package/dist/commonjs/funcs/organizationsListFacilityVendors.d.ts +42 -0
  17. package/dist/commonjs/funcs/organizationsListFacilityVendors.d.ts.map +1 -0
  18. package/dist/commonjs/funcs/organizationsListFacilityVendors.js +187 -0
  19. package/dist/commonjs/funcs/organizationsListFacilityVendors.js.map +1 -0
  20. package/dist/commonjs/index.extras.d.ts +8 -0
  21. package/dist/commonjs/index.extras.d.ts.map +1 -1
  22. package/dist/commonjs/index.extras.js +8 -0
  23. package/dist/commonjs/index.extras.js.map +1 -1
  24. package/dist/commonjs/lib/config.d.ts +2 -2
  25. package/dist/commonjs/lib/config.js +2 -2
  26. package/dist/commonjs/models/operations/exportcompanytargetfacilities.d.ts +4 -4
  27. package/dist/commonjs/models/operations/exportcompanytargetfacilities.d.ts.map +1 -1
  28. package/dist/commonjs/models/operations/exportcompanytargetfacilities.js +6 -4
  29. package/dist/commonjs/models/operations/exportcompanytargetfacilities.js.map +1 -1
  30. package/dist/commonjs/models/operations/index.d.ts +1 -0
  31. package/dist/commonjs/models/operations/index.d.ts.map +1 -1
  32. package/dist/commonjs/models/operations/index.js +1 -0
  33. package/dist/commonjs/models/operations/index.js.map +1 -1
  34. package/dist/commonjs/models/operations/listfacilityvendors.d.ts +162 -0
  35. package/dist/commonjs/models/operations/listfacilityvendors.d.ts.map +1 -0
  36. package/dist/commonjs/models/operations/listfacilityvendors.js +150 -0
  37. package/dist/commonjs/models/operations/listfacilityvendors.js.map +1 -0
  38. package/dist/commonjs/models/operations/listvendoradditionalfacilityfields.d.ts +4 -4
  39. package/dist/commonjs/models/operations/listvendoradditionalfacilityfields.d.ts.map +1 -1
  40. package/dist/commonjs/models/operations/listvendoradditionalfacilityfields.js +6 -7
  41. package/dist/commonjs/models/operations/listvendoradditionalfacilityfields.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/organizationsExportCompanyTargetFacilities.core.d.ts +1 -1
  47. package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.core.d.ts.map +1 -1
  48. package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.core.js.map +1 -1
  49. package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.d.ts +2 -2
  50. package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.d.ts.map +1 -1
  51. package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.js.map +1 -1
  52. package/dist/commonjs/react-query/organizationsListFacilityVendors.core.d.ts +42 -0
  53. package/dist/commonjs/react-query/organizationsListFacilityVendors.core.d.ts.map +1 -0
  54. package/dist/commonjs/react-query/organizationsListFacilityVendors.core.js +99 -0
  55. package/dist/commonjs/react-query/organizationsListFacilityVendors.core.js.map +1 -0
  56. package/dist/commonjs/react-query/organizationsListFacilityVendors.d.ts +142 -0
  57. package/dist/commonjs/react-query/organizationsListFacilityVendors.d.ts.map +1 -0
  58. package/dist/commonjs/react-query/organizationsListFacilityVendors.js +180 -0
  59. package/dist/commonjs/react-query/organizationsListFacilityVendors.js.map +1 -0
  60. package/dist/commonjs/sdk/organizations.d.ts +28 -0
  61. package/dist/commonjs/sdk/organizations.d.ts.map +1 -1
  62. package/dist/commonjs/sdk/organizations.js +29 -0
  63. package/dist/commonjs/sdk/organizations.js.map +1 -1
  64. package/dist/esm/__tests__/organizations.test.js +29 -0
  65. package/dist/esm/__tests__/organizations.test.js.map +1 -1
  66. package/dist/esm/__tests__/webhooks.test.js +1 -1
  67. package/dist/esm/__tests__/webhooks.test.js.map +1 -1
  68. package/dist/esm/__tests__/zones.test.js +7 -8
  69. package/dist/esm/__tests__/zones.test.js.map +1 -1
  70. package/dist/esm/admin-funcs/companyManagerGetPaymentForm.d.ts +3 -0
  71. package/dist/esm/admin-funcs/companyManagerGetPaymentForm.d.ts.map +1 -0
  72. package/dist/esm/admin-funcs/companyManagerGetPaymentForm.js +6 -0
  73. package/dist/esm/admin-funcs/companyManagerGetPaymentForm.js.map +1 -0
  74. package/dist/esm/admin-funcs/vendorGetPaymentForm.d.ts +3 -0
  75. package/dist/esm/admin-funcs/vendorGetPaymentForm.d.ts.map +1 -0
  76. package/dist/esm/admin-funcs/vendorGetPaymentForm.js +6 -0
  77. package/dist/esm/admin-funcs/vendorGetPaymentForm.js.map +1 -0
  78. package/dist/esm/funcs/organizationsListFacilityVendors.d.ts +42 -0
  79. package/dist/esm/funcs/organizationsListFacilityVendors.d.ts.map +1 -0
  80. package/dist/esm/funcs/organizationsListFacilityVendors.js +151 -0
  81. package/dist/esm/funcs/organizationsListFacilityVendors.js.map +1 -0
  82. package/dist/esm/index.extras.d.ts +8 -0
  83. package/dist/esm/index.extras.d.ts.map +1 -1
  84. package/dist/esm/index.extras.js +8 -0
  85. package/dist/esm/index.extras.js.map +1 -1
  86. package/dist/esm/lib/config.d.ts +2 -2
  87. package/dist/esm/lib/config.js +2 -2
  88. package/dist/esm/models/operations/exportcompanytargetfacilities.d.ts +4 -4
  89. package/dist/esm/models/operations/exportcompanytargetfacilities.d.ts.map +1 -1
  90. package/dist/esm/models/operations/exportcompanytargetfacilities.js +5 -3
  91. package/dist/esm/models/operations/exportcompanytargetfacilities.js.map +1 -1
  92. package/dist/esm/models/operations/index.d.ts +1 -0
  93. package/dist/esm/models/operations/index.d.ts.map +1 -1
  94. package/dist/esm/models/operations/index.js +1 -0
  95. package/dist/esm/models/operations/index.js.map +1 -1
  96. package/dist/esm/models/operations/listfacilityvendors.d.ts +162 -0
  97. package/dist/esm/models/operations/listfacilityvendors.d.ts.map +1 -0
  98. package/dist/esm/models/operations/listfacilityvendors.js +109 -0
  99. package/dist/esm/models/operations/listfacilityvendors.js.map +1 -0
  100. package/dist/esm/models/operations/listvendoradditionalfacilityfields.d.ts +4 -4
  101. package/dist/esm/models/operations/listvendoradditionalfacilityfields.d.ts.map +1 -1
  102. package/dist/esm/models/operations/listvendoradditionalfacilityfields.js +4 -5
  103. package/dist/esm/models/operations/listvendoradditionalfacilityfields.js.map +1 -1
  104. package/dist/esm/react-query/index.d.ts +1 -0
  105. package/dist/esm/react-query/index.d.ts.map +1 -1
  106. package/dist/esm/react-query/index.js +1 -0
  107. package/dist/esm/react-query/index.js.map +1 -1
  108. package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.d.ts +1 -1
  109. package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.d.ts.map +1 -1
  110. package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.js.map +1 -1
  111. package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.d.ts +2 -2
  112. package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.d.ts.map +1 -1
  113. package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.js.map +1 -1
  114. package/dist/esm/react-query/organizationsListFacilityVendors.core.d.ts +42 -0
  115. package/dist/esm/react-query/organizationsListFacilityVendors.core.d.ts.map +1 -0
  116. package/dist/esm/react-query/organizationsListFacilityVendors.core.js +91 -0
  117. package/dist/esm/react-query/organizationsListFacilityVendors.core.js.map +1 -0
  118. package/dist/esm/react-query/organizationsListFacilityVendors.d.ts +142 -0
  119. package/dist/esm/react-query/organizationsListFacilityVendors.d.ts.map +1 -0
  120. package/dist/esm/react-query/organizationsListFacilityVendors.js +165 -0
  121. package/dist/esm/react-query/organizationsListFacilityVendors.js.map +1 -0
  122. package/dist/esm/sdk/organizations.d.ts +28 -0
  123. package/dist/esm/sdk/organizations.d.ts.map +1 -1
  124. package/dist/esm/sdk/organizations.js +29 -0
  125. package/dist/esm/sdk/organizations.js.map +1 -1
  126. package/jsr.json +1 -1
  127. package/package.json +1 -1
  128. package/src/__tests__/organizations.test.ts +32 -0
  129. package/src/__tests__/webhooks.test.ts +1 -1
  130. package/src/__tests__/zones.test.ts +7 -8
  131. package/src/admin-funcs/companyManagerGetPaymentForm.ts +6 -0
  132. package/src/admin-funcs/vendorGetPaymentForm.ts +6 -0
  133. package/src/funcs/organizationsListFacilityVendors.ts +279 -0
  134. package/src/index.extras.ts +13 -3
  135. package/src/lib/config.ts +2 -2
  136. package/src/models/operations/exportcompanytargetfacilities.ts +10 -7
  137. package/src/models/operations/index.ts +1 -0
  138. package/src/models/operations/listfacilityvendors.ts +307 -0
  139. package/src/models/operations/listvendoradditionalfacilityfields.ts +26 -15
  140. package/src/react-query/index.ts +1 -0
  141. package/src/react-query/organizationsExportCompanyTargetFacilities.core.ts +3 -1
  142. package/src/react-query/organizationsExportCompanyTargetFacilities.ts +6 -2
  143. package/src/react-query/organizationsListFacilityVendors.core.ts +207 -0
  144. package/src/react-query/organizationsListFacilityVendors.ts +351 -0
  145. package/src/sdk/organizations.ts +39 -0
@@ -0,0 +1,6 @@
1
+ import { APIPromise } from "../types/async.js";
2
+ import { $doGetSingle, internalApiResult } from "./doAdmin.js";
3
+
4
+ export function vendorGetPaymentForm(): internalApiResult {
5
+ return new APIPromise($doGetSingle("/vendors/me/payment_form", {}));
6
+ }
@@ -0,0 +1,279 @@
1
+ /*
2
+ * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
3
+ */
4
+
5
+ import { GreenSecurityCore } from "../core.js";
6
+ import { dlv } from "../lib/dlv.js";
7
+ import { encodeFormQuery, encodeSimple } 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 { GreenSecurityError } from "../models/errors/greensecurityerror.js";
16
+ import {
17
+ ConnectionError,
18
+ InvalidRequestError,
19
+ RequestAbortedError,
20
+ RequestTimeoutError,
21
+ UnexpectedClientError,
22
+ } from "../models/errors/httpclienterrors.js";
23
+ import * as errors from "../models/errors/index.js";
24
+ import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
25
+ import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
26
+ import * as operations from "../models/operations/index.js";
27
+ import { APICall, APIPromise } from "../types/async.js";
28
+ import { Result } from "../types/fp.js";
29
+ import {
30
+ createPageIterator,
31
+ haltIterator,
32
+ PageIterator,
33
+ Paginator,
34
+ } from "../types/operations.js";
35
+
36
+ /**
37
+ * List vendors targeting a facility
38
+ *
39
+ * @remarks
40
+ * Powers the Company Portal → Facility Details page. Returns the
41
+ * paginated list of company-scoped vendor reps that are targeting the
42
+ * given facility, with each row carrying the rep's name + email, their
43
+ * last visit to this facility, their facility access status, and any
44
+ * company custom fields the company has flagged `show_to_vendor` (which
45
+ * is where the "Employee ID" column on the UI lives).
46
+ *
47
+ * Filtering: pass `status=approved|pending|denied` to scope the rows to a
48
+ * single status tab. Pass `search=<term>` for a single search box that
49
+ * matches first name, last name, full name, email, OR any visible custom
50
+ * field value (covering the "search by name / email / Employee ID"
51
+ * requirement).
52
+ *
53
+ * Access control:
54
+ * * Regular users: the URL's `:id` must be in the caller's read scope for
55
+ * Facility (resolved via `has_facility_access_policy`). Out-of-scope or
56
+ * soft-deleted facilities return `404 Facility not found`.
57
+ * * API users: must pass `company_id`. Both the company and the facility
58
+ * must be activated for the caller's marketplace app
59
+ * (`MarketplaceAppActivation`).
60
+ *
61
+ * If set, this operation will use {@link Security.bearerJwt} from the global security.
62
+ */
63
+ export function organizationsListFacilityVendors(
64
+ client: GreenSecurityCore,
65
+ request: operations.ListFacilityVendorsRequest,
66
+ options?: RequestOptions,
67
+ ): APIPromise<
68
+ PageIterator<
69
+ Result<
70
+ operations.ListFacilityVendorsResponse,
71
+ | errors.ApiErrorResponse
72
+ | GreenSecurityError
73
+ | ResponseValidationError
74
+ | ConnectionError
75
+ | RequestAbortedError
76
+ | RequestTimeoutError
77
+ | InvalidRequestError
78
+ | UnexpectedClientError
79
+ | SDKValidationError
80
+ >,
81
+ { page: number }
82
+ >
83
+ > {
84
+ return new APIPromise($do(
85
+ client,
86
+ request,
87
+ options,
88
+ ));
89
+ }
90
+
91
+ async function $do(
92
+ client: GreenSecurityCore,
93
+ request: operations.ListFacilityVendorsRequest,
94
+ options?: RequestOptions,
95
+ ): Promise<
96
+ [
97
+ PageIterator<
98
+ Result<
99
+ operations.ListFacilityVendorsResponse,
100
+ | errors.ApiErrorResponse
101
+ | GreenSecurityError
102
+ | ResponseValidationError
103
+ | ConnectionError
104
+ | RequestAbortedError
105
+ | RequestTimeoutError
106
+ | InvalidRequestError
107
+ | UnexpectedClientError
108
+ | SDKValidationError
109
+ >,
110
+ { page: number }
111
+ >,
112
+ APICall,
113
+ ]
114
+ > {
115
+ const parsed = safeParse(
116
+ request,
117
+ (value) =>
118
+ operations.ListFacilityVendorsRequest$outboundSchema.parse(value),
119
+ "Input validation failed",
120
+ );
121
+ if (!parsed.ok) {
122
+ return [haltIterator(parsed), { status: "invalid" }];
123
+ }
124
+ const payload = parsed.value;
125
+ const body = null;
126
+
127
+ const pathParams = {
128
+ id: encodeSimple("id", payload.id, {
129
+ explode: false,
130
+ charEncoding: "percent",
131
+ }),
132
+ };
133
+ const path = pathToFunc("/facilities/{id}/vendors")(pathParams);
134
+
135
+ const query = encodeFormQuery({
136
+ "company_id": payload.company_id,
137
+ "desc": payload.desc,
138
+ "items_per_page": payload.items_per_page,
139
+ "page": payload.page,
140
+ "search": payload.search,
141
+ "sort": payload.sort,
142
+ "status": payload.status,
143
+ });
144
+
145
+ const headers = new Headers(compactMap({
146
+ Accept: "application/json",
147
+ }));
148
+
149
+ const securityInput = await extractSecurity(client._options.security);
150
+ const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
151
+
152
+ const context = {
153
+ options: client._options,
154
+ baseURL: options?.serverURL ?? client._baseURL ?? "",
155
+ operationID: "listFacilityVendors",
156
+ oAuth2Scopes: null,
157
+
158
+ resolvedSecurity: requestSecurity,
159
+
160
+ securitySource: client._options.security,
161
+ retryConfig: options?.retries
162
+ || client._options.retryConfig
163
+ || { strategy: "none" },
164
+ retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
165
+ };
166
+
167
+ const requestRes = client._createRequest(context, {
168
+ security: requestSecurity,
169
+ method: "GET",
170
+ baseURL: options?.serverURL,
171
+ path: path,
172
+ headers: headers,
173
+ query: query,
174
+ body: body,
175
+ userAgent: client._options.userAgent,
176
+ timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
177
+ }, options);
178
+ if (!requestRes.ok) {
179
+ return [haltIterator(requestRes), { status: "invalid" }];
180
+ }
181
+ const req = requestRes.value;
182
+
183
+ const doResult = await client._do(req, {
184
+ context,
185
+ isErrorStatusCode: (statusCode: number) =>
186
+ matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
187
+ retryConfig: context.retryConfig,
188
+ retryCodes: context.retryCodes,
189
+ });
190
+ if (!doResult.ok) {
191
+ return [haltIterator(doResult), { status: "request-error", request: req }];
192
+ }
193
+ const response = doResult.value;
194
+
195
+ const responseFields = {
196
+ HttpMeta: { Response: response, Request: req },
197
+ };
198
+
199
+ const [result, raw] = await M.match<
200
+ operations.ListFacilityVendorsResponse,
201
+ | errors.ApiErrorResponse
202
+ | GreenSecurityError
203
+ | ResponseValidationError
204
+ | ConnectionError
205
+ | RequestAbortedError
206
+ | RequestTimeoutError
207
+ | InvalidRequestError
208
+ | UnexpectedClientError
209
+ | SDKValidationError
210
+ >(
211
+ M.json(200, operations.ListFacilityVendorsResponse$inboundSchema, {
212
+ key: "Result",
213
+ }),
214
+ M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
215
+ M.fail("4XX"),
216
+ M.fail([500, "5XX"]),
217
+ )(response, req, { extraFields: responseFields });
218
+ if (!result.ok) {
219
+ return [haltIterator(result), {
220
+ status: "complete",
221
+ request: req,
222
+ response,
223
+ }];
224
+ }
225
+
226
+ const nextFunc = (
227
+ responseData: unknown,
228
+ ): {
229
+ next: Paginator<
230
+ Result<
231
+ operations.ListFacilityVendorsResponse,
232
+ | errors.ApiErrorResponse
233
+ | GreenSecurityError
234
+ | ResponseValidationError
235
+ | ConnectionError
236
+ | RequestAbortedError
237
+ | RequestTimeoutError
238
+ | InvalidRequestError
239
+ | UnexpectedClientError
240
+ | SDKValidationError
241
+ >
242
+ >;
243
+ "~next"?: { page: number };
244
+ } => {
245
+ const page = request?.page ?? 1;
246
+ const nextPage = page + 1;
247
+
248
+ if (!responseData) {
249
+ return { next: () => null };
250
+ }
251
+ const results = dlv(responseData, "items");
252
+ if (!Array.isArray(results) || !results.length) {
253
+ return { next: () => null };
254
+ }
255
+ const limit = request?.itemsPerPage ?? 0;
256
+ if (results.length < limit) {
257
+ return { next: () => null };
258
+ }
259
+
260
+ const nextVal = () =>
261
+ organizationsListFacilityVendors(
262
+ client,
263
+ {
264
+ ...request,
265
+ page: nextPage,
266
+ },
267
+ options,
268
+ );
269
+
270
+ return { next: nextVal, "~next": { page: nextPage } };
271
+ };
272
+
273
+ const page = { ...result, ...nextFunc(raw) };
274
+ return [{ ...page, ...createPageIterator(page, (v) => !v.ok) }, {
275
+ status: "complete",
276
+ request: req,
277
+ response,
278
+ }];
279
+ }
@@ -29,10 +29,12 @@ import { submitPassword } from "./admin-funcs/registerPassword.js";
29
29
  import { submitGeneralInfo } from "./admin-funcs/registerGeneralInfo.js";
30
30
  import { submitCompany } from "./admin-funcs/registerCompanies.js";
31
31
 
32
- import {smartBadgePairBadge} from "./admin-funcs/smartBadgePairBadge.js";
33
- import {smartBadgeUnpairBadge} from "./admin-funcs/smartBadgeUnpairBadge.js";
32
+ import { smartBadgePairBadge } from "./admin-funcs/smartBadgePairBadge.js";
33
+ import { smartBadgeUnpairBadge } from "./admin-funcs/smartBadgeUnpairBadge.js";
34
34
 
35
35
  import { notifyVendorCredentialFileUploaded } from "./admin-funcs/notifyVendorCredentialFileUploaded.js";
36
+ import { companyManagerGetPaymentForm } from "./admin-funcs/companyManagerGetPaymentForm.js";
37
+ import { vendorGetPaymentForm } from "./admin-funcs/vendorGetPaymentForm.js";
36
38
 
37
39
  export const __internal = {
38
40
  getInternalCore,
@@ -74,7 +76,7 @@ export const __internal = {
74
76
  submitGeneralInfo,
75
77
  submitCompany
76
78
  },
77
-
79
+
78
80
  smartBadge: {
79
81
  pairBadge: smartBadgePairBadge,
80
82
  unpairBadge: smartBadgeUnpairBadge
@@ -82,5 +84,13 @@ export const __internal = {
82
84
 
83
85
  vendorCredentialFile: {
84
86
  notifyUploaded: notifyVendorCredentialFileUploaded
87
+ },
88
+
89
+ companyManager: {
90
+ getPaymentForm: companyManagerGetPaymentForm,
91
+ },
92
+
93
+ vendor: {
94
+ getPaymentForm: vendorGetPaymentForm,
85
95
  }
86
96
  };
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.43.5",
83
- sdkVersion: "0.44.0-beta.13",
83
+ sdkVersion: "0.44.0-beta.14",
84
84
  genVersion: "2.897.1",
85
85
  userAgent:
86
- "speakeasy-sdk/typescript 0.44.0-beta.13 2.897.1 0.43.5 @greensecurity/javascript-sdk",
86
+ "speakeasy-sdk/typescript 0.44.0-beta.14 2.897.1 0.43.5 @greensecurity/javascript-sdk",
87
87
  } as const;
@@ -14,7 +14,7 @@ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
14
14
  /**
15
15
  * Filter by link status.
16
16
  */
17
- export const QueryParamStatus = {
17
+ export const ExportCompanyTargetFacilitiesQueryParamStatus = {
18
18
  Pending: "pending",
19
19
  Approved: "approved",
20
20
  Denied: "denied",
@@ -22,7 +22,9 @@ export const QueryParamStatus = {
22
22
  /**
23
23
  * Filter by link status.
24
24
  */
25
- export type QueryParamStatus = ClosedEnum<typeof QueryParamStatus>;
25
+ export type ExportCompanyTargetFacilitiesQueryParamStatus = ClosedEnum<
26
+ typeof ExportCompanyTargetFacilitiesQueryParamStatus
27
+ >;
26
28
 
27
29
  /**
28
30
  * `true` returns only facilities the company has at least one individual targeting; `false` returns only those with none.
@@ -81,7 +83,7 @@ export type ExportCompanyTargetFacilitiesRequest = {
81
83
  /**
82
84
  * Filter by link status.
83
85
  */
84
- status?: QueryParamStatus | undefined;
86
+ status?: ExportCompanyTargetFacilitiesQueryParamStatus | undefined;
85
87
  /**
86
88
  * `true` returns only facilities the company has at least one individual targeting; `false` returns only those with none.
87
89
  */
@@ -127,9 +129,9 @@ export type ExportCompanyTargetFacilitiesResponseBody = {
127
129
  };
128
130
 
129
131
  /** @internal */
130
- export const QueryParamStatus$outboundSchema: z.ZodNativeEnum<
131
- typeof QueryParamStatus
132
- > = z.nativeEnum(QueryParamStatus);
132
+ export const ExportCompanyTargetFacilitiesQueryParamStatus$outboundSchema:
133
+ z.ZodNativeEnum<typeof ExportCompanyTargetFacilitiesQueryParamStatus> = z
134
+ .nativeEnum(ExportCompanyTargetFacilitiesQueryParamStatus);
133
135
 
134
136
  /** @internal */
135
137
  export const HasIndividual$outboundSchema: z.ZodNativeEnum<
@@ -181,7 +183,8 @@ export const ExportCompanyTargetFacilitiesRequest$outboundSchema: z.ZodType<
181
183
  ExportCompanyTargetFacilitiesRequest
182
184
  > = z.object({
183
185
  companyId: z.number().int(),
184
- status: QueryParamStatus$outboundSchema.optional(),
186
+ status: ExportCompanyTargetFacilitiesQueryParamStatus$outboundSchema
187
+ .optional(),
185
188
  hasIndividual: HasIndividual$outboundSchema.optional(),
186
189
  hasActiveIndividual: HasActiveIndividual$outboundSchema.optional(),
187
190
  facilityNameLike: z.string().optional(),
@@ -70,6 +70,7 @@ export * from "./listallwebhookendpoints.js";
70
70
  export * from "./listcompanycredentials.js";
71
71
  export * from "./listcompanycredits.js";
72
72
  export * from "./listcompanymanagers.js";
73
+ export * from "./listfacilityvendors.js";
73
74
  export * from "./listfeed.js";
74
75
  export * from "./listinvoices.js";
75
76
  export * from "./listlocations.js";
@@ -0,0 +1,307 @@
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 * as openEnums from "../../types/enums.js";
9
+ import { ClosedEnum, OpenEnum } from "../../types/enums.js";
10
+ import { Result as SafeParseResult } from "../../types/fp.js";
11
+ import * as types from "../../types/primitives.js";
12
+ import * as components from "../components/index.js";
13
+ import { SDKValidationError } from "../errors/sdkvalidationerror.js";
14
+
15
+ /**
16
+ * Filter rows to a single facility access status. Omit for "All".
17
+ */
18
+ export const QueryParamStatus = {
19
+ Approved: "approved",
20
+ Pending: "pending",
21
+ Denied: "denied",
22
+ } as const;
23
+ /**
24
+ * Filter rows to a single facility access status. Omit for "All".
25
+ */
26
+ export type QueryParamStatus = ClosedEnum<typeof QueryParamStatus>;
27
+
28
+ /**
29
+ * Sort field. Defaults to `name`.
30
+ */
31
+ export const ListFacilityVendorsQueryParamSort = {
32
+ Id: "id",
33
+ Name: "name",
34
+ LastName: "last_name",
35
+ Email: "email",
36
+ Status: "status",
37
+ } as const;
38
+ /**
39
+ * Sort field. Defaults to `name`.
40
+ */
41
+ export type ListFacilityVendorsQueryParamSort = ClosedEnum<
42
+ typeof ListFacilityVendorsQueryParamSort
43
+ >;
44
+
45
+ export type ListFacilityVendorsRequest = {
46
+ /**
47
+ * The facility whose vendor roster to list.
48
+ */
49
+ id: number;
50
+ /**
51
+ * API users only — the company whose vendors to list. Ignored for company managers / vendors (resolved from the session).
52
+ */
53
+ companyId?: number | undefined;
54
+ /**
55
+ * Filter rows to a single facility access status. Omit for "All".
56
+ */
57
+ status?: QueryParamStatus | undefined;
58
+ /**
59
+ * Single search term applied case-insensitively across first name,
60
+ *
61
+ * @remarks
62
+ * last name, full name, email, and any company custom-field value the
63
+ * vendor has set for a field flagged `show_to_vendor`.
64
+ */
65
+ search?: string | undefined;
66
+ /**
67
+ * A 1-based offset for which page to request (defaults to 1)
68
+ */
69
+ page?: number | undefined;
70
+ /**
71
+ * Number of items to show in a given page
72
+ */
73
+ itemsPerPage?: number | undefined;
74
+ /**
75
+ * Sort field. Defaults to `name`.
76
+ */
77
+ sort?: ListFacilityVendorsQueryParamSort | undefined;
78
+ /**
79
+ * Sort desc
80
+ */
81
+ desc?: components.Desc | undefined;
82
+ };
83
+
84
+ /**
85
+ * Facility access status from `target_facilities.status`.
86
+ */
87
+ export const ListFacilityVendorsStatus = {
88
+ Approved: "Approved",
89
+ Pending: "Pending",
90
+ Denied: "Denied",
91
+ } as const;
92
+ /**
93
+ * Facility access status from `target_facilities.status`.
94
+ */
95
+ export type ListFacilityVendorsStatus = OpenEnum<
96
+ typeof ListFacilityVendorsStatus
97
+ >;
98
+
99
+ export type CustomFields = {
100
+ id?: number | undefined;
101
+ name?: string | undefined;
102
+ value?: string | null | undefined;
103
+ };
104
+
105
+ export type Items = {
106
+ /**
107
+ * Vendor ID.
108
+ */
109
+ id?: number | undefined;
110
+ /**
111
+ * Vendor's full name (`first_name + last_name`).
112
+ */
113
+ name?: string | null | undefined;
114
+ /**
115
+ * Vendor's email.
116
+ */
117
+ email?: string | null | undefined;
118
+ /**
119
+ * Thumbnail URL for the vendor's head shot.
120
+ */
121
+ imageUrl?: string | null | undefined;
122
+ /**
123
+ * ISO8601 timestamp of the vendor's most recent scan at this facility, or null if they have never visited.
124
+ */
125
+ lastVisit?: string | null | undefined;
126
+ /**
127
+ * Facility access status from `target_facilities.status`.
128
+ */
129
+ status?: ListFacilityVendorsStatus | null | undefined;
130
+ /**
131
+ * Company custom fields flagged `show_to_vendor`. One entry per enabled field; `value` is null when the vendor has no value set.
132
+ */
133
+ customFields?: Array<CustomFields> | undefined;
134
+ };
135
+
136
+ /**
137
+ * The request was successful, and the server has returned the requested resource in the response body.
138
+ */
139
+ export type ListFacilityVendorsListFacilityVendorsOk = {
140
+ /**
141
+ * Pagination information for a pageable list
142
+ */
143
+ pager: components.Pager;
144
+ items: Array<Items>;
145
+ };
146
+
147
+ export type ListFacilityVendorsResponse = {
148
+ result: ListFacilityVendorsListFacilityVendorsOk;
149
+ };
150
+
151
+ /** @internal */
152
+ export const QueryParamStatus$outboundSchema: z.ZodNativeEnum<
153
+ typeof QueryParamStatus
154
+ > = z.nativeEnum(QueryParamStatus);
155
+
156
+ /** @internal */
157
+ export const ListFacilityVendorsQueryParamSort$outboundSchema: z.ZodNativeEnum<
158
+ typeof ListFacilityVendorsQueryParamSort
159
+ > = z.nativeEnum(ListFacilityVendorsQueryParamSort);
160
+
161
+ /** @internal */
162
+ export type ListFacilityVendorsRequest$Outbound = {
163
+ id: number;
164
+ company_id?: number | undefined;
165
+ status?: string | undefined;
166
+ search?: string | undefined;
167
+ page?: number | undefined;
168
+ items_per_page?: number | undefined;
169
+ sort?: string | undefined;
170
+ desc?: components.Desc$Outbound | undefined;
171
+ };
172
+
173
+ /** @internal */
174
+ export const ListFacilityVendorsRequest$outboundSchema: z.ZodType<
175
+ ListFacilityVendorsRequest$Outbound,
176
+ z.ZodTypeDef,
177
+ ListFacilityVendorsRequest
178
+ > = z.object({
179
+ id: z.number().int(),
180
+ companyId: z.number().int().optional(),
181
+ status: QueryParamStatus$outboundSchema.optional(),
182
+ search: z.string().optional(),
183
+ page: z.number().int().optional(),
184
+ itemsPerPage: z.number().int().optional(),
185
+ sort: ListFacilityVendorsQueryParamSort$outboundSchema.optional(),
186
+ desc: components.Desc$outboundSchema.optional(),
187
+ }).transform((v) => {
188
+ return remap$(v, {
189
+ companyId: "company_id",
190
+ itemsPerPage: "items_per_page",
191
+ });
192
+ });
193
+
194
+ export function listFacilityVendorsRequestToJSON(
195
+ listFacilityVendorsRequest: ListFacilityVendorsRequest,
196
+ ): string {
197
+ return JSON.stringify(
198
+ ListFacilityVendorsRequest$outboundSchema.parse(listFacilityVendorsRequest),
199
+ );
200
+ }
201
+
202
+ /** @internal */
203
+ export const ListFacilityVendorsStatus$inboundSchema: z.ZodType<
204
+ ListFacilityVendorsStatus,
205
+ z.ZodTypeDef,
206
+ unknown
207
+ > = openEnums.inboundSchema(ListFacilityVendorsStatus);
208
+
209
+ /** @internal */
210
+ export const CustomFields$inboundSchema: z.ZodType<
211
+ CustomFields,
212
+ z.ZodTypeDef,
213
+ unknown
214
+ > = z.object({
215
+ id: types.optional(types.number()),
216
+ name: types.optional(types.string()),
217
+ value: z.nullable(types.string()).optional(),
218
+ });
219
+
220
+ export function customFieldsFromJSON(
221
+ jsonString: string,
222
+ ): SafeParseResult<CustomFields, SDKValidationError> {
223
+ return safeParse(
224
+ jsonString,
225
+ (x) => CustomFields$inboundSchema.parse(JSON.parse(x)),
226
+ `Failed to parse 'CustomFields' from JSON`,
227
+ );
228
+ }
229
+
230
+ /** @internal */
231
+ export const Items$inboundSchema: z.ZodType<Items, z.ZodTypeDef, unknown> = z
232
+ .object({
233
+ id: types.optional(types.number()),
234
+ name: z.nullable(types.string()).optional(),
235
+ email: z.nullable(types.string()).optional(),
236
+ image_url: z.nullable(types.string()).optional(),
237
+ last_visit: z.nullable(types.string()).optional(),
238
+ status: z.nullable(ListFacilityVendorsStatus$inboundSchema).optional(),
239
+ custom_fields: types.optional(
240
+ z.array(z.lazy(() => CustomFields$inboundSchema)),
241
+ ),
242
+ }).transform((v) => {
243
+ return remap$(v, {
244
+ "image_url": "imageUrl",
245
+ "last_visit": "lastVisit",
246
+ "custom_fields": "customFields",
247
+ });
248
+ });
249
+
250
+ export function itemsFromJSON(
251
+ jsonString: string,
252
+ ): SafeParseResult<Items, SDKValidationError> {
253
+ return safeParse(
254
+ jsonString,
255
+ (x) => Items$inboundSchema.parse(JSON.parse(x)),
256
+ `Failed to parse 'Items' from JSON`,
257
+ );
258
+ }
259
+
260
+ /** @internal */
261
+ export const ListFacilityVendorsListFacilityVendorsOk$inboundSchema: z.ZodType<
262
+ ListFacilityVendorsListFacilityVendorsOk,
263
+ z.ZodTypeDef,
264
+ unknown
265
+ > = z.object({
266
+ pager: components.Pager$inboundSchema,
267
+ items: z.array(z.lazy(() => Items$inboundSchema)),
268
+ });
269
+
270
+ export function listFacilityVendorsListFacilityVendorsOkFromJSON(
271
+ jsonString: string,
272
+ ): SafeParseResult<
273
+ ListFacilityVendorsListFacilityVendorsOk,
274
+ SDKValidationError
275
+ > {
276
+ return safeParse(
277
+ jsonString,
278
+ (x) =>
279
+ ListFacilityVendorsListFacilityVendorsOk$inboundSchema.parse(
280
+ JSON.parse(x),
281
+ ),
282
+ `Failed to parse 'ListFacilityVendorsListFacilityVendorsOk' from JSON`,
283
+ );
284
+ }
285
+
286
+ /** @internal */
287
+ export const ListFacilityVendorsResponse$inboundSchema: z.ZodType<
288
+ ListFacilityVendorsResponse,
289
+ z.ZodTypeDef,
290
+ unknown
291
+ > = z.object({
292
+ Result: z.lazy(() => ListFacilityVendorsListFacilityVendorsOk$inboundSchema),
293
+ }).transform((v) => {
294
+ return remap$(v, {
295
+ "Result": "result",
296
+ });
297
+ });
298
+
299
+ export function listFacilityVendorsResponseFromJSON(
300
+ jsonString: string,
301
+ ): SafeParseResult<ListFacilityVendorsResponse, SDKValidationError> {
302
+ return safeParse(
303
+ jsonString,
304
+ (x) => ListFacilityVendorsResponse$inboundSchema.parse(JSON.parse(x)),
305
+ `Failed to parse 'ListFacilityVendorsResponse' from JSON`,
306
+ );
307
+ }