UNPKG

nylas

Version:

A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.

109 lines (108 loc) 3.5 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Events = void 0; const resource_js_1 = require("./resource.js"); const utils_js_1 = require("../utils.js"); /** * Nylas Events API * * The Nylas Events API allows you to create, update, and delete events on user calendars. */ class Events extends resource_js_1.Resource { /** * Return all Events * @return The list of Events */ list({ identifier, queryParams, overrides, }) { return super._list({ queryParams, path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/events', { identifier }), overrides, }); } /** * (Beta) Import events from a calendar within a given time frame * This is useful when you want to import, store, and synchronize events from the time frame to your application * @return The list of imported Events */ listImportEvents({ identifier, queryParams, overrides, }) { return super._list({ queryParams, path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/events/import', { identifier, }), overrides, }); } /** * Return an Event * @return The Event */ find({ identifier, eventId, queryParams, overrides, }) { return super._find({ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/events/{eventId}', { identifier, eventId, }), queryParams, overrides, }); } /** * Create an Event * @return The created Event */ create({ identifier, requestBody, queryParams, overrides, }) { return super._create({ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/events', { identifier }), queryParams, requestBody, overrides, }); } /** * Update an Event * @return The updated Event */ update({ identifier, eventId, requestBody, queryParams, overrides, }) { return super._update({ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/events/{eventId}', { identifier, eventId, }), queryParams, requestBody, overrides, }); } /** * Delete an Event * @return The deletion response */ destroy({ identifier, eventId, queryParams, overrides, }) { return super._destroy({ path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/events/{eventId}', { identifier, eventId, }), queryParams, overrides, }); } /** * Send RSVP. Allows users to respond to events they have been added to as an attendee. * You cannot send RSVP as an event owner/organizer. * You cannot directly update events as an invitee, since you are not the owner/organizer. * @return The send-rsvp response */ sendRsvp({ identifier, eventId, requestBody, queryParams, overrides, }) { return this.apiClient.request({ method: 'POST', path: (0, utils_js_1.makePathParams)('/v3/grants/{identifier}/events/{eventId}/send-rsvp', { identifier, eventId }), queryParams, body: requestBody, overrides, }); } } exports.Events = Events;