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