UNPKG

@eleva-io/erp-sdk

Version:

SDK oficial para el ERP de Eleva

145 lines 6.59 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MeetingsAPI = void 0; const guards_1 = require("../../../../utils/guards"); const participants_1 = require("./participants"); const debtors_1 = require("./debtors"); const agenda_1 = require("./agenda"); const action_points_1 = require("./action_points"); const notes_1 = require("./notes"); const documents_1 = require("./documents"); class MeetingsAPI { _httpClient; _baseUrl; _entityType; _entityId; _meetingId; constructor(_httpClient, _baseUrl, _entityType, _entityId, _meetingId) { this._httpClient = _httpClient; this._baseUrl = _baseUrl; this._entityType = _entityType; this._entityId = _entityId; this._meetingId = _meetingId; } async find(query) { (0, guards_1.requireField)('entityId', this._entityId); return this._httpClient.get(this._getBasePath(), { query, }); } async get() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.get(`${this._getBasePath()}/${this._meetingId}`); } async create(data) { (0, guards_1.requireField)('entityId', this._entityId); return this._httpClient.post(this._getBasePath(), { body: data, }); } async update(data) { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.patch(`${this._getBasePath()}/${this._meetingId}`, { body: data, }); } async startPreparing() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/start-preparing`); } async start() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/start`); } async finish() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/finish`); } async cancel() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/cancel`); } async approveMeetingCall(data) { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/call/approve`, { body: data, }); } async rejectMeetingCall() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/call/reject`); } async approveMinutes() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/minutes/approve`); } async rejectMinutes() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/minutes/reject`); } async complete(data) { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/complete`, { body: data, }); } async exportParticipants(data) { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/participants/export`, { body: data, }); } async generatePdf() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return this._httpClient.post(`${this._getBasePath()}/${this._meetingId}/generate-pdf`); } participants() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return new participants_1.MeetingParticipantsAPI(this._httpClient, `${this._getBasePath()}/${this._meetingId}/participants`); } debtors() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return new debtors_1.MeetingDebtorsAPI(this._httpClient, `${this._getBasePath()}/${this._meetingId}/debtors`); } agenda() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return new agenda_1.MeetingAgendaAPI(this._httpClient, `${this._getBasePath()}/${this._meetingId}/agenda`); } actionPoints() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return new action_points_1.MeetingActionPointsAPI(this._httpClient, `${this._getBasePath()}/${this._meetingId}/action-points`); } notes() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return new notes_1.MeetingNotesAPI(this._httpClient, `${this._getBasePath()}/${this._meetingId}/notes`); } documents() { (0, guards_1.requireField)('entityId', this._entityId); (0, guards_1.requireField)('meetingId', this._meetingId); return new documents_1.MeetingDocumentsAPI(this._httpClient, `${this._getBasePath()}/${this._meetingId}/documents`); } _getBasePath() { const entityTypeStr = this._entityType === 'macrocommunity' ? 'macrocommunities' : 'communities'; return `${this._baseUrl}/${entityTypeStr}/${this._entityId}/meetings`; } } exports.MeetingsAPI = MeetingsAPI; //# sourceMappingURL=meetings.js.map