UNPKG

@hubs101/js-api-skd-client

Version:
75 lines (74 loc) 4.16 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._fetchPublicEventStatistics = exports._getPublicGroupDetails = exports._getPublicRegistrationForm = exports._fetchPublicAgenda = exports._fetchPublicExhibitions = exports._fetchAllPublicEvents = void 0; const api_1 = require("../../utils/api"); const base_1 = require("../../utils/base"); const _fetchAllPublicEvents = (basePath, nbPage, params) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const configUrl = () => { if (nbPage && params) return `${base.PUBLIC_EVENTS}?limit=36&page=${nbPage}${params}`; else if (nbPage) return `${base.PUBLIC_EVENTS}?limit=36&page=${nbPage}`; return `${base.PUBLIC_EVENTS}?limit=36`; }; const allEvents = yield (0, api_1.getRequest)(configUrl()); return allEvents; }); exports._fetchAllPublicEvents = _fetchAllPublicEvents; const _fetchPublicExhibitions = (basePath, eventId, nbPage, params) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const configUrl = () => { if (nbPage && params) return `${base.PUBLIC_EVENTS}/${eventId}/exhibitions?limit=36&page=${nbPage}${params}`; else if (nbPage) return `${base.PUBLIC_EVENTS}/${eventId}/exhibitions?limit=36&page=${nbPage}`; return `${base.PUBLIC_EVENTS}/${eventId}/exhibitions?limit=36`; }; const exhibitions = yield (0, api_1.getRequest)(configUrl()); return exhibitions; }); exports._fetchPublicExhibitions = _fetchPublicExhibitions; const _fetchPublicAgenda = (basePath, eventId, nbPage, params) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const configUrl = () => { if (nbPage && params) return `${base.PUBLIC_EVENTS}/${eventId}/agenda?limit=36&page=${nbPage}${params}`; else if (nbPage) return `${base.PUBLIC_EVENTS}/${eventId}/agenda?limit=36&page=${nbPage}`; return `${base.PUBLIC_EVENTS}/${eventId}/agenda?limit=36`; }; const agenda = yield (0, api_1.getRequest)(configUrl()); return agenda; }); exports._fetchPublicAgenda = _fetchPublicAgenda; const _getPublicRegistrationForm = (basePath, eventId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const configUrl = () => { return `${base.PUBLIC_EVENTS}/${eventId}/registration-form`; }; const data = yield (0, api_1.getRequest)(configUrl()); return data; }); exports._getPublicRegistrationForm = _getPublicRegistrationForm; const _getPublicGroupDetails = (basePath, groupId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const groups = yield (0, api_1.getRequest)(`${base.PUBLIC_GROUPS}/${groupId}`); return (groups === null || groups === void 0 ? void 0 : groups.data) || groups; }); exports._getPublicGroupDetails = _getPublicGroupDetails; const _fetchPublicEventStatistics = (basePath, eventId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const data = yield (0, api_1.getRequest)(`${base.PUBLIC_EVENTS}/${eventId}/statistics`); return (data === null || data === void 0 ? void 0 : data.data) || data; }); exports._fetchPublicEventStatistics = _fetchPublicEventStatistics;