UNPKG

@archon-inc/sdk

Version:

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

19 lines (18 loc) 875 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = updateResourceMetadata; const Archon_js_1 = require("../Archon.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. */ async function updateResourceMetadata(arid, metadata, merge = true) { const response = await Archon_js_1.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; }