@archon-inc/sdk
Version:
Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk
16 lines (15 loc) • 753 B
JavaScript
import { Archon } from "../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.
*/
export default async function updateResourceMetadata(arid, metadata, merge = true) {
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;
}