UNPKG

event-app-api

Version:

Package for easy access to Event App API

91 lines (90 loc) 6.05 kB
"use strict"; 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()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports._fetchEventMeetingsStatistics = exports._editMeeting = exports._createArrangedMeeting = exports._createMeeting = exports._deliverMeeting = exports._rateMeeting = exports._confirmMeeting = exports._declineMeeting = exports._cancelMeeting = exports._fetchLocation = exports._fetchArrangedMeetings = exports._fetchMeetings = void 0; const api_1 = require("../../utils/api"); const base_1 = require("../../utils/base"); const _fetchMeetings = (basePath, token) => __awaiter(void 0, void 0, void 0, function* () { var _a; const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.USERS}/meetings`, token); return ((_a = response === null || response === void 0 ? void 0 : response.data) === null || _a === void 0 ? void 0 : _a.data) || (response === null || response === void 0 ? void 0 : response.data) || response; }); exports._fetchMeetings = _fetchMeetings; const _fetchArrangedMeetings = (basePath, token, eventId) => __awaiter(void 0, void 0, void 0, function* () { var _b; const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.EVENTS}/${eventId}/meetings/arranged`, token); return ((_b = response === null || response === void 0 ? void 0 : response.data) === null || _b === void 0 ? void 0 : _b.data) || (response === null || response === void 0 ? void 0 : response.data) || response; }); exports._fetchArrangedMeetings = _fetchArrangedMeetings; const _fetchLocation = (basePath, token, locationId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.LOCATION_API_KEY}/${locationId}`, token); return response; }); exports._fetchLocation = _fetchLocation; const _cancelMeeting = (basePath, token, meetingId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const meeting = yield (0, api_1.getRequest)(`${base.MEETINGS_API_KEY}/${meetingId}/cancel`, token); return (meeting === null || meeting === void 0 ? void 0 : meeting.data) || meeting; }); exports._cancelMeeting = _cancelMeeting; const _declineMeeting = (basePath, token, meetingId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const meeting = yield (0, api_1.getRequest)(`${base.MEETINGS_API_KEY}/${meetingId}/decline`, token); return (meeting === null || meeting === void 0 ? void 0 : meeting.data) || meeting; }); exports._declineMeeting = _declineMeeting; const _confirmMeeting = (basePath, token, meetingId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const meeting = yield (0, api_1.getRequest)(`${base.MEETINGS_API_KEY}/${meetingId}/confirm`, token); return (meeting === null || meeting === void 0 ? void 0 : meeting.data) || meeting; }); exports._confirmMeeting = _confirmMeeting; const _rateMeeting = (basePath, token, meetingId, rate) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.postRequest)(`${base.MEETINGS_API_KEY}/${meetingId}/rate`, { rate, }, token); return response; }); exports._rateMeeting = _rateMeeting; const _deliverMeeting = (basePath, token, meetingId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.postRequest)(`${base.MEETINGS_API_KEY}/${meetingId}/deliver`, {}, token); return response; }); exports._deliverMeeting = _deliverMeeting; const _createMeeting = (basePath, token, body) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const meeting = yield (0, api_1.postRequest)(base.MEETINGS_API_KEY, body, token); return (meeting === null || meeting === void 0 ? void 0 : meeting.data) || meeting; }); exports._createMeeting = _createMeeting; const _createArrangedMeeting = (basePath, token, body) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const meeting = yield (0, api_1.postRequest)(base.MEETINGS_ARRANGE, body, token); return (meeting === null || meeting === void 0 ? void 0 : meeting.data) || meeting; }); exports._createArrangedMeeting = _createArrangedMeeting; const _editMeeting = (basePath, token, body) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const meeting = yield (0, api_1.putRequest)(`${base.MEETINGS_API_KEY}/${body === null || body === void 0 ? void 0 : body.id}`, token, body); return (meeting === null || meeting === void 0 ? void 0 : meeting.data) || meeting; }); exports._editMeeting = _editMeeting; const _fetchEventMeetingsStatistics = (basePath, token, eventId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const meetings = yield (0, api_1.getRequest)(`${base.EVENTS}/${eventId}/meetings`, token); return (meetings === null || meetings === void 0 ? void 0 : meetings.data) || meetings; }); exports._fetchEventMeetingsStatistics = _fetchEventMeetingsStatistics;