UNPKG

@archon-inc/sdk

Version:

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

21 lines (16 loc) 860 B
import { Archon } from "../Archon.js"; import { ARID, Resource } from "../types/policy.js"; /** * Update the metadata of a resource by its ARID. * @param arid - The ARID of the resource to update. * @param metadata - The new metadata to associate with the resource. * @param merge - If true, merge the new metadata with the existing metadata. If false, replace the existing metadata. * @returns A promise resolving to the updated resource. */ export default async function updateResourceMetadata(arid: ARID, metadata: Record<string, unknown>, merge = true): Promise<Resource> { const response = await Archon.request(`/policy/resource/${arid}`, "POST", { metadata, merge }); if (response.status !== 200) { throw new Error(`Failed to update metadata for resource with ARID ${arid}: ${response.data}`); } return response.data; }