@greensecurity/javascript-sdk 0.44.0-beta.14 → 0.44.0-beta.16
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 +72 -6
- package/dist/commonjs/__tests__/organizations.test.js.map +1 -1
- package/dist/commonjs/__tests__/zones.test.js +4 -31
- package/dist/commonjs/__tests__/zones.test.js.map +1 -1
- package/dist/commonjs/funcs/organizationsCreateCompanyTargetFacility.d.ts +34 -0
- package/dist/commonjs/funcs/organizationsCreateCompanyTargetFacility.d.ts.map +1 -0
- package/dist/commonjs/funcs/organizationsCreateCompanyTargetFacility.js +145 -0
- package/dist/commonjs/funcs/organizationsCreateCompanyTargetFacility.js.map +1 -0
- package/dist/commonjs/funcs/organizationsDeleteCompanyTargetFacility.d.ts +28 -0
- package/dist/commonjs/funcs/organizationsDeleteCompanyTargetFacility.d.ts.map +1 -0
- package/dist/commonjs/funcs/organizationsDeleteCompanyTargetFacility.js +138 -0
- package/dist/commonjs/funcs/organizationsDeleteCompanyTargetFacility.js.map +1 -0
- package/dist/commonjs/funcs/organizationsListCompanyTargetFacilities.d.ts +42 -0
- package/dist/commonjs/funcs/organizationsListCompanyTargetFacilities.d.ts.map +1 -0
- package/dist/commonjs/funcs/organizationsListCompanyTargetFacilities.js +194 -0
- package/dist/commonjs/funcs/organizationsListCompanyTargetFacilities.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/companytargetfacility.d.ts +54 -0
- package/dist/commonjs/models/components/companytargetfacility.d.ts.map +1 -0
- package/dist/commonjs/models/components/companytargetfacility.js +80 -0
- package/dist/commonjs/models/components/companytargetfacility.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/createcompanytargetfacility.d.ts +50 -0
- package/dist/commonjs/models/operations/createcompanytargetfacility.d.ts.map +1 -0
- package/dist/commonjs/models/operations/createcompanytargetfacility.js +84 -0
- package/dist/commonjs/models/operations/createcompanytargetfacility.js.map +1 -0
- package/dist/commonjs/models/operations/deletecompanytargetfacility.d.ts +20 -0
- package/dist/commonjs/models/operations/deletecompanytargetfacility.d.ts.map +1 -0
- package/dist/commonjs/models/operations/deletecompanytargetfacility.js +55 -0
- package/dist/commonjs/models/operations/deletecompanytargetfacility.js.map +1 -0
- package/dist/commonjs/models/operations/exportcompanytargetfacilities.d.ts +16 -16
- package/dist/commonjs/models/operations/exportcompanytargetfacilities.d.ts.map +1 -1
- package/dist/commonjs/models/operations/exportcompanytargetfacilities.js +14 -15
- package/dist/commonjs/models/operations/exportcompanytargetfacilities.js.map +1 -1
- 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/models/operations/listcompanytargetfacilities.d.ts +173 -0
- package/dist/commonjs/models/operations/listcompanytargetfacilities.d.ts.map +1 -0
- package/dist/commonjs/models/operations/listcompanytargetfacilities.js +150 -0
- package/dist/commonjs/models/operations/listcompanytargetfacilities.js.map +1 -0
- package/dist/commonjs/models/operations/listfacilityvendors.d.ts +4 -4
- package/dist/commonjs/models/operations/listfacilityvendors.d.ts.map +1 -1
- package/dist/commonjs/models/operations/listfacilityvendors.js +4 -4
- package/dist/commonjs/models/operations/listfacilityvendors.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/organizationsCreateCompanyTargetFacility.d.ts +43 -0
- package/dist/commonjs/react-query/organizationsCreateCompanyTargetFacility.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsCreateCompanyTargetFacility.js +65 -0
- package/dist/commonjs/react-query/organizationsCreateCompanyTargetFacility.js.map +1 -0
- package/dist/commonjs/react-query/organizationsDeleteCompanyTargetFacility.d.ts +37 -0
- package/dist/commonjs/react-query/organizationsDeleteCompanyTargetFacility.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsDeleteCompanyTargetFacility.js +59 -0
- package/dist/commonjs/react-query/organizationsDeleteCompanyTargetFacility.js.map +1 -0
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.core.d.ts +4 -4
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.core.d.ts.map +1 -1
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.core.js.map +1 -1
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.d.ts +8 -8
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.d.ts.map +1 -1
- package/dist/commonjs/react-query/organizationsExportCompanyTargetFacilities.js.map +1 -1
- package/dist/commonjs/react-query/organizationsListCompanyTargetFacilities.core.d.ts +54 -0
- package/dist/commonjs/react-query/organizationsListCompanyTargetFacilities.core.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsListCompanyTargetFacilities.core.js +111 -0
- package/dist/commonjs/react-query/organizationsListCompanyTargetFacilities.core.js.map +1 -0
- package/dist/commonjs/react-query/organizationsListCompanyTargetFacilities.d.ts +154 -0
- package/dist/commonjs/react-query/organizationsListCompanyTargetFacilities.d.ts.map +1 -0
- package/dist/commonjs/react-query/organizationsListCompanyTargetFacilities.js +180 -0
- package/dist/commonjs/react-query/organizationsListCompanyTargetFacilities.js.map +1 -0
- package/dist/commonjs/react-query/organizationsListFacilityVendors.core.d.ts +2 -2
- package/dist/commonjs/react-query/organizationsListFacilityVendors.core.d.ts.map +1 -1
- package/dist/commonjs/react-query/organizationsListFacilityVendors.d.ts +2 -2
- package/dist/commonjs/react-query/organizationsListFacilityVendors.d.ts.map +1 -1
- package/dist/commonjs/sdk/organizations.d.ts +64 -0
- package/dist/commonjs/sdk/organizations.d.ts.map +1 -1
- package/dist/commonjs/sdk/organizations.js +71 -0
- package/dist/commonjs/sdk/organizations.js.map +1 -1
- package/dist/esm/__tests__/organizations.test.js +73 -7
- package/dist/esm/__tests__/organizations.test.js.map +1 -1
- package/dist/esm/__tests__/zones.test.js +4 -31
- package/dist/esm/__tests__/zones.test.js.map +1 -1
- package/dist/esm/funcs/organizationsCreateCompanyTargetFacility.d.ts +34 -0
- package/dist/esm/funcs/organizationsCreateCompanyTargetFacility.d.ts.map +1 -0
- package/dist/esm/funcs/organizationsCreateCompanyTargetFacility.js +109 -0
- package/dist/esm/funcs/organizationsCreateCompanyTargetFacility.js.map +1 -0
- package/dist/esm/funcs/organizationsDeleteCompanyTargetFacility.d.ts +28 -0
- package/dist/esm/funcs/organizationsDeleteCompanyTargetFacility.d.ts.map +1 -0
- package/dist/esm/funcs/organizationsDeleteCompanyTargetFacility.js +102 -0
- package/dist/esm/funcs/organizationsDeleteCompanyTargetFacility.js.map +1 -0
- package/dist/esm/funcs/organizationsListCompanyTargetFacilities.d.ts +42 -0
- package/dist/esm/funcs/organizationsListCompanyTargetFacilities.d.ts.map +1 -0
- package/dist/esm/funcs/organizationsListCompanyTargetFacilities.js +158 -0
- package/dist/esm/funcs/organizationsListCompanyTargetFacilities.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/companytargetfacility.d.ts +54 -0
- package/dist/esm/models/components/companytargetfacility.d.ts.map +1 -0
- package/dist/esm/models/components/companytargetfacility.js +41 -0
- package/dist/esm/models/components/companytargetfacility.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/createcompanytargetfacility.d.ts +50 -0
- package/dist/esm/models/operations/createcompanytargetfacility.d.ts.map +1 -0
- package/dist/esm/models/operations/createcompanytargetfacility.js +45 -0
- package/dist/esm/models/operations/createcompanytargetfacility.js.map +1 -0
- package/dist/esm/models/operations/deletecompanytargetfacility.d.ts +20 -0
- package/dist/esm/models/operations/deletecompanytargetfacility.d.ts.map +1 -0
- package/dist/esm/models/operations/deletecompanytargetfacility.js +18 -0
- package/dist/esm/models/operations/deletecompanytargetfacility.js.map +1 -0
- package/dist/esm/models/operations/exportcompanytargetfacilities.d.ts +16 -16
- package/dist/esm/models/operations/exportcompanytargetfacilities.d.ts.map +1 -1
- package/dist/esm/models/operations/exportcompanytargetfacilities.js +13 -14
- package/dist/esm/models/operations/exportcompanytargetfacilities.js.map +1 -1
- 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/models/operations/listcompanytargetfacilities.d.ts +173 -0
- package/dist/esm/models/operations/listcompanytargetfacilities.d.ts.map +1 -0
- package/dist/esm/models/operations/listcompanytargetfacilities.js +111 -0
- package/dist/esm/models/operations/listcompanytargetfacilities.js.map +1 -0
- package/dist/esm/models/operations/listfacilityvendors.d.ts +4 -4
- package/dist/esm/models/operations/listfacilityvendors.d.ts.map +1 -1
- package/dist/esm/models/operations/listfacilityvendors.js +3 -3
- package/dist/esm/models/operations/listfacilityvendors.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/organizationsCreateCompanyTargetFacility.d.ts +43 -0
- package/dist/esm/react-query/organizationsCreateCompanyTargetFacility.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsCreateCompanyTargetFacility.js +60 -0
- package/dist/esm/react-query/organizationsCreateCompanyTargetFacility.js.map +1 -0
- package/dist/esm/react-query/organizationsDeleteCompanyTargetFacility.d.ts +37 -0
- package/dist/esm/react-query/organizationsDeleteCompanyTargetFacility.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsDeleteCompanyTargetFacility.js +54 -0
- package/dist/esm/react-query/organizationsDeleteCompanyTargetFacility.js.map +1 -0
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.d.ts +4 -4
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.d.ts.map +1 -1
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.core.js.map +1 -1
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.d.ts +8 -8
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.d.ts.map +1 -1
- package/dist/esm/react-query/organizationsExportCompanyTargetFacilities.js.map +1 -1
- package/dist/esm/react-query/organizationsListCompanyTargetFacilities.core.d.ts +54 -0
- package/dist/esm/react-query/organizationsListCompanyTargetFacilities.core.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsListCompanyTargetFacilities.core.js +103 -0
- package/dist/esm/react-query/organizationsListCompanyTargetFacilities.core.js.map +1 -0
- package/dist/esm/react-query/organizationsListCompanyTargetFacilities.d.ts +154 -0
- package/dist/esm/react-query/organizationsListCompanyTargetFacilities.d.ts.map +1 -0
- package/dist/esm/react-query/organizationsListCompanyTargetFacilities.js +165 -0
- package/dist/esm/react-query/organizationsListCompanyTargetFacilities.js.map +1 -0
- package/dist/esm/react-query/organizationsListFacilityVendors.core.d.ts +2 -2
- package/dist/esm/react-query/organizationsListFacilityVendors.core.d.ts.map +1 -1
- package/dist/esm/react-query/organizationsListFacilityVendors.d.ts +2 -2
- package/dist/esm/react-query/organizationsListFacilityVendors.d.ts.map +1 -1
- package/dist/esm/sdk/organizations.d.ts +64 -0
- package/dist/esm/sdk/organizations.d.ts.map +1 -1
- package/dist/esm/sdk/organizations.js +71 -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 +79 -13
- package/src/__tests__/zones.test.ts +4 -31
- package/src/funcs/organizationsCreateCompanyTargetFacility.ts +204 -0
- package/src/funcs/organizationsDeleteCompanyTargetFacility.ts +193 -0
- package/src/funcs/organizationsListCompanyTargetFacilities.ts +291 -0
- package/src/lib/config.ts +2 -2
- package/src/models/components/companytargetfacility.ts +124 -0
- package/src/models/components/index.ts +1 -0
- package/src/models/operations/createcompanytargetfacility.ts +132 -0
- package/src/models/operations/deletecompanytargetfacility.ts +47 -0
- package/src/models/operations/exportcompanytargetfacilities.ts +34 -31
- package/src/models/operations/index.ts +3 -0
- package/src/models/operations/listcompanytargetfacilities.ts +293 -0
- package/src/models/operations/listfacilityvendors.ts +10 -7
- package/src/react-query/index.ts +3 -0
- package/src/react-query/organizationsCreateCompanyTargetFacility.ts +129 -0
- package/src/react-query/organizationsDeleteCompanyTargetFacility.ts +122 -0
- package/src/react-query/organizationsExportCompanyTargetFacilities.core.ts +4 -6
- package/src/react-query/organizationsExportCompanyTargetFacilities.ts +12 -10
- package/src/react-query/organizationsListCompanyTargetFacilities.core.ts +239 -0
- package/src/react-query/organizationsListCompanyTargetFacilities.ts +369 -0
- package/src/react-query/organizationsListFacilityVendors.core.ts +2 -2
- package/src/react-query/organizationsListFacilityVendors.ts +2 -2
- package/src/sdk/organizations.ts +102 -0
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
/*
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
|
+
import { organizationsCreateCompanyTargetFacility } from "../funcs/organizationsCreateCompanyTargetFacility.js";
|
|
5
|
+
import { organizationsDeleteCompanyTargetFacility } from "../funcs/organizationsDeleteCompanyTargetFacility.js";
|
|
4
6
|
import { organizationsDownloadCompanyTargetFacilitiesExport } from "../funcs/organizationsDownloadCompanyTargetFacilitiesExport.js";
|
|
5
7
|
import { organizationsExportCompanyTargetFacilities } from "../funcs/organizationsExportCompanyTargetFacilities.js";
|
|
6
8
|
import { organizationsGetCompanyTargetFacilitiesExportStatus } from "../funcs/organizationsGetCompanyTargetFacilitiesExportStatus.js";
|
|
7
9
|
import { organizationsGetFacility } from "../funcs/organizationsGetFacility.js";
|
|
10
|
+
import { organizationsListCompanyTargetFacilities } from "../funcs/organizationsListCompanyTargetFacilities.js";
|
|
8
11
|
import { organizationsListFacilityVendors } from "../funcs/organizationsListFacilityVendors.js";
|
|
9
12
|
import { organizationsListOrSearchDepartmentContacts } from "../funcs/organizationsListOrSearchDepartmentContacts.js";
|
|
10
13
|
import { organizationsListOrSearchDepartments } from "../funcs/organizationsListOrSearchDepartments.js";
|
|
@@ -53,6 +56,74 @@ export class Organizations extends ClientSDK {
|
|
|
53
56
|
async listOrSearchDepartments(request, options) {
|
|
54
57
|
return unwrapResultIterator(organizationsListOrSearchDepartments(this, request, options));
|
|
55
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* List company target facilities
|
|
61
|
+
*
|
|
62
|
+
* @remarks
|
|
63
|
+
* Lists the CompanyTargetFacility links for a company — the facilities the
|
|
64
|
+
* company is targeting. Each row carries the linked facility (with location
|
|
65
|
+
* and parent system), the link status, and per-facility counts of the
|
|
66
|
+
* company's individuals targeting it.
|
|
67
|
+
*
|
|
68
|
+
* When `include_potential_targets=true`, returns ALL non-deleted facilities
|
|
69
|
+
* via a LEFT JOIN. Targeted rows carry their CTF `id` and `status`; non-targeted
|
|
70
|
+
* rows have `id: null` and `status: "Not Targeted"`.
|
|
71
|
+
*
|
|
72
|
+
* Access control: the URL's `company_id` must be in the caller's read scope
|
|
73
|
+
* for Company (a company manager's or vendor's own company, or a company
|
|
74
|
+
* whose app is activated for the API user). Callers outside that scope
|
|
75
|
+
* receive `404 Company not found`.
|
|
76
|
+
*
|
|
77
|
+
* Filter with `has_individual` / `has_active_individual` to drive the
|
|
78
|
+
* facility roster views.
|
|
79
|
+
*
|
|
80
|
+
* Available `expand` scopes are:
|
|
81
|
+
*
|
|
82
|
+
* - company_target_facility.facility
|
|
83
|
+
*/
|
|
84
|
+
async listCompanyTargetFacilities(request, options) {
|
|
85
|
+
return unwrapResultIterator(organizationsListCompanyTargetFacilities(this, request, options));
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Add a company target facility
|
|
89
|
+
*
|
|
90
|
+
* @remarks
|
|
91
|
+
* Links the URL's company to an existing facility. The link is created with
|
|
92
|
+
* status `Pending`. Only the link row is created — the Facility entity
|
|
93
|
+
* itself is never created or modified by this endpoint.
|
|
94
|
+
*
|
|
95
|
+
* Access control: the URL's `company_id` must be in the caller's update
|
|
96
|
+
* scope for Company, AND the `facility_id` must be in the caller's create
|
|
97
|
+
* scope for Facility (a facility on the company's site, or a facility
|
|
98
|
+
* reachable via the API user's site/system/facility-scoped activation).
|
|
99
|
+
* Either being out of scope returns `404 Company not found` /
|
|
100
|
+
* `404 Facility not found` respectively. Deleted facilities also return
|
|
101
|
+
* `404 Facility not found`.
|
|
102
|
+
*
|
|
103
|
+
* Available `expand` scopes are:
|
|
104
|
+
*
|
|
105
|
+
* - company_target_facility.facility
|
|
106
|
+
*/
|
|
107
|
+
async createCompanyTargetFacility(request, options) {
|
|
108
|
+
return unwrapAsync(organizationsCreateCompanyTargetFacility(this, request, options));
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Remove a company target facility
|
|
112
|
+
*
|
|
113
|
+
* @remarks
|
|
114
|
+
* Removes a CompanyTargetFacility link. Blocked when any of the company's
|
|
115
|
+
* individuals still target the same facility (to avoid orphaning their
|
|
116
|
+
* vendor-scoped target rows). Only the link row is removed — the Facility
|
|
117
|
+
* entity itself is never touched.
|
|
118
|
+
*
|
|
119
|
+
* Access control: the URL's `company_id` must be in the caller's update
|
|
120
|
+
* scope for Company (a company manager's or vendor's own company, or a
|
|
121
|
+
* company whose app is activated for the API user). Callers outside that
|
|
122
|
+
* scope receive `404 Company not found`.
|
|
123
|
+
*/
|
|
124
|
+
async deleteCompanyTargetFacility(request, options) {
|
|
125
|
+
return unwrapAsync(organizationsDeleteCompanyTargetFacility(this, request, options));
|
|
126
|
+
}
|
|
56
127
|
/**
|
|
57
128
|
* Export company target facilities to CSV (async)
|
|
58
129
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"organizations.js","sourceRoot":"","sources":["../../../src/sdk/organizations.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,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,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,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,uBAAuB,CAC3B,OAAkD,EAClD,OAAwB;QAIxB,OAAO,oBAAoB,CAAC,oCAAoC,CAC9D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;OAYG;IACH,KAAK,CAAC,6BAA6B,CACjC,OAAwD,EACxD,OAAwB;QAExB,OAAO,WAAW,CAAC,0CAA0C,CAC3D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,sCAAsC,CAC1C,OAAiE,EACjE,OAAwB;QAExB,OAAO,WAAW,CAAC,mDAAmD,CACpE,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,qCAAqC,CACzC,OAAgE,EAChE,OAAwB;QAIxB,OAAO,WAAW,CAAC,kDAAkD,CACnE,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;OAwBG;IACH,KAAK,CAAC,mBAAmB,CACvB,OAA8C,EAC9C,OAAwB;QAIxB,OAAO,oBAAoB,CAAC,gCAAgC,CAC1D,IAAI,EACJ,OAAO,EACP,OAAO,CACR,CAAC,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"}
|
|
1
|
+
{"version":3,"file":"organizations.js","sourceRoot":"","sources":["../../../src/sdk/organizations.ts"],"names":[],"mappings":"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"}
|
package/jsr.json
CHANGED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import {
|
|
5
|
+
import { expect, test } from "vitest";
|
|
6
6
|
import { GreenSecurity } from "../index.js";
|
|
7
7
|
import { createTestHTTPClient } from "./testclient.js";
|
|
8
8
|
|
|
@@ -84,22 +84,88 @@ test("Organizations List Or Search Department Contacts", async () => {
|
|
|
84
84
|
});
|
|
85
85
|
});
|
|
86
86
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
87
|
+
test("Organizations List Company Target Facilities", async () => {
|
|
88
|
+
const testHttpClient = createTestHTTPClient("listCompanyTargetFacilities");
|
|
89
|
+
|
|
90
|
+
const greenSecurity = new GreenSecurity({
|
|
91
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
92
|
+
httpClient: testHttpClient,
|
|
93
|
+
security: {
|
|
94
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const result = await greenSecurity.organizations.listCompanyTargetFacilities({
|
|
99
|
+
companyId: 864839,
|
|
100
|
+
expand: [
|
|
101
|
+
"facility.system",
|
|
102
|
+
],
|
|
103
|
+
desc: true,
|
|
104
|
+
itemsPerPage: 25,
|
|
105
|
+
});
|
|
106
|
+
expect(result).toBeDefined();
|
|
107
|
+
expect(result!.result).toBeDefined();
|
|
108
|
+
expect(result!.result).toEqual({
|
|
109
|
+
pager: {
|
|
110
|
+
baseUrl: "api/vendors/job_titles",
|
|
111
|
+
sort: "job,title",
|
|
112
|
+
desc: 0,
|
|
113
|
+
itemCount: 228,
|
|
114
|
+
itemsPerPage: 112555,
|
|
115
|
+
page: 1,
|
|
116
|
+
useUrlParams: true,
|
|
117
|
+
},
|
|
118
|
+
items: [],
|
|
119
|
+
});
|
|
91
120
|
});
|
|
92
121
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
122
|
+
test("Organizations Create Company Target Facility", async () => {
|
|
123
|
+
const testHttpClient = createTestHTTPClient("createCompanyTargetFacility");
|
|
124
|
+
|
|
125
|
+
const greenSecurity = new GreenSecurity({
|
|
126
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
127
|
+
httpClient: testHttpClient,
|
|
128
|
+
security: {
|
|
129
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
130
|
+
},
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
const result = await greenSecurity.organizations.createCompanyTargetFacility({
|
|
134
|
+
companyId: 846108,
|
|
135
|
+
expand: [
|
|
136
|
+
"facility.system",
|
|
137
|
+
],
|
|
138
|
+
requestBody: {
|
|
139
|
+
facilityId: 253646,
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
expect(result).toBeDefined();
|
|
143
|
+
expect(result).toEqual({
|
|
144
|
+
companyTargetFacility: {
|
|
145
|
+
id: 335466,
|
|
146
|
+
facility: 582706,
|
|
147
|
+
status: "<value>",
|
|
148
|
+
},
|
|
149
|
+
});
|
|
97
150
|
});
|
|
98
151
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
152
|
+
test("Organizations Delete Company Target Facility", async () => {
|
|
153
|
+
const testHttpClient = createTestHTTPClient("deleteCompanyTargetFacility");
|
|
154
|
+
|
|
155
|
+
const greenSecurity = new GreenSecurity({
|
|
156
|
+
serverURL: process.env["TEST_SERVER_URL"] ?? "https://localhost:3000/api",
|
|
157
|
+
httpClient: testHttpClient,
|
|
158
|
+
security: {
|
|
159
|
+
token: process.env["GREEN_SECURITY_TOKEN"] ?? "value",
|
|
160
|
+
},
|
|
161
|
+
});
|
|
162
|
+
|
|
163
|
+
const result = await greenSecurity.organizations.deleteCompanyTargetFacility({
|
|
164
|
+
companyId: 56711,
|
|
165
|
+
id: 304723,
|
|
166
|
+
});
|
|
167
|
+
expect(result).toBeDefined();
|
|
168
|
+
expect(result).toEqual(true);
|
|
103
169
|
});
|
|
104
170
|
|
|
105
171
|
test("Organizations Export Company Target Facilities", async () => {
|
|
@@ -39,35 +39,7 @@ test("Zones List Or Search Security Zones", async () => {
|
|
|
39
39
|
facility: {},
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
|
-
facility: {
|
|
43
|
-
contacts: {
|
|
44
|
-
contact: {
|
|
45
|
-
status: "Inactive",
|
|
46
|
-
department: 123,
|
|
47
|
-
},
|
|
48
|
-
adminContact: {
|
|
49
|
-
status: "Active",
|
|
50
|
-
department: 123,
|
|
51
|
-
},
|
|
52
|
-
techContact: {
|
|
53
|
-
status: "Deleted",
|
|
54
|
-
department: 123,
|
|
55
|
-
},
|
|
56
|
-
greenSecurityCsm: {
|
|
57
|
-
status: "Deleted",
|
|
58
|
-
department: 123,
|
|
59
|
-
},
|
|
60
|
-
accountManager: {
|
|
61
|
-
status: "Inactive",
|
|
62
|
-
department: 123,
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
|
-
vendorGuestPolicy: {
|
|
66
|
-
enabled: true,
|
|
67
|
-
vendorGuestLimitAndOr: "and",
|
|
68
|
-
vendorGuestRequireEmail: false,
|
|
69
|
-
},
|
|
70
|
-
},
|
|
42
|
+
facility: {},
|
|
71
43
|
},
|
|
72
44
|
],
|
|
73
45
|
});
|
|
@@ -85,8 +57,9 @@ test("Zones Security Zone Checkin", async () => {
|
|
|
85
57
|
});
|
|
86
58
|
|
|
87
59
|
const result = await greenSecurity.zones.securityZoneCheckin({
|
|
88
|
-
|
|
89
|
-
|
|
60
|
+
longitude: 886.22,
|
|
61
|
+
latitude: 8672.38,
|
|
62
|
+
zoneId: 777343,
|
|
90
63
|
});
|
|
91
64
|
expect(result).toBeDefined();
|
|
92
65
|
expect(result).toEqual({});
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { GreenSecurityCore } from "../core.js";
|
|
6
|
+
import { encodeFormQuery, encodeJSON, 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
|
+
* Add a company target facility
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Links the URL's company to an existing facility. The link is created with
|
|
34
|
+
* status `Pending`. Only the link row is created — the Facility entity
|
|
35
|
+
* itself is never created or modified by this endpoint.
|
|
36
|
+
*
|
|
37
|
+
* Access control: the URL's `company_id` must be in the caller's update
|
|
38
|
+
* scope for Company, AND the `facility_id` must be in the caller's create
|
|
39
|
+
* scope for Facility (a facility on the company's site, or a facility
|
|
40
|
+
* reachable via the API user's site/system/facility-scoped activation).
|
|
41
|
+
* Either being out of scope returns `404 Company not found` /
|
|
42
|
+
* `404 Facility not found` respectively. Deleted facilities also return
|
|
43
|
+
* `404 Facility not found`.
|
|
44
|
+
*
|
|
45
|
+
* Available `expand` scopes are:
|
|
46
|
+
*
|
|
47
|
+
* - company_target_facility.facility
|
|
48
|
+
*
|
|
49
|
+
* If set, this operation will use {@link Security.bearerJwt} from the global security.
|
|
50
|
+
*/
|
|
51
|
+
export function organizationsCreateCompanyTargetFacility(
|
|
52
|
+
client: GreenSecurityCore,
|
|
53
|
+
request: operations.CreateCompanyTargetFacilityRequest,
|
|
54
|
+
options?: RequestOptions,
|
|
55
|
+
): APIPromise<
|
|
56
|
+
Result<
|
|
57
|
+
operations.CreateCompanyTargetFacilityCreateCompanyTargetFacilityOk,
|
|
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.CreateCompanyTargetFacilityRequest,
|
|
79
|
+
options?: RequestOptions,
|
|
80
|
+
): Promise<
|
|
81
|
+
[
|
|
82
|
+
Result<
|
|
83
|
+
operations.CreateCompanyTargetFacilityCreateCompanyTargetFacilityOk,
|
|
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.CreateCompanyTargetFacilityRequest$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 = encodeJSON("body", payload.RequestBody, { explode: true });
|
|
108
|
+
|
|
109
|
+
const pathParams = {
|
|
110
|
+
company_id: encodeSimple("company_id", payload.company_id, {
|
|
111
|
+
explode: false,
|
|
112
|
+
charEncoding: "percent",
|
|
113
|
+
}),
|
|
114
|
+
};
|
|
115
|
+
const path = pathToFunc("/companies/{company_id}/target-facilities")(
|
|
116
|
+
pathParams,
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const query = encodeFormQuery({
|
|
120
|
+
"expand": payload.expand,
|
|
121
|
+
}, { explode: false });
|
|
122
|
+
|
|
123
|
+
const headers = new Headers(compactMap({
|
|
124
|
+
"Content-Type": "application/json",
|
|
125
|
+
Accept: "application/json",
|
|
126
|
+
}));
|
|
127
|
+
|
|
128
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
129
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
|
|
130
|
+
|
|
131
|
+
const context = {
|
|
132
|
+
options: client._options,
|
|
133
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
134
|
+
operationID: "createCompanyTargetFacility",
|
|
135
|
+
oAuth2Scopes: null,
|
|
136
|
+
|
|
137
|
+
resolvedSecurity: requestSecurity,
|
|
138
|
+
|
|
139
|
+
securitySource: client._options.security,
|
|
140
|
+
retryConfig: options?.retries
|
|
141
|
+
|| client._options.retryConfig
|
|
142
|
+
|| { strategy: "none" },
|
|
143
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
const requestRes = client._createRequest(context, {
|
|
147
|
+
security: requestSecurity,
|
|
148
|
+
method: "POST",
|
|
149
|
+
baseURL: options?.serverURL,
|
|
150
|
+
path: path,
|
|
151
|
+
headers: headers,
|
|
152
|
+
query: query,
|
|
153
|
+
body: body,
|
|
154
|
+
userAgent: client._options.userAgent,
|
|
155
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
156
|
+
}, options);
|
|
157
|
+
if (!requestRes.ok) {
|
|
158
|
+
return [requestRes, { status: "invalid" }];
|
|
159
|
+
}
|
|
160
|
+
const req = requestRes.value;
|
|
161
|
+
|
|
162
|
+
const doResult = await client._do(req, {
|
|
163
|
+
context,
|
|
164
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
165
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
166
|
+
retryConfig: context.retryConfig,
|
|
167
|
+
retryCodes: context.retryCodes,
|
|
168
|
+
});
|
|
169
|
+
if (!doResult.ok) {
|
|
170
|
+
return [doResult, { status: "request-error", request: req }];
|
|
171
|
+
}
|
|
172
|
+
const response = doResult.value;
|
|
173
|
+
|
|
174
|
+
const responseFields = {
|
|
175
|
+
HttpMeta: { Response: response, Request: req },
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
const [result] = await M.match<
|
|
179
|
+
operations.CreateCompanyTargetFacilityCreateCompanyTargetFacilityOk,
|
|
180
|
+
| errors.ApiErrorResponse
|
|
181
|
+
| GreenSecurityError
|
|
182
|
+
| ResponseValidationError
|
|
183
|
+
| ConnectionError
|
|
184
|
+
| RequestAbortedError
|
|
185
|
+
| RequestTimeoutError
|
|
186
|
+
| InvalidRequestError
|
|
187
|
+
| UnexpectedClientError
|
|
188
|
+
| SDKValidationError
|
|
189
|
+
>(
|
|
190
|
+
M.json(
|
|
191
|
+
201,
|
|
192
|
+
operations
|
|
193
|
+
.CreateCompanyTargetFacilityCreateCompanyTargetFacilityOk$inboundSchema,
|
|
194
|
+
),
|
|
195
|
+
M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
|
|
196
|
+
M.fail("4XX"),
|
|
197
|
+
M.fail([500, "5XX"]),
|
|
198
|
+
)(response, req, { extraFields: responseFields });
|
|
199
|
+
if (!result.ok) {
|
|
200
|
+
return [result, { status: "complete", request: req, response }];
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return [result, { status: "complete", request: req, response }];
|
|
204
|
+
}
|
|
@@ -0,0 +1,193 @@
|
|
|
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
|
+
* Remove a company target facility
|
|
32
|
+
*
|
|
33
|
+
* @remarks
|
|
34
|
+
* Removes a CompanyTargetFacility link. Blocked when any of the company's
|
|
35
|
+
* individuals still target the same facility (to avoid orphaning their
|
|
36
|
+
* vendor-scoped target rows). Only the link row is removed — the Facility
|
|
37
|
+
* entity itself is never touched.
|
|
38
|
+
*
|
|
39
|
+
* Access control: the URL's `company_id` must be in the caller's update
|
|
40
|
+
* scope for Company (a company manager's or vendor's own company, or a
|
|
41
|
+
* company whose app is activated for the API user). Callers outside that
|
|
42
|
+
* scope receive `404 Company not found`.
|
|
43
|
+
*
|
|
44
|
+
* If set, this operation will use {@link Security.bearerJwt} from the global security.
|
|
45
|
+
*/
|
|
46
|
+
export function organizationsDeleteCompanyTargetFacility(
|
|
47
|
+
client: GreenSecurityCore,
|
|
48
|
+
request: operations.DeleteCompanyTargetFacilityRequest,
|
|
49
|
+
options?: RequestOptions,
|
|
50
|
+
): APIPromise<
|
|
51
|
+
Result<
|
|
52
|
+
boolean,
|
|
53
|
+
| errors.ApiErrorResponse
|
|
54
|
+
| GreenSecurityError
|
|
55
|
+
| ResponseValidationError
|
|
56
|
+
| ConnectionError
|
|
57
|
+
| RequestAbortedError
|
|
58
|
+
| RequestTimeoutError
|
|
59
|
+
| InvalidRequestError
|
|
60
|
+
| UnexpectedClientError
|
|
61
|
+
| SDKValidationError
|
|
62
|
+
>
|
|
63
|
+
> {
|
|
64
|
+
return new APIPromise($do(
|
|
65
|
+
client,
|
|
66
|
+
request,
|
|
67
|
+
options,
|
|
68
|
+
));
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
async function $do(
|
|
72
|
+
client: GreenSecurityCore,
|
|
73
|
+
request: operations.DeleteCompanyTargetFacilityRequest,
|
|
74
|
+
options?: RequestOptions,
|
|
75
|
+
): Promise<
|
|
76
|
+
[
|
|
77
|
+
Result<
|
|
78
|
+
boolean,
|
|
79
|
+
| errors.ApiErrorResponse
|
|
80
|
+
| GreenSecurityError
|
|
81
|
+
| ResponseValidationError
|
|
82
|
+
| ConnectionError
|
|
83
|
+
| RequestAbortedError
|
|
84
|
+
| RequestTimeoutError
|
|
85
|
+
| InvalidRequestError
|
|
86
|
+
| UnexpectedClientError
|
|
87
|
+
| SDKValidationError
|
|
88
|
+
>,
|
|
89
|
+
APICall,
|
|
90
|
+
]
|
|
91
|
+
> {
|
|
92
|
+
const parsed = safeParse(
|
|
93
|
+
request,
|
|
94
|
+
(value) =>
|
|
95
|
+
operations.DeleteCompanyTargetFacilityRequest$outboundSchema.parse(value),
|
|
96
|
+
"Input validation failed",
|
|
97
|
+
);
|
|
98
|
+
if (!parsed.ok) {
|
|
99
|
+
return [parsed, { status: "invalid" }];
|
|
100
|
+
}
|
|
101
|
+
const payload = parsed.value;
|
|
102
|
+
const body = null;
|
|
103
|
+
|
|
104
|
+
const pathParams = {
|
|
105
|
+
company_id: encodeSimple("company_id", payload.company_id, {
|
|
106
|
+
explode: false,
|
|
107
|
+
charEncoding: "percent",
|
|
108
|
+
}),
|
|
109
|
+
id: encodeSimple("id", payload.id, {
|
|
110
|
+
explode: false,
|
|
111
|
+
charEncoding: "percent",
|
|
112
|
+
}),
|
|
113
|
+
};
|
|
114
|
+
const path = pathToFunc("/companies/{company_id}/target-facilities/{id}")(
|
|
115
|
+
pathParams,
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const headers = new Headers(compactMap({
|
|
119
|
+
Accept: "application/json",
|
|
120
|
+
}));
|
|
121
|
+
|
|
122
|
+
const securityInput = await extractSecurity(client._options.security);
|
|
123
|
+
const requestSecurity = resolveGlobalSecurity(securityInput, [1]);
|
|
124
|
+
|
|
125
|
+
const context = {
|
|
126
|
+
options: client._options,
|
|
127
|
+
baseURL: options?.serverURL ?? client._baseURL ?? "",
|
|
128
|
+
operationID: "deleteCompanyTargetFacility",
|
|
129
|
+
oAuth2Scopes: null,
|
|
130
|
+
|
|
131
|
+
resolvedSecurity: requestSecurity,
|
|
132
|
+
|
|
133
|
+
securitySource: client._options.security,
|
|
134
|
+
retryConfig: options?.retries
|
|
135
|
+
|| client._options.retryConfig
|
|
136
|
+
|| { strategy: "none" },
|
|
137
|
+
retryCodes: options?.retryCodes || ["429", "500", "502", "503", "504"],
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
const requestRes = client._createRequest(context, {
|
|
141
|
+
security: requestSecurity,
|
|
142
|
+
method: "DELETE",
|
|
143
|
+
baseURL: options?.serverURL,
|
|
144
|
+
path: path,
|
|
145
|
+
headers: headers,
|
|
146
|
+
body: body,
|
|
147
|
+
userAgent: client._options.userAgent,
|
|
148
|
+
timeoutMs: options?.timeoutMs || client._options.timeoutMs || -1,
|
|
149
|
+
}, options);
|
|
150
|
+
if (!requestRes.ok) {
|
|
151
|
+
return [requestRes, { status: "invalid" }];
|
|
152
|
+
}
|
|
153
|
+
const req = requestRes.value;
|
|
154
|
+
|
|
155
|
+
const doResult = await client._do(req, {
|
|
156
|
+
context,
|
|
157
|
+
isErrorStatusCode: (statusCode: number) =>
|
|
158
|
+
matchStatusCode({ status: statusCode } as Response, ["4XX", "5XX"]),
|
|
159
|
+
retryConfig: context.retryConfig,
|
|
160
|
+
retryCodes: context.retryCodes,
|
|
161
|
+
});
|
|
162
|
+
if (!doResult.ok) {
|
|
163
|
+
return [doResult, { status: "request-error", request: req }];
|
|
164
|
+
}
|
|
165
|
+
const response = doResult.value;
|
|
166
|
+
|
|
167
|
+
const responseFields = {
|
|
168
|
+
HttpMeta: { Response: response, Request: req },
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
const [result] = await M.match<
|
|
172
|
+
boolean,
|
|
173
|
+
| errors.ApiErrorResponse
|
|
174
|
+
| GreenSecurityError
|
|
175
|
+
| ResponseValidationError
|
|
176
|
+
| ConnectionError
|
|
177
|
+
| RequestAbortedError
|
|
178
|
+
| RequestTimeoutError
|
|
179
|
+
| InvalidRequestError
|
|
180
|
+
| UnexpectedClientError
|
|
181
|
+
| SDKValidationError
|
|
182
|
+
>(
|
|
183
|
+
M.json(200, types$.boolean()),
|
|
184
|
+
M.jsonErr([400, 401, 403, 404, 422], errors.ApiErrorResponse$inboundSchema),
|
|
185
|
+
M.fail("4XX"),
|
|
186
|
+
M.fail([500, "5XX"]),
|
|
187
|
+
)(response, req, { extraFields: responseFields });
|
|
188
|
+
if (!result.ok) {
|
|
189
|
+
return [result, { status: "complete", request: req, response }];
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
return [result, { status: "complete", request: req, response }];
|
|
193
|
+
}
|