@archon-inc/sdk
Version:
Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk
17 lines (16 loc) • 716 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.default = getResourceType;
const Archon_js_1 = require("../Archon.js");
/**
* Given a resource type name, return the resource type from the Archon policy service.
* @param resourceTypeName the name of the resource type to retrieve, found in the archon.yaml file.
* @returns The resource type from the Archon policy service.
*/
async function getResourceType(resourceTypeName) {
const response = await Archon_js_1.Archon.request(`/policy/type/${resourceTypeName}`, "GET");
if (response.status !== 200) {
throw new Error(`Failed to retrieve resource type ${resourceTypeName}.`);
}
return response.data;
}