@greensecurity/javascript-sdk 0.9.1
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/.devcontainer/README.md +35 -0
- package/.devcontainer/devcontainer.json +45 -0
- package/FUNCTIONS.md +109 -0
- package/REACT_QUERY.md +318 -0
- package/README.md +561 -0
- package/RUNTIMES.md +48 -0
- package/core.d.ts +10 -0
- package/core.d.ts.map +1 -0
- package/core.js +17 -0
- package/core.js.map +1 -0
- package/docs/sdks/greensecurity/README.md +14 -0
- package/docs/sdks/organizations/README.md +252 -0
- package/docs/sdks/user/README.md +348 -0
- package/docs/sdks/vendors/README.md +219 -0
- package/funcs/organizationsGetFacility.d.ts +17 -0
- package/funcs/organizationsGetFacility.d.ts.map +1 -0
- package/funcs/organizationsGetFacility.js +117 -0
- package/funcs/organizationsGetFacility.js.map +1 -0
- package/funcs/organizationsListOrSearchFacilities.d.ts +28 -0
- package/funcs/organizationsListOrSearchFacilities.d.ts.map +1 -0
- package/funcs/organizationsListOrSearchFacilities.js +131 -0
- package/funcs/organizationsListOrSearchFacilities.js.map +1 -0
- package/funcs/userGetCurrentUser.d.ts +16 -0
- package/funcs/userGetCurrentUser.d.ts.map +1 -0
- package/funcs/userGetCurrentUser.js +101 -0
- package/funcs/userGetCurrentUser.js.map +1 -0
- package/funcs/userGetUserById.d.ts +17 -0
- package/funcs/userGetUserById.d.ts.map +1 -0
- package/funcs/userGetUserById.js +117 -0
- package/funcs/userGetUserById.js.map +1 -0
- package/funcs/userLogsUserIntoTheSystem.d.ts +46 -0
- package/funcs/userLogsUserIntoTheSystem.d.ts.map +1 -0
- package/funcs/userLogsUserIntoTheSystem.js +137 -0
- package/funcs/userLogsUserIntoTheSystem.js.map +1 -0
- package/funcs/vendorsCreateVendorRegistration.d.ts +16 -0
- package/funcs/vendorsCreateVendorRegistration.d.ts.map +1 -0
- package/funcs/vendorsCreateVendorRegistration.js +107 -0
- package/funcs/vendorsCreateVendorRegistration.js.map +1 -0
- package/funcs/vendorsListVendorJobTitles.d.ts +16 -0
- package/funcs/vendorsListVendorJobTitles.d.ts.map +1 -0
- package/funcs/vendorsListVendorJobTitles.js +114 -0
- package/funcs/vendorsListVendorJobTitles.js.map +1 -0
- package/hooks/hooks.d.ts +24 -0
- package/hooks/hooks.d.ts.map +1 -0
- package/hooks/hooks.js +86 -0
- package/hooks/hooks.js.map +1 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/index.d.ts.map +1 -0
- package/hooks/index.js +22 -0
- package/hooks/index.js.map +1 -0
- package/hooks/registration.d.ts +3 -0
- package/hooks/registration.d.ts.map +1 -0
- package/hooks/registration.js +15 -0
- package/hooks/registration.js.map +1 -0
- package/hooks/types.d.ts +78 -0
- package/hooks/types.d.ts.map +1 -0
- package/hooks/types.js +6 -0
- package/hooks/types.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/index.js +46 -0
- package/index.js.map +1 -0
- package/jsr.json +27 -0
- package/lib/base64.d.ts +10 -0
- package/lib/base64.d.ts.map +1 -0
- package/lib/base64.js +71 -0
- package/lib/base64.js.map +1 -0
- package/lib/config.d.ts +38 -0
- package/lib/config.d.ts.map +1 -0
- package/lib/config.js +46 -0
- package/lib/config.js.map +1 -0
- package/lib/dlv.d.ts +14 -0
- package/lib/dlv.d.ts.map +1 -0
- package/lib/dlv.js +49 -0
- package/lib/dlv.js.map +1 -0
- package/lib/encodings.d.ts +52 -0
- package/lib/encodings.d.ts.map +1 -0
- package/lib/encodings.js +368 -0
- package/lib/encodings.js.map +1 -0
- package/lib/env.d.ts +16 -0
- package/lib/env.d.ts.map +1 -0
- package/lib/env.js +66 -0
- package/lib/env.js.map +1 -0
- package/lib/files.d.ts +8 -0
- package/lib/files.d.ts.map +1 -0
- package/lib/files.js +36 -0
- package/lib/files.js.map +1 -0
- package/lib/http.d.ts +67 -0
- package/lib/http.d.ts.map +1 -0
- package/lib/http.js +217 -0
- package/lib/http.js.map +1 -0
- package/lib/is-plain-object.d.ts +2 -0
- package/lib/is-plain-object.d.ts.map +1 -0
- package/lib/is-plain-object.js +41 -0
- package/lib/is-plain-object.js.map +1 -0
- package/lib/logger.d.ts +6 -0
- package/lib/logger.d.ts.map +1 -0
- package/lib/logger.js +6 -0
- package/lib/logger.js.map +1 -0
- package/lib/matchers.d.ts +64 -0
- package/lib/matchers.d.ts.map +1 -0
- package/lib/matchers.js +204 -0
- package/lib/matchers.js.map +1 -0
- package/lib/primitives.d.ts +23 -0
- package/lib/primitives.d.ts.map +1 -0
- package/lib/primitives.js +104 -0
- package/lib/primitives.js.map +1 -0
- package/lib/retries.d.ts +38 -0
- package/lib/retries.d.ts.map +1 -0
- package/lib/retries.js +153 -0
- package/lib/retries.js.map +1 -0
- package/lib/schemas.d.ts +19 -0
- package/lib/schemas.d.ts.map +1 -0
- package/lib/schemas.js +62 -0
- package/lib/schemas.js.map +1 -0
- package/lib/sdks.d.ts +60 -0
- package/lib/sdks.d.ts.map +1 -0
- package/lib/sdks.js +280 -0
- package/lib/sdks.js.map +1 -0
- package/lib/security.d.ts +82 -0
- package/lib/security.d.ts.map +1 -0
- package/lib/security.js +145 -0
- package/lib/security.js.map +1 -0
- package/lib/url.d.ts +5 -0
- package/lib/url.d.ts.map +1 -0
- package/lib/url.js +25 -0
- package/lib/url.js.map +1 -0
- package/models/components/contact.d.ts +135 -0
- package/models/components/contact.d.ts.map +1 -0
- package/models/components/contact.js +172 -0
- package/models/components/contact.js.map +1 -0
- package/models/components/departmentsummary.d.ts +34 -0
- package/models/components/departmentsummary.d.ts.map +1 -0
- package/models/components/departmentsummary.js +71 -0
- package/models/components/departmentsummary.js.map +1 -0
- package/models/components/desc.d.ts +25 -0
- package/models/components/desc.d.ts.map +1 -0
- package/models/components/desc.js +66 -0
- package/models/components/desc.js.map +1 -0
- package/models/components/expand.d.ts +79 -0
- package/models/components/expand.d.ts.map +1 -0
- package/models/components/expand.js +79 -0
- package/models/components/expand.js.map +1 -0
- package/models/components/facility.d.ts +544 -0
- package/models/components/facility.d.ts.map +1 -0
- package/models/components/facility.js +797 -0
- package/models/components/facility.js.map +1 -0
- package/models/components/facilitysummary.d.ts +34 -0
- package/models/components/facilitysummary.d.ts.map +1 -0
- package/models/components/facilitysummary.js +71 -0
- package/models/components/facilitysummary.js.map +1 -0
- package/models/components/imageset.d.ts +38 -0
- package/models/components/imageset.d.ts.map +1 -0
- package/models/components/imageset.js +75 -0
- package/models/components/imageset.js.map +1 -0
- package/models/components/index.d.ts +20 -0
- package/models/components/index.d.ts.map +1 -0
- package/models/components/index.js +39 -0
- package/models/components/index.js.map +1 -0
- package/models/components/loginemailandpassword.d.ts +45 -0
- package/models/components/loginemailandpassword.d.ts.map +1 -0
- package/models/components/loginemailandpassword.js +82 -0
- package/models/components/loginemailandpassword.js.map +1 -0
- package/models/components/loginrequirementsfromemail.d.ts +40 -0
- package/models/components/loginrequirementsfromemail.d.ts.map +1 -0
- package/models/components/loginrequirementsfromemail.js +80 -0
- package/models/components/loginrequirementsfromemail.js.map +1 -0
- package/models/components/mfarequiredresponse.d.ts +98 -0
- package/models/components/mfarequiredresponse.d.ts.map +1 -0
- package/models/components/mfarequiredresponse.js +126 -0
- package/models/components/mfarequiredresponse.js.map +1 -0
- package/models/components/pager.d.ts +69 -0
- package/models/components/pager.d.ts.map +1 -0
- package/models/components/pager.js +97 -0
- package/models/components/pager.js.map +1 -0
- package/models/components/passwordrequiredresponse.d.ts +62 -0
- package/models/components/passwordrequiredresponse.d.ts.map +1 -0
- package/models/components/passwordrequiredresponse.js +92 -0
- package/models/components/passwordrequiredresponse.js.map +1 -0
- package/models/components/samlloginrequiredresponse.d.ts +73 -0
- package/models/components/samlloginrequiredresponse.d.ts.map +1 -0
- package/models/components/samlloginrequiredresponse.js +106 -0
- package/models/components/samlloginrequiredresponse.js.map +1 -0
- package/models/components/security.d.ts +31 -0
- package/models/components/security.d.ts.map +1 -0
- package/models/components/security.js +80 -0
- package/models/components/security.js.map +1 -0
- package/models/components/status.d.ts +37 -0
- package/models/components/status.d.ts.map +1 -0
- package/models/components/status.js +65 -0
- package/models/components/status.js.map +1 -0
- package/models/components/systemsummary.d.ts +34 -0
- package/models/components/systemsummary.d.ts.map +1 -0
- package/models/components/systemsummary.js +71 -0
- package/models/components/systemsummary.js.map +1 -0
- package/models/components/user.d.ts +265 -0
- package/models/components/user.d.ts.map +1 -0
- package/models/components/user.js +284 -0
- package/models/components/user.js.map +1 -0
- package/models/components/vendorjobtitle.d.ts +41 -0
- package/models/components/vendorjobtitle.d.ts.map +1 -0
- package/models/components/vendorjobtitle.js +71 -0
- package/models/components/vendorjobtitle.js.map +1 -0
- package/models/components/vendortype.d.ts +69 -0
- package/models/components/vendortype.d.ts.map +1 -0
- package/models/components/vendortype.js +135 -0
- package/models/components/vendortype.js.map +1 -0
- package/models/errors/apierror.d.ts +8 -0
- package/models/errors/apierror.d.ts.map +1 -0
- package/models/errors/apierror.js +21 -0
- package/models/errors/apierror.js.map +1 -0
- package/models/errors/apierrorresponse.d.ts +51 -0
- package/models/errors/apierrorresponse.d.ts.map +1 -0
- package/models/errors/apierrorresponse.js +91 -0
- package/models/errors/apierrorresponse.js.map +1 -0
- package/models/errors/httpclienterrors.d.ts +44 -0
- package/models/errors/httpclienterrors.d.ts.map +1 -0
- package/models/errors/httpclienterrors.js +78 -0
- package/models/errors/httpclienterrors.js.map +1 -0
- package/models/errors/index.d.ts +5 -0
- package/models/errors/index.d.ts.map +1 -0
- package/models/errors/index.js +24 -0
- package/models/errors/index.js.map +1 -0
- package/models/errors/sdkvalidationerror.d.ts +20 -0
- package/models/errors/sdkvalidationerror.d.ts.map +1 -0
- package/models/errors/sdkvalidationerror.js +115 -0
- package/models/errors/sdkvalidationerror.js.map +1 -0
- package/models/operations/createvendorregistration.d.ts +115 -0
- package/models/operations/createvendorregistration.d.ts.map +1 -0
- package/models/operations/createvendorregistration.js +143 -0
- package/models/operations/createvendorregistration.js.map +1 -0
- package/models/operations/getfacility.d.ts +32 -0
- package/models/operations/getfacility.d.ts.map +1 -0
- package/models/operations/getfacility.js +69 -0
- package/models/operations/getfacility.js.map +1 -0
- package/models/operations/getuserbyid.d.ts +32 -0
- package/models/operations/getuserbyid.d.ts.map +1 -0
- package/models/operations/getuserbyid.js +69 -0
- package/models/operations/getuserbyid.js.map +1 -0
- package/models/operations/index.d.ts +7 -0
- package/models/operations/index.d.ts.map +1 -0
- package/models/operations/index.js +26 -0
- package/models/operations/index.js.map +1 -0
- package/models/operations/listorsearchfacilities.d.ts +110 -0
- package/models/operations/listorsearchfacilities.d.ts.map +1 -0
- package/models/operations/listorsearchfacilities.js +130 -0
- package/models/operations/listorsearchfacilities.js.map +1 -0
- package/models/operations/listvendorjobtitles.d.ts +86 -0
- package/models/operations/listvendorjobtitles.d.ts.map +1 -0
- package/models/operations/listvendorjobtitles.js +118 -0
- package/models/operations/listvendorjobtitles.js.map +1 -0
- package/models/operations/logsuserintothesystem.d.ts +98 -0
- package/models/operations/logsuserintothesystem.d.ts.map +1 -0
- package/models/operations/logsuserintothesystem.js +164 -0
- package/models/operations/logsuserintothesystem.js.map +1 -0
- package/package.json +41 -0
- package/react-query/_context.d.ts +8 -0
- package/react-query/_context.d.ts.map +1 -0
- package/react-query/_context.js +21 -0
- package/react-query/_context.js.map +1 -0
- package/react-query/_types.d.ts +14 -0
- package/react-query/_types.d.ts.map +1 -0
- package/react-query/_types.js +6 -0
- package/react-query/_types.js.map +1 -0
- package/react-query/index.d.ts +10 -0
- package/react-query/index.d.ts.map +1 -0
- package/react-query/index.js +32 -0
- package/react-query/index.js.map +1 -0
- package/react-query/organizationsGetFacility.d.ts +31 -0
- package/react-query/organizationsGetFacility.d.ts.map +1 -0
- package/react-query/organizationsGetFacility.js +87 -0
- package/react-query/organizationsGetFacility.js.map +1 -0
- package/react-query/organizationsListOrSearchFacilities.d.ts +91 -0
- package/react-query/organizationsListOrSearchFacilities.d.ts.map +1 -0
- package/react-query/organizationsListOrSearchFacilities.js +132 -0
- package/react-query/organizationsListOrSearchFacilities.js.map +1 -0
- package/react-query/userGetCurrentUser.d.ts +29 -0
- package/react-query/userGetCurrentUser.d.ts.map +1 -0
- package/react-query/userGetCurrentUser.js +75 -0
- package/react-query/userGetCurrentUser.js.map +1 -0
- package/react-query/userGetUserById.d.ts +31 -0
- package/react-query/userGetUserById.d.ts.map +1 -0
- package/react-query/userGetUserById.js +87 -0
- package/react-query/userGetUserById.js.map +1 -0
- package/react-query/userLogsUserIntoTheSystem.d.ts +53 -0
- package/react-query/userLogsUserIntoTheSystem.d.ts.map +1 -0
- package/react-query/userLogsUserIntoTheSystem.js +77 -0
- package/react-query/userLogsUserIntoTheSystem.js.map +1 -0
- package/react-query/vendorsCreateVendorRegistration.d.ts +23 -0
- package/react-query/vendorsCreateVendorRegistration.d.ts.map +1 -0
- package/react-query/vendorsCreateVendorRegistration.js +51 -0
- package/react-query/vendorsCreateVendorRegistration.js.map +1 -0
- package/react-query/vendorsListVendorJobTitles.d.ts +53 -0
- package/react-query/vendorsListVendorJobTitles.d.ts.map +1 -0
- package/react-query/vendorsListVendorJobTitles.js +102 -0
- package/react-query/vendorsListVendorJobTitles.js.map +1 -0
- package/sdk/index.d.ts +2 -0
- package/sdk/index.d.ts.map +1 -0
- package/sdk/index.js +21 -0
- package/sdk/index.js.map +1 -0
- package/sdk/organizations.d.ts +33 -0
- package/sdk/organizations.d.ts.map +1 -0
- package/sdk/organizations.js +45 -0
- package/sdk/organizations.js.map +1 -0
- package/sdk/sdk.d.ts +13 -0
- package/sdk/sdk.d.ts.map +1 -0
- package/sdk/sdk.js +23 -0
- package/sdk/sdk.js.map +1 -0
- package/sdk/user.d.ts +57 -0
- package/sdk/user.d.ts.map +1 -0
- package/sdk/user.js +72 -0
- package/sdk/user.js.map +1 -0
- package/sdk/vendors.d.ts +19 -0
- package/sdk/vendors.d.ts.map +1 -0
- package/sdk/vendors.js +32 -0
- package/sdk/vendors.js.map +1 -0
- package/src/core.ts +13 -0
- package/src/funcs/organizationsGetFacility.ts +144 -0
- package/src/funcs/organizationsListOrSearchFacilities.ts +152 -0
- package/src/funcs/userGetCurrentUser.ts +118 -0
- package/src/funcs/userGetUserById.ts +141 -0
- package/src/funcs/userLogsUserIntoTheSystem.ts +161 -0
- package/src/funcs/vendorsCreateVendorRegistration.ts +132 -0
- package/src/funcs/vendorsListVendorJobTitles.ts +141 -0
- package/src/hooks/hooks.ts +132 -0
- package/src/hooks/index.ts +6 -0
- package/src/hooks/registration.ts +14 -0
- package/src/hooks/types.ts +110 -0
- package/src/index.ts +7 -0
- package/src/lib/base64.ts +37 -0
- package/src/lib/config.ts +76 -0
- package/src/lib/dlv.ts +53 -0
- package/src/lib/encodings.ts +483 -0
- package/src/lib/env.ts +43 -0
- package/src/lib/files.ts +40 -0
- package/src/lib/http.ts +323 -0
- package/src/lib/is-plain-object.ts +43 -0
- package/src/lib/logger.ts +9 -0
- package/src/lib/matchers.ts +322 -0
- package/src/lib/primitives.ts +136 -0
- package/src/lib/retries.ts +218 -0
- package/src/lib/schemas.ts +91 -0
- package/src/lib/sdks.ts +400 -0
- package/src/lib/security.ts +260 -0
- package/src/lib/url.ts +33 -0
- package/src/models/components/contact.ts +268 -0
- package/src/models/components/departmentsummary.ts +73 -0
- package/src/models/components/desc.ts +48 -0
- package/src/models/components/expand.ts +52 -0
- package/src/models/components/facility.ts +1334 -0
- package/src/models/components/facilitysummary.ts +71 -0
- package/src/models/components/imageset.ts +77 -0
- package/src/models/components/index.ts +23 -0
- package/src/models/components/loginemailandpassword.ts +95 -0
- package/src/models/components/loginrequirementsfromemail.ts +88 -0
- package/src/models/components/mfarequiredresponse.ts +160 -0
- package/src/models/components/pager.ts +126 -0
- package/src/models/components/passwordrequiredresponse.ts +105 -0
- package/src/models/components/samlloginrequiredresponse.ts +136 -0
- package/src/models/components/security.ts +75 -0
- package/src/models/components/status.ts +38 -0
- package/src/models/components/systemsummary.ts +69 -0
- package/src/models/components/user.ts +451 -0
- package/src/models/components/vendorjobtitle.ts +76 -0
- package/src/models/components/vendortype.ts +170 -0
- package/src/models/errors/apierror.ts +27 -0
- package/src/models/errors/apierrorresponse.ts +95 -0
- package/src/models/errors/httpclienterrors.ts +62 -0
- package/src/models/errors/index.ts +8 -0
- package/src/models/errors/sdkvalidationerror.ts +97 -0
- package/src/models/operations/createvendorregistration.ts +237 -0
- package/src/models/operations/getfacility.ts +69 -0
- package/src/models/operations/getuserbyid.ts +69 -0
- package/src/models/operations/index.ts +10 -0
- package/src/models/operations/listorsearchfacilities.ts +219 -0
- package/src/models/operations/listvendorjobtitles.ts +179 -0
- package/src/models/operations/logsuserintothesystem.ts +270 -0
- package/src/react-query/_types.ts +91 -0
- package/src/react-query/index.ts +14 -0
- package/src/react-query/organizationsGetFacility.ts +154 -0
- package/src/react-query/organizationsListOrSearchFacilities.ts +241 -0
- package/src/react-query/userGetCurrentUser.ts +124 -0
- package/src/react-query/userGetUserById.ts +152 -0
- package/src/react-query/userLogsUserIntoTheSystem.ts +119 -0
- package/src/react-query/vendorsCreateVendorRegistration.ts +93 -0
- package/src/react-query/vendorsListVendorJobTitles.ts +194 -0
- package/src/sdk/index.ts +5 -0
- package/src/sdk/organizations.ts +59 -0
- package/src/sdk/sdk.ts +25 -0
- package/src/sdk/user.ts +92 -0
- package/src/sdk/vendors.ts +45 -0
- package/src/types/blobs.ts +31 -0
- package/src/types/constdatetime.ts +15 -0
- package/src/types/enums.ts +16 -0
- package/src/types/fp.ts +50 -0
- package/src/types/index.ts +11 -0
- package/src/types/operations.ts +105 -0
- package/src/types/rfcdate.ts +54 -0
- package/src/types/streams.ts +21 -0
- package/tsconfig.json +41 -0
- package/types/blobs.d.ts +4 -0
- package/types/blobs.d.ts.map +1 -0
- package/types/blobs.js +62 -0
- package/types/blobs.js.map +1 -0
- package/types/constdatetime.d.ts +3 -0
- package/types/constdatetime.d.ts.map +1 -0
- package/types/constdatetime.js +46 -0
- package/types/constdatetime.js.map +1 -0
- package/types/enums.d.ts +12 -0
- package/types/enums.d.ts.map +1 -0
- package/types/enums.js +10 -0
- package/types/enums.js.map +1 -0
- package/types/fp.d.ts +31 -0
- package/types/fp.d.ts.map +1 -0
- package/types/fp.js +37 -0
- package/types/fp.js.map +1 -0
- package/types/index.d.ts +8 -0
- package/types/index.d.ts.map +1 -0
- package/types/index.js +16 -0
- package/types/index.js.map +1 -0
- package/types/operations.d.ts +27 -0
- package/types/operations.d.ts.map +1 -0
- package/types/operations.js +83 -0
- package/types/operations.js.map +1 -0
- package/types/rfcdate.d.ts +21 -0
- package/types/rfcdate.d.ts.map +1 -0
- package/types/rfcdate.js +46 -0
- package/types/rfcdate.js.map +1 -0
- package/types/streams.d.ts +2 -0
- package/types/streams.d.ts.map +1 -0
- package/types/streams.js +18 -0
- package/types/streams.js.map +1 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as components from "../models/components/index.js";
|
|
6
|
+
import { env } from "./env.js";
|
|
7
|
+
type OAuth2PasswordFlow = {
|
|
8
|
+
username: string;
|
|
9
|
+
password?: string | undefined;
|
|
10
|
+
clientID: string;
|
|
11
|
+
clientSecret?: string | undefined;
|
|
12
|
+
tokenURL: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export enum SecurityErrorCode {
|
|
16
|
+
Incomplete = "incomplete",
|
|
17
|
+
UnrecognisedSecurityType = "unrecognized_security_type",
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export class SecurityError extends Error {
|
|
21
|
+
constructor(
|
|
22
|
+
public code: SecurityErrorCode,
|
|
23
|
+
message: string,
|
|
24
|
+
) {
|
|
25
|
+
super(message);
|
|
26
|
+
this.name = "SecurityError";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
static incomplete(): SecurityError {
|
|
30
|
+
return new SecurityError(
|
|
31
|
+
SecurityErrorCode.Incomplete,
|
|
32
|
+
"Security requirements not met in order to perform the operation",
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
static unrecognizedType(type: string): SecurityError {
|
|
36
|
+
return new SecurityError(
|
|
37
|
+
SecurityErrorCode.UnrecognisedSecurityType,
|
|
38
|
+
`Unrecognised security type: ${type}`,
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export type SecurityState = {
|
|
44
|
+
basic: { username?: string | undefined; password?: string | undefined };
|
|
45
|
+
headers: Record<string, string>;
|
|
46
|
+
queryParams: Record<string, string>;
|
|
47
|
+
cookies: Record<string, string>;
|
|
48
|
+
oauth2: ({ type: "password" } & OAuth2PasswordFlow) | { type: "none" };
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
type SecurityInputBasic = {
|
|
52
|
+
type: "http:basic";
|
|
53
|
+
value:
|
|
54
|
+
| { username?: string | undefined; password?: string | undefined }
|
|
55
|
+
| null
|
|
56
|
+
| undefined;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
type SecurityInputBearer = {
|
|
60
|
+
type: "http:bearer";
|
|
61
|
+
value: string | null | undefined;
|
|
62
|
+
fieldName: string;
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
type SecurityInputAPIKey = {
|
|
66
|
+
type: "apiKey:header" | "apiKey:query" | "apiKey:cookie";
|
|
67
|
+
value: string | null | undefined;
|
|
68
|
+
fieldName: string;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
type SecurityInputOIDC = {
|
|
72
|
+
type: "openIdConnect";
|
|
73
|
+
value: string | null | undefined;
|
|
74
|
+
fieldName: string;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type SecurityInputOAuth2 = {
|
|
78
|
+
type: "oauth2";
|
|
79
|
+
value: string | null | undefined;
|
|
80
|
+
fieldName: string;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
type SecurityInputOAuth2ClientCredentials = {
|
|
84
|
+
type: "oauth2:client_credentials";
|
|
85
|
+
value:
|
|
86
|
+
| { clientID?: string | undefined; clientSecret?: string | undefined }
|
|
87
|
+
| null
|
|
88
|
+
| undefined;
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
type SecurityInputOAuth2PasswordCredentials = {
|
|
92
|
+
type: "oauth2:password";
|
|
93
|
+
value:
|
|
94
|
+
| string
|
|
95
|
+
| null
|
|
96
|
+
| undefined;
|
|
97
|
+
fieldName: string;
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
type SecurityInputCustom = {
|
|
101
|
+
type: "http:custom";
|
|
102
|
+
value: any | null | undefined;
|
|
103
|
+
fieldName: string;
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export type SecurityInput =
|
|
107
|
+
| SecurityInputBasic
|
|
108
|
+
| SecurityInputBearer
|
|
109
|
+
| SecurityInputAPIKey
|
|
110
|
+
| SecurityInputOAuth2
|
|
111
|
+
| SecurityInputOAuth2ClientCredentials
|
|
112
|
+
| SecurityInputOAuth2PasswordCredentials
|
|
113
|
+
| SecurityInputOIDC
|
|
114
|
+
| SecurityInputCustom;
|
|
115
|
+
|
|
116
|
+
export function resolveSecurity(
|
|
117
|
+
...options: SecurityInput[][]
|
|
118
|
+
): SecurityState | null {
|
|
119
|
+
const state: SecurityState = {
|
|
120
|
+
basic: {},
|
|
121
|
+
headers: {},
|
|
122
|
+
queryParams: {},
|
|
123
|
+
cookies: {},
|
|
124
|
+
oauth2: { type: "none" },
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
const option = options.find((opts) => {
|
|
128
|
+
return opts.every((o) => {
|
|
129
|
+
if (o.value == null) {
|
|
130
|
+
return false;
|
|
131
|
+
} else if (o.type === "http:basic") {
|
|
132
|
+
return o.value.username != null || o.value.password != null;
|
|
133
|
+
} else if (o.type === "http:custom") {
|
|
134
|
+
return null;
|
|
135
|
+
} else if (o.type === "oauth2:password") {
|
|
136
|
+
return (
|
|
137
|
+
typeof o.value === "string" && !!o.value
|
|
138
|
+
);
|
|
139
|
+
} else if (o.type === "oauth2:client_credentials") {
|
|
140
|
+
return o.value.clientID != null || o.value.clientSecret != null;
|
|
141
|
+
} else if (typeof o.value === "string") {
|
|
142
|
+
return !!o.value;
|
|
143
|
+
} else {
|
|
144
|
+
throw new Error(
|
|
145
|
+
`Unrecognized security type: ${o.type} (value type: ${typeof o
|
|
146
|
+
.value})`,
|
|
147
|
+
);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
if (option == null) {
|
|
152
|
+
return null;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
option.forEach((spec) => {
|
|
156
|
+
if (spec.value == null) {
|
|
157
|
+
return;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const { type } = spec;
|
|
161
|
+
|
|
162
|
+
switch (type) {
|
|
163
|
+
case "apiKey:header":
|
|
164
|
+
state.headers[spec.fieldName] = spec.value;
|
|
165
|
+
break;
|
|
166
|
+
case "apiKey:query":
|
|
167
|
+
state.queryParams[spec.fieldName] = spec.value;
|
|
168
|
+
break;
|
|
169
|
+
case "apiKey:cookie":
|
|
170
|
+
state.cookies[spec.fieldName] = spec.value;
|
|
171
|
+
break;
|
|
172
|
+
case "http:basic":
|
|
173
|
+
applyBasic(state, spec);
|
|
174
|
+
break;
|
|
175
|
+
case "http:custom":
|
|
176
|
+
break;
|
|
177
|
+
case "http:bearer":
|
|
178
|
+
applyBearer(state, spec);
|
|
179
|
+
break;
|
|
180
|
+
case "oauth2":
|
|
181
|
+
applyBearer(state, spec);
|
|
182
|
+
break;
|
|
183
|
+
case "oauth2:password":
|
|
184
|
+
applyBearer(state, spec);
|
|
185
|
+
break;
|
|
186
|
+
case "oauth2:client_credentials":
|
|
187
|
+
break;
|
|
188
|
+
case "openIdConnect":
|
|
189
|
+
applyBearer(state, spec);
|
|
190
|
+
break;
|
|
191
|
+
default:
|
|
192
|
+
spec satisfies never;
|
|
193
|
+
throw SecurityError.unrecognizedType(type);
|
|
194
|
+
}
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
return state;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
function applyBasic(
|
|
201
|
+
state: SecurityState,
|
|
202
|
+
spec: SecurityInputBasic,
|
|
203
|
+
) {
|
|
204
|
+
if (spec.value == null) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
state.basic = spec.value;
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
function applyBearer(
|
|
212
|
+
state: SecurityState,
|
|
213
|
+
spec:
|
|
214
|
+
| SecurityInputBearer
|
|
215
|
+
| SecurityInputOAuth2
|
|
216
|
+
| SecurityInputOIDC
|
|
217
|
+
| SecurityInputOAuth2PasswordCredentials,
|
|
218
|
+
) {
|
|
219
|
+
if (typeof spec.value !== "string" || !spec.value) {
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
let value = spec.value;
|
|
224
|
+
if (value.slice(0, 7).toLowerCase() !== "bearer ") {
|
|
225
|
+
value = `Bearer ${value}`;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
state.headers[spec.fieldName] = value;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export function resolveGlobalSecurity(
|
|
232
|
+
security: Partial<components.Security> | null | undefined,
|
|
233
|
+
): SecurityState | null {
|
|
234
|
+
return resolveSecurity(
|
|
235
|
+
[
|
|
236
|
+
{
|
|
237
|
+
fieldName: "token",
|
|
238
|
+
type: "apiKey:query",
|
|
239
|
+
value: security?.token ?? env().GREEN_SECURITY_TOKEN,
|
|
240
|
+
},
|
|
241
|
+
],
|
|
242
|
+
[
|
|
243
|
+
{
|
|
244
|
+
fieldName: "Authorization",
|
|
245
|
+
type: "http:bearer",
|
|
246
|
+
value: security?.bearerJwt ?? env().GREEN_SECURITY_BEARER_JWT,
|
|
247
|
+
},
|
|
248
|
+
],
|
|
249
|
+
);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export async function extractSecurity<
|
|
253
|
+
T extends string | Record<string, unknown>,
|
|
254
|
+
>(sec: T | (() => Promise<T>) | undefined): Promise<T | undefined> {
|
|
255
|
+
if (sec == null) {
|
|
256
|
+
return;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
return typeof sec === "function" ? sec() : sec;
|
|
260
|
+
}
|
package/src/lib/url.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
const hasOwn = Object.prototype.hasOwnProperty;
|
|
6
|
+
|
|
7
|
+
export type Params = Partial<Record<string, string | number>>;
|
|
8
|
+
|
|
9
|
+
export function pathToFunc(
|
|
10
|
+
pathPattern: string,
|
|
11
|
+
options?: { charEncoding?: "percent" | "none" },
|
|
12
|
+
): (params?: Params) => string {
|
|
13
|
+
const paramRE = /\{([a-zA-Z0-9_]+?)\}/g;
|
|
14
|
+
|
|
15
|
+
return function buildURLPath(params: Record<string, unknown> = {}): string {
|
|
16
|
+
return pathPattern.replace(paramRE, function (_, placeholder) {
|
|
17
|
+
if (!hasOwn.call(params, placeholder)) {
|
|
18
|
+
throw new Error(`Parameter '${placeholder}' is required`);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const value = params[placeholder];
|
|
22
|
+
if (typeof value !== "string" && typeof value !== "number") {
|
|
23
|
+
throw new Error(
|
|
24
|
+
`Parameter '${placeholder}' must be a string or number`,
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return options?.charEncoding === "percent"
|
|
29
|
+
? encodeURIComponent(`${value}`)
|
|
30
|
+
: `${value}`;
|
|
31
|
+
});
|
|
32
|
+
};
|
|
33
|
+
}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { ClosedEnum } from "../../types/enums.js";
|
|
8
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
9
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
10
|
+
import {
|
|
11
|
+
DepartmentSummary,
|
|
12
|
+
DepartmentSummary$inboundSchema,
|
|
13
|
+
DepartmentSummary$Outbound,
|
|
14
|
+
DepartmentSummary$outboundSchema,
|
|
15
|
+
} from "./departmentsummary.js";
|
|
16
|
+
import {
|
|
17
|
+
FacilitySummary,
|
|
18
|
+
FacilitySummary$inboundSchema,
|
|
19
|
+
FacilitySummary$Outbound,
|
|
20
|
+
FacilitySummary$outboundSchema,
|
|
21
|
+
} from "./facilitysummary.js";
|
|
22
|
+
import {
|
|
23
|
+
SystemSummary,
|
|
24
|
+
SystemSummary$inboundSchema,
|
|
25
|
+
SystemSummary$Outbound,
|
|
26
|
+
SystemSummary$outboundSchema,
|
|
27
|
+
} from "./systemsummary.js";
|
|
28
|
+
|
|
29
|
+
export type ContactFacility = FacilitySummary | number;
|
|
30
|
+
|
|
31
|
+
export type System = SystemSummary | number;
|
|
32
|
+
|
|
33
|
+
export const ContactStatus = {
|
|
34
|
+
Active: "Active",
|
|
35
|
+
Inactive: "Inactive",
|
|
36
|
+
Deleted: "Deleted",
|
|
37
|
+
} as const;
|
|
38
|
+
export type ContactStatus = ClosedEnum<typeof ContactStatus>;
|
|
39
|
+
|
|
40
|
+
export type Department = DepartmentSummary | number;
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* This object represents a contact at the system or facility level. Use it to verify vendors, create appointments, or check in visitors.
|
|
44
|
+
*/
|
|
45
|
+
export type Contact = {
|
|
46
|
+
facility?: FacilitySummary | number | undefined;
|
|
47
|
+
system?: SystemSummary | number | undefined;
|
|
48
|
+
status: ContactStatus;
|
|
49
|
+
position?: string | null | undefined;
|
|
50
|
+
department?: DepartmentSummary | number | null | undefined;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/** @internal */
|
|
54
|
+
export const ContactFacility$inboundSchema: z.ZodType<
|
|
55
|
+
ContactFacility,
|
|
56
|
+
z.ZodTypeDef,
|
|
57
|
+
unknown
|
|
58
|
+
> = z.union([FacilitySummary$inboundSchema, z.number().int()]);
|
|
59
|
+
|
|
60
|
+
/** @internal */
|
|
61
|
+
export type ContactFacility$Outbound = FacilitySummary$Outbound | number;
|
|
62
|
+
|
|
63
|
+
/** @internal */
|
|
64
|
+
export const ContactFacility$outboundSchema: z.ZodType<
|
|
65
|
+
ContactFacility$Outbound,
|
|
66
|
+
z.ZodTypeDef,
|
|
67
|
+
ContactFacility
|
|
68
|
+
> = z.union([FacilitySummary$outboundSchema, z.number().int()]);
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* @internal
|
|
72
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
73
|
+
*/
|
|
74
|
+
export namespace ContactFacility$ {
|
|
75
|
+
/** @deprecated use `ContactFacility$inboundSchema` instead. */
|
|
76
|
+
export const inboundSchema = ContactFacility$inboundSchema;
|
|
77
|
+
/** @deprecated use `ContactFacility$outboundSchema` instead. */
|
|
78
|
+
export const outboundSchema = ContactFacility$outboundSchema;
|
|
79
|
+
/** @deprecated use `ContactFacility$Outbound` instead. */
|
|
80
|
+
export type Outbound = ContactFacility$Outbound;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export function contactFacilityToJSON(
|
|
84
|
+
contactFacility: ContactFacility,
|
|
85
|
+
): string {
|
|
86
|
+
return JSON.stringify(ContactFacility$outboundSchema.parse(contactFacility));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export function contactFacilityFromJSON(
|
|
90
|
+
jsonString: string,
|
|
91
|
+
): SafeParseResult<ContactFacility, SDKValidationError> {
|
|
92
|
+
return safeParse(
|
|
93
|
+
jsonString,
|
|
94
|
+
(x) => ContactFacility$inboundSchema.parse(JSON.parse(x)),
|
|
95
|
+
`Failed to parse 'ContactFacility' from JSON`,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/** @internal */
|
|
100
|
+
export const System$inboundSchema: z.ZodType<System, z.ZodTypeDef, unknown> = z
|
|
101
|
+
.union([SystemSummary$inboundSchema, z.number().int()]);
|
|
102
|
+
|
|
103
|
+
/** @internal */
|
|
104
|
+
export type System$Outbound = SystemSummary$Outbound | number;
|
|
105
|
+
|
|
106
|
+
/** @internal */
|
|
107
|
+
export const System$outboundSchema: z.ZodType<
|
|
108
|
+
System$Outbound,
|
|
109
|
+
z.ZodTypeDef,
|
|
110
|
+
System
|
|
111
|
+
> = z.union([SystemSummary$outboundSchema, z.number().int()]);
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* @internal
|
|
115
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
116
|
+
*/
|
|
117
|
+
export namespace System$ {
|
|
118
|
+
/** @deprecated use `System$inboundSchema` instead. */
|
|
119
|
+
export const inboundSchema = System$inboundSchema;
|
|
120
|
+
/** @deprecated use `System$outboundSchema` instead. */
|
|
121
|
+
export const outboundSchema = System$outboundSchema;
|
|
122
|
+
/** @deprecated use `System$Outbound` instead. */
|
|
123
|
+
export type Outbound = System$Outbound;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export function systemToJSON(system: System): string {
|
|
127
|
+
return JSON.stringify(System$outboundSchema.parse(system));
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
export function systemFromJSON(
|
|
131
|
+
jsonString: string,
|
|
132
|
+
): SafeParseResult<System, SDKValidationError> {
|
|
133
|
+
return safeParse(
|
|
134
|
+
jsonString,
|
|
135
|
+
(x) => System$inboundSchema.parse(JSON.parse(x)),
|
|
136
|
+
`Failed to parse 'System' from JSON`,
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/** @internal */
|
|
141
|
+
export const ContactStatus$inboundSchema: z.ZodNativeEnum<
|
|
142
|
+
typeof ContactStatus
|
|
143
|
+
> = z.nativeEnum(ContactStatus);
|
|
144
|
+
|
|
145
|
+
/** @internal */
|
|
146
|
+
export const ContactStatus$outboundSchema: z.ZodNativeEnum<
|
|
147
|
+
typeof ContactStatus
|
|
148
|
+
> = ContactStatus$inboundSchema;
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* @internal
|
|
152
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
153
|
+
*/
|
|
154
|
+
export namespace ContactStatus$ {
|
|
155
|
+
/** @deprecated use `ContactStatus$inboundSchema` instead. */
|
|
156
|
+
export const inboundSchema = ContactStatus$inboundSchema;
|
|
157
|
+
/** @deprecated use `ContactStatus$outboundSchema` instead. */
|
|
158
|
+
export const outboundSchema = ContactStatus$outboundSchema;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/** @internal */
|
|
162
|
+
export const Department$inboundSchema: z.ZodType<
|
|
163
|
+
Department,
|
|
164
|
+
z.ZodTypeDef,
|
|
165
|
+
unknown
|
|
166
|
+
> = z.union([DepartmentSummary$inboundSchema, z.number().int()]);
|
|
167
|
+
|
|
168
|
+
/** @internal */
|
|
169
|
+
export type Department$Outbound = DepartmentSummary$Outbound | number;
|
|
170
|
+
|
|
171
|
+
/** @internal */
|
|
172
|
+
export const Department$outboundSchema: z.ZodType<
|
|
173
|
+
Department$Outbound,
|
|
174
|
+
z.ZodTypeDef,
|
|
175
|
+
Department
|
|
176
|
+
> = z.union([DepartmentSummary$outboundSchema, z.number().int()]);
|
|
177
|
+
|
|
178
|
+
/**
|
|
179
|
+
* @internal
|
|
180
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
181
|
+
*/
|
|
182
|
+
export namespace Department$ {
|
|
183
|
+
/** @deprecated use `Department$inboundSchema` instead. */
|
|
184
|
+
export const inboundSchema = Department$inboundSchema;
|
|
185
|
+
/** @deprecated use `Department$outboundSchema` instead. */
|
|
186
|
+
export const outboundSchema = Department$outboundSchema;
|
|
187
|
+
/** @deprecated use `Department$Outbound` instead. */
|
|
188
|
+
export type Outbound = Department$Outbound;
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
export function departmentToJSON(department: Department): string {
|
|
192
|
+
return JSON.stringify(Department$outboundSchema.parse(department));
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export function departmentFromJSON(
|
|
196
|
+
jsonString: string,
|
|
197
|
+
): SafeParseResult<Department, SDKValidationError> {
|
|
198
|
+
return safeParse(
|
|
199
|
+
jsonString,
|
|
200
|
+
(x) => Department$inboundSchema.parse(JSON.parse(x)),
|
|
201
|
+
`Failed to parse 'Department' from JSON`,
|
|
202
|
+
);
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
/** @internal */
|
|
206
|
+
export const Contact$inboundSchema: z.ZodType<Contact, z.ZodTypeDef, unknown> =
|
|
207
|
+
z.object({
|
|
208
|
+
facility: z.union([FacilitySummary$inboundSchema, z.number().int()])
|
|
209
|
+
.optional(),
|
|
210
|
+
system: z.union([SystemSummary$inboundSchema, z.number().int()]).optional(),
|
|
211
|
+
status: ContactStatus$inboundSchema,
|
|
212
|
+
position: z.nullable(z.string()).optional(),
|
|
213
|
+
department: z.nullable(
|
|
214
|
+
z.union([DepartmentSummary$inboundSchema, z.number().int()]),
|
|
215
|
+
).optional(),
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
/** @internal */
|
|
219
|
+
export type Contact$Outbound = {
|
|
220
|
+
facility?: FacilitySummary$Outbound | number | undefined;
|
|
221
|
+
system?: SystemSummary$Outbound | number | undefined;
|
|
222
|
+
status: string;
|
|
223
|
+
position?: string | null | undefined;
|
|
224
|
+
department?: DepartmentSummary$Outbound | number | null | undefined;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
/** @internal */
|
|
228
|
+
export const Contact$outboundSchema: z.ZodType<
|
|
229
|
+
Contact$Outbound,
|
|
230
|
+
z.ZodTypeDef,
|
|
231
|
+
Contact
|
|
232
|
+
> = z.object({
|
|
233
|
+
facility: z.union([FacilitySummary$outboundSchema, z.number().int()])
|
|
234
|
+
.optional(),
|
|
235
|
+
system: z.union([SystemSummary$outboundSchema, z.number().int()]).optional(),
|
|
236
|
+
status: ContactStatus$outboundSchema,
|
|
237
|
+
position: z.nullable(z.string()).optional(),
|
|
238
|
+
department: z.nullable(
|
|
239
|
+
z.union([DepartmentSummary$outboundSchema, z.number().int()]),
|
|
240
|
+
).optional(),
|
|
241
|
+
});
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @internal
|
|
245
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
246
|
+
*/
|
|
247
|
+
export namespace Contact$ {
|
|
248
|
+
/** @deprecated use `Contact$inboundSchema` instead. */
|
|
249
|
+
export const inboundSchema = Contact$inboundSchema;
|
|
250
|
+
/** @deprecated use `Contact$outboundSchema` instead. */
|
|
251
|
+
export const outboundSchema = Contact$outboundSchema;
|
|
252
|
+
/** @deprecated use `Contact$Outbound` instead. */
|
|
253
|
+
export type Outbound = Contact$Outbound;
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
export function contactToJSON(contact: Contact): string {
|
|
257
|
+
return JSON.stringify(Contact$outboundSchema.parse(contact));
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
export function contactFromJSON(
|
|
261
|
+
jsonString: string,
|
|
262
|
+
): SafeParseResult<Contact, SDKValidationError> {
|
|
263
|
+
return safeParse(
|
|
264
|
+
jsonString,
|
|
265
|
+
(x) => Contact$inboundSchema.parse(JSON.parse(x)),
|
|
266
|
+
`Failed to parse 'Contact' from JSON`,
|
|
267
|
+
);
|
|
268
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A simplified representation of a Department, typically used in list views.
|
|
12
|
+
*/
|
|
13
|
+
export type DepartmentSummary = {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/** @internal */
|
|
19
|
+
export const DepartmentSummary$inboundSchema: z.ZodType<
|
|
20
|
+
DepartmentSummary,
|
|
21
|
+
z.ZodTypeDef,
|
|
22
|
+
unknown
|
|
23
|
+
> = z.object({
|
|
24
|
+
id: z.number().int(),
|
|
25
|
+
name: z.string(),
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
/** @internal */
|
|
29
|
+
export type DepartmentSummary$Outbound = {
|
|
30
|
+
id: number;
|
|
31
|
+
name: string;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/** @internal */
|
|
35
|
+
export const DepartmentSummary$outboundSchema: z.ZodType<
|
|
36
|
+
DepartmentSummary$Outbound,
|
|
37
|
+
z.ZodTypeDef,
|
|
38
|
+
DepartmentSummary
|
|
39
|
+
> = z.object({
|
|
40
|
+
id: z.number().int(),
|
|
41
|
+
name: z.string(),
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* @internal
|
|
46
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
47
|
+
*/
|
|
48
|
+
export namespace DepartmentSummary$ {
|
|
49
|
+
/** @deprecated use `DepartmentSummary$inboundSchema` instead. */
|
|
50
|
+
export const inboundSchema = DepartmentSummary$inboundSchema;
|
|
51
|
+
/** @deprecated use `DepartmentSummary$outboundSchema` instead. */
|
|
52
|
+
export const outboundSchema = DepartmentSummary$outboundSchema;
|
|
53
|
+
/** @deprecated use `DepartmentSummary$Outbound` instead. */
|
|
54
|
+
export type Outbound = DepartmentSummary$Outbound;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
export function departmentSummaryToJSON(
|
|
58
|
+
departmentSummary: DepartmentSummary,
|
|
59
|
+
): string {
|
|
60
|
+
return JSON.stringify(
|
|
61
|
+
DepartmentSummary$outboundSchema.parse(departmentSummary),
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export function departmentSummaryFromJSON(
|
|
66
|
+
jsonString: string,
|
|
67
|
+
): SafeParseResult<DepartmentSummary, SDKValidationError> {
|
|
68
|
+
return safeParse(
|
|
69
|
+
jsonString,
|
|
70
|
+
(x) => DepartmentSummary$inboundSchema.parse(JSON.parse(x)),
|
|
71
|
+
`Failed to parse 'DepartmentSummary' from JSON`,
|
|
72
|
+
);
|
|
73
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import * as z from "zod";
|
|
6
|
+
import { safeParse } from "../../lib/schemas.js";
|
|
7
|
+
import { Result as SafeParseResult } from "../../types/fp.js";
|
|
8
|
+
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
|
|
9
|
+
|
|
10
|
+
export type Desc = boolean | number;
|
|
11
|
+
|
|
12
|
+
/** @internal */
|
|
13
|
+
export const Desc$inboundSchema: z.ZodType<Desc, z.ZodTypeDef, unknown> = z
|
|
14
|
+
.union([z.boolean(), z.number().int()]);
|
|
15
|
+
|
|
16
|
+
/** @internal */
|
|
17
|
+
export type Desc$Outbound = boolean | number;
|
|
18
|
+
|
|
19
|
+
/** @internal */
|
|
20
|
+
export const Desc$outboundSchema: z.ZodType<Desc$Outbound, z.ZodTypeDef, Desc> =
|
|
21
|
+
z.union([z.boolean(), z.number().int()]);
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @internal
|
|
25
|
+
* @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
|
|
26
|
+
*/
|
|
27
|
+
export namespace Desc$ {
|
|
28
|
+
/** @deprecated use `Desc$inboundSchema` instead. */
|
|
29
|
+
export const inboundSchema = Desc$inboundSchema;
|
|
30
|
+
/** @deprecated use `Desc$outboundSchema` instead. */
|
|
31
|
+
export const outboundSchema = Desc$outboundSchema;
|
|
32
|
+
/** @deprecated use `Desc$Outbound` instead. */
|
|
33
|
+
export type Outbound = Desc$Outbound;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export function descToJSON(desc: Desc): string {
|
|
37
|
+
return JSON.stringify(Desc$outboundSchema.parse(desc));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export function descFromJSON(
|
|
41
|
+
jsonString: string,
|
|
42
|
+
): SafeParseResult<Desc, SDKValidationError> {
|
|
43
|
+
return safeParse(
|
|
44
|
+
jsonString,
|
|
45
|
+
(x) => Desc$inboundSchema.parse(JSON.parse(x)),
|
|
46
|
+
`Failed to parse 'Desc' from JSON`,
|
|
47
|
+
);
|
|
48
|
+
}
|