UNPKG

event-app-api

Version:

Package for easy access to Event App API

236 lines (235 loc) 15.3 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._showAttendee = exports._hideAttendee = exports._resendWelcomeEmail = exports._addOnsiteAttendee = exports._removeOnsiteAttendee = exports._checkAvailabilityAttendee = exports._resendConfirmationEmail = exports._deleteAllUserNotifications = exports._deleteUserNotification = exports._markUserNotificationAsRead = exports._fetchUserNotifications = exports._deleteNote = exports._updateNote = exports._createNote = exports._fetchMyNotes = exports._reportAttendeeAction = exports._importProfileFromLinkedIn = exports._createAttendee = exports._sendAttendeeOnboardingAnswers = exports._checkout = exports._checkIn = exports._confirmMyEventInvitation = exports._unpinAttendee = exports._pinAttendee = exports._removeConnection = exports._addConnection = exports._fetchMyConnections = exports._updateGlobalAttendee = exports._updateGlobalAttendeeImage = exports._updateAttendee = exports._updateAttendeeImage = exports._fetchMyUser = exports._fetchAttendees = exports._fetchAttendeeProfile = void 0; const api_1 = require("../../utils/api"); const base_1 = require("../../utils/base"); const _fetchAttendeeProfile = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const profile = yield (0, api_1.getRequest)(`${base.ATTENDEES}/${attendeeId}`, token); return profile; }); exports._fetchAttendeeProfile = _fetchAttendeeProfile; const _fetchAttendees = (basePath, token, eventId) => __awaiter(void 0, void 0, void 0, function* () { var _a; const base = (0, base_1.getBasePath)(basePath); const attendees = yield (0, api_1.getRequest)(`${base.EVENTS}/${eventId}/attendees`, token); return ((_a = attendees === null || attendees === void 0 ? void 0 : attendees.data) === null || _a === void 0 ? void 0 : _a.data) || (attendees === null || attendees === void 0 ? void 0 : attendees.data) || attendees; }); exports._fetchAttendees = _fetchAttendees; const _fetchMyUser = (basePath, token) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const user = yield (0, api_1.getRequest)(`${base.PROFILE}`, token); return (user === null || user === void 0 ? void 0 : user.data) || user; }); exports._fetchMyUser = _fetchMyUser; const _updateAttendeeImage = (basePath, token, file, param, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { var _b; const base = (0, base_1.getBasePath)(basePath); const attendee = yield (0, api_1.postFileRequest)(`${base.ATTENDEES}/${attendeeId}`, file, param, token); return ((_b = attendee === null || attendee === void 0 ? void 0 : attendee.data) === null || _b === void 0 ? void 0 : _b.data) || (attendee === null || attendee === void 0 ? void 0 : attendee.data) || attendee; }); exports._updateAttendeeImage = _updateAttendeeImage; const _updateAttendee = (basePath, token, updatedAttendee, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { var _c; const base = (0, base_1.getBasePath)(basePath); const attendee = yield (0, api_1.putRequest)(`${base.ATTENDEES}/${attendeeId}`, token, Object.assign({}, updatedAttendee)); return ((_c = attendee === null || attendee === void 0 ? void 0 : attendee.data) === null || _c === void 0 ? void 0 : _c.data) || (attendee === null || attendee === void 0 ? void 0 : attendee.data) || attendee; }); exports._updateAttendee = _updateAttendee; const _updateGlobalAttendeeImage = (basePath, token, file, param) => __awaiter(void 0, void 0, void 0, function* () { var _d; const base = (0, base_1.getBasePath)(basePath); const attendee = yield (0, api_1.postFileRequest)(base.PROFILE, file, param, token); return ((_d = attendee === null || attendee === void 0 ? void 0 : attendee.data) === null || _d === void 0 ? void 0 : _d.data) || (attendee === null || attendee === void 0 ? void 0 : attendee.data) || attendee; }); exports._updateGlobalAttendeeImage = _updateGlobalAttendeeImage; const _updateGlobalAttendee = (basePath, token, updatedAttendee) => __awaiter(void 0, void 0, void 0, function* () { var _e; const base = (0, base_1.getBasePath)(basePath); const attendee = yield (0, api_1.putRequest)(base.PROFILE, token, Object.assign({}, updatedAttendee)); return ((_e = attendee === null || attendee === void 0 ? void 0 : attendee.data) === null || _e === void 0 ? void 0 : _e.data) || (attendee === null || attendee === void 0 ? void 0 : attendee.data) || attendee; }); exports._updateGlobalAttendee = _updateGlobalAttendee; const _fetchMyConnections = (basePath, token) => __awaiter(void 0, void 0, void 0, function* () { var _f; const base = (0, base_1.getBasePath)(basePath); const myConnections = yield (0, api_1.getRequest)(base.CONNECTIONS, token); return ((_f = myConnections === null || myConnections === void 0 ? void 0 : myConnections.data) === null || _f === void 0 ? void 0 : _f.data) || (myConnections === null || myConnections === void 0 ? void 0 : myConnections.data) || myConnections; }); exports._fetchMyConnections = _fetchMyConnections; const _addConnection = (basePath, token, profile, leadsToken) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); yield (0, api_1.postRequest)(`${base.CONNECTIONS}/${profile}`, { profile, token: leadsToken, }, token); }); exports._addConnection = _addConnection; const _removeConnection = (basePath, token, profile) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); yield (0, api_1.deleteRequest)(`${base.CONNECTIONS}/${profile}`, { profile, }, token); }); exports._removeConnection = _removeConnection; const _pinAttendee = (basePath, token, attendeeId, pinAttendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); return yield (0, api_1.postRequest)(`${base.ATTENDEES}/${attendeeId}/pin`, { pinned_attendee: pinAttendeeId, }, token); }); exports._pinAttendee = _pinAttendee; const _unpinAttendee = (basePath, token, attendeeId, pinAttendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); return yield (0, api_1.postRequest)(`${base.ATTENDEES}/${attendeeId}/unpin`, { pinned_attendee: pinAttendeeId, }, token); }); exports._unpinAttendee = _unpinAttendee; const _confirmMyEventInvitation = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.ATTENDEES}/${attendeeId}/confirm`, token); return response; }); exports._confirmMyEventInvitation = _confirmMyEventInvitation; const _checkIn = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.ATTENDEES}/${attendeeId}/check-in`, token); return response; }); exports._checkIn = _checkIn; const _checkout = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.deleteRequest)(`${base.ATTENDEES}/${attendeeId}/check-in`, {}, token); return response; }); exports._checkout = _checkout; const _sendAttendeeOnboardingAnswers = (basePath, token, attendeeId, body) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.patchRequest)(`${base.ATTENDEES}/${attendeeId}/onboarding`, token, body); return response; }); exports._sendAttendeeOnboardingAnswers = _sendAttendeeOnboardingAnswers; const _createAttendee = (basePath, token, eventId, type, body) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.patchRequest)(`${base.EVENTS}/${eventId}/invite/${type}`, token, body); return response; }); exports._createAttendee = _createAttendee; const _importProfileFromLinkedIn = (basePath, token, body) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.postRequest)(`${base.LINKEDIN_IMPORT_PROFILE}`, body, token); return response === null || response === void 0 ? void 0 : response.url; }); exports._importProfileFromLinkedIn = _importProfileFromLinkedIn; const _reportAttendeeAction = (basePath, token, requestData) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.postRequest)(base.ACTIONS_ATTENDEES, requestData, token); return response === null || response === void 0 ? void 0 : response.url; }); exports._reportAttendeeAction = _reportAttendeeAction; const _fetchMyNotes = (basePath, token) => __awaiter(void 0, void 0, void 0, function* () { var _g; const base = (0, base_1.getBasePath)(basePath); const myNotes = yield (0, api_1.getRequest)(`${base.NOTES}`, token); return ((_g = myNotes === null || myNotes === void 0 ? void 0 : myNotes.data) === null || _g === void 0 ? void 0 : _g.data) || (myNotes === null || myNotes === void 0 ? void 0 : myNotes.data) || myNotes; }); exports._fetchMyNotes = _fetchMyNotes; const _createNote = (basePath, token, note) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.postRequest)(base.NOTES, note, token); return response; }); exports._createNote = _createNote; const _updateNote = (basePath, token, noteId, note) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.putRequest)(`${base.NOTES}/${noteId}`, token, note); return response; }); exports._updateNote = _updateNote; const _deleteNote = (basePath, token, noteId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.deleteRequest)(`${base.NOTES}/${noteId}`, { note: noteId }, token); return response; }); exports._deleteNote = _deleteNote; const _fetchUserNotifications = (basePath, token) => __awaiter(void 0, void 0, void 0, function* () { var _h; const base = (0, base_1.getBasePath)(basePath); const userNotifications = yield (0, api_1.getRequest)(`${base.USER_NOTIFICATIONS}`, token); return (((_h = userNotifications === null || userNotifications === void 0 ? void 0 : userNotifications.data) === null || _h === void 0 ? void 0 : _h.data) || (userNotifications === null || userNotifications === void 0 ? void 0 : userNotifications.data) || userNotifications); }); exports._fetchUserNotifications = _fetchUserNotifications; const _markUserNotificationAsRead = (basePath, token, notificationId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.USER_NOTIFICATIONS}/${notificationId}/view`, token); return response; }); exports._markUserNotificationAsRead = _markUserNotificationAsRead; const _deleteUserNotification = (basePath, token, notificationId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.deleteRequest)(`${base.USER_NOTIFICATIONS}/${notificationId}`, { id: notificationId, }, token); return response; }); exports._deleteUserNotification = _deleteUserNotification; const _deleteAllUserNotifications = (basePath, token) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.deleteRequest)(`${base.USER_NOTIFICATIONS}`, {}, token); return response; }); exports._deleteAllUserNotifications = _deleteAllUserNotifications; const _resendConfirmationEmail = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.ATTENDEES}/${attendeeId}/resend-confirmation-email`, token); return response; }); exports._resendConfirmationEmail = _resendConfirmationEmail; const _checkAvailabilityAttendee = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const { data } = yield (0, api_1.getRequest)(`${base.ATTENDEES}/${attendeeId}/availability`, token); return data; }); exports._checkAvailabilityAttendee = _checkAvailabilityAttendee; const _removeOnsiteAttendee = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.deleteRequestWE)(`${base.ATTENDEES}/${attendeeId}/onsite`, token); return response; }); exports._removeOnsiteAttendee = _removeOnsiteAttendee; const _addOnsiteAttendee = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.ATTENDEES}/${attendeeId}/onsite`, token); return response; }); exports._addOnsiteAttendee = _addOnsiteAttendee; const _resendWelcomeEmail = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.getRequest)(`${base.ATTENDEES}/${attendeeId}/resend-reminder-email`, token); return response; }); exports._resendWelcomeEmail = _resendWelcomeEmail; const _hideAttendee = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.postRequestWE)(`${base.ATTENDEES}/${attendeeId}/hide`, attendeeId, token); return response; }); exports._hideAttendee = _hideAttendee; const _showAttendee = (basePath, token, attendeeId) => __awaiter(void 0, void 0, void 0, function* () { const base = (0, base_1.getBasePath)(basePath); const response = yield (0, api_1.deleteRequestWE)(`${base.ATTENDEES}/${attendeeId}/hide`, token); return response; }); exports._showAttendee = _showAttendee;