UNPKG

@archon-inc/sdk

Version:

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

16 lines (15 loc) 728 B
import { Archon } from "../Archon.js"; /** * Search for resources based on type and metadata. * @param resourceType - The type of the resource to search for. * @param metadata - Metadata key-value pairs to filter resources. * @returns A promise resolving to a list of resources matching the criteria. */ export default async function searchResources(resourceType, metadata = {}) { const type = typeof resourceType === "string" ? resourceType : resourceType.name; const response = await Archon.request("/policy/resource/search", "POST", { type, metadata }); if (response.status !== 200) { throw new Error(`Failed to search resources of type ${type}: ${response.data}`); } return response.data; }