An open API service indexing awesome lists of open source software.

https://github.com/3sidedcube/nylas

NestJS module for the Nylas API
https://github.com/3sidedcube/nylas

Last synced: 7 months ago
JSON representation

NestJS module for the Nylas API

Awesome Lists containing this project

README

          

# Nylas

Handle emails for users on Chelsea Apps projects.

### Installation

The project is hosted on our private npm registry, so to install simply run

##### npm

```bash
npm i @chelseaapps/nylas
```

##### yarn

```bash
yarn add @chelseaapps/nylas
```

### Requirements

To be able to interact with the given endpoints valid `communicationToken` & `nylasAccountId`
values are needed

### Config

Import the module into the module in which you wish to register, and call the static `registerAsync` function.

#### Config options

| Option | Description | Example |
| ------------------------------ | ---------------------------------------------------------- | ---------------------------------- |
| isGlobal | Register the module globally across all modules in the app | True |
| clientId | Client's ID | 6c6wcj5j54qer74l72189ot2 |
| clientSecret | Secret key for authentication | RXIARTJAQWWNM3Q3QEXQ |
| apiServer | Specify an alternative Nylas server | ireland.api.nylas.com |
| authentication > redirectURI | Redirect after connection | `https://chelseaapps.com/callback` |
| authentication > defaultScopes | Default scopes to pass for all connections | [email.modify, email.read_only] |
| encryption> key | Encryption options | 6c6wcj5j54qer74l72 |

```typescript
import { Module } from '@nestjs/common';
import { NylasModule } from '@chelseaapps/nylas';

@Module({
imports: [
... other imports here
NylasModule.registerAsync({
imports: [ConfigModule],
inject: [HelperService, ConfigService],
useClass: NylasConfig,
}),
],
controllers: [],
providers: [],
})
export class AppModule {}
```

### Usage

| Methods | Returns | Description |
| ----------------- | --------------------- | ----------------------------------- |
| connect | Promise `` | Generates an OAuth set up URL |
| findThreadByID | Promise `` | Return a Thread by its ID |
| findThreadByIDs | Promise `` | Returns List of Threads by its IDs |
| searchThreads | Promise `` | Returns Threads found |
| send | Promise `` | Sends a message |
| findMessageByID | Promise `` | Returns a Message by its ID |
| findMessagesByIDs | Promise `` | Returns List of Messages by its IDs |
| findMessagesByID | Promise `` | Returns List of Messages by IDs |
| searchMessages | Promise `` | Returns Messages found |
| deleteMessage | Promise `` | Deletes Message |
| createDraft | Promise `` | Create a Draft |
| sendDraft | Promise `` | Sends a Draft |
| updateDraft | Promise `` | Updates a Draft |
| findDraftById | Promise `` | Returns Drafts by Id |
| findDraftByIds | Promise `` | Returns List of Drafts by IDs |
| deleteDraft | Promise `` | Deletes a Draft |
| fileUpload | Promise `` | Uploads a new File |
| fileDownload | Promise `` | Downloads the File Object |
| fileById | Promise `` | Return a File |
| fileByIds | Promise `` | Return a List of Files |
| fileDelete | Promise `` | Deletes a File |