UNPKG

@archon-inc/sdk

Version:

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

17 lines (16 loc) 615 B
import { Archon } from "../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. */ export default async function getResourceById(arid) { const response = await 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; }