nylas 7.0.0-beta.0 → 7.0.0-beta.2
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 +27 -19
- package/lib/cjs/apiClient.js +114 -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/package.json +3 -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/cjs/version.js +5 -0
- package/lib/esm/apiClient.js +111 -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/package.json +3 -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/esm/version.js +2 -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/lib/types/version.d.ts +1 -0
- package/package.json +33 -42
- package/lib/config.d.ts +0 -70
- package/lib/config.js +0 -68
- 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 -31
- package/lib/models/calendar.js +0 -93
- 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.d.ts +0 -96
- package/lib/models/event.js +0 -297
- 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 -61
- 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/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 -108
- package/lib/models/webhook-notification.js +0 -239
- package/lib/models/webhook.d.ts +0 -50
- package/lib/models/webhook.js +0 -101
- package/lib/models/when.d.ts +0 -23
- package/lib/models/when.js +0 -65
- package/lib/nylas-connection.d.ts +0 -71
- package/lib/nylas-connection.js +0 -258
- package/lib/nylas.d.ts +0 -57
- package/lib/nylas.js +0 -210
- package/lib/server-bindings/express-binding.d.ts +0 -18
- package/lib/server-bindings/express-binding.js +0 -163
- package/lib/server-bindings/server-binding.d.ts +0 -65
- package/lib/server-bindings/server-binding.js +0 -87
- package/lib/services/routes.d.ts +0 -26
- package/lib/services/routes.js +0 -95
- package/lib/services/tunnel.d.ts +0 -29
- package/lib/services/tunnel.js +0 -112
package/lib/models/contact.js
DELETED
|
@@ -1,289 +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 EmailAddress = /** @class */ (function (_super) {
|
|
34
|
-
__extends(EmailAddress, _super);
|
|
35
|
-
function EmailAddress(props) {
|
|
36
|
-
var _this = _super.call(this) || this;
|
|
37
|
-
_this.type = '';
|
|
38
|
-
_this.email = '';
|
|
39
|
-
_this.initAttributes(props);
|
|
40
|
-
return _this;
|
|
41
|
-
}
|
|
42
|
-
EmailAddress.attributes = {
|
|
43
|
-
type: attributes_1.default.String({
|
|
44
|
-
modelKey: 'type',
|
|
45
|
-
}),
|
|
46
|
-
email: attributes_1.default.String({
|
|
47
|
-
modelKey: 'email',
|
|
48
|
-
}),
|
|
49
|
-
};
|
|
50
|
-
return EmailAddress;
|
|
51
|
-
}(model_1.default));
|
|
52
|
-
exports.EmailAddress = EmailAddress;
|
|
53
|
-
var IMAddress = /** @class */ (function (_super) {
|
|
54
|
-
__extends(IMAddress, _super);
|
|
55
|
-
function IMAddress(props) {
|
|
56
|
-
var _this = _super.call(this) || this;
|
|
57
|
-
_this.type = '';
|
|
58
|
-
_this.imAddress = '';
|
|
59
|
-
_this.initAttributes(props);
|
|
60
|
-
return _this;
|
|
61
|
-
}
|
|
62
|
-
IMAddress.attributes = {
|
|
63
|
-
type: attributes_1.default.String({
|
|
64
|
-
modelKey: 'type',
|
|
65
|
-
}),
|
|
66
|
-
imAddress: attributes_1.default.String({
|
|
67
|
-
modelKey: 'imAddress',
|
|
68
|
-
jsonKey: 'im_address',
|
|
69
|
-
}),
|
|
70
|
-
};
|
|
71
|
-
return IMAddress;
|
|
72
|
-
}(model_1.default));
|
|
73
|
-
exports.IMAddress = IMAddress;
|
|
74
|
-
var PhysicalAddress = /** @class */ (function (_super) {
|
|
75
|
-
__extends(PhysicalAddress, _super);
|
|
76
|
-
function PhysicalAddress(props) {
|
|
77
|
-
var _this = _super.call(this) || this;
|
|
78
|
-
_this.type = '';
|
|
79
|
-
_this.format = '';
|
|
80
|
-
_this.streetAddress = '';
|
|
81
|
-
_this.city = '';
|
|
82
|
-
_this.postalCode = '';
|
|
83
|
-
_this.state = '';
|
|
84
|
-
_this.country = '';
|
|
85
|
-
_this.address = '';
|
|
86
|
-
_this.initAttributes(props);
|
|
87
|
-
return _this;
|
|
88
|
-
}
|
|
89
|
-
PhysicalAddress.prototype.toJSON = function () {
|
|
90
|
-
var json = {
|
|
91
|
-
type: this.type,
|
|
92
|
-
format: this.format,
|
|
93
|
-
};
|
|
94
|
-
if (this.format == 'unstructured') {
|
|
95
|
-
json.address = this.address;
|
|
96
|
-
}
|
|
97
|
-
else {
|
|
98
|
-
json.street_address = this.streetAddress;
|
|
99
|
-
json.postal_code = this.postalCode;
|
|
100
|
-
json.state = this.state;
|
|
101
|
-
json.city = this.city;
|
|
102
|
-
json.country = this.country;
|
|
103
|
-
}
|
|
104
|
-
return json;
|
|
105
|
-
};
|
|
106
|
-
PhysicalAddress.attributes = {
|
|
107
|
-
type: attributes_1.default.String({
|
|
108
|
-
modelKey: 'type',
|
|
109
|
-
}),
|
|
110
|
-
format: attributes_1.default.String({
|
|
111
|
-
modelKey: 'format',
|
|
112
|
-
}),
|
|
113
|
-
address: attributes_1.default.String({
|
|
114
|
-
modelKey: 'address',
|
|
115
|
-
}),
|
|
116
|
-
streetAddress: attributes_1.default.String({
|
|
117
|
-
modelKey: 'streetAddress',
|
|
118
|
-
jsonKey: 'street_address',
|
|
119
|
-
}),
|
|
120
|
-
city: attributes_1.default.String({
|
|
121
|
-
modelKey: 'city',
|
|
122
|
-
}),
|
|
123
|
-
postalCode: attributes_1.default.String({
|
|
124
|
-
modelKey: 'postalCode',
|
|
125
|
-
jsonKey: 'postal_code',
|
|
126
|
-
}),
|
|
127
|
-
state: attributes_1.default.String({
|
|
128
|
-
modelKey: 'state',
|
|
129
|
-
}),
|
|
130
|
-
country: attributes_1.default.String({
|
|
131
|
-
modelKey: 'country',
|
|
132
|
-
}),
|
|
133
|
-
};
|
|
134
|
-
return PhysicalAddress;
|
|
135
|
-
}(model_1.default));
|
|
136
|
-
exports.PhysicalAddress = PhysicalAddress;
|
|
137
|
-
var PhoneNumber = /** @class */ (function (_super) {
|
|
138
|
-
__extends(PhoneNumber, _super);
|
|
139
|
-
function PhoneNumber(props) {
|
|
140
|
-
var _this = _super.call(this) || this;
|
|
141
|
-
_this.type = '';
|
|
142
|
-
_this.number = '';
|
|
143
|
-
_this.initAttributes(props);
|
|
144
|
-
return _this;
|
|
145
|
-
}
|
|
146
|
-
PhoneNumber.attributes = {
|
|
147
|
-
type: attributes_1.default.String({
|
|
148
|
-
modelKey: 'type',
|
|
149
|
-
}),
|
|
150
|
-
number: attributes_1.default.String({
|
|
151
|
-
modelKey: 'number',
|
|
152
|
-
}),
|
|
153
|
-
};
|
|
154
|
-
return PhoneNumber;
|
|
155
|
-
}(model_1.default));
|
|
156
|
-
exports.PhoneNumber = PhoneNumber;
|
|
157
|
-
var WebPage = /** @class */ (function (_super) {
|
|
158
|
-
__extends(WebPage, _super);
|
|
159
|
-
function WebPage(props) {
|
|
160
|
-
var _this = _super.call(this) || this;
|
|
161
|
-
_this.type = '';
|
|
162
|
-
_this.url = '';
|
|
163
|
-
_this.initAttributes(props);
|
|
164
|
-
return _this;
|
|
165
|
-
}
|
|
166
|
-
WebPage.attributes = {
|
|
167
|
-
type: attributes_1.default.String({
|
|
168
|
-
modelKey: 'type',
|
|
169
|
-
}),
|
|
170
|
-
url: attributes_1.default.String({
|
|
171
|
-
modelKey: 'url',
|
|
172
|
-
}),
|
|
173
|
-
};
|
|
174
|
-
return WebPage;
|
|
175
|
-
}(model_1.default));
|
|
176
|
-
exports.WebPage = WebPage;
|
|
177
|
-
var Group = /** @class */ (function (_super) {
|
|
178
|
-
__extends(Group, _super);
|
|
179
|
-
function Group(props) {
|
|
180
|
-
var _this = _super.call(this) || this;
|
|
181
|
-
_this.name = '';
|
|
182
|
-
_this.path = '';
|
|
183
|
-
_this.initAttributes(props);
|
|
184
|
-
return _this;
|
|
185
|
-
}
|
|
186
|
-
Group.attributes = {
|
|
187
|
-
name: attributes_1.default.String({
|
|
188
|
-
modelKey: 'name',
|
|
189
|
-
}),
|
|
190
|
-
path: attributes_1.default.String({
|
|
191
|
-
modelKey: 'path',
|
|
192
|
-
}),
|
|
193
|
-
id: attributes_1.default.String({
|
|
194
|
-
modelKey: 'id',
|
|
195
|
-
readOnly: true,
|
|
196
|
-
}),
|
|
197
|
-
object: attributes_1.default.String({
|
|
198
|
-
modelKey: 'object',
|
|
199
|
-
readOnly: true,
|
|
200
|
-
}),
|
|
201
|
-
accountId: attributes_1.default.String({
|
|
202
|
-
modelKey: 'accountId',
|
|
203
|
-
jsonKey: 'account_id',
|
|
204
|
-
readOnly: true,
|
|
205
|
-
}),
|
|
206
|
-
};
|
|
207
|
-
return Group;
|
|
208
|
-
}(model_1.default));
|
|
209
|
-
exports.Group = Group;
|
|
210
|
-
var Contact = /** @class */ (function (_super) {
|
|
211
|
-
__extends(Contact, _super);
|
|
212
|
-
function Contact(connection, props) {
|
|
213
|
-
var _this = _super.call(this, connection) || this;
|
|
214
|
-
_this.initAttributes(props);
|
|
215
|
-
return _this;
|
|
216
|
-
}
|
|
217
|
-
Contact.prototype.getPicture = function (params, callback) {
|
|
218
|
-
if (params === void 0) { params = {}; }
|
|
219
|
-
return this.get(params, callback, '/picture');
|
|
220
|
-
};
|
|
221
|
-
Contact.prototype.save = function (params, callback) {
|
|
222
|
-
if (params === void 0) { params = {}; }
|
|
223
|
-
return _super.prototype.save.call(this, params, callback);
|
|
224
|
-
};
|
|
225
|
-
Contact.collectionName = 'contacts';
|
|
226
|
-
Contact.attributes = __assign(__assign({}, restful_model_1.default.attributes), { givenName: attributes_1.default.String({
|
|
227
|
-
modelKey: 'givenName',
|
|
228
|
-
jsonKey: 'given_name',
|
|
229
|
-
}), middleName: attributes_1.default.String({
|
|
230
|
-
modelKey: 'middleName',
|
|
231
|
-
jsonKey: 'middle_name',
|
|
232
|
-
}), surname: attributes_1.default.String({
|
|
233
|
-
modelKey: 'surname',
|
|
234
|
-
}), suffix: attributes_1.default.String({
|
|
235
|
-
modelKey: 'suffix',
|
|
236
|
-
}), nickname: attributes_1.default.String({
|
|
237
|
-
modelKey: 'nickname',
|
|
238
|
-
}), birthday: attributes_1.default.String({
|
|
239
|
-
modelKey: 'birthday',
|
|
240
|
-
}), companyName: attributes_1.default.String({
|
|
241
|
-
modelKey: 'companyName',
|
|
242
|
-
jsonKey: 'company_name',
|
|
243
|
-
}), jobTitle: attributes_1.default.String({
|
|
244
|
-
modelKey: 'jobTitle',
|
|
245
|
-
jsonKey: 'job_title',
|
|
246
|
-
}), managerName: attributes_1.default.String({
|
|
247
|
-
modelKey: 'managerName',
|
|
248
|
-
jsonKey: 'manager_name',
|
|
249
|
-
}), officeLocation: attributes_1.default.String({
|
|
250
|
-
modelKey: 'officeLocation',
|
|
251
|
-
jsonKey: 'office_location',
|
|
252
|
-
}), notes: attributes_1.default.String({
|
|
253
|
-
modelKey: 'notes',
|
|
254
|
-
}), pictureUrl: attributes_1.default.String({
|
|
255
|
-
modelKey: 'pictureUrl',
|
|
256
|
-
jsonKey: 'picture_url',
|
|
257
|
-
}), emailAddresses: attributes_1.default.Collection({
|
|
258
|
-
modelKey: 'emailAddresses',
|
|
259
|
-
jsonKey: 'emails',
|
|
260
|
-
itemClass: EmailAddress,
|
|
261
|
-
}), imAddresses: attributes_1.default.Collection({
|
|
262
|
-
modelKey: 'imAddresses',
|
|
263
|
-
jsonKey: 'im_addresses',
|
|
264
|
-
itemClass: IMAddress,
|
|
265
|
-
}), physicalAddresses: attributes_1.default.Collection({
|
|
266
|
-
modelKey: 'physicalAddresses',
|
|
267
|
-
jsonKey: 'physical_addresses',
|
|
268
|
-
itemClass: PhysicalAddress,
|
|
269
|
-
}), phoneNumbers: attributes_1.default.Collection({
|
|
270
|
-
modelKey: 'phoneNumbers',
|
|
271
|
-
jsonKey: 'phone_numbers',
|
|
272
|
-
itemClass: PhoneNumber,
|
|
273
|
-
}), webPages: attributes_1.default.Collection({
|
|
274
|
-
modelKey: 'webPages',
|
|
275
|
-
jsonKey: 'web_pages',
|
|
276
|
-
itemClass: WebPage,
|
|
277
|
-
}), groups: attributes_1.default.Collection({
|
|
278
|
-
modelKey: 'groups',
|
|
279
|
-
itemClass: Group,
|
|
280
|
-
}), source: attributes_1.default.String({
|
|
281
|
-
modelKey: 'source',
|
|
282
|
-
}), jobStatusId: attributes_1.default.String({
|
|
283
|
-
modelKey: 'jobStatusId',
|
|
284
|
-
jsonKey: 'job_status_id',
|
|
285
|
-
readOnly: true,
|
|
286
|
-
}) });
|
|
287
|
-
return Contact;
|
|
288
|
-
}(restful_model_1.default));
|
|
289
|
-
exports.default = Contact;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import NylasConnection from '../nylas-connection';
|
|
2
|
-
import DeltaStream, { DeltaLongPoll } from './delta-stream';
|
|
3
|
-
import { DeltaParams } from './delta';
|
|
4
|
-
import { Deltas } from './deltas';
|
|
5
|
-
export declare type LatestCursor = {
|
|
6
|
-
cursor: string;
|
|
7
|
-
};
|
|
8
|
-
export default class DeltaCollection {
|
|
9
|
-
connection: NylasConnection;
|
|
10
|
-
private path;
|
|
11
|
-
constructor(connection: NylasConnection);
|
|
12
|
-
latestCursor(callback: (error: Error | null, cursor: string | null) => void): Promise<string>;
|
|
13
|
-
since(cursor: string, params?: DeltaParams): Promise<Deltas>;
|
|
14
|
-
longPoll(cursor: string, timeout: number, params?: DeltaParams): Promise<DeltaLongPoll>;
|
|
15
|
-
startStream(cursor: string, params?: Record<string, unknown>): Promise<DeltaStream>;
|
|
16
|
-
private buildDeltaParams;
|
|
17
|
-
}
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __assign = (this && this.__assign) || function () {
|
|
3
|
-
__assign = Object.assign || function(t) {
|
|
4
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
-
s = arguments[i];
|
|
6
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
-
t[p] = s[p];
|
|
8
|
-
}
|
|
9
|
-
return t;
|
|
10
|
-
};
|
|
11
|
-
return __assign.apply(this, arguments);
|
|
12
|
-
};
|
|
13
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
14
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
15
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
16
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
17
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
18
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
19
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
20
|
-
});
|
|
21
|
-
};
|
|
22
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
23
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
24
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
25
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
26
|
-
function step(op) {
|
|
27
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
28
|
-
while (_) try {
|
|
29
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
30
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
31
|
-
switch (op[0]) {
|
|
32
|
-
case 0: case 1: t = op; break;
|
|
33
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
34
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
35
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
36
|
-
default:
|
|
37
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
38
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
39
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
40
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
41
|
-
if (t[2]) _.ops.pop();
|
|
42
|
-
_.trys.pop(); continue;
|
|
43
|
-
}
|
|
44
|
-
op = body.call(thisArg, _);
|
|
45
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
46
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
47
|
-
}
|
|
48
|
-
};
|
|
49
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
50
|
-
if (mod && mod.__esModule) return mod;
|
|
51
|
-
var result = {};
|
|
52
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
53
|
-
result["default"] = mod;
|
|
54
|
-
return result;
|
|
55
|
-
};
|
|
56
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
57
|
-
var delta_stream_1 = __importStar(require("./delta-stream"));
|
|
58
|
-
var deltas_1 = require("./deltas");
|
|
59
|
-
var DeltaCollection = /** @class */ (function () {
|
|
60
|
-
function DeltaCollection(connection) {
|
|
61
|
-
this.path = '/delta';
|
|
62
|
-
this.connection = connection;
|
|
63
|
-
}
|
|
64
|
-
DeltaCollection.prototype.latestCursor = function (callback) {
|
|
65
|
-
var reqOpts = {
|
|
66
|
-
method: 'POST',
|
|
67
|
-
path: this.path + "/latest_cursor",
|
|
68
|
-
};
|
|
69
|
-
return this.connection
|
|
70
|
-
.request(reqOpts)
|
|
71
|
-
.then(function (response) {
|
|
72
|
-
if (callback) {
|
|
73
|
-
callback(null, response.cursor);
|
|
74
|
-
}
|
|
75
|
-
return Promise.resolve(response.cursor);
|
|
76
|
-
})
|
|
77
|
-
.catch(function (err) {
|
|
78
|
-
if (callback) {
|
|
79
|
-
callback(err, null);
|
|
80
|
-
}
|
|
81
|
-
return Promise.reject(err);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
DeltaCollection.prototype.since = function (cursor, params) {
|
|
85
|
-
var _this = this;
|
|
86
|
-
var queryParams = this.buildDeltaParams(params);
|
|
87
|
-
return this.connection
|
|
88
|
-
.request({
|
|
89
|
-
method: 'GET',
|
|
90
|
-
path: "" + this.path,
|
|
91
|
-
qs: __assign({ cursor: cursor }, queryParams),
|
|
92
|
-
})
|
|
93
|
-
.then(function (response) {
|
|
94
|
-
return Promise.resolve(new deltas_1.Deltas(_this.connection).fromJSON(response));
|
|
95
|
-
})
|
|
96
|
-
.catch(function (err) {
|
|
97
|
-
return Promise.reject(err);
|
|
98
|
-
});
|
|
99
|
-
};
|
|
100
|
-
DeltaCollection.prototype.longPoll = function (cursor, timeout, params) {
|
|
101
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
102
|
-
var queryParams, stream;
|
|
103
|
-
return __generator(this, function (_a) {
|
|
104
|
-
switch (_a.label) {
|
|
105
|
-
case 0:
|
|
106
|
-
queryParams = this.buildDeltaParams(params);
|
|
107
|
-
stream = new delta_stream_1.DeltaLongPoll(this.connection, cursor, timeout, queryParams);
|
|
108
|
-
return [4 /*yield*/, stream.open(true)];
|
|
109
|
-
case 1:
|
|
110
|
-
_a.sent();
|
|
111
|
-
return [2 /*return*/, stream];
|
|
112
|
-
}
|
|
113
|
-
});
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
DeltaCollection.prototype.startStream = function (cursor, params) {
|
|
117
|
-
if (params === void 0) { params = {}; }
|
|
118
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
119
|
-
var stream;
|
|
120
|
-
return __generator(this, function (_a) {
|
|
121
|
-
switch (_a.label) {
|
|
122
|
-
case 0:
|
|
123
|
-
stream = new delta_stream_1.default(this.connection, cursor, params);
|
|
124
|
-
return [4 /*yield*/, stream.open()];
|
|
125
|
-
case 1:
|
|
126
|
-
_a.sent();
|
|
127
|
-
return [2 /*return*/, stream];
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
DeltaCollection.prototype.buildDeltaParams = function (params) {
|
|
133
|
-
return __assign(__assign(__assign({}, ((params === null || params === void 0 ? void 0 : params.view) && { view: params.view })), ((params === null || params === void 0 ? void 0 : params.excludeTypes) && {
|
|
134
|
-
exclude_types: params.excludeTypes.join(),
|
|
135
|
-
})), ((params === null || params === void 0 ? void 0 : params.includeTypes) && { includeTypes: params.includeTypes.join() }));
|
|
136
|
-
};
|
|
137
|
-
return DeltaCollection;
|
|
138
|
-
}());
|
|
139
|
-
exports.default = DeltaCollection;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { EventEmitter } from 'events';
|
|
3
|
-
import NylasConnection from '../nylas-connection';
|
|
4
|
-
import { Request } from 'node-fetch';
|
|
5
|
-
import AbortController from 'abort-controller';
|
|
6
|
-
import backoff from 'backoff';
|
|
7
|
-
import Delta, { DeltaParams } from './delta';
|
|
8
|
-
import { Deltas } from './deltas';
|
|
9
|
-
export default class DeltaStream extends EventEmitter {
|
|
10
|
-
static MAX_RESTART_RETRIES: number;
|
|
11
|
-
connection: NylasConnection;
|
|
12
|
-
path: string;
|
|
13
|
-
modelClass: typeof Deltas | typeof Delta;
|
|
14
|
-
cursor?: string;
|
|
15
|
-
params: DeltaParams;
|
|
16
|
-
requestInfo?: {
|
|
17
|
-
request: Request;
|
|
18
|
-
controller: AbortController;
|
|
19
|
-
};
|
|
20
|
-
restartBackoff: backoff.Backoff;
|
|
21
|
-
timeoutId?: number;
|
|
22
|
-
constructor(connection: NylasConnection, cursor: string, params?: Record<string, unknown>);
|
|
23
|
-
close(): void;
|
|
24
|
-
open(emitAsModel?: boolean): Promise<void>;
|
|
25
|
-
protected onDataReceived(): void;
|
|
26
|
-
private onError;
|
|
27
|
-
private restartConnection;
|
|
28
|
-
}
|
|
29
|
-
export declare class DeltaLongPoll extends DeltaStream {
|
|
30
|
-
constructor(connection: NylasConnection, cursor: string, timeout: number, params?: Record<string, unknown>);
|
|
31
|
-
protected onDataReceived(): void;
|
|
32
|
-
}
|