@archon-inc/sdk
Version:
Integrate easily to our government platform using this SDK. More info on https://archon.inc/sdk
17 lines (16 loc) • 537 B
JavaScript
import { Archon } from "../Archon.js";
/**
* Get the session object from the session ID.
* @param sessionId The ID of the session to get.
* @returns The session object.
*/
export default async function getSession(sessionId) {
if (typeof sessionId !== "number") {
sessionId = parseInt(sessionId);
}
const response = await Archon.request(`/users/session/${sessionId}`, "GET");
if (response.status !== 200) {
throw new Error(`Failed to retrieve session ${sessionId}.`);
}
return response.data;
}