nylas 6.10.0 → 7.0.0-beta.1

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.
Files changed (197) hide show
  1. package/README.md +26 -14
  2. package/lib/cjs/apiClient.js +115 -0
  3. package/lib/cjs/config.js +32 -0
  4. package/lib/cjs/models/applicationDetails.js +2 -0
  5. package/lib/cjs/models/auth.js +2 -0
  6. package/lib/cjs/models/availability.js +11 -0
  7. package/lib/cjs/models/calendars.js +2 -0
  8. package/lib/cjs/models/error.js +53 -0
  9. package/lib/cjs/models/events.js +2 -0
  10. package/lib/cjs/models/grants.js +2 -0
  11. package/lib/cjs/models/listQueryParams.js +2 -0
  12. package/lib/cjs/models/redirectUri.js +2 -0
  13. package/lib/cjs/models/response.js +2 -0
  14. package/lib/cjs/models/webhooks.js +18 -0
  15. package/lib/cjs/nylas.js +34 -0
  16. package/lib/cjs/resources/applications.js +30 -0
  17. package/lib/cjs/resources/auth.js +153 -0
  18. package/lib/cjs/resources/calendars.js +78 -0
  19. package/lib/cjs/resources/events.js +69 -0
  20. package/lib/cjs/resources/grants.js +65 -0
  21. package/lib/cjs/resources/redirectUris.js +64 -0
  22. package/lib/cjs/resources/resource.js +111 -0
  23. package/lib/cjs/resources/webhooks.js +98 -0
  24. package/lib/cjs/utils.js +58 -0
  25. package/lib/esm/apiClient.js +112 -0
  26. package/lib/esm/config.js +29 -0
  27. package/lib/esm/models/applicationDetails.js +1 -0
  28. package/lib/esm/models/auth.js +1 -0
  29. package/lib/esm/models/availability.js +8 -0
  30. package/lib/esm/models/calendars.js +1 -0
  31. package/lib/esm/models/error.js +45 -0
  32. package/lib/esm/models/events.js +1 -0
  33. package/lib/esm/models/grants.js +1 -0
  34. package/lib/esm/models/listQueryParams.js +1 -0
  35. package/lib/esm/models/redirectUri.js +1 -0
  36. package/lib/esm/models/response.js +1 -0
  37. package/lib/esm/models/webhooks.js +15 -0
  38. package/lib/esm/nylas.js +31 -0
  39. package/lib/esm/resources/applications.js +26 -0
  40. package/lib/esm/resources/auth.js +149 -0
  41. package/lib/esm/resources/calendars.js +74 -0
  42. package/lib/esm/resources/events.js +65 -0
  43. package/lib/esm/resources/grants.js +61 -0
  44. package/lib/esm/resources/redirectUris.js +60 -0
  45. package/lib/esm/resources/resource.js +107 -0
  46. package/lib/esm/resources/webhooks.js +94 -0
  47. package/lib/esm/utils.js +53 -0
  48. package/lib/types/apiClient.d.ts +65 -0
  49. package/lib/types/config.d.ts +50 -0
  50. package/lib/types/models/applicationDetails.d.ts +93 -0
  51. package/lib/types/models/auth.d.ts +196 -0
  52. package/lib/types/models/availability.d.ts +159 -0
  53. package/lib/types/models/calendars.d.ts +121 -0
  54. package/lib/types/models/error.d.ts +104 -0
  55. package/lib/types/models/events.d.ts +494 -0
  56. package/lib/types/models/grants.d.ts +134 -0
  57. package/lib/types/models/listQueryParams.d.ts +4 -0
  58. package/lib/types/models/redirectUri.d.ts +71 -0
  59. package/lib/types/models/response.d.ts +40 -0
  60. package/lib/types/models/webhooks.d.ts +45 -0
  61. package/lib/types/nylas.d.ts +44 -0
  62. package/lib/types/resources/applications.d.ts +26 -0
  63. package/lib/types/resources/auth.d.ts +66 -0
  64. package/lib/types/resources/calendars.d.ts +97 -0
  65. package/lib/types/resources/events.d.ts +87 -0
  66. package/lib/types/resources/grants.d.ts +63 -0
  67. package/lib/types/resources/redirectUris.d.ts +63 -0
  68. package/lib/types/resources/resource.d.ts +55 -0
  69. package/lib/types/resources/webhooks.d.ts +79 -0
  70. package/lib/types/utils.d.ts +22 -0
  71. package/package.json +28 -39
  72. package/lib/config.d.ts +0 -52
  73. package/lib/config.js +0 -47
  74. package/lib/models/access-token.d.ts +0 -18
  75. package/lib/models/access-token.js +0 -56
  76. package/lib/models/account.d.ts +0 -27
  77. package/lib/models/account.js +0 -73
  78. package/lib/models/application-details.d.ts +0 -14
  79. package/lib/models/application-details.js +0 -47
  80. package/lib/models/attributes.d.ts +0 -151
  81. package/lib/models/attributes.js +0 -382
  82. package/lib/models/calendar-availability.d.ts +0 -76
  83. package/lib/models/calendar-availability.js +0 -121
  84. package/lib/models/calendar-restful-model-collection.d.ts +0 -17
  85. package/lib/models/calendar-restful-model-collection.js +0 -181
  86. package/lib/models/calendar.d.ts +0 -33
  87. package/lib/models/calendar.js +0 -97
  88. package/lib/models/component-restful-model-collection.d.ts +0 -9
  89. package/lib/models/component-restful-model-collection.js +0 -34
  90. package/lib/models/component.d.ts +0 -37
  91. package/lib/models/component.js +0 -91
  92. package/lib/models/connect.d.ts +0 -73
  93. package/lib/models/connect.js +0 -193
  94. package/lib/models/contact-restful-model-collection.d.ts +0 -9
  95. package/lib/models/contact-restful-model-collection.js +0 -60
  96. package/lib/models/contact.d.ts +0 -129
  97. package/lib/models/contact.js +0 -289
  98. package/lib/models/delta-collection.d.ts +0 -17
  99. package/lib/models/delta-collection.js +0 -139
  100. package/lib/models/delta-stream.d.ts +0 -32
  101. package/lib/models/delta-stream.js +0 -250
  102. package/lib/models/delta.d.ts +0 -28
  103. package/lib/models/delta.js +0 -88
  104. package/lib/models/deltas.d.ts +0 -17
  105. package/lib/models/deltas.js +0 -49
  106. package/lib/models/draft.d.ts +0 -27
  107. package/lib/models/draft.js +0 -156
  108. package/lib/models/email-participant.d.ts +0 -13
  109. package/lib/models/email-participant.js +0 -46
  110. package/lib/models/event-conferencing.d.ts +0 -34
  111. package/lib/models/event-conferencing.js +0 -71
  112. package/lib/models/event-notification.d.ts +0 -27
  113. package/lib/models/event-notification.js +0 -62
  114. package/lib/models/event-participant.d.ts +0 -19
  115. package/lib/models/event-participant.js +0 -56
  116. package/lib/models/event-reminder-method.d.ts +0 -18
  117. package/lib/models/event-reminder-method.js +0 -47
  118. package/lib/models/event.d.ts +0 -104
  119. package/lib/models/event.js +0 -308
  120. package/lib/models/file.d.ts +0 -29
  121. package/lib/models/file.js +0 -136
  122. package/lib/models/folder.d.ts +0 -21
  123. package/lib/models/folder.js +0 -69
  124. package/lib/models/free-busy.d.ts +0 -58
  125. package/lib/models/free-busy.js +0 -132
  126. package/lib/models/job-status-restful-model-collection.d.ts +0 -9
  127. package/lib/models/job-status-restful-model-collection.js +0 -38
  128. package/lib/models/job-status.d.ts +0 -24
  129. package/lib/models/job-status.js +0 -68
  130. package/lib/models/management-account.d.ts +0 -63
  131. package/lib/models/management-account.js +0 -187
  132. package/lib/models/management-model-collection.d.ts +0 -10
  133. package/lib/models/management-model-collection.js +0 -39
  134. package/lib/models/management-model.d.ts +0 -6
  135. package/lib/models/management-model.js +0 -29
  136. package/lib/models/message-restful-model-collection.d.ts +0 -26
  137. package/lib/models/message-restful-model-collection.js +0 -80
  138. package/lib/models/message.d.ts +0 -57
  139. package/lib/models/message.js +0 -173
  140. package/lib/models/model-collection.d.ts +0 -25
  141. package/lib/models/model-collection.js +0 -201
  142. package/lib/models/model.d.ts +0 -12
  143. package/lib/models/model.js +0 -64
  144. package/lib/models/neural-categorizer.d.ts +0 -28
  145. package/lib/models/neural-categorizer.js +0 -139
  146. package/lib/models/neural-clean-conversation.d.ts +0 -16
  147. package/lib/models/neural-clean-conversation.js +0 -114
  148. package/lib/models/neural-ocr.d.ts +0 -14
  149. package/lib/models/neural-ocr.js +0 -50
  150. package/lib/models/neural-sentiment-analysis.d.ts +0 -20
  151. package/lib/models/neural-sentiment-analysis.js +0 -56
  152. package/lib/models/neural-signature-contact.d.ts +0 -43
  153. package/lib/models/neural-signature-contact.js +0 -142
  154. package/lib/models/neural-signature-extraction.d.ts +0 -17
  155. package/lib/models/neural-signature-extraction.js +0 -54
  156. package/lib/models/neural.d.ts +0 -36
  157. package/lib/models/neural.js +0 -163
  158. package/lib/models/nylas-api-error.d.ts +0 -26
  159. package/lib/models/nylas-api-error.js +0 -62
  160. package/lib/models/outbox-job-status.d.ts +0 -20
  161. package/lib/models/outbox-job-status.js +0 -64
  162. package/lib/models/outbox-message.d.ts +0 -16
  163. package/lib/models/outbox-message.js +0 -54
  164. package/lib/models/outbox.d.ts +0 -35
  165. package/lib/models/outbox.js +0 -158
  166. package/lib/models/rate-limit-error.d.ts +0 -26
  167. package/lib/models/rate-limit-error.js +0 -47
  168. package/lib/models/resource.d.ts +0 -22
  169. package/lib/models/resource.js +0 -66
  170. package/lib/models/restful-model-collection.d.ts +0 -15
  171. package/lib/models/restful-model-collection.js +0 -169
  172. package/lib/models/restful-model-instance.d.ts +0 -9
  173. package/lib/models/restful-model-instance.js +0 -37
  174. package/lib/models/restful-model.d.ts +0 -36
  175. package/lib/models/restful-model.js +0 -146
  176. package/lib/models/scheduler-booking-request.d.ts +0 -64
  177. package/lib/models/scheduler-booking-request.js +0 -148
  178. package/lib/models/scheduler-restful-model-collection.d.ts +0 -26
  179. package/lib/models/scheduler-restful-model-collection.js +0 -133
  180. package/lib/models/scheduler-time-slot.d.ts +0 -20
  181. package/lib/models/scheduler-time-slot.js +0 -53
  182. package/lib/models/scheduler.d.ts +0 -226
  183. package/lib/models/scheduler.js +0 -446
  184. package/lib/models/thread.d.ts +0 -49
  185. package/lib/models/thread.js +0 -127
  186. package/lib/models/webhook-notification.d.ts +0 -133
  187. package/lib/models/webhook-notification.js +0 -314
  188. package/lib/models/webhook.d.ts +0 -50
  189. package/lib/models/webhook.js +0 -101
  190. package/lib/models/when.d.ts +0 -29
  191. package/lib/models/when.js +0 -76
  192. package/lib/nylas-connection.d.ts +0 -71
  193. package/lib/nylas-connection.js +0 -282
  194. package/lib/nylas.d.ts +0 -34
  195. package/lib/nylas.js +0 -199
  196. package/lib/services/tunnel.d.ts +0 -28
  197. package/lib/services/tunnel.js +0 -89
@@ -1,446 +0,0 @@
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 __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- var restful_model_1 = __importDefault(require("./restful-model"));
31
- var attributes_1 = __importDefault(require("./attributes"));
32
- var model_1 = __importDefault(require("./model"));
33
- var calendar_1 = __importDefault(require("./calendar"));
34
- var SchedulerAvailableCalendars = /** @class */ (function (_super) {
35
- __extends(SchedulerAvailableCalendars, _super);
36
- function SchedulerAvailableCalendars(props) {
37
- var _this = _super.call(this) || this;
38
- _this.id = '';
39
- _this.name = '';
40
- _this.email = '';
41
- _this.calendars = [];
42
- _this.initAttributes(props);
43
- return _this;
44
- }
45
- Object.defineProperty(SchedulerAvailableCalendars.prototype, "connection", {
46
- get: function () {
47
- return this._connection;
48
- },
49
- enumerable: true,
50
- configurable: true
51
- });
52
- SchedulerAvailableCalendars.prototype.fromJSON = function (json, connection) {
53
- // Allow a connection object to be passed in to instantiate a Calendar sub object
54
- if (connection) {
55
- this._connection = connection;
56
- }
57
- return _super.prototype.fromJSON.call(this, json);
58
- };
59
- SchedulerAvailableCalendars.attributes = {
60
- calendars: attributes_1.default.Collection({
61
- modelKey: 'calendars',
62
- itemClass: calendar_1.default,
63
- }),
64
- email: attributes_1.default.String({
65
- modelKey: 'email',
66
- }),
67
- id: attributes_1.default.String({
68
- modelKey: 'id',
69
- }),
70
- name: attributes_1.default.String({
71
- modelKey: 'name',
72
- }),
73
- };
74
- return SchedulerAvailableCalendars;
75
- }(model_1.default));
76
- exports.SchedulerAvailableCalendars = SchedulerAvailableCalendars;
77
- var SchedulerAppearance = /** @class */ (function (_super) {
78
- __extends(SchedulerAppearance, _super);
79
- function SchedulerAppearance(props) {
80
- var _this = _super.call(this) || this;
81
- _this.initAttributes(props);
82
- return _this;
83
- }
84
- SchedulerAppearance.attributes = {
85
- color: attributes_1.default.String({
86
- modelKey: 'color',
87
- }),
88
- companyName: attributes_1.default.String({
89
- modelKey: 'companyName',
90
- jsonKey: 'company_name',
91
- }),
92
- logo: attributes_1.default.String({
93
- modelKey: 'logo',
94
- }),
95
- privacyPolicyRedirect: attributes_1.default.String({
96
- modelKey: 'privacyPolicyRedirect',
97
- jsonKey: 'privacy_policy_redirect',
98
- }),
99
- showAutoschedule: attributes_1.default.Boolean({
100
- modelKey: 'showAutoschedule',
101
- jsonKey: 'show_autoschedule',
102
- }),
103
- showNylasBranding: attributes_1.default.Boolean({
104
- modelKey: 'showNylasBranding',
105
- jsonKey: 'show_nylas_branding',
106
- }),
107
- showTimezoneOptions: attributes_1.default.Boolean({
108
- modelKey: 'showTimezoneOptions',
109
- jsonKey: 'show_timezone_options',
110
- }),
111
- showWeekView: attributes_1.default.Boolean({
112
- modelKey: 'showWeekView',
113
- jsonKey: 'show_week_view',
114
- }),
115
- submitText: attributes_1.default.String({
116
- modelKey: 'submitText',
117
- jsonKey: 'submit_text',
118
- }),
119
- thankYouRedirect: attributes_1.default.String({
120
- modelKey: 'thankYouRedirect',
121
- jsonKey: 'thank_you_redirect',
122
- }),
123
- thankYouText: attributes_1.default.String({
124
- modelKey: 'thankYouText',
125
- jsonKey: 'thank_you_text',
126
- }),
127
- thankYouTextSecondary: attributes_1.default.String({
128
- modelKey: 'thankYouTextSecondary',
129
- jsonKey: 'thank_you_text_secondary',
130
- }),
131
- };
132
- return SchedulerAppearance;
133
- }(model_1.default));
134
- exports.SchedulerAppearance = SchedulerAppearance;
135
- var SchedulerBookingAdditionalFields = /** @class */ (function (_super) {
136
- __extends(SchedulerBookingAdditionalFields, _super);
137
- function SchedulerBookingAdditionalFields(props) {
138
- var _this = _super.call(this) || this;
139
- _this.initAttributes(props);
140
- return _this;
141
- }
142
- SchedulerBookingAdditionalFields.attributes = {
143
- dropdownOptions: attributes_1.default.StringList({
144
- modelKey: 'dropdownOptions',
145
- jsonKey: 'dropdown_options',
146
- }),
147
- label: attributes_1.default.String({
148
- modelKey: 'label',
149
- }),
150
- multiSelectOptions: attributes_1.default.StringList({
151
- modelKey: 'multiSelectOptions',
152
- jsonKey: 'multi_select_options',
153
- }),
154
- name: attributes_1.default.String({
155
- modelKey: 'name',
156
- }),
157
- order: attributes_1.default.Number({
158
- modelKey: 'order',
159
- }),
160
- pattern: attributes_1.default.String({
161
- modelKey: 'pattern',
162
- }),
163
- required: attributes_1.default.Boolean({
164
- modelKey: 'required',
165
- }),
166
- type: attributes_1.default.String({
167
- modelKey: 'type',
168
- }),
169
- };
170
- return SchedulerBookingAdditionalFields;
171
- }(model_1.default));
172
- exports.SchedulerBookingAdditionalFields = SchedulerBookingAdditionalFields;
173
- var SchedulerBookingOpeningHours = /** @class */ (function (_super) {
174
- __extends(SchedulerBookingOpeningHours, _super);
175
- function SchedulerBookingOpeningHours(props) {
176
- var _this = _super.call(this) || this;
177
- _this.initAttributes(props);
178
- return _this;
179
- }
180
- SchedulerBookingOpeningHours.attributes = {
181
- accountId: attributes_1.default.String({
182
- modelKey: 'accountId',
183
- jsonKey: 'account_id',
184
- }),
185
- days: attributes_1.default.StringList({
186
- modelKey: 'days',
187
- }),
188
- end: attributes_1.default.String({
189
- modelKey: 'end',
190
- }),
191
- start: attributes_1.default.String({
192
- modelKey: 'start',
193
- }),
194
- };
195
- return SchedulerBookingOpeningHours;
196
- }(model_1.default));
197
- exports.SchedulerBookingOpeningHours = SchedulerBookingOpeningHours;
198
- var SchedulerBooking = /** @class */ (function (_super) {
199
- __extends(SchedulerBooking, _super);
200
- function SchedulerBooking(props) {
201
- var _this = _super.call(this) || this;
202
- _this.initAttributes(props);
203
- return _this;
204
- }
205
- SchedulerBooking.attributes = {
206
- additionalFields: attributes_1.default.Collection({
207
- modelKey: 'additionalFields',
208
- jsonKey: 'additional_fields',
209
- itemClass: SchedulerBookingAdditionalFields,
210
- }),
211
- additionalGuestsHidden: attributes_1.default.Boolean({
212
- modelKey: 'additionalGuestsHidden',
213
- jsonKey: 'additional_guests_hidden',
214
- }),
215
- availableDaysInFuture: attributes_1.default.Number({
216
- modelKey: 'availableDaysInFuture',
217
- jsonKey: 'available_days_in_future',
218
- }),
219
- calendarInviteToGuests: attributes_1.default.Boolean({
220
- modelKey: 'calendarInviteToGuests',
221
- jsonKey: 'calendar_invite_to_guests',
222
- }),
223
- cancellationPolicy: attributes_1.default.String({
224
- modelKey: 'cancellationPolicy',
225
- jsonKey: 'cancellation_policy',
226
- }),
227
- confirmationEmailsToGuests: attributes_1.default.Boolean({
228
- modelKey: 'confirmationEmailsToGuests',
229
- jsonKey: 'confirmation_emails_to_guests',
230
- }),
231
- confirmationEmailToHost: attributes_1.default.Boolean({
232
- modelKey: 'confirmationEmailToHost',
233
- jsonKey: 'confirmation_emails_to_host',
234
- }),
235
- confirmationMethod: attributes_1.default.String({
236
- modelKey: 'confirmationMethod',
237
- jsonKey: 'confirmation_method',
238
- }),
239
- minBookingNotice: attributes_1.default.Number({
240
- modelKey: 'minBookingNotice',
241
- jsonKey: 'min_booking_notice',
242
- }),
243
- minBuffer: attributes_1.default.Number({
244
- modelKey: 'minBuffer',
245
- jsonKey: 'min_buffer',
246
- }),
247
- minCancellationNotice: attributes_1.default.Number({
248
- modelKey: 'minCancellationNotice',
249
- jsonKey: 'min_cancellation_notice',
250
- }),
251
- intervalMinutes: attributes_1.default.Number({
252
- modelKey: 'intervalMinutes',
253
- jsonKey: 'interval_minutes',
254
- }),
255
- nameFieldHidden: attributes_1.default.Boolean({
256
- modelKey: 'nameFieldHidden',
257
- jsonKey: 'name_field_hidden',
258
- }),
259
- openingHours: attributes_1.default.Collection({
260
- modelKey: 'openingHours',
261
- jsonKey: 'opening_hours',
262
- itemClass: SchedulerBookingOpeningHours,
263
- }),
264
- schedulingMethod: attributes_1.default.String({
265
- modelKey: 'schedulingMethod',
266
- jsonKey: 'scheduling_method',
267
- }),
268
- };
269
- return SchedulerBooking;
270
- }(model_1.default));
271
- exports.SchedulerBooking = SchedulerBooking;
272
- var SchedulerReminders = /** @class */ (function (_super) {
273
- __extends(SchedulerReminders, _super);
274
- function SchedulerReminders(props) {
275
- var _this = _super.call(this) || this;
276
- _this.initAttributes(props);
277
- return _this;
278
- }
279
- SchedulerReminders.attributes = {
280
- deliveryMethod: attributes_1.default.String({
281
- modelKey: 'deliveryMethod',
282
- jsonKey: 'delivery_method',
283
- }),
284
- deliveryRecipient: attributes_1.default.String({
285
- modelKey: 'deliveryRecipient',
286
- jsonKey: 'delivery_recipient',
287
- }),
288
- emailSubject: attributes_1.default.String({
289
- modelKey: 'emailSubject',
290
- jsonKey: 'email_subject',
291
- }),
292
- timeBeforeEvent: attributes_1.default.Number({
293
- modelKey: 'timeBeforeEvent',
294
- jsonKey: 'time_before_event',
295
- }),
296
- webhookUrl: attributes_1.default.String({
297
- modelKey: 'webhookUrl',
298
- jsonKey: 'webhook_url',
299
- }),
300
- };
301
- return SchedulerReminders;
302
- }(model_1.default));
303
- exports.SchedulerReminders = SchedulerReminders;
304
- var SchedulerConfig = /** @class */ (function (_super) {
305
- __extends(SchedulerConfig, _super);
306
- function SchedulerConfig(props) {
307
- var _this = _super.call(this) || this;
308
- _this.initAttributes(props);
309
- return _this;
310
- }
311
- SchedulerConfig.attributes = {
312
- appearance: attributes_1.default.Object({
313
- modelKey: 'appearance',
314
- itemClass: SchedulerAppearance,
315
- }),
316
- booking: attributes_1.default.Object({
317
- modelKey: 'booking',
318
- itemClass: SchedulerBooking,
319
- }),
320
- calendarIds: attributes_1.default.Object({
321
- modelKey: 'calendarIds',
322
- jsonKey: 'calendar_ids',
323
- }),
324
- event: attributes_1.default.Object({
325
- modelKey: 'event',
326
- }),
327
- expireAfter: attributes_1.default.Object({
328
- modelKey: 'expireAfter',
329
- jsonKey: 'expire_after',
330
- }),
331
- disableEmails: attributes_1.default.Boolean({
332
- modelKey: 'disableEmails',
333
- jsonKey: 'disable_emails',
334
- }),
335
- locale: attributes_1.default.String({
336
- modelKey: 'locale',
337
- }),
338
- localeForGuests: attributes_1.default.String({
339
- modelKey: 'localeForGuests',
340
- jsonKey: 'locale_for_guests',
341
- }),
342
- reminders: attributes_1.default.Collection({
343
- modelKey: 'reminders',
344
- itemClass: SchedulerReminders,
345
- }),
346
- timezone: attributes_1.default.String({
347
- modelKey: 'timezone',
348
- }),
349
- };
350
- return SchedulerConfig;
351
- }(model_1.default));
352
- exports.SchedulerConfig = SchedulerConfig;
353
- var Scheduler = /** @class */ (function (_super) {
354
- __extends(Scheduler, _super);
355
- function Scheduler(connection, props) {
356
- var _this = _super.call(this, connection, props) || this;
357
- _this.initAttributes(props);
358
- _this.baseUrl = 'https://api.schedule.nylas.com';
359
- return _this;
360
- }
361
- Scheduler.prototype.save = function (params, callback) {
362
- if (params === void 0) { params = {}; }
363
- this.validate();
364
- return _super.prototype.save.call(this, params, callback);
365
- };
366
- Scheduler.prototype.getAvailableCalendars = function () {
367
- var _this = this;
368
- if (!this.id) {
369
- throw new Error('Cannot get calendars for a page without an ID.');
370
- }
371
- return this.connection
372
- .request({
373
- method: 'GET',
374
- path: "/manage/pages/" + this.id + "/calendars",
375
- headers: {
376
- 'Content-Type': 'application/json',
377
- },
378
- baseUrl: this.baseUrl,
379
- })
380
- .then(function (json) {
381
- var calendars = json.map(function (cal) {
382
- return new SchedulerAvailableCalendars().fromJSON(cal, _this.connection);
383
- });
384
- return Promise.resolve(calendars);
385
- });
386
- };
387
- Scheduler.prototype.uploadImage = function (contentType, objectName) {
388
- if (!this.id) {
389
- throw new Error('Cannot upload an image to a page without an ID.');
390
- }
391
- return this.connection.request({
392
- method: 'PUT',
393
- path: "/manage/pages/" + this.id + "/upload-image",
394
- headers: {
395
- 'Content-Type': 'application/json',
396
- },
397
- body: {
398
- contentType: contentType,
399
- objectName: objectName,
400
- },
401
- baseUrl: this.baseUrl,
402
- });
403
- };
404
- Scheduler.prototype.validate = function () {
405
- var _a, _b;
406
- var bookingIntervalMinutes = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.booking) === null || _b === void 0 ? void 0 : _b.intervalMinutes;
407
- if (bookingIntervalMinutes !== undefined &&
408
- (bookingIntervalMinutes <= 0 || bookingIntervalMinutes % 5 != 0)) {
409
- throw new Error('SchedulerBooking.intervalMinutes must be a non-zero positive integer, divisible by 5.');
410
- }
411
- };
412
- Scheduler.collectionName = 'manage/pages';
413
- Scheduler.attributes = __assign(__assign({}, restful_model_1.default.attributes), { accessTokens: attributes_1.default.StringList({
414
- modelKey: 'accessTokens',
415
- jsonKey: 'access_tokens',
416
- }), appClientId: attributes_1.default.String({
417
- modelKey: 'appClientId',
418
- jsonKey: 'app_client_id',
419
- readOnly: true,
420
- }), appOrganizationId: attributes_1.default.Number({
421
- modelKey: 'appOrganizationId',
422
- jsonKey: 'app_organization_id',
423
- readOnly: true,
424
- }), config: attributes_1.default.Object({
425
- modelKey: 'config',
426
- itemClass: SchedulerConfig,
427
- }), editToken: attributes_1.default.String({
428
- modelKey: 'editToken',
429
- jsonKey: 'edit_token',
430
- readOnly: true,
431
- }), name: attributes_1.default.String({
432
- modelKey: 'name',
433
- }), slug: attributes_1.default.String({
434
- modelKey: 'slug',
435
- }), createdAt: attributes_1.default.Date({
436
- modelKey: 'createdAt',
437
- jsonKey: 'created_at',
438
- readOnly: true,
439
- }), modifiedAt: attributes_1.default.Date({
440
- modelKey: 'modifiedAt',
441
- jsonKey: 'modified_at',
442
- readOnly: true,
443
- }) });
444
- return Scheduler;
445
- }(restful_model_1.default));
446
- exports.default = Scheduler;
@@ -1,49 +0,0 @@
1
- import Message, { MessageProperties } from './message';
2
- import RestfulModel, { SaveCallback } from './restful-model';
3
- import { Attribute } from './attributes';
4
- import EmailParticipant, { EmailParticipantProperties } from './email-participant';
5
- import Folder, { Label, FolderProperties } from './folder';
6
- import NylasConnection from '../nylas-connection';
7
- export declare type ThreadProperties = {
8
- subject: string;
9
- participants: EmailParticipantProperties[];
10
- lastMessageTimestamp: Date;
11
- lastMessageReceivedTimestamp: Date;
12
- firstMessageTimestamp: Date;
13
- messageIds: string[];
14
- snippet: string;
15
- unread: boolean;
16
- starred: boolean;
17
- version: string;
18
- hasAttachments?: boolean;
19
- lastMessageSentTimestamp?: Date;
20
- folders?: FolderProperties[];
21
- labels?: FolderProperties[];
22
- draftIds?: string[];
23
- messages?: MessageProperties[];
24
- drafts?: MessageProperties[];
25
- };
26
- export default class Thread extends RestfulModel implements ThreadProperties {
27
- subject: string;
28
- participants: EmailParticipant[];
29
- lastMessageTimestamp: Date;
30
- lastMessageReceivedTimestamp: Date;
31
- firstMessageTimestamp: Date;
32
- messageIds: string[];
33
- snippet: string;
34
- unread: boolean;
35
- starred: boolean;
36
- version: string;
37
- hasAttachments?: boolean;
38
- lastMessageSentTimestamp?: Date;
39
- folders?: Folder[];
40
- labels?: Label[];
41
- draftIds?: string[];
42
- messages?: Message[];
43
- drafts?: Message[];
44
- static collectionName: string;
45
- static attributes: Record<string, Attribute>;
46
- constructor(connection: NylasConnection, props?: ThreadProperties);
47
- saveRequestBody(): Record<string, unknown>;
48
- save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
49
- }
@@ -1,127 +0,0 @@
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 __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
33
- result["default"] = mod;
34
- return result;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- var message_1 = __importDefault(require("./message"));
38
- var restful_model_1 = __importDefault(require("./restful-model"));
39
- var attributes_1 = __importDefault(require("./attributes"));
40
- var email_participant_1 = __importDefault(require("./email-participant"));
41
- var folder_1 = __importStar(require("./folder"));
42
- var Thread = /** @class */ (function (_super) {
43
- __extends(Thread, _super);
44
- function Thread(connection, props) {
45
- var _this = _super.call(this, connection, props) || this;
46
- _this.subject = '';
47
- _this.participants = [];
48
- _this.lastMessageTimestamp = new Date();
49
- _this.lastMessageReceivedTimestamp = new Date();
50
- _this.firstMessageTimestamp = new Date();
51
- _this.messageIds = [];
52
- _this.snippet = '';
53
- _this.unread = false;
54
- _this.starred = false;
55
- _this.version = '';
56
- _this.initAttributes(props);
57
- return _this;
58
- }
59
- Thread.prototype.saveRequestBody = function () {
60
- var json = {};
61
- if (this.labels) {
62
- json['label_ids'] = this.labels.map(function (label) { return label.id; });
63
- }
64
- else if (this.folders && this.folders.length === 1) {
65
- json['folder_id'] = this.folders[0].id;
66
- }
67
- json['starred'] = this.starred;
68
- json['unread'] = this.unread;
69
- return json;
70
- };
71
- Thread.prototype.save = function (params, callback) {
72
- if (params === void 0) { params = {}; }
73
- return _super.prototype.save.call(this, params, callback);
74
- };
75
- Thread.collectionName = 'threads';
76
- Thread.attributes = __assign(__assign({}, restful_model_1.default.attributes), { subject: attributes_1.default.String({
77
- modelKey: 'subject',
78
- }), participants: attributes_1.default.Collection({
79
- modelKey: 'participants',
80
- itemClass: email_participant_1.default,
81
- }), lastMessageTimestamp: attributes_1.default.DateTime({
82
- modelKey: 'lastMessageTimestamp',
83
- jsonKey: 'last_message_timestamp',
84
- }), lastMessageReceivedTimestamp: attributes_1.default.DateTime({
85
- modelKey: 'lastMessageReceivedTimestamp',
86
- jsonKey: 'last_message_received_timestamp',
87
- }), lastMessageSentTimestamp: attributes_1.default.DateTime({
88
- modelKey: 'lastMessageSentTimestamp',
89
- jsonKey: 'last_message_sent_timestamp',
90
- }), firstMessageTimestamp: attributes_1.default.DateTime({
91
- modelKey: 'firstMessageTimestamp',
92
- jsonKey: 'first_message_timestamp',
93
- }), snippet: attributes_1.default.String({
94
- modelKey: 'snippet',
95
- }), unread: attributes_1.default.Boolean({
96
- modelKey: 'unread',
97
- }), starred: attributes_1.default.Boolean({
98
- modelKey: 'starred',
99
- }), hasAttachments: attributes_1.default.Boolean({
100
- modelKey: 'has_attachments',
101
- }), version: attributes_1.default.String({
102
- modelKey: 'version',
103
- jsonKey: 'version',
104
- }), folders: attributes_1.default.Collection({
105
- modelKey: 'folders',
106
- itemClass: folder_1.default,
107
- jsonKey: 'folders',
108
- }), labels: attributes_1.default.Collection({
109
- modelKey: 'labels',
110
- itemClass: folder_1.Label,
111
- jsonKey: 'labels',
112
- }), messageIds: attributes_1.default.StringList({
113
- modelKey: 'messageIds',
114
- jsonKey: 'message_ids',
115
- }), draftIds: attributes_1.default.StringList({
116
- modelKey: 'draftIds',
117
- jsonKey: 'draft_ids',
118
- }), messages: attributes_1.default.Collection({
119
- modelKey: 'messages',
120
- itemClass: message_1.default,
121
- }), drafts: attributes_1.default.Collection({
122
- modelKey: 'drafts',
123
- itemClass: message_1.default,
124
- }) });
125
- return Thread;
126
- }(restful_model_1.default));
127
- exports.default = Thread;