nylas 6.5.0 → 6.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,6 +1,11 @@
1
+ <a href="https://www.nylas.com/">
2
+ <img src="https://brand.nylas.com/assets/downloads/logo_horizontal_png/Nylas-Logo-Horizontal-Blue_.png" alt="Aimeos logo" title="Aimeos" align="right" height="60" />
3
+ </a>
4
+
1
5
  # Nylas Node.js SDK
2
6
 
3
7
  [![Travis build status](https://travis-ci.org/nylas/nylas-nodejs.svg?branch=master)](https://travis-ci.org/nylas/nylas-nodejs)
8
+ [![codecov](https://codecov.io/gh/nylas/nylas-nodejs/branch/main/graph/badge.svg?token=94IMGU4F09)](https://codecov.io/gh/nylas/nylas-nodejs)
4
9
 
5
10
  This is the GitHub repository for the Nylas Node SDK and this repo is primarily for anyone who wants to make contributions to the SDK or install it from source. If you are looking to use Node to access the Nylas Email, Calendar, or Contacts API you should refer to our official [Node SDK Quickstart Guide](https://developer.nylas.com/docs/developer-tools/sdk/node-sdk/).
6
11
 
@@ -13,7 +18,7 @@ Here are some resources to help you get started:
13
18
  - [Nylas API Reference](https://developer.nylas.com/docs/api/)
14
19
 
15
20
 
16
- # Install
21
+ ## ⚙️ Install
17
22
 
18
23
  To run the Nylas Node SDK, you will first need to have [Node](https://nodejs.org/en/download/) and [npm](https://www.npmjs.com/get-npm) installed on your machine.
19
24
 
@@ -30,7 +35,7 @@ cd nylas-nodejs
30
35
  npm install
31
36
  ```
32
37
 
33
- # Usage
38
+ ## ⚡️ Usage
34
39
 
35
40
  Every resource (i.e., messages, events, contacts) is accessed via an instance of `Nylas`. Before making any requests, be sure to call `config` and initialize the `Nylas` instance with your `clientId` and `clientSecret`. Then, call `with` and pass it your `accessToken`. The `accessToken` allows `Nylas` to make requests for a given account's resources.
36
41
 
@@ -54,11 +59,11 @@ nylas.threads.list({}).then(threads => {
54
59
 
55
60
  For more information about how to use the Nylas Node SDK, [take a look at our quickstart guide](https://developer.nylas.com/docs/developer-tools/sdk/node-sdk/).
56
61
 
57
- # Contributing
62
+ ## 💙 Contributing
58
63
 
59
64
  Please refer to [Contributing](Contributing.md) for information about how to make contributions to this project. We welcome questions, bug reports, and pull requests.
60
65
 
61
- # License
66
+ ## 📝 License
62
67
 
63
68
  This project is licensed under the terms of the MIT license. Please refer to [LICENSE](LICENSE.txt) for the full terms.
64
69
 
@@ -12,6 +12,7 @@ export declare type CalendarProperties = {
12
12
  isPrimary?: boolean;
13
13
  jobStatusId?: string;
14
14
  metadata?: object;
15
+ color?: number;
15
16
  };
16
17
  export default class Calendar extends RestfulModel implements CalendarProperties {
17
18
  name: string;
@@ -22,6 +23,7 @@ export default class Calendar extends RestfulModel implements CalendarProperties
22
23
  isPrimary?: boolean;
23
24
  jobStatusId?: string;
24
25
  metadata?: object;
26
+ color?: number;
25
27
  static collectionName: string;
26
28
  static attributes: Record<string, Attribute>;
27
29
  constructor(connection: NylasConnection, props?: CalendarProperties);
@@ -87,6 +87,9 @@ var Calendar = /** @class */ (function (_super) {
87
87
  readOnly: true,
88
88
  }), metadata: attributes_1.default.Object({
89
89
  modelKey: 'metadata',
90
+ }), color: attributes_1.default.Number({
91
+ modelKey: 'color',
92
+ readOnly: true,
90
93
  }) });
91
94
  return Calendar;
92
95
  }(restful_model_1.default));
@@ -49,7 +49,6 @@ var EventParticipant = /** @class */ (function (_super) {
49
49
  }),
50
50
  status: attributes_1.default.String({
51
51
  modelKey: 'status',
52
- readOnly: true,
53
52
  }),
54
53
  };
55
54
  return EventParticipant;
@@ -0,0 +1,18 @@
1
+ import { Attribute } from './attributes';
2
+ import Model from './model';
3
+ export declare enum EventReminderMethod {
4
+ Email = "email",
5
+ Popup = "popup",
6
+ Display = "display",
7
+ Sound = "sound"
8
+ }
9
+ export declare type EventReminderProperties = {
10
+ reminderMinutes?: string;
11
+ reminderMethod?: EventReminderMethod;
12
+ };
13
+ export declare class EventReminder extends Model implements EventReminderProperties {
14
+ reminderMinutes?: string;
15
+ reminderMethod?: EventReminderMethod;
16
+ static attributes: Record<string, Attribute>;
17
+ constructor(props?: EventReminderProperties);
18
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __extends = (this && this.__extends) || (function () {
3
+ var extendStatics = function (d, b) {
4
+ extendStatics = Object.setPrototypeOf ||
5
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
7
+ return extendStatics(d, b);
8
+ };
9
+ return function (d, b) {
10
+ extendStatics(d, b);
11
+ function __() { this.constructor = d; }
12
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
13
+ };
14
+ })();
15
+ var __importDefault = (this && this.__importDefault) || function (mod) {
16
+ return (mod && mod.__esModule) ? mod : { "default": mod };
17
+ };
18
+ Object.defineProperty(exports, "__esModule", { value: true });
19
+ var attributes_1 = __importDefault(require("./attributes"));
20
+ var model_1 = __importDefault(require("./model"));
21
+ var EventReminderMethod;
22
+ (function (EventReminderMethod) {
23
+ EventReminderMethod["Email"] = "email";
24
+ EventReminderMethod["Popup"] = "popup";
25
+ EventReminderMethod["Display"] = "display";
26
+ EventReminderMethod["Sound"] = "sound";
27
+ })(EventReminderMethod = exports.EventReminderMethod || (exports.EventReminderMethod = {}));
28
+ var EventReminder = /** @class */ (function (_super) {
29
+ __extends(EventReminder, _super);
30
+ function EventReminder(props) {
31
+ var _this = _super.call(this) || this;
32
+ _this.initAttributes(props);
33
+ return _this;
34
+ }
35
+ EventReminder.attributes = {
36
+ reminderMinutes: attributes_1.default.String({
37
+ modelKey: 'reminderMinutes',
38
+ jsonKey: 'reminder_minutes',
39
+ }),
40
+ reminderMethod: attributes_1.default.String({
41
+ modelKey: 'reminderMethod',
42
+ jsonKey: 'reminder_method',
43
+ }),
44
+ };
45
+ return EventReminder;
46
+ }(model_1.default));
47
+ exports.EventReminder = EventReminder;
@@ -5,6 +5,7 @@ import EventConferencing, { EventConferencingProperties } from './event-conferen
5
5
  import When, { WhenProperties } from './when';
6
6
  import NylasConnection from '../nylas-connection';
7
7
  import EventNotification, { EventNotificationProperties } from './event-notification';
8
+ import { EventReminder, EventReminderMethod, EventReminderProperties } from './event-reminder-method';
8
9
  export declare enum ICSMethod {
9
10
  Request = "request",
10
11
  Publish = "publish",
@@ -44,6 +45,13 @@ export declare type EventProperties = {
44
45
  roundRobinOrder?: string[];
45
46
  metadata?: object;
46
47
  jobStatusId?: string;
48
+ organizerEmail?: string;
49
+ organizerName?: string;
50
+ visibility?: string;
51
+ customerEventId?: string;
52
+ reminderMinutes?: string;
53
+ reminderMethod?: EventReminderMethod;
54
+ reminders?: EventReminderProperties;
47
55
  };
48
56
  export default class Event extends RestfulModel {
49
57
  calendarId: string;
@@ -67,11 +75,17 @@ export default class Event extends RestfulModel {
67
75
  originalStartTime?: Date;
68
76
  capacity?: number;
69
77
  conferencing?: EventConferencing;
78
+ readonly reminders?: EventReminder;
70
79
  reminderMinutes?: string;
80
+ reminderMethod?: EventReminderMethod;
71
81
  notifications?: EventNotification[];
72
82
  roundRobinOrder?: string[];
73
83
  metadata?: object;
74
84
  jobStatusId?: string;
85
+ organizerEmail?: string;
86
+ organizerName?: string;
87
+ visibility?: string;
88
+ customerEventId?: string;
75
89
  static collectionName: string;
76
90
  static attributes: Record<string, Attribute>;
77
91
  constructor(connection: NylasConnection, props?: EventProperties);
@@ -33,6 +33,7 @@ var event_participant_1 = __importDefault(require("./event-participant"));
33
33
  var event_conferencing_1 = __importDefault(require("./event-conferencing"));
34
34
  var when_1 = __importDefault(require("./when"));
35
35
  var event_notification_1 = __importDefault(require("./event-notification"));
36
+ var event_reminder_method_1 = require("./event-reminder-method");
36
37
  var ICSMethod;
37
38
  (function (ICSMethod) {
38
39
  ICSMethod["Request"] = "request";
@@ -143,6 +144,10 @@ var Event = /** @class */ (function (_super) {
143
144
  if (!this.notifications) {
144
145
  delete json.notifications;
145
146
  }
147
+ // Participant status cannot be updated
148
+ if (this.id && json.participants) {
149
+ json.participants.forEach(function (participant) { return delete participant.status; });
150
+ }
146
151
  return json;
147
152
  };
148
153
  Event.prototype.rsvp = function (status, comment, callback) {
@@ -261,6 +266,14 @@ var Event = /** @class */ (function (_super) {
261
266
  }), reminderMinutes: attributes_1.default.String({
262
267
  modelKey: 'reminderMinutes',
263
268
  jsonKey: 'reminder_minutes',
269
+ }), reminderMethod: attributes_1.default.String({
270
+ modelKey: 'reminderMethod',
271
+ jsonKey: 'reminder_method',
272
+ }), reminders: attributes_1.default.Object({
273
+ modelKey: 'reminders',
274
+ jsonKey: 'reminders',
275
+ itemClass: event_reminder_method_1.EventReminder,
276
+ readOnly: true,
264
277
  }), notifications: attributes_1.default.Collection({
265
278
  modelKey: 'notifications',
266
279
  itemClass: event_notification_1.default,
@@ -273,6 +286,20 @@ var Event = /** @class */ (function (_super) {
273
286
  modelKey: 'jobStatusId',
274
287
  jsonKey: 'job_status_id',
275
288
  readOnly: true,
289
+ }), organizerEmail: attributes_1.default.String({
290
+ modelKey: 'organizerEmail',
291
+ jsonKey: 'organizer_email',
292
+ readOnly: true,
293
+ }), organizerName: attributes_1.default.String({
294
+ modelKey: 'organizerName',
295
+ jsonKey: 'organizer_name',
296
+ readOnly: true,
297
+ }), visibility: attributes_1.default.String({
298
+ modelKey: 'visibility',
299
+ readOnly: true,
300
+ }), customerEventId: attributes_1.default.String({
301
+ modelKey: 'customerEventId',
302
+ jsonKey: 'customer_event_id',
276
303
  }) });
277
304
  return Event;
278
305
  }(restful_model_1.default));
@@ -218,7 +218,7 @@ var SchedulerBooking = /** @class */ (function (_super) {
218
218
  }),
219
219
  calendarInviteToGuests: attributes_1.default.Boolean({
220
220
  modelKey: 'calendarInviteToGuests',
221
- jsonKey: 'calendar_invites_to_guests',
221
+ jsonKey: 'calendar_invite_to_guests',
222
222
  }),
223
223
  cancellationPolicy: attributes_1.default.String({
224
224
  modelKey: 'cancellationPolicy',
@@ -52,6 +52,17 @@ export declare class MessageTrackingData extends Model implements MessageTrackin
52
52
  static attributes: Record<string, Attribute>;
53
53
  constructor(props?: MessageTrackingDataProperties);
54
54
  }
55
+ export declare type WebhookObjectExtrasProperties = {
56
+ reason?: string;
57
+ sendAt?: Date;
58
+ originalSendAt?: Date;
59
+ };
60
+ export declare class WebhookObjectExtras extends Model implements WebhookObjectExtrasProperties {
61
+ reason?: string;
62
+ sendAt?: Date;
63
+ originalSendAt?: Date;
64
+ static attributes: Record<string, Attribute>;
65
+ }
55
66
  export declare type WebhookObjectAttributesProperties = {
56
67
  action?: string;
57
68
  jobStatusId?: string;
@@ -61,6 +72,8 @@ export declare type WebhookObjectAttributesProperties = {
61
72
  export declare class WebhookObjectAttributes extends Model implements WebhookObjectAttributesProperties {
62
73
  action?: string;
63
74
  jobStatusId?: string;
75
+ messageId?: string;
76
+ extras?: WebhookObjectExtrasProperties;
64
77
  threadId?: string;
65
78
  receivedDate?: Date;
66
79
  static attributes: Record<string, Attribute>;
@@ -124,6 +124,27 @@ var MessageTrackingData = /** @class */ (function (_super) {
124
124
  return MessageTrackingData;
125
125
  }(model_1.default));
126
126
  exports.MessageTrackingData = MessageTrackingData;
127
+ var WebhookObjectExtras = /** @class */ (function (_super) {
128
+ __extends(WebhookObjectExtras, _super);
129
+ function WebhookObjectExtras() {
130
+ return _super !== null && _super.apply(this, arguments) || this;
131
+ }
132
+ WebhookObjectExtras.attributes = {
133
+ reason: attributes_1.default.String({
134
+ modelKey: 'reason',
135
+ }),
136
+ sendAt: attributes_1.default.DateTime({
137
+ modelKey: 'sendAt',
138
+ jsonKey: 'send_at',
139
+ }),
140
+ originalSendAt: attributes_1.default.DateTime({
141
+ modelKey: 'originalSendAt',
142
+ jsonKey: 'original_send_at',
143
+ }),
144
+ };
145
+ return WebhookObjectExtras;
146
+ }(model_1.default));
147
+ exports.WebhookObjectExtras = WebhookObjectExtras;
127
148
  var WebhookObjectAttributes = /** @class */ (function (_super) {
128
149
  __extends(WebhookObjectAttributes, _super);
129
150
  function WebhookObjectAttributes(props) {
@@ -139,6 +160,10 @@ var WebhookObjectAttributes = /** @class */ (function (_super) {
139
160
  modelKey: 'jobStatusId',
140
161
  jsonKey: 'job_status_id',
141
162
  }),
163
+ messageId: attributes_1.default.String({
164
+ modelKey: 'messageId',
165
+ jsonKey: 'message_id',
166
+ }),
142
167
  threadId: attributes_1.default.String({
143
168
  modelKey: 'threadId',
144
169
  jsonKey: 'thread_id',
@@ -147,6 +172,10 @@ var WebhookObjectAttributes = /** @class */ (function (_super) {
147
172
  modelKey: 'receivedDate',
148
173
  jsonKey: 'received_date',
149
174
  }),
175
+ extras: attributes_1.default.Object({
176
+ modelKey: 'extras',
177
+ itemClass: WebhookObjectExtras,
178
+ }),
150
179
  };
151
180
  return WebhookObjectAttributes;
152
181
  }(model_1.default));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "6.5.0",
3
+ "version": "6.6.0",
4
4
  "description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
5
5
  "main": "lib/nylas.js",
6
6
  "types": "lib/nylas.d.ts",
@@ -9,6 +9,7 @@
9
9
  ],
10
10
  "scripts": {
11
11
  "test": "jest",
12
+ "test:coverage": "npm run test -- --coverage",
12
13
  "lint": "eslint --ext .js,.ts -f visualstudio .",
13
14
  "lint:fix": "npm run lint -- --fix",
14
15
  "lint:ci": "npm run lint:fix -- --quiet",