UNPKG

@archon-inc/sdk

Version:

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

17 lines (14 loc) 521 B
import { Archon } from "../Archon.js"; import { Role, RoleName } from "../types/policy.js"; /** * Retrieves a role by its name. * @param role The name of the role to retrieve. * @returns A promise resolving to the role. */ export default async function getRole(role: string | RoleName): Promise<Role> { const response = await Archon.request(`/policy/role/${role}`, "GET"); if (response.status !== 200) { throw new Error(`Failed to retrieve role with ID ${role}.`); } return response.data; }