UNPKG

nylas

Version:

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

105 lines (104 loc) 3.25 kB
import { Resource } from './resource.js'; import { makePathParams } from '../utils.js'; /** * Nylas Events API * * The Nylas Events API allows you to create, update, and delete events on user calendars. */ export class Events extends Resource { /** * Return all Events * @return The list of Events */ list({ identifier, queryParams, overrides, }) { return super._list({ queryParams, path: 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: makePathParams('/v3/grants/{identifier}/events/import', { identifier, }), overrides, }); } /** * Return an Event * @return The Event */ find({ identifier, eventId, queryParams, overrides, }) { return super._find({ path: 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: 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: 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: 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: makePathParams('/v3/grants/{identifier}/events/{eventId}/send-rsvp', { identifier, eventId }), queryParams, body: requestBody, overrides, }); } }