@isaac-platform/isaac-integration-sdk
Version:
A Typescript SDK for integrating with ISAAC
43 lines (42 loc) • 1.74 kB
JavaScript
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import { IsaacEvent } from "./event.js";
import isaacConnection from "../../controller/isaac.js";
export class EventController {
constructor() {
}
GetEvents() {
return __awaiter(this, void 0, void 0, function* () {
try {
let eventObjects = [];
let eventList = yield isaacConnection.getRequest(`events`);
eventList.forEach((event) => {
eventObjects.push(new IsaacEvent(event));
});
return eventObjects;
}
catch (error) {
console.error('ISAAC SDK: Error getting events.', error);
throw error;
}
});
}
GetEvent(id) {
return __awaiter(this, void 0, void 0, function* () {
try {
return yield isaacConnection.getRequest(`events/${id}`);
}
catch (error) {
console.error('ISAAC SDK: Error getting event.', error);
throw error;
}
});
}
}