nylas
Version:
A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.
54 lines (53 loc) • 2.3 kB
JavaScript
export * from './models/index.js';
import APIClient from './apiClient.js';
import { DEFAULT_SERVER_URL } from './config.js';
import { Calendars } from './resources/calendars.js';
import { Events } from './resources/events.js';
import { Auth } from './resources/auth.js';
import { Webhooks } from './resources/webhooks.js';
import { Applications } from './resources/applications.js';
import { Messages } from './resources/messages.js';
import { Drafts } from './resources/drafts.js';
import { Threads } from './resources/threads.js';
import { Connectors } from './resources/connectors.js';
import { Folders } from './resources/folders.js';
import { Grants } from './resources/grants.js';
import { Contacts } from './resources/contacts.js';
import { Attachments } from './resources/attachments.js';
import { Scheduler } from './resources/scheduler.js';
import { Notetakers } from './resources/notetakers.js';
/**
* The entry point to the Node SDK
*
* A Nylas instance holds a configured http client pointing to a base URL and is intended to be reused and shared
* across threads and time.
*/
export default class Nylas {
/**
* @param config Configuration options for the Nylas SDK
*/
constructor(config) {
this.apiClient = new APIClient({
apiKey: config.apiKey,
apiUri: config.apiUri || DEFAULT_SERVER_URL,
timeout: config.timeout || 90,
headers: config.headers || {},
});
this.applications = new Applications(this.apiClient);
this.auth = new Auth(this.apiClient);
this.calendars = new Calendars(this.apiClient);
this.connectors = new Connectors(this.apiClient);
this.drafts = new Drafts(this.apiClient);
this.events = new Events(this.apiClient);
this.grants = new Grants(this.apiClient);
this.messages = new Messages(this.apiClient);
this.notetakers = new Notetakers(this.apiClient);
this.threads = new Threads(this.apiClient);
this.webhooks = new Webhooks(this.apiClient);
this.folders = new Folders(this.apiClient);
this.contacts = new Contacts(this.apiClient);
this.attachments = new Attachments(this.apiClient);
this.scheduler = new Scheduler(this.apiClient);
return this;
}
}