@greensecurity/javascript-sdk 0.44.0-beta.18 → 0.44.0-beta.19
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.
- package/README.md +9 -0
- package/dist/commonjs/__tests__/organizations.test.js +57 -0
- package/dist/commonjs/__tests__/organizations.test.js.map +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js +1 -1
- package/dist/commonjs/__tests__/webhooks.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +27 -6
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/organizationsDownloadFacilityVendorsExport.d.ts +22 -0
- package/dist/commonjs/funcs/organizationsDownloadFacilityVendorsExport.d.ts.map +1 -0
- package/dist/commonjs/funcs/organizationsDownloadFacilityVendorsExport.js +132 -0
- package/dist/commonjs/funcs/organizationsDownloadFacilityVendorsExport.js.map +1 -0
- package/dist/commonjs/funcs/organizationsExportFacilityVendors.d.ts +34 -0
- package/dist/commonjs/funcs/organizationsExportFacilityVendors.d.ts.map +1 -0
- package/dist/commonjs/funcs/organizationsExportFacilityVendors.js +148 -0
- package/dist/commonjs/funcs/organizationsExportFacilityVendors.js.map +1 -0
- package/dist/commonjs/funcs/organizationsGetFacilityVendorsExportStatus.d.ts +22 -0
- package/dist/commonjs/funcs/organizationsGetFacilityVendorsExportStatus.d.ts.map +1 -0
- package/dist/commonjs/funcs/organizationsGetFacilityVendorsExportStatus.js +131 -0
- package/dist/commonjs/funcs/organizationsGetFacilityVendorsExportStatus.js.map +1 -0
- package/dist/commonjs/lib/config.d.ts +2 -2
- package/dist/commonjs/lib/config.js +2 -2
- package/dist/commonjs/models/components/csvexportstatusresponse.d.ts +43 -0
- package/dist/commonjs/models/components/csvexportstatusresponse.d.ts.map +1 -0
- package/dist/commonjs/models/components/csvexportstatusresponse.js +65 -0
- package/dist/commonjs/models/components/csvexportstatusresponse.js.map +1 -0
- package/dist/commonjs/models/components/index.d.ts +1 -0
- package/dist/commonjs/models/components/index.d.ts.map +1 -1
- package/dist/commonjs/models/components/index.js +1 -0
- package/dist/commonjs/models/components/index.js.map +1 -1
- package/dist/commonjs/models/operations/downloadfacilityvendorsexport.d.ts +47 -0
- package/dist/commonjs/models/operations/downloadfacilityvendorsexport.d.ts.map +1 -0
- package/dist/commonjs/models/operations/downloadfacilityvendorsexport.js +80 -0
- package/dist/commonjs/models/operations/downloadfacilityvendorsexport.js.map +1 -0
- package/dist/commonjs/models/operations/exportfacilityvendors.d.ts +118 -0
- package/dist/commonjs/models/operations/exportfacilityvendors.d.ts.map +1 -0
- package/dist/commonjs/models/operations/exportfacilityvendors.js +115 -0
- package/dist/commonjs/models/operations/exportfacilityvendors.js.map +1 -0
- package/dist/commonjs/models/operations/getfacilityvendorsexportstatus.d.ts +20 -0
- package/dist/commonjs/models/operations/getfacilityvendorsexportstatus.d.ts.map +1 -0
- package/dist/commonjs/models/operations/getfacilityvendorsexportstatus.js +55 -0
- package/dist/commonjs/models/operations/getfacilityvendorsexportstatus.js.map +1 -0
- package/dist/commonjs/models/operations/index.d.ts +3 -0
- package/dist/commonjs/models/operations/index.d.ts.map +1 -1
- package/dist/commonjs/models/operations/index.js +3 -0
- package/dist/commonjs/models/operations/index.js.map +1 -1
- package/dist/commonjs/react-query/index.d.ts +3 -0
- package/dist/commonjs/react-query/index.d.ts.map +1 -1
- package/dist/commonjs/react-query/index.js +3 -0
- package/dist/commonjs/react-query/index.js.map +1 -1
- package/dist/commonjs/react-query/organizationsDownloadFacilityVendorsExport.core.d.ts +12 -0
- package/dist/commonjs/react-query/organizationsDownloadFacilityVendorsExport.core.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsDownloadFacilityVendorsExport.core.js +40 -0
- package/dist/commonjs/react-query/organizationsDownloadFacilityVendorsExport.core.js.map +1 -0
- package/dist/commonjs/react-query/organizationsDownloadFacilityVendorsExport.d.ts +33 -0
- package/dist/commonjs/react-query/organizationsDownloadFacilityVendorsExport.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsDownloadFacilityVendorsExport.js +73 -0
- package/dist/commonjs/react-query/organizationsDownloadFacilityVendorsExport.js.map +1 -0
- package/dist/commonjs/react-query/organizationsExportFacilityVendors.core.d.ts +19 -0
- package/dist/commonjs/react-query/organizationsExportFacilityVendors.core.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsExportFacilityVendors.core.js +47 -0
- package/dist/commonjs/react-query/organizationsExportFacilityVendors.core.js.map +1 -0
- package/dist/commonjs/react-query/organizationsExportFacilityVendors.d.ts +77 -0
- package/dist/commonjs/react-query/organizationsExportFacilityVendors.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsExportFacilityVendors.js +97 -0
- package/dist/commonjs/react-query/organizationsExportFacilityVendors.js.map +1 -0
- package/dist/commonjs/react-query/organizationsGetFacilityVendorsExportStatus.core.d.ts +13 -0
- package/dist/commonjs/react-query/organizationsGetFacilityVendorsExportStatus.core.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsGetFacilityVendorsExportStatus.core.js +40 -0
- package/dist/commonjs/react-query/organizationsGetFacilityVendorsExportStatus.core.js.map +1 -0
- package/dist/commonjs/react-query/organizationsGetFacilityVendorsExportStatus.d.ts +31 -0
- package/dist/commonjs/react-query/organizationsGetFacilityVendorsExportStatus.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsGetFacilityVendorsExportStatus.js +71 -0
- package/dist/commonjs/react-query/organizationsGetFacilityVendorsExportStatus.js.map +1 -0
- package/dist/commonjs/sdk/organizations.d.ts +38 -0
- package/dist/commonjs/sdk/organizations.d.ts.map +1 -1
- package/dist/commonjs/sdk/organizations.js +47 -0
- package/dist/commonjs/sdk/organizations.js.map +1 -1
- package/dist/esm/__tests__/organizations.test.js +57 -0
- package/dist/esm/__tests__/organizations.test.js.map +1 -1
- package/dist/esm/__tests__/webhooks.test.js +1 -1
- package/dist/esm/__tests__/webhooks.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +27 -6
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/organizationsDownloadFacilityVendorsExport.d.ts +22 -0
- package/dist/esm/funcs/organizationsDownloadFacilityVendorsExport.d.ts.map +1 -0
- package/dist/esm/funcs/organizationsDownloadFacilityVendorsExport.js +96 -0
- package/dist/esm/funcs/organizationsDownloadFacilityVendorsExport.js.map +1 -0
- package/dist/esm/funcs/organizationsExportFacilityVendors.d.ts +34 -0
- package/dist/esm/funcs/organizationsExportFacilityVendors.d.ts.map +1 -0
- package/dist/esm/funcs/organizationsExportFacilityVendors.js +112 -0
- package/dist/esm/funcs/organizationsExportFacilityVendors.js.map +1 -0
- package/dist/esm/funcs/organizationsGetFacilityVendorsExportStatus.d.ts +22 -0
- package/dist/esm/funcs/organizationsGetFacilityVendorsExportStatus.d.ts.map +1 -0
- package/dist/esm/funcs/organizationsGetFacilityVendorsExportStatus.js +95 -0
- package/dist/esm/funcs/organizationsGetFacilityVendorsExportStatus.js.map +1 -0
- package/dist/esm/lib/config.d.ts +2 -2
- package/dist/esm/lib/config.js +2 -2
- package/dist/esm/models/components/csvexportstatusresponse.d.ts +43 -0
- package/dist/esm/models/components/csvexportstatusresponse.d.ts.map +1 -0
- package/dist/esm/models/components/csvexportstatusresponse.js +28 -0
- package/dist/esm/models/components/csvexportstatusresponse.js.map +1 -0
- package/dist/esm/models/components/index.d.ts +1 -0
- package/dist/esm/models/components/index.d.ts.map +1 -1
- package/dist/esm/models/components/index.js +1 -0
- package/dist/esm/models/components/index.js.map +1 -1
- package/dist/esm/models/operations/downloadfacilityvendorsexport.d.ts +47 -0
- package/dist/esm/models/operations/downloadfacilityvendorsexport.d.ts.map +1 -0
- package/dist/esm/models/operations/downloadfacilityvendorsexport.js +41 -0
- package/dist/esm/models/operations/downloadfacilityvendorsexport.js.map +1 -0
- package/dist/esm/models/operations/exportfacilityvendors.d.ts +118 -0
- package/dist/esm/models/operations/exportfacilityvendors.d.ts.map +1 -0
- package/dist/esm/models/operations/exportfacilityvendors.js +76 -0
- package/dist/esm/models/operations/exportfacilityvendors.js.map +1 -0
- package/dist/esm/models/operations/getfacilityvendorsexportstatus.d.ts +20 -0
- package/dist/esm/models/operations/getfacilityvendorsexportstatus.d.ts.map +1 -0
- package/dist/esm/models/operations/getfacilityvendorsexportstatus.js +18 -0
- package/dist/esm/models/operations/getfacilityvendorsexportstatus.js.map +1 -0
- package/dist/esm/models/operations/index.d.ts +3 -0
- package/dist/esm/models/operations/index.d.ts.map +1 -1
- package/dist/esm/models/operations/index.js +3 -0
- package/dist/esm/models/operations/index.js.map +1 -1
- package/dist/esm/react-query/index.d.ts +3 -0
- package/dist/esm/react-query/index.d.ts.map +1 -1
- package/dist/esm/react-query/index.js +3 -0
- package/dist/esm/react-query/index.js.map +1 -1
- package/dist/esm/react-query/organizationsDownloadFacilityVendorsExport.core.d.ts +12 -0
- package/dist/esm/react-query/organizationsDownloadFacilityVendorsExport.core.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsDownloadFacilityVendorsExport.core.js +35 -0
- package/dist/esm/react-query/organizationsDownloadFacilityVendorsExport.core.js.map +1 -0
- package/dist/esm/react-query/organizationsDownloadFacilityVendorsExport.d.ts +33 -0
- package/dist/esm/react-query/organizationsDownloadFacilityVendorsExport.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsDownloadFacilityVendorsExport.js +63 -0
- package/dist/esm/react-query/organizationsDownloadFacilityVendorsExport.js.map +1 -0
- package/dist/esm/react-query/organizationsExportFacilityVendors.core.d.ts +19 -0
- package/dist/esm/react-query/organizationsExportFacilityVendors.core.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsExportFacilityVendors.core.js +42 -0
- package/dist/esm/react-query/organizationsExportFacilityVendors.core.js.map +1 -0
- package/dist/esm/react-query/organizationsExportFacilityVendors.d.ts +77 -0
- package/dist/esm/react-query/organizationsExportFacilityVendors.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsExportFacilityVendors.js +87 -0
- package/dist/esm/react-query/organizationsExportFacilityVendors.js.map +1 -0
- package/dist/esm/react-query/organizationsGetFacilityVendorsExportStatus.core.d.ts +13 -0
- package/dist/esm/react-query/organizationsGetFacilityVendorsExportStatus.core.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsGetFacilityVendorsExportStatus.core.js +35 -0
- package/dist/esm/react-query/organizationsGetFacilityVendorsExportStatus.core.js.map +1 -0
- package/dist/esm/react-query/organizationsGetFacilityVendorsExportStatus.d.ts +31 -0
- package/dist/esm/react-query/organizationsGetFacilityVendorsExportStatus.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsGetFacilityVendorsExportStatus.js +61 -0
- package/dist/esm/react-query/organizationsGetFacilityVendorsExportStatus.js.map +1 -0
- package/dist/esm/sdk/organizations.d.ts +38 -0
- package/dist/esm/sdk/organizations.d.ts.map +1 -1
- package/dist/esm/sdk/organizations.js +47 -0
- package/dist/esm/sdk/organizations.js.map +1 -1
- package/jsr.json +1 -1
- package/package.json +1 -1
- package/src/__tests__/organizations.test.ts +66 -0
- package/src/__tests__/webhooks.test.ts +1 -1
- package/src/__tests__/zones.test.ts +27 -6
- package/src/funcs/organizationsDownloadFacilityVendorsExport.ts +202 -0
- package/src/funcs/organizationsExportFacilityVendors.ts +202 -0
- package/src/funcs/organizationsGetFacilityVendorsExportStatus.ts +188 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/csvexportstatusresponse.ts +79 -0
- package/src/models/components/index.ts +1 -0
- package/src/models/operations/downloadfacilityvendorsexport.ts +124 -0
- package/src/models/operations/exportfacilityvendors.ts +206 -0
- package/src/models/operations/getfacilityvendorsexportstatus.ts +47 -0
- package/src/models/operations/index.ts +3 -0
- package/src/react-query/index.ts +3 -0
- package/src/react-query/organizationsDownloadFacilityVendorsExport.core.ts +84 -0
- package/src/react-query/organizationsDownloadFacilityVendorsExport.ts +155 -0
- package/src/react-query/organizationsExportFacilityVendors.core.ts +94 -0
- package/src/react-query/organizationsExportFacilityVendors.ts +200 -0
- package/src/react-query/organizationsGetFacilityVendorsExportStatus.core.ts +84 -0
- package/src/react-query/organizationsGetFacilityVendorsExportStatus.ts +153 -0
- package/src/sdk/organizations.ts +71 -0
|
@@ -4,9 +4,12 @@
|
|
|
4
4
|
import { organizationsCreateCompanyTargetFacility } from "../funcs/organizationsCreateCompanyTargetFacility.js";
|
|
5
5
|
import { organizationsDeleteCompanyTargetFacility } from "../funcs/organizationsDeleteCompanyTargetFacility.js";
|
|
6
6
|
import { organizationsDownloadCompanyTargetFacilitiesExport } from "../funcs/organizationsDownloadCompanyTargetFacilitiesExport.js";
|
|
7
|
+
import { organizationsDownloadFacilityVendorsExport } from "../funcs/organizationsDownloadFacilityVendorsExport.js";
|
|
7
8
|
import { organizationsExportCompanyTargetFacilities } from "../funcs/organizationsExportCompanyTargetFacilities.js";
|
|
9
|
+
import { organizationsExportFacilityVendors } from "../funcs/organizationsExportFacilityVendors.js";
|
|
8
10
|
import { organizationsGetCompanyTargetFacilitiesExportStatus } from "../funcs/organizationsGetCompanyTargetFacilitiesExportStatus.js";
|
|
9
11
|
import { organizationsGetFacility } from "../funcs/organizationsGetFacility.js";
|
|
12
|
+
import { organizationsGetFacilityVendorsExportStatus } from "../funcs/organizationsGetFacilityVendorsExportStatus.js";
|
|
10
13
|
import { organizationsListCompanyTargetFacilities } from "../funcs/organizationsListCompanyTargetFacilities.js";
|
|
11
14
|
import { organizationsListFacilityVendors } from "../funcs/organizationsListFacilityVendors.js";
|
|
12
15
|
import { organizationsListOrSearchDepartmentContacts } from "../funcs/organizationsListOrSearchDepartmentContacts.js";
|
|
@@ -188,6 +191,50 @@ export class Organizations extends ClientSDK {
|
|
|
188
191
|
async listFacilityVendors(request, options) {
|
|
189
192
|
return unwrapResultIterator(organizationsListFacilityVendors(this, request, options));
|
|
190
193
|
}
|
|
194
|
+
/**
|
|
195
|
+
* Export facility vendors to CSV (async)
|
|
196
|
+
*
|
|
197
|
+
* @remarks
|
|
198
|
+
* Enqueues an asynchronous job to generate a CSV export of the vendors (vendor reps)
|
|
199
|
+
* targeting the given facility, applying the same access scope and filter parameters as
|
|
200
|
+
* the listing endpoint. The CSV contains: Name, Email, one column per company custom field
|
|
201
|
+
* flagged `show_to_vendor` (e.g. Employee ID), Last Visit, and Status.
|
|
202
|
+
*
|
|
203
|
+
* Returns a `status_url` for polling until the export is ready, along with a `download_url`
|
|
204
|
+
* and `status_id`.
|
|
205
|
+
*
|
|
206
|
+
* Access control mirrors the list endpoint:
|
|
207
|
+
* * Regular users — facility must be in the caller's read scope (via
|
|
208
|
+
* `has_facility_access_policy`); company resolved from the session. Out-of-scope or
|
|
209
|
+
* soft-deleted facilities return `404 Facility not found`.
|
|
210
|
+
* * API users — `company_id` required; both the company AND the facility must be
|
|
211
|
+
* activated for the caller's marketplace app via the join-scoped
|
|
212
|
+
* `MarketplaceAppActivation` check.
|
|
213
|
+
*/
|
|
214
|
+
async exportFacilityVendors(request, options) {
|
|
215
|
+
return unwrapAsync(organizationsExportFacilityVendors(this, request, options));
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Get facility vendors export status
|
|
219
|
+
*
|
|
220
|
+
* @remarks
|
|
221
|
+
* Poll the state of an asynchronous facility vendors export job. When `ready` is true,
|
|
222
|
+
* the export is complete and can be downloaded via the download endpoint.
|
|
223
|
+
*/
|
|
224
|
+
async getFacilityVendorsExportStatus(request, options) {
|
|
225
|
+
return unwrapAsync(organizationsGetFacilityVendorsExportStatus(this, request, options));
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Download facility vendors CSV
|
|
229
|
+
*
|
|
230
|
+
* @remarks
|
|
231
|
+
* Returns the exported facility vendors CSV via a 302 redirect to a short-lived
|
|
232
|
+
* presigned S3 URL. If the export is still being generated, returns 202 with a JSON
|
|
233
|
+
* `{ ready: false }` payload.
|
|
234
|
+
*/
|
|
235
|
+
async downloadFacilityVendorsExport(request, options) {
|
|
236
|
+
return unwrapAsync(organizationsDownloadFacilityVendorsExport(this, request, options));
|
|
237
|
+
}
|
|
191
238
|
/**
|
|
192
239
|
* List or search department contacts
|
|
193
240
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations.js","sourceRoot":"","sources":["../../../src/sdk/organizations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,wCAAwC,EAAE,MAAM,sDAAsD,CAAC;AAChH,OAAO,EAAE,wCAAwC,EAAE,MAAM,sDAAsD,CAAC;AAChH,OAAO,EAAE,kDAAkD,EAAE,MAAM,gEAAgE,CAAC;AACpI,OAAO,EAAE,0CAA0C,EAAE,MAAM,wDAAwD,CAAC;AACpH,OAAO,EAAE,mDAAmD,EAAE,MAAM,iEAAiE,CAAC;AACtI,OAAO,EAAE,wBAAwB,EAAE,MAAM,sCAAsC,CAAC;AAChF,OAAO,EAAE,wCAAwC,EAAE,MAAM,sDAAsD,CAAC;AAChH,OAAO,EAAE,gCAAgC,EAAE,MAAM,8CAA8C,CAAC;AAChG,OAAO,EAAE,2CAA2C,EAAE,MAAM,yDAAyD,CAAC;AACtH,OAAO,EAAE,oCAAoC,EAAE,MAAM,kDAAkD,CAAC;AACxG,OAAO,EAAE,mCAAmC,EAAE,MAAM,iDAAiD,CAAC;AACtG,OAAO,EAAE,SAAS,EAAkB,MAAM,gBAAgB,CAAC;AAG3D,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAgB,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAE5E,MAAM,OAAO,aAAc,SAAQ,SAAS;IAC1C;;;;;;;;;;;;;;;;;;OAkBG;IACH,KAAK,CAAC,sBAAsB,CAC1B,OAAiD,EACjD,OAAwB;QAIxB,OAAO,oBAAoB,CAAC,mCAAmC,CAC7D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,WAAW,CACf,OAAsC,EACtC,OAAwB;QAExB,OAAO,WAAW,CAAC,wBAAwB,CACzC,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,CAAC;IACL,CAAC;IAED;;;;;;;;;;OAUG;IACH,KAAK,CAAC,8BAA8B,CAClC,OAAyD,EACzD,OAAwB;QAOxB,OAAO,oBAAoB,CAAC,2CAA2C,CACrE,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -270,3 +270,69 @@ test("Organizations List Facility Vendors", async () => {
|
|
|
270
270
|
items: [],
|
|
271
271
|
});
|
|
272
272
|
});
|
|
273
|
+
|
|
274
|
+
test("Organizations Export Facility Vendors", async () => {
|
|
275
|
+
const testHttpClient = createTestHTTPClient("exportFacilityVendors");
|
|
276
|
+
|
|
277
|
+
const greenSecurity = new GreenSecurity({
|
|
278
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
279
|
+
httpClient: testHttpClient,
|
|
280
|
+
security: {
|
|
281
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
282
|
+
},
|
|
283
|
+
});
|
|
284
|
+
|
|
285
|
+
const result = await greenSecurity.organizations.exportFacilityVendors({
|
|
286
|
+
id: 657024,
|
|
287
|
+
});
|
|
288
|
+
expect(result).toBeDefined();
|
|
289
|
+
expect(result).toEqual({
|
|
290
|
+
statusUrl: "https://classic-nectarine.net",
|
|
291
|
+
downloadUrl: "https://smooth-custody.org/",
|
|
292
|
+
statusId: "<id>",
|
|
293
|
+
});
|
|
294
|
+
});
|
|
295
|
+
|
|
296
|
+
test("Organizations Get Facility Vendors Export Status", async () => {
|
|
297
|
+
const testHttpClient = createTestHTTPClient("getFacilityVendorsExportStatus");
|
|
298
|
+
|
|
299
|
+
const greenSecurity = new GreenSecurity({
|
|
300
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
301
|
+
httpClient: testHttpClient,
|
|
302
|
+
security: {
|
|
303
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
304
|
+
},
|
|
305
|
+
});
|
|
306
|
+
|
|
307
|
+
const result = await greenSecurity.organizations
|
|
308
|
+
.getFacilityVendorsExportStatus({
|
|
309
|
+
id: 453991,
|
|
310
|
+
exportId: "<id>",
|
|
311
|
+
});
|
|
312
|
+
expect(result).toBeDefined();
|
|
313
|
+
expect(result).toEqual({
|
|
314
|
+
ready: true,
|
|
315
|
+
statusId: "<id>",
|
|
316
|
+
});
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
test("Organizations Download Facility Vendors Export", async () => {
|
|
320
|
+
const testHttpClient = createTestHTTPClient("downloadFacilityVendorsExport");
|
|
321
|
+
|
|
322
|
+
const greenSecurity = new GreenSecurity({
|
|
323
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
324
|
+
httpClient: testHttpClient,
|
|
325
|
+
security: {
|
|
326
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
327
|
+
},
|
|
328
|
+
});
|
|
329
|
+
|
|
330
|
+
const result = await greenSecurity.organizations
|
|
331
|
+
.downloadFacilityVendorsExport({
|
|
332
|
+
id: 615627,
|
|
333
|
+
exportId: "<id>",
|
|
334
|
+
});
|
|
335
|
+
expect(result).toBeDefined();
|
|
336
|
+
expect(result!.result).toBeDefined();
|
|
337
|
+
expect(result!.result).toEqual({});
|
|
338
|
+
});
|
|
@@ -20,7 +20,7 @@ test("Webhooks List All Webhook Endpoints", async () => {
|
|
|
20
20
|
const testWebhookListForVendorUserResult = await greenSecurity.webhooks
|
|
21
21
|
.listAllWebhookEndpoints({
|
|
22
22
|
itemsPerPage: 25,
|
|
23
|
-
desc:
|
|
23
|
+
desc: true,
|
|
24
24
|
sort: "",
|
|
25
25
|
});
|
|
26
26
|
expect(testWebhookListForVendorUserResult).toBeDefined();
|
|
@@ -35,19 +35,40 @@ test("Zones List Or Search Security Zones", async () => {
|
|
|
35
35
|
useUrlParams: false,
|
|
36
36
|
},
|
|
37
37
|
items: [
|
|
38
|
-
{
|
|
39
|
-
facility: {},
|
|
40
|
-
},
|
|
41
38
|
{
|
|
42
39
|
facility: {
|
|
43
|
-
contacts:
|
|
40
|
+
contacts: {
|
|
41
|
+
contact: {
|
|
42
|
+
status: "Deleted",
|
|
43
|
+
department: 123,
|
|
44
|
+
},
|
|
45
|
+
adminContact: {
|
|
46
|
+
status: "Active",
|
|
47
|
+
department: 123,
|
|
48
|
+
},
|
|
49
|
+
techContact: {
|
|
50
|
+
status: "Deleted",
|
|
51
|
+
department: 123,
|
|
52
|
+
},
|
|
53
|
+
greenSecurityCsm: {
|
|
54
|
+
status: "Inactive",
|
|
55
|
+
department: 123,
|
|
56
|
+
},
|
|
57
|
+
accountManager: {
|
|
58
|
+
status: "Active",
|
|
59
|
+
department: 123,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
44
62
|
vendorGuestPolicy: {
|
|
45
|
-
enabled:
|
|
63
|
+
enabled: false,
|
|
46
64
|
vendorGuestLimitAndOr: "and",
|
|
47
65
|
vendorGuestRequireEmail: false,
|
|
48
66
|
},
|
|
49
67
|
},
|
|
50
68
|
},
|
|
69
|
+
{
|
|
70
|
+
facility: {},
|
|
71
|
+
},
|
|
51
72
|
],
|
|
52
73
|
});
|
|
53
74
|
});
|
|
@@ -65,7 +86,7 @@ test("Zones Security Zone Checkin", async () => {
|
|
|
65
86
|
|
|
66
87
|
const result = await greenSecurity.zones.securityZoneCheckin({
|
|
67
88
|
qrCode: "<value>",
|
|
68
|
-
zoneId:
|
|
89
|
+
zoneId: 185875,
|
|
69
90
|
});
|
|
70
91
|
expect(result).toBeDefined();
|
|
71
92
|
expect(result).toEqual({});
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
import * as types$ from "../types/primitives.js";
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Download facility vendors CSV
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Returns the exported facility vendors CSV via a 302 redirect to a short-lived
|
|
35
|
+
* presigned S3 URL. If the export is still being generated, returns 202 with a JSON
|
|
36
|
+
* `{ ready: false }` payload.
|
|
37
|
+
*
|
|
38
|
+
* If set, this operation will use {@link Security.bearerJwt} from the global security.
|
|
39
|
+
*/
|
|
40
|
+
export function organizationsDownloadFacilityVendorsExport(
|
|
41
|
+
client: GreenSecurityCore,
|
|
42
|
+
request: operations.DownloadFacilityVendorsExportRequest,
|
|
43
|
+
options?: RequestOptions,
|
|
44
|
+
): APIPromise<
|
|
45
|
+
Result<
|
|
46
|
+
operations.DownloadFacilityVendorsExportResponse | undefined,
|
|
47
|
+
| errors.ApiErrorResponse
|
|
48
|
+
| GreenSecurityError
|
|
49
|
+
| ResponseValidationError
|
|
50
|
+
| ConnectionError
|
|
51
|
+
| RequestAbortedError
|
|
52
|
+
| RequestTimeoutError
|
|
53
|
+
| InvalidRequestError
|
|
54
|
+
| UnexpectedClientError
|
|
55
|
+
| SDKValidationError
|
|
56
|
+
>
|
|
57
|
+
> {
|
|
58
|
+
return new APIPromise($do(
|
|
59
|
+
client,
|
|
60
|
+
request,
|
|
61
|
+
options,
|
|
62
|
+
));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
async function $do(
|
|
66
|
+
client: GreenSecurityCore,
|
|
67
|
+
request: operations.DownloadFacilityVendorsExportRequest,
|
|
68
|
+
options?: RequestOptions,
|
|
69
|
+
): Promise<
|
|
70
|
+
[
|
|
71
|
+
Result<
|
|
72
|
+
operations.DownloadFacilityVendorsExportResponse | undefined,
|
|
73
|
+
| errors.ApiErrorResponse
|
|
74
|
+
| GreenSecurityError
|
|
75
|
+
| ResponseValidationError
|
|
76
|
+
| ConnectionError
|
|
77
|
+
| RequestAbortedError
|
|
78
|
+
| RequestTimeoutError
|
|
79
|
+
| InvalidRequestError
|
|
80
|
+
| UnexpectedClientError
|
|
81
|
+
| SDKValidationError
|
|
82
|
+
>,
|
|
83
|
+
APICall,
|
|
84
|
+
]
|
|
85
|
+
> {
|
|
86
|
+
const parsed = safeParse(
|
|
87
|
+
request,
|
|
88
|
+
(value) =>
|
|
89
|
+
operations.DownloadFacilityVendorsExportRequest$outboundSchema.parse(
|
|
90
|
+
value,
|
|
91
|
+
),
|
|
92
|
+
"Input validation failed",
|
|
93
|
+
);
|
|
94
|
+
if (!parsed.ok) {
|
|
95
|
+
return [parsed, { status: "invalid" }];
|
|
96
|
+
}
|
|
97
|
+
const payload = parsed.value;
|
|
98
|
+
const body = null;
|
|
99
|
+
|
|
100
|
+
const pathParams = {
|
|
101
|
+
export_id: encodeSimple("export_id", payload.export_id, {
|
|
102
|
+
explode: false,
|
|
103
|
+
charEncoding: "percent",
|
|
104
|
+
}),
|
|
105
|
+
id: encodeSimple("id", payload.id, {
|
|
106
|
+
explode: false,
|
|
107
|
+
charEncoding: "percent",
|
|
108
|
+
}),
|
|
109
|
+
};
|
|
110
|
+
const path = pathToFunc("/facilities/{id}/vendors/export/{export_id}")(
|
|
111
|
+
pathParams,
|
|
112
|
+
);
|
|
113
|
+
|
|
114
|
+
const headers = new Headers(compactMap({
|
|
115
|
+
Accept: "application/json",
|
|
116
|
+
}));
|
|
117
|
+
|
|
118
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
119
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
|
|
120
|
+
|
|
121
|
+
const context = {
|
|
122
|
+
options: client._options,
|
|
123
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
124
|
+
operationID: "downloadFacilityVendorsExport",
|
|
125
|
+
oAuth2Scopes: null,
|
|
126
|
+
|
|
127
|
+
resolvedSecurity: requestSecurity,
|
|
128
|
+
|
|
129
|
+
securitySource: client._options.security,
|
|
130
|
+
retryConfig: options?.retries
|
|
131
|
+
|| client._options.retryConfig
|
|
132
|
+
|| { strategy: "none" },
|
|
133
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
const requestRes = client._createRequest(context, {
|
|
137
|
+
security: requestSecurity,
|
|
138
|
+
method: "GET",
|
|
139
|
+
baseURL: options?.serverURL,
|
|
140
|
+
path: path,
|
|
141
|
+
headers: headers,
|
|
142
|
+
body: body,
|
|
143
|
+
userAgent: client._options.userAgent,
|
|
144
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
145
|
+
}, options);
|
|
146
|
+
if (!requestRes.ok) {
|
|
147
|
+
return [requestRes, { status: "invalid" }];
|
|
148
|
+
}
|
|
149
|
+
const req = requestRes.value;
|
|
150
|
+
|
|
151
|
+
const doResult = await client._do(req, {
|
|
152
|
+
context,
|
|
153
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
154
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
155
|
+
retryConfig: context.retryConfig,
|
|
156
|
+
retryCodes: context.retryCodes,
|
|
157
|
+
});
|
|
158
|
+
if (!doResult.ok) {
|
|
159
|
+
return [doResult, { status: "request-error", request: req }];
|
|
160
|
+
}
|
|
161
|
+
const response = doResult.value;
|
|
162
|
+
|
|
163
|
+
const responseFields = {
|
|
164
|
+
HttpMeta: { Response: response, Request: req },
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
const [result] = await M.match<
|
|
168
|
+
operations.DownloadFacilityVendorsExportResponse | undefined,
|
|
169
|
+
| errors.ApiErrorResponse
|
|
170
|
+
| GreenSecurityError
|
|
171
|
+
| ResponseValidationError
|
|
172
|
+
| ConnectionError
|
|
173
|
+
| RequestAbortedError
|
|
174
|
+
| RequestTimeoutError
|
|
175
|
+
| InvalidRequestError
|
|
176
|
+
| UnexpectedClientError
|
|
177
|
+
| SDKValidationError
|
|
178
|
+
>(
|
|
179
|
+
M.json(
|
|
180
|
+
202,
|
|
181
|
+
types$.optional(
|
|
182
|
+
operations.DownloadFacilityVendorsExportResponse$inboundSchema,
|
|
183
|
+
),
|
|
184
|
+
{ key: "Result" },
|
|
185
|
+
),
|
|
186
|
+
M.nil(
|
|
187
|
+
302,
|
|
188
|
+
types$.optional(
|
|
189
|
+
operations.DownloadFacilityVendorsExportResponse$inboundSchema,
|
|
190
|
+
),
|
|
191
|
+
{ hdrs: true },
|
|
192
|
+
),
|
|
193
|
+
M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
|
|
194
|
+
M.fail("4XX"),
|
|
195
|
+
M.fail([500, "5XX"]),
|
|
196
|
+
)(response, req, { extraFields: responseFields });
|
|
197
|
+
if (!result.ok) {
|
|
198
|
+
return [result, { status: "complete", request: req, response }];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return [result, { status: "complete", request: req, response }];
|
|
202
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeSimple } from "../lib/encodings.js";
|
|
7
|
+
import { matchStatusCode } from "../lib/http.js";
|
|
8
|
+
import * as M from "../lib/matchers.js";
|
|
9
|
+
import { compactMap } from "../lib/primitives.js";
|
|
10
|
+
import { safeParse } from "../lib/schemas.js";
|
|
11
|
+
import { RequestOptions } from "../lib/sdks.js";
|
|
12
|
+
import { extractSecurity, resolveGlobalSecurity } from "../lib/security.js";
|
|
13
|
+
import { pathToFunc } from "../lib/url.js";
|
|
14
|
+
import { GreenSecurityError } from "../models/errors/greensecurityerror.js";
|
|
15
|
+
import {
|
|
16
|
+
ConnectionError,
|
|
17
|
+
InvalidRequestError,
|
|
18
|
+
RequestAbortedError,
|
|
19
|
+
RequestTimeoutError,
|
|
20
|
+
UnexpectedClientError,
|
|
21
|
+
} from "../models/errors/httpclienterrors.js";
|
|
22
|
+
import * as errors from "../models/errors/index.js";
|
|
23
|
+
import { ResponseValidationError } from "../models/errors/responsevalidationerror.js";
|
|
24
|
+
import { SDKValidationError } from "../models/errors/sdkvalidationerror.js";
|
|
25
|
+
import * as operations from "../models/operations/index.js";
|
|
26
|
+
import { APICall, APIPromise } from "../types/async.js";
|
|
27
|
+
import { Result } from "../types/fp.js";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Export facility vendors to CSV (async)
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Enqueues an asynchronous job to generate a CSV export of the vendors (vendor reps)
|
|
34
|
+
* targeting the given facility, applying the same access scope and filter parameters as
|
|
35
|
+
* the listing endpoint. The CSV contains: Name, Email, one column per company custom field
|
|
36
|
+
* flagged `show_to_vendor` (e.g. Employee ID), Last Visit, and Status.
|
|
37
|
+
*
|
|
38
|
+
* Returns a `status_url` for polling until the export is ready, along with a `download_url`
|
|
39
|
+
* and `status_id`.
|
|
40
|
+
*
|
|
41
|
+
* Access control mirrors the list endpoint:
|
|
42
|
+
* * Regular users — facility must be in the caller's read scope (via
|
|
43
|
+
* `has_facility_access_policy`); company resolved from the session. Out-of-scope or
|
|
44
|
+
* soft-deleted facilities return `404 Facility not found`.
|
|
45
|
+
* * API users — `company_id` required; both the company AND the facility must be
|
|
46
|
+
* activated for the caller's marketplace app via the join-scoped
|
|
47
|
+
* `MarketplaceAppActivation` check.
|
|
48
|
+
*
|
|
49
|
+
* If set, this operation will use {@link Security.bearerJwt} from the global security.
|
|
50
|
+
*/
|
|
51
|
+
export function organizationsExportFacilityVendors(
|
|
52
|
+
client: GreenSecurityCore,
|
|
53
|
+
request: operations.ExportFacilityVendorsRequest,
|
|
54
|
+
options?: RequestOptions,
|
|
55
|
+
): APIPromise<
|
|
56
|
+
Result<
|
|
57
|
+
operations.ExportFacilityVendorsResponseBody,
|
|
58
|
+
| errors.ApiErrorResponse
|
|
59
|
+
| GreenSecurityError
|
|
60
|
+
| ResponseValidationError
|
|
61
|
+
| ConnectionError
|
|
62
|
+
| RequestAbortedError
|
|
63
|
+
| RequestTimeoutError
|
|
64
|
+
| InvalidRequestError
|
|
65
|
+
| UnexpectedClientError
|
|
66
|
+
| SDKValidationError
|
|
67
|
+
>
|
|
68
|
+
> {
|
|
69
|
+
return new APIPromise($do(
|
|
70
|
+
client,
|
|
71
|
+
request,
|
|
72
|
+
options,
|
|
73
|
+
));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async function $do(
|
|
77
|
+
client: GreenSecurityCore,
|
|
78
|
+
request: operations.ExportFacilityVendorsRequest,
|
|
79
|
+
options?: RequestOptions,
|
|
80
|
+
): Promise<
|
|
81
|
+
[
|
|
82
|
+
Result<
|
|
83
|
+
operations.ExportFacilityVendorsResponseBody,
|
|
84
|
+
| errors.ApiErrorResponse
|
|
85
|
+
| GreenSecurityError
|
|
86
|
+
| ResponseValidationError
|
|
87
|
+
| ConnectionError
|
|
88
|
+
| RequestAbortedError
|
|
89
|
+
| RequestTimeoutError
|
|
90
|
+
| InvalidRequestError
|
|
91
|
+
| UnexpectedClientError
|
|
92
|
+
| SDKValidationError
|
|
93
|
+
>,
|
|
94
|
+
APICall,
|
|
95
|
+
]
|
|
96
|
+
> {
|
|
97
|
+
const parsed = safeParse(
|
|
98
|
+
request,
|
|
99
|
+
(value) =>
|
|
100
|
+
operations.ExportFacilityVendorsRequest$outboundSchema.parse(value),
|
|
101
|
+
"Input validation failed",
|
|
102
|
+
);
|
|
103
|
+
if (!parsed.ok) {
|
|
104
|
+
return [parsed, { status: "invalid" }];
|
|
105
|
+
}
|
|
106
|
+
const payload = parsed.value;
|
|
107
|
+
const body = null;
|
|
108
|
+
|
|
109
|
+
const pathParams = {
|
|
110
|
+
id: encodeSimple("id", payload.id, {
|
|
111
|
+
explode: false,
|
|
112
|
+
charEncoding: "percent",
|
|
113
|
+
}),
|
|
114
|
+
};
|
|
115
|
+
const path = pathToFunc("/facilities/{id}/vendors/export")(pathParams);
|
|
116
|
+
|
|
117
|
+
const query = encodeFormQuery({
|
|
118
|
+
"company_id": payload.company_id,
|
|
119
|
+
"desc": payload.desc,
|
|
120
|
+
"items_per_page": payload.items_per_page,
|
|
121
|
+
"search": payload.search,
|
|
122
|
+
"sort": payload.sort,
|
|
123
|
+
"status": payload.status,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const headers = new Headers(compactMap({
|
|
127
|
+
Accept: "application/json",
|
|
128
|
+
}));
|
|
129
|
+
|
|
130
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
131
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
|
|
132
|
+
|
|
133
|
+
const context = {
|
|
134
|
+
options: client._options,
|
|
135
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
136
|
+
operationID: "exportFacilityVendors",
|
|
137
|
+
oAuth2Scopes: null,
|
|
138
|
+
|
|
139
|
+
resolvedSecurity: requestSecurity,
|
|
140
|
+
|
|
141
|
+
securitySource: client._options.security,
|
|
142
|
+
retryConfig: options?.retries
|
|
143
|
+
|| client._options.retryConfig
|
|
144
|
+
|| { strategy: "none" },
|
|
145
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
const requestRes = client._createRequest(context, {
|
|
149
|
+
security: requestSecurity,
|
|
150
|
+
method: "GET",
|
|
151
|
+
baseURL: options?.serverURL,
|
|
152
|
+
path: path,
|
|
153
|
+
headers: headers,
|
|
154
|
+
query: query,
|
|
155
|
+
body: body,
|
|
156
|
+
userAgent: client._options.userAgent,
|
|
157
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
158
|
+
}, options);
|
|
159
|
+
if (!requestRes.ok) {
|
|
160
|
+
return [requestRes, { status: "invalid" }];
|
|
161
|
+
}
|
|
162
|
+
const req = requestRes.value;
|
|
163
|
+
|
|
164
|
+
const doResult = await client._do(req, {
|
|
165
|
+
context,
|
|
166
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
167
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
168
|
+
retryConfig: context.retryConfig,
|
|
169
|
+
retryCodes: context.retryCodes,
|
|
170
|
+
});
|
|
171
|
+
if (!doResult.ok) {
|
|
172
|
+
return [doResult, { status: "request-error", request: req }];
|
|
173
|
+
}
|
|
174
|
+
const response = doResult.value;
|
|
175
|
+
|
|
176
|
+
const responseFields = {
|
|
177
|
+
HttpMeta: { Response: response, Request: req },
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
const [result] = await M.match<
|
|
181
|
+
operations.ExportFacilityVendorsResponseBody,
|
|
182
|
+
| errors.ApiErrorResponse
|
|
183
|
+
| GreenSecurityError
|
|
184
|
+
| ResponseValidationError
|
|
185
|
+
| ConnectionError
|
|
186
|
+
| RequestAbortedError
|
|
187
|
+
| RequestTimeoutError
|
|
188
|
+
| InvalidRequestError
|
|
189
|
+
| UnexpectedClientError
|
|
190
|
+
| SDKValidationError
|
|
191
|
+
>(
|
|
192
|
+
M.json(200, operations.ExportFacilityVendorsResponseBody$inboundSchema),
|
|
193
|
+
M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
|
|
194
|
+
M.fail("4XX"),
|
|
195
|
+
M.fail([500, "5XX"]),
|
|
196
|
+
)(response, req, { extraFields: responseFields });
|
|
197
|
+
if (!result.ok) {
|
|
198
|
+
return [result, { status: "complete", request: req, response }];
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return [result, { status: "complete", request: req, response }];
|
|
202
|
+
}
|