UNPKG

@archon-inc/sdk

Version:

Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk

20 lines (19 loc) 730 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = getResourceById; const Archon_js_1 = require("../Archon.js"); /** * Retrieve a resource by its ARID. * @param arid - The Archon Resource Identifier (ARID) of the resource to retrieve. * @returns A promise resolving to the resource, or null if not found. */ async function getResourceById(arid) { const response = await Archon_js_1.Archon.request(`/policy/resource/${arid}`, "GET"); if (response.status === 404) { return null; // Resource not found } if (response.status !== 200) { throw new Error(`Failed to retrieve resource with ARID ${arid}: ${response.data}`); } return response.data; }