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.
- package/README.md +26 -14
- package/lib/cjs/apiClient.js +115 -0
- package/lib/cjs/config.js +32 -0
- package/lib/cjs/models/applicationDetails.js +2 -0
- package/lib/cjs/models/auth.js +2 -0
- package/lib/cjs/models/availability.js +11 -0
- package/lib/cjs/models/calendars.js +2 -0
- package/lib/cjs/models/error.js +53 -0
- package/lib/cjs/models/events.js +2 -0
- package/lib/cjs/models/grants.js +2 -0
- package/lib/cjs/models/listQueryParams.js +2 -0
- package/lib/cjs/models/redirectUri.js +2 -0
- package/lib/cjs/models/response.js +2 -0
- package/lib/cjs/models/webhooks.js +18 -0
- package/lib/cjs/nylas.js +34 -0
- package/lib/cjs/resources/applications.js +30 -0
- package/lib/cjs/resources/auth.js +153 -0
- package/lib/cjs/resources/calendars.js +78 -0
- package/lib/cjs/resources/events.js +69 -0
- package/lib/cjs/resources/grants.js +65 -0
- package/lib/cjs/resources/redirectUris.js +64 -0
- package/lib/cjs/resources/resource.js +111 -0
- package/lib/cjs/resources/webhooks.js +98 -0
- package/lib/cjs/utils.js +58 -0
- package/lib/esm/apiClient.js +112 -0
- package/lib/esm/config.js +29 -0
- package/lib/esm/models/applicationDetails.js +1 -0
- package/lib/esm/models/auth.js +1 -0
- package/lib/esm/models/availability.js +8 -0
- package/lib/esm/models/calendars.js +1 -0
- package/lib/esm/models/error.js +45 -0
- package/lib/esm/models/events.js +1 -0
- package/lib/esm/models/grants.js +1 -0
- package/lib/esm/models/listQueryParams.js +1 -0
- package/lib/esm/models/redirectUri.js +1 -0
- package/lib/esm/models/response.js +1 -0
- package/lib/esm/models/webhooks.js +15 -0
- package/lib/esm/nylas.js +31 -0
- package/lib/esm/resources/applications.js +26 -0
- package/lib/esm/resources/auth.js +149 -0
- package/lib/esm/resources/calendars.js +74 -0
- package/lib/esm/resources/events.js +65 -0
- package/lib/esm/resources/grants.js +61 -0
- package/lib/esm/resources/redirectUris.js +60 -0
- package/lib/esm/resources/resource.js +107 -0
- package/lib/esm/resources/webhooks.js +94 -0
- package/lib/esm/utils.js +53 -0
- package/lib/types/apiClient.d.ts +65 -0
- package/lib/types/config.d.ts +50 -0
- package/lib/types/models/applicationDetails.d.ts +93 -0
- package/lib/types/models/auth.d.ts +196 -0
- package/lib/types/models/availability.d.ts +159 -0
- package/lib/types/models/calendars.d.ts +121 -0
- package/lib/types/models/error.d.ts +104 -0
- package/lib/types/models/events.d.ts +494 -0
- package/lib/types/models/grants.d.ts +134 -0
- package/lib/types/models/listQueryParams.d.ts +4 -0
- package/lib/types/models/redirectUri.d.ts +71 -0
- package/lib/types/models/response.d.ts +40 -0
- package/lib/types/models/webhooks.d.ts +45 -0
- package/lib/types/nylas.d.ts +44 -0
- package/lib/types/resources/applications.d.ts +26 -0
- package/lib/types/resources/auth.d.ts +66 -0
- package/lib/types/resources/calendars.d.ts +97 -0
- package/lib/types/resources/events.d.ts +87 -0
- package/lib/types/resources/grants.d.ts +63 -0
- package/lib/types/resources/redirectUris.d.ts +63 -0
- package/lib/types/resources/resource.d.ts +55 -0
- package/lib/types/resources/webhooks.d.ts +79 -0
- package/lib/types/utils.d.ts +22 -0
- package/package.json +28 -39
- package/lib/config.d.ts +0 -52
- package/lib/config.js +0 -47
- package/lib/models/access-token.d.ts +0 -18
- package/lib/models/access-token.js +0 -56
- package/lib/models/account.d.ts +0 -27
- package/lib/models/account.js +0 -73
- package/lib/models/application-details.d.ts +0 -14
- package/lib/models/application-details.js +0 -47
- package/lib/models/attributes.d.ts +0 -151
- package/lib/models/attributes.js +0 -382
- package/lib/models/calendar-availability.d.ts +0 -76
- package/lib/models/calendar-availability.js +0 -121
- package/lib/models/calendar-restful-model-collection.d.ts +0 -17
- package/lib/models/calendar-restful-model-collection.js +0 -181
- package/lib/models/calendar.d.ts +0 -33
- package/lib/models/calendar.js +0 -97
- package/lib/models/component-restful-model-collection.d.ts +0 -9
- package/lib/models/component-restful-model-collection.js +0 -34
- package/lib/models/component.d.ts +0 -37
- package/lib/models/component.js +0 -91
- package/lib/models/connect.d.ts +0 -73
- package/lib/models/connect.js +0 -193
- package/lib/models/contact-restful-model-collection.d.ts +0 -9
- package/lib/models/contact-restful-model-collection.js +0 -60
- package/lib/models/contact.d.ts +0 -129
- package/lib/models/contact.js +0 -289
- package/lib/models/delta-collection.d.ts +0 -17
- package/lib/models/delta-collection.js +0 -139
- package/lib/models/delta-stream.d.ts +0 -32
- package/lib/models/delta-stream.js +0 -250
- package/lib/models/delta.d.ts +0 -28
- package/lib/models/delta.js +0 -88
- package/lib/models/deltas.d.ts +0 -17
- package/lib/models/deltas.js +0 -49
- package/lib/models/draft.d.ts +0 -27
- package/lib/models/draft.js +0 -156
- package/lib/models/email-participant.d.ts +0 -13
- package/lib/models/email-participant.js +0 -46
- package/lib/models/event-conferencing.d.ts +0 -34
- package/lib/models/event-conferencing.js +0 -71
- package/lib/models/event-notification.d.ts +0 -27
- package/lib/models/event-notification.js +0 -62
- package/lib/models/event-participant.d.ts +0 -19
- package/lib/models/event-participant.js +0 -56
- package/lib/models/event-reminder-method.d.ts +0 -18
- package/lib/models/event-reminder-method.js +0 -47
- package/lib/models/event.d.ts +0 -104
- package/lib/models/event.js +0 -308
- package/lib/models/file.d.ts +0 -29
- package/lib/models/file.js +0 -136
- package/lib/models/folder.d.ts +0 -21
- package/lib/models/folder.js +0 -69
- package/lib/models/free-busy.d.ts +0 -58
- package/lib/models/free-busy.js +0 -132
- package/lib/models/job-status-restful-model-collection.d.ts +0 -9
- package/lib/models/job-status-restful-model-collection.js +0 -38
- package/lib/models/job-status.d.ts +0 -24
- package/lib/models/job-status.js +0 -68
- package/lib/models/management-account.d.ts +0 -63
- package/lib/models/management-account.js +0 -187
- package/lib/models/management-model-collection.d.ts +0 -10
- package/lib/models/management-model-collection.js +0 -39
- package/lib/models/management-model.d.ts +0 -6
- package/lib/models/management-model.js +0 -29
- package/lib/models/message-restful-model-collection.d.ts +0 -26
- package/lib/models/message-restful-model-collection.js +0 -80
- package/lib/models/message.d.ts +0 -57
- package/lib/models/message.js +0 -173
- package/lib/models/model-collection.d.ts +0 -25
- package/lib/models/model-collection.js +0 -201
- package/lib/models/model.d.ts +0 -12
- package/lib/models/model.js +0 -64
- package/lib/models/neural-categorizer.d.ts +0 -28
- package/lib/models/neural-categorizer.js +0 -139
- package/lib/models/neural-clean-conversation.d.ts +0 -16
- package/lib/models/neural-clean-conversation.js +0 -114
- package/lib/models/neural-ocr.d.ts +0 -14
- package/lib/models/neural-ocr.js +0 -50
- package/lib/models/neural-sentiment-analysis.d.ts +0 -20
- package/lib/models/neural-sentiment-analysis.js +0 -56
- package/lib/models/neural-signature-contact.d.ts +0 -43
- package/lib/models/neural-signature-contact.js +0 -142
- package/lib/models/neural-signature-extraction.d.ts +0 -17
- package/lib/models/neural-signature-extraction.js +0 -54
- package/lib/models/neural.d.ts +0 -36
- package/lib/models/neural.js +0 -163
- package/lib/models/nylas-api-error.d.ts +0 -26
- package/lib/models/nylas-api-error.js +0 -62
- package/lib/models/outbox-job-status.d.ts +0 -20
- package/lib/models/outbox-job-status.js +0 -64
- package/lib/models/outbox-message.d.ts +0 -16
- package/lib/models/outbox-message.js +0 -54
- package/lib/models/outbox.d.ts +0 -35
- package/lib/models/outbox.js +0 -158
- package/lib/models/rate-limit-error.d.ts +0 -26
- package/lib/models/rate-limit-error.js +0 -47
- package/lib/models/resource.d.ts +0 -22
- package/lib/models/resource.js +0 -66
- package/lib/models/restful-model-collection.d.ts +0 -15
- package/lib/models/restful-model-collection.js +0 -169
- package/lib/models/restful-model-instance.d.ts +0 -9
- package/lib/models/restful-model-instance.js +0 -37
- package/lib/models/restful-model.d.ts +0 -36
- package/lib/models/restful-model.js +0 -146
- package/lib/models/scheduler-booking-request.d.ts +0 -64
- package/lib/models/scheduler-booking-request.js +0 -148
- package/lib/models/scheduler-restful-model-collection.d.ts +0 -26
- package/lib/models/scheduler-restful-model-collection.js +0 -133
- package/lib/models/scheduler-time-slot.d.ts +0 -20
- package/lib/models/scheduler-time-slot.js +0 -53
- package/lib/models/scheduler.d.ts +0 -226
- package/lib/models/scheduler.js +0 -446
- package/lib/models/thread.d.ts +0 -49
- package/lib/models/thread.js +0 -127
- package/lib/models/webhook-notification.d.ts +0 -133
- package/lib/models/webhook-notification.js +0 -314
- package/lib/models/webhook.d.ts +0 -50
- package/lib/models/webhook.js +0 -101
- package/lib/models/when.d.ts +0 -29
- package/lib/models/when.js +0 -76
- package/lib/nylas-connection.d.ts +0 -71
- package/lib/nylas-connection.js +0 -282
- package/lib/nylas.d.ts +0 -34
- package/lib/nylas.js +0 -199
- package/lib/services/tunnel.d.ts +0 -28
- package/lib/services/tunnel.js +0 -89
package/lib/models/event.js
DELETED
|
@@ -1,308 +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 event_participant_1 = __importDefault(require("./event-participant"));
|
|
33
|
-
var event_conferencing_1 = __importDefault(require("./event-conferencing"));
|
|
34
|
-
var when_1 = __importDefault(require("./when"));
|
|
35
|
-
var event_notification_1 = __importDefault(require("./event-notification"));
|
|
36
|
-
var event_reminder_method_1 = require("./event-reminder-method");
|
|
37
|
-
var ICSMethod;
|
|
38
|
-
(function (ICSMethod) {
|
|
39
|
-
ICSMethod["Request"] = "request";
|
|
40
|
-
ICSMethod["Publish"] = "publish";
|
|
41
|
-
ICSMethod["Reply"] = "reply";
|
|
42
|
-
ICSMethod["Add"] = "add";
|
|
43
|
-
ICSMethod["Cancel"] = "cancel";
|
|
44
|
-
ICSMethod["Refresh"] = "refresh";
|
|
45
|
-
})(ICSMethod = exports.ICSMethod || (exports.ICSMethod = {}));
|
|
46
|
-
var Event = /** @class */ (function (_super) {
|
|
47
|
-
__extends(Event, _super);
|
|
48
|
-
function Event(connection, props) {
|
|
49
|
-
var _this = _super.call(this, connection, props) || this;
|
|
50
|
-
_this.calendarId = '';
|
|
51
|
-
_this.when = new when_1.default();
|
|
52
|
-
_this.initAttributes(props);
|
|
53
|
-
return _this;
|
|
54
|
-
}
|
|
55
|
-
Object.defineProperty(Event.prototype, "start", {
|
|
56
|
-
get: function () {
|
|
57
|
-
var _a, _b, _c, _d;
|
|
58
|
-
return (((_a = this.when) === null || _a === void 0 ? void 0 : _a.startTime) || ((_b = this.when) === null || _b === void 0 ? void 0 : _b.startDate) || ((_c = this.when) === null || _c === void 0 ? void 0 : _c.time) || ((_d = this.when) === null || _d === void 0 ? void 0 : _d.date));
|
|
59
|
-
},
|
|
60
|
-
set: function (val) {
|
|
61
|
-
if (!this.when) {
|
|
62
|
-
this.when = new when_1.default();
|
|
63
|
-
}
|
|
64
|
-
if (typeof val === 'number') {
|
|
65
|
-
if (val === this.when.endTime) {
|
|
66
|
-
this.when.time = val;
|
|
67
|
-
this.when.endTime = undefined;
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
this.when.time = undefined;
|
|
71
|
-
this.when.startDate = undefined;
|
|
72
|
-
this.when.date = undefined;
|
|
73
|
-
this.when.startTime = val;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
if (typeof val === 'string') {
|
|
77
|
-
if (val === this.when.endDate) {
|
|
78
|
-
this.when.date = val;
|
|
79
|
-
this.when.endDate = undefined;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
this.when.time = undefined;
|
|
83
|
-
this.when.startTime = undefined;
|
|
84
|
-
this.when.date = undefined;
|
|
85
|
-
this.when.startDate = val;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
enumerable: true,
|
|
90
|
-
configurable: true
|
|
91
|
-
});
|
|
92
|
-
Object.defineProperty(Event.prototype, "end", {
|
|
93
|
-
get: function () {
|
|
94
|
-
var _a, _b, _c, _d;
|
|
95
|
-
return (((_a = this.when) === null || _a === void 0 ? void 0 : _a.endTime) || ((_b = this.when) === null || _b === void 0 ? void 0 : _b.endDate) || ((_c = this.when) === null || _c === void 0 ? void 0 : _c.time) || ((_d = this.when) === null || _d === void 0 ? void 0 : _d.date));
|
|
96
|
-
},
|
|
97
|
-
set: function (val) {
|
|
98
|
-
if (!this.when) {
|
|
99
|
-
this.when = new when_1.default();
|
|
100
|
-
}
|
|
101
|
-
if (typeof val === 'number') {
|
|
102
|
-
if (val === this.when.startTime) {
|
|
103
|
-
this.when.time = val;
|
|
104
|
-
this.when.startTime = undefined;
|
|
105
|
-
}
|
|
106
|
-
else {
|
|
107
|
-
this.when.time = undefined;
|
|
108
|
-
this.when.endDate = undefined;
|
|
109
|
-
this.when.date = undefined;
|
|
110
|
-
this.when.endTime = val;
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
if (typeof val === 'string') {
|
|
114
|
-
if (val === this.when.startDate) {
|
|
115
|
-
this.when.date = val;
|
|
116
|
-
this.when.startDate = undefined;
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
this.when.time = undefined;
|
|
120
|
-
this.when.endTime = undefined;
|
|
121
|
-
this.when.date = undefined;
|
|
122
|
-
this.when.endDate = val;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
enumerable: true,
|
|
127
|
-
configurable: true
|
|
128
|
-
});
|
|
129
|
-
Event.prototype.deleteRequestQueryString = function (params) {
|
|
130
|
-
if (params === void 0) { params = {}; }
|
|
131
|
-
var qs = {};
|
|
132
|
-
if (params.hasOwnProperty('notify_participants')) {
|
|
133
|
-
qs.notify_participants = params.notify_participants;
|
|
134
|
-
}
|
|
135
|
-
return qs;
|
|
136
|
-
};
|
|
137
|
-
Event.prototype.save = function (params, callback) {
|
|
138
|
-
if (params === void 0) { params = {}; }
|
|
139
|
-
this.validate();
|
|
140
|
-
return _super.prototype.save.call(this, params, callback);
|
|
141
|
-
};
|
|
142
|
-
Event.prototype.saveRequestBody = function () {
|
|
143
|
-
var json = _super.prototype.saveRequestBody.call(this);
|
|
144
|
-
if (!this.notifications) {
|
|
145
|
-
delete json.notifications;
|
|
146
|
-
}
|
|
147
|
-
// Participant status cannot be updated
|
|
148
|
-
if (this.id && json.participants) {
|
|
149
|
-
json.participants.forEach(function (participant) { return delete participant.status; });
|
|
150
|
-
}
|
|
151
|
-
return json;
|
|
152
|
-
};
|
|
153
|
-
Event.prototype.rsvp = function (status, comment, callback) {
|
|
154
|
-
var _this = this;
|
|
155
|
-
return this.connection
|
|
156
|
-
.request({
|
|
157
|
-
method: 'POST',
|
|
158
|
-
body: { event_id: this.id, status: status, comment: comment },
|
|
159
|
-
path: '/send-rsvp',
|
|
160
|
-
})
|
|
161
|
-
.then(function (json) {
|
|
162
|
-
_this.fromJSON(json);
|
|
163
|
-
if (callback) {
|
|
164
|
-
callback(null, _this);
|
|
165
|
-
}
|
|
166
|
-
return Promise.resolve(_this);
|
|
167
|
-
})
|
|
168
|
-
.catch(function (err) {
|
|
169
|
-
if (callback) {
|
|
170
|
-
callback(err);
|
|
171
|
-
}
|
|
172
|
-
return Promise.reject(err);
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
Event.prototype.generateICS = function (options) {
|
|
176
|
-
if (this.calendarId == '' || !this.when.isSet()) {
|
|
177
|
-
throw new Error('Cannot generate an ICS file for an event without a Calendar ID or when set');
|
|
178
|
-
}
|
|
179
|
-
var optionsPayload = {};
|
|
180
|
-
if (options) {
|
|
181
|
-
optionsPayload = {
|
|
182
|
-
ical_uid: options.iCalUID,
|
|
183
|
-
prodid: options.prodId,
|
|
184
|
-
method: options.method,
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
return this.connection
|
|
188
|
-
.request({
|
|
189
|
-
method: 'POST',
|
|
190
|
-
body: __assign(__assign({}, this.saveRequestBody()), { ics_options: optionsPayload }),
|
|
191
|
-
path: '/events/to-ics',
|
|
192
|
-
})
|
|
193
|
-
.then(function (response) {
|
|
194
|
-
if (!response.ics) {
|
|
195
|
-
throw new Error("Unexpected response from the API server. Returned 200 but no 'ics' string found.");
|
|
196
|
-
}
|
|
197
|
-
return response.ics;
|
|
198
|
-
});
|
|
199
|
-
};
|
|
200
|
-
Event.prototype.validate = function () {
|
|
201
|
-
if (this.conferencing &&
|
|
202
|
-
this.conferencing.details &&
|
|
203
|
-
this.conferencing.autocreate) {
|
|
204
|
-
throw new Error("Cannot set both 'details' and 'autocreate' in conferencing object.");
|
|
205
|
-
}
|
|
206
|
-
if (this.capacity &&
|
|
207
|
-
this.capacity != -1 &&
|
|
208
|
-
this.participants &&
|
|
209
|
-
this.participants.length > this.capacity) {
|
|
210
|
-
throw new Error('The number of participants in the event exceeds the set capacity.');
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
Event.collectionName = 'events';
|
|
214
|
-
Event.attributes = __assign(__assign({}, restful_model_1.default.attributes), { calendarId: attributes_1.default.String({
|
|
215
|
-
modelKey: 'calendarId',
|
|
216
|
-
jsonKey: 'calendar_id',
|
|
217
|
-
}), iCalUID: attributes_1.default.String({
|
|
218
|
-
modelKey: 'iCalUID',
|
|
219
|
-
jsonKey: 'ical_uid',
|
|
220
|
-
readOnly: true,
|
|
221
|
-
}), messageId: attributes_1.default.String({
|
|
222
|
-
modelKey: 'messageId',
|
|
223
|
-
jsonKey: 'message_id',
|
|
224
|
-
readOnly: true,
|
|
225
|
-
}), eventCollectionId: attributes_1.default.String({
|
|
226
|
-
modelKey: 'eventCollectionId',
|
|
227
|
-
jsonKey: 'event_collection_id',
|
|
228
|
-
}), title: attributes_1.default.String({
|
|
229
|
-
modelKey: 'title',
|
|
230
|
-
}), description: attributes_1.default.String({
|
|
231
|
-
modelKey: 'description',
|
|
232
|
-
}), owner: attributes_1.default.String({
|
|
233
|
-
modelKey: 'owner',
|
|
234
|
-
readOnly: true,
|
|
235
|
-
}), participants: attributes_1.default.Collection({
|
|
236
|
-
modelKey: 'participants',
|
|
237
|
-
itemClass: event_participant_1.default,
|
|
238
|
-
}), readOnly: attributes_1.default.Boolean({
|
|
239
|
-
modelKey: 'readOnly',
|
|
240
|
-
jsonKey: 'read_only',
|
|
241
|
-
}), location: attributes_1.default.String({
|
|
242
|
-
modelKey: 'location',
|
|
243
|
-
}), when: attributes_1.default.Object({
|
|
244
|
-
modelKey: 'when',
|
|
245
|
-
itemClass: when_1.default,
|
|
246
|
-
}), busy: attributes_1.default.Boolean({
|
|
247
|
-
modelKey: 'busy',
|
|
248
|
-
}), status: attributes_1.default.String({
|
|
249
|
-
modelKey: 'status',
|
|
250
|
-
readOnly: true,
|
|
251
|
-
}), recurrence: attributes_1.default.Object({
|
|
252
|
-
modelKey: 'recurrence',
|
|
253
|
-
}), masterEventId: attributes_1.default.String({
|
|
254
|
-
modelKey: 'masterEventId',
|
|
255
|
-
jsonKey: 'master_event_id',
|
|
256
|
-
readOnly: true,
|
|
257
|
-
}), originalStartTime: attributes_1.default.DateTime({
|
|
258
|
-
modelKey: 'originalStartTime',
|
|
259
|
-
jsonKey: 'original_start_time',
|
|
260
|
-
readOnly: true,
|
|
261
|
-
}), capacity: attributes_1.default.Number({
|
|
262
|
-
modelKey: 'capacity',
|
|
263
|
-
}), conferencing: attributes_1.default.Object({
|
|
264
|
-
modelKey: 'conferencing',
|
|
265
|
-
itemClass: event_conferencing_1.default,
|
|
266
|
-
}), reminderMinutes: attributes_1.default.String({
|
|
267
|
-
modelKey: 'reminderMinutes',
|
|
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,
|
|
277
|
-
}), notifications: attributes_1.default.Collection({
|
|
278
|
-
modelKey: 'notifications',
|
|
279
|
-
itemClass: event_notification_1.default,
|
|
280
|
-
}), roundRobinOrder: attributes_1.default.StringList({
|
|
281
|
-
modelKey: 'roundRobinOrder',
|
|
282
|
-
jsonKey: 'round_robin_order',
|
|
283
|
-
}), metadata: attributes_1.default.Object({
|
|
284
|
-
modelKey: 'metadata',
|
|
285
|
-
}), jobStatusId: attributes_1.default.String({
|
|
286
|
-
modelKey: 'jobStatusId',
|
|
287
|
-
jsonKey: 'job_status_id',
|
|
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
|
-
}), hideParticipants: attributes_1.default.Boolean({
|
|
298
|
-
modelKey: 'hideParticipants',
|
|
299
|
-
jsonKey: 'hide_participants',
|
|
300
|
-
}), visibility: attributes_1.default.String({
|
|
301
|
-
modelKey: 'visibility',
|
|
302
|
-
}), customerEventId: attributes_1.default.String({
|
|
303
|
-
modelKey: 'customerEventId',
|
|
304
|
-
jsonKey: 'customer_event_id',
|
|
305
|
-
}) });
|
|
306
|
-
return Event;
|
|
307
|
-
}(restful_model_1.default));
|
|
308
|
-
exports.default = Event;
|
package/lib/models/file.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attributes';
|
|
2
|
-
import RestfulModel from './restful-model';
|
|
3
|
-
import NylasConnection from '../nylas-connection';
|
|
4
|
-
export declare type FileProperties = {
|
|
5
|
-
contentType?: string;
|
|
6
|
-
size?: number;
|
|
7
|
-
filename?: string;
|
|
8
|
-
messageIds?: string[];
|
|
9
|
-
contentId?: string;
|
|
10
|
-
contentDisposition?: string;
|
|
11
|
-
data?: unknown;
|
|
12
|
-
};
|
|
13
|
-
export default class File extends RestfulModel implements FileProperties {
|
|
14
|
-
contentType?: string;
|
|
15
|
-
size?: number;
|
|
16
|
-
filename?: string;
|
|
17
|
-
messageIds?: string[];
|
|
18
|
-
contentId?: string;
|
|
19
|
-
contentDisposition?: string;
|
|
20
|
-
data?: unknown;
|
|
21
|
-
static collectionName: string;
|
|
22
|
-
static attributes: Record<string, Attribute>;
|
|
23
|
-
constructor(connection: NylasConnection, props?: FileProperties);
|
|
24
|
-
upload(callback?: (error: Error | null, model?: File) => void): Promise<File>;
|
|
25
|
-
download(callback?: (error: Error | null, file?: {
|
|
26
|
-
body: any;
|
|
27
|
-
[key: string]: any;
|
|
28
|
-
}) => void): Promise<any>;
|
|
29
|
-
}
|
package/lib/models/file.js
DELETED
|
@@ -1,136 +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 attributes_1 = __importDefault(require("./attributes"));
|
|
31
|
-
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
32
|
-
var File = /** @class */ (function (_super) {
|
|
33
|
-
__extends(File, _super);
|
|
34
|
-
function File(connection, props) {
|
|
35
|
-
var _this = _super.call(this, connection, props) || this;
|
|
36
|
-
_this.initAttributes(props);
|
|
37
|
-
return _this;
|
|
38
|
-
}
|
|
39
|
-
File.prototype.upload = function (callback) {
|
|
40
|
-
var _this = this;
|
|
41
|
-
if (!this.filename) {
|
|
42
|
-
throw new Error('Please define a filename');
|
|
43
|
-
}
|
|
44
|
-
if (!this.data) {
|
|
45
|
-
throw new Error('Please add some data to the file');
|
|
46
|
-
}
|
|
47
|
-
if (!this.contentType) {
|
|
48
|
-
throw new Error('Please define a content-type');
|
|
49
|
-
}
|
|
50
|
-
var formOptions = {
|
|
51
|
-
filename: this.filename,
|
|
52
|
-
contentType: this.contentType,
|
|
53
|
-
};
|
|
54
|
-
if (this.size) {
|
|
55
|
-
formOptions.knownLength = this.size;
|
|
56
|
-
}
|
|
57
|
-
return this.connection
|
|
58
|
-
.request({
|
|
59
|
-
method: 'POST',
|
|
60
|
-
path: "/" + File.collectionName,
|
|
61
|
-
json: true,
|
|
62
|
-
formData: {
|
|
63
|
-
file: {
|
|
64
|
-
value: this.data,
|
|
65
|
-
options: formOptions,
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
})
|
|
69
|
-
.then(function (json) {
|
|
70
|
-
// The API returns a list of files. It should
|
|
71
|
-
// always have a length of 1 since we only
|
|
72
|
-
// upload file-by-file.
|
|
73
|
-
if (json.length > 0) {
|
|
74
|
-
_this.fromJSON(json[0]);
|
|
75
|
-
if (callback) {
|
|
76
|
-
callback(null, _this);
|
|
77
|
-
}
|
|
78
|
-
return Promise.resolve(_this);
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
return Promise.reject(null);
|
|
82
|
-
}
|
|
83
|
-
})
|
|
84
|
-
.catch(function (err) {
|
|
85
|
-
if (callback) {
|
|
86
|
-
callback(err);
|
|
87
|
-
}
|
|
88
|
-
return Promise.reject(err);
|
|
89
|
-
});
|
|
90
|
-
};
|
|
91
|
-
File.prototype.download = function (callback) {
|
|
92
|
-
if (!this.id) {
|
|
93
|
-
throw new Error('Please provide a File id');
|
|
94
|
-
}
|
|
95
|
-
return this.connection
|
|
96
|
-
.request({
|
|
97
|
-
path: "/files/" + this.id + "/download",
|
|
98
|
-
downloadRequest: true,
|
|
99
|
-
})
|
|
100
|
-
.then(function (file) {
|
|
101
|
-
if (callback) {
|
|
102
|
-
callback(null, file);
|
|
103
|
-
}
|
|
104
|
-
return Promise.resolve(file);
|
|
105
|
-
})
|
|
106
|
-
.catch(function (err) {
|
|
107
|
-
if (callback) {
|
|
108
|
-
callback(err);
|
|
109
|
-
}
|
|
110
|
-
return Promise.reject(err);
|
|
111
|
-
});
|
|
112
|
-
};
|
|
113
|
-
File.collectionName = 'files';
|
|
114
|
-
File.attributes = __assign(__assign({}, restful_model_1.default.attributes), { contentType: attributes_1.default.String({
|
|
115
|
-
modelKey: 'contentType',
|
|
116
|
-
jsonKey: 'content_type',
|
|
117
|
-
}), size: attributes_1.default.Number({
|
|
118
|
-
modelKey: 'size',
|
|
119
|
-
}), filename: attributes_1.default.String({
|
|
120
|
-
modelKey: 'filename',
|
|
121
|
-
}), messageIds: attributes_1.default.StringList({
|
|
122
|
-
modelKey: 'messageIds',
|
|
123
|
-
jsonKey: 'message_ids',
|
|
124
|
-
}), contentId: attributes_1.default.String({
|
|
125
|
-
modelKey: 'contentId',
|
|
126
|
-
jsonKey: 'content_id',
|
|
127
|
-
}), contentDisposition: attributes_1.default.String({
|
|
128
|
-
modelKey: 'contentDisposition',
|
|
129
|
-
jsonKey: 'content_disposition',
|
|
130
|
-
}), data: attributes_1.default.Object({
|
|
131
|
-
modelKey: 'data',
|
|
132
|
-
readOnly: true,
|
|
133
|
-
}) });
|
|
134
|
-
return File;
|
|
135
|
-
}(restful_model_1.default));
|
|
136
|
-
exports.default = File;
|
package/lib/models/folder.d.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import RestfulModel, { SaveCallback } from './restful-model';
|
|
2
|
-
import { Attribute } from './attributes';
|
|
3
|
-
import NylasConnection from '../nylas-connection';
|
|
4
|
-
export declare type FolderProperties = {
|
|
5
|
-
displayName?: string;
|
|
6
|
-
name?: string;
|
|
7
|
-
};
|
|
8
|
-
export default class Folder extends RestfulModel implements FolderProperties {
|
|
9
|
-
displayName?: string;
|
|
10
|
-
name?: string;
|
|
11
|
-
jobStatusId?: string;
|
|
12
|
-
static collectionName: string;
|
|
13
|
-
static attributes: Record<string, Attribute>;
|
|
14
|
-
constructor(connection: NylasConnection, props?: FolderProperties);
|
|
15
|
-
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
16
|
-
}
|
|
17
|
-
export declare class Label extends Folder {
|
|
18
|
-
static collectionName: string;
|
|
19
|
-
constructor(connection: NylasConnection, props?: FolderProperties);
|
|
20
|
-
saveRequestBody(): Record<string, any>;
|
|
21
|
-
}
|
package/lib/models/folder.js
DELETED
|
@@ -1,69 +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 Folder = /** @class */ (function (_super) {
|
|
33
|
-
__extends(Folder, _super);
|
|
34
|
-
function Folder(connection, props) {
|
|
35
|
-
var _this = _super.call(this, connection, props) || this;
|
|
36
|
-
_this.initAttributes(props);
|
|
37
|
-
return _this;
|
|
38
|
-
}
|
|
39
|
-
Folder.prototype.save = function (params, callback) {
|
|
40
|
-
if (params === void 0) { params = {}; }
|
|
41
|
-
return _super.prototype.save.call(this, params, callback);
|
|
42
|
-
};
|
|
43
|
-
Folder.collectionName = 'folders';
|
|
44
|
-
Folder.attributes = __assign(__assign({}, restful_model_1.default.attributes), { name: attributes_1.default.String({
|
|
45
|
-
modelKey: 'name',
|
|
46
|
-
jsonKey: 'name',
|
|
47
|
-
}), displayName: attributes_1.default.String({
|
|
48
|
-
modelKey: 'displayName',
|
|
49
|
-
jsonKey: 'display_name',
|
|
50
|
-
}), jobStatusId: attributes_1.default.String({
|
|
51
|
-
modelKey: 'jobStatusId',
|
|
52
|
-
jsonKey: 'job_status_id',
|
|
53
|
-
readOnly: true,
|
|
54
|
-
}) });
|
|
55
|
-
return Folder;
|
|
56
|
-
}(restful_model_1.default));
|
|
57
|
-
exports.default = Folder;
|
|
58
|
-
var Label = /** @class */ (function (_super) {
|
|
59
|
-
__extends(Label, _super);
|
|
60
|
-
function Label(connection, props) {
|
|
61
|
-
return _super.call(this, connection, props) || this;
|
|
62
|
-
}
|
|
63
|
-
Label.prototype.saveRequestBody = function () {
|
|
64
|
-
return { display_name: this.displayName };
|
|
65
|
-
};
|
|
66
|
-
Label.collectionName = 'labels';
|
|
67
|
-
return Label;
|
|
68
|
-
}(Folder));
|
|
69
|
-
exports.Label = Label;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import Model from './model';
|
|
2
|
-
import { Attribute } from './attributes';
|
|
3
|
-
export declare type FreeBusyQuery = {
|
|
4
|
-
startTime: number;
|
|
5
|
-
endTime: number;
|
|
6
|
-
emails?: string[];
|
|
7
|
-
calendars?: FreeBusyCalendarProperties[];
|
|
8
|
-
};
|
|
9
|
-
export declare type FreeBusyCalendarProperties = {
|
|
10
|
-
accountId: string;
|
|
11
|
-
calendarIds: string[];
|
|
12
|
-
};
|
|
13
|
-
export declare class FreeBusyCalendar extends Model implements FreeBusyCalendarProperties {
|
|
14
|
-
accountId: string;
|
|
15
|
-
calendarIds: string[];
|
|
16
|
-
static attributes: Record<string, Attribute>;
|
|
17
|
-
constructor(props?: FreeBusyCalendarProperties);
|
|
18
|
-
}
|
|
19
|
-
export declare type TimeSlotCapacityProperties = {
|
|
20
|
-
eventId: string;
|
|
21
|
-
currentCapacity: number;
|
|
22
|
-
maxCapacity: number;
|
|
23
|
-
};
|
|
24
|
-
export declare class TimeSlotCapacity extends Model implements TimeSlotCapacityProperties {
|
|
25
|
-
eventId: string;
|
|
26
|
-
currentCapacity: number;
|
|
27
|
-
maxCapacity: number;
|
|
28
|
-
static attributes: Record<string, Attribute>;
|
|
29
|
-
constructor(props?: TimeSlotCapacityProperties);
|
|
30
|
-
}
|
|
31
|
-
export declare type TimeSlotProperties = {
|
|
32
|
-
status: string;
|
|
33
|
-
startTime: number;
|
|
34
|
-
endTime: number;
|
|
35
|
-
emails?: string[];
|
|
36
|
-
capacity?: TimeSlotCapacityProperties;
|
|
37
|
-
};
|
|
38
|
-
export declare class TimeSlot extends Model implements TimeSlotProperties {
|
|
39
|
-
object: string;
|
|
40
|
-
status: string;
|
|
41
|
-
startTime: number;
|
|
42
|
-
endTime: number;
|
|
43
|
-
emails?: string[];
|
|
44
|
-
capacity?: TimeSlotCapacity;
|
|
45
|
-
static attributes: Record<string, Attribute>;
|
|
46
|
-
constructor(props?: TimeSlotProperties);
|
|
47
|
-
}
|
|
48
|
-
export declare type FreeBusyProperties = {
|
|
49
|
-
email: string;
|
|
50
|
-
timeSlots: TimeSlotProperties[];
|
|
51
|
-
};
|
|
52
|
-
export default class FreeBusy extends Model implements FreeBusyProperties {
|
|
53
|
-
object: string;
|
|
54
|
-
email: string;
|
|
55
|
-
timeSlots: TimeSlot[];
|
|
56
|
-
static attributes: Record<string, Attribute>;
|
|
57
|
-
constructor(props?: FreeBusyProperties);
|
|
58
|
-
}
|