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
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attributes';
|
|
2
|
-
import Model from './model';
|
|
3
|
-
export declare type EventConferencingDetailsProperties = {
|
|
4
|
-
meetingCode?: string;
|
|
5
|
-
phone?: string[];
|
|
6
|
-
password?: string;
|
|
7
|
-
pin?: string;
|
|
8
|
-
url?: string;
|
|
9
|
-
};
|
|
10
|
-
export declare class EventConferencingDetails extends Model implements EventConferencingDetailsProperties {
|
|
11
|
-
meetingCode?: string;
|
|
12
|
-
phone?: string[];
|
|
13
|
-
password?: string;
|
|
14
|
-
pin?: string;
|
|
15
|
-
url?: string;
|
|
16
|
-
static attributes: Record<string, Attribute>;
|
|
17
|
-
constructor(props?: EventConferencingProperties);
|
|
18
|
-
}
|
|
19
|
-
export declare type EventConferencingProperties = {
|
|
20
|
-
provider: string;
|
|
21
|
-
details?: EventConferencingDetailsProperties;
|
|
22
|
-
autocreate?: {
|
|
23
|
-
settings?: object;
|
|
24
|
-
};
|
|
25
|
-
};
|
|
26
|
-
export default class EventConferencing extends Model implements EventConferencingProperties {
|
|
27
|
-
provider: string;
|
|
28
|
-
details?: EventConferencingDetails;
|
|
29
|
-
autocreate?: {
|
|
30
|
-
settings?: Record<string, string>;
|
|
31
|
-
};
|
|
32
|
-
static attributes: Record<string, Attribute>;
|
|
33
|
-
constructor(props?: EventConferencingProperties);
|
|
34
|
-
}
|
|
@@ -1,71 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
20
|
-
var model_1 = __importDefault(require("./model"));
|
|
21
|
-
var EventConferencingDetails = /** @class */ (function (_super) {
|
|
22
|
-
__extends(EventConferencingDetails, _super);
|
|
23
|
-
function EventConferencingDetails(props) {
|
|
24
|
-
var _this = _super.call(this) || this;
|
|
25
|
-
_this.initAttributes(props);
|
|
26
|
-
return _this;
|
|
27
|
-
}
|
|
28
|
-
EventConferencingDetails.attributes = {
|
|
29
|
-
meetingCode: attributes_1.default.String({
|
|
30
|
-
modelKey: 'meetingCode',
|
|
31
|
-
jsonKey: 'meeting_code',
|
|
32
|
-
}),
|
|
33
|
-
phone: attributes_1.default.StringList({
|
|
34
|
-
modelKey: 'phone',
|
|
35
|
-
}),
|
|
36
|
-
password: attributes_1.default.String({
|
|
37
|
-
modelKey: 'password',
|
|
38
|
-
}),
|
|
39
|
-
pin: attributes_1.default.String({
|
|
40
|
-
modelKey: 'pin',
|
|
41
|
-
}),
|
|
42
|
-
url: attributes_1.default.String({
|
|
43
|
-
modelKey: 'url',
|
|
44
|
-
}),
|
|
45
|
-
};
|
|
46
|
-
return EventConferencingDetails;
|
|
47
|
-
}(model_1.default));
|
|
48
|
-
exports.EventConferencingDetails = EventConferencingDetails;
|
|
49
|
-
var EventConferencing = /** @class */ (function (_super) {
|
|
50
|
-
__extends(EventConferencing, _super);
|
|
51
|
-
function EventConferencing(props) {
|
|
52
|
-
var _this = _super.call(this) || this;
|
|
53
|
-
_this.provider = '';
|
|
54
|
-
_this.initAttributes(props);
|
|
55
|
-
return _this;
|
|
56
|
-
}
|
|
57
|
-
EventConferencing.attributes = {
|
|
58
|
-
details: attributes_1.default.Object({
|
|
59
|
-
modelKey: 'details',
|
|
60
|
-
itemClass: EventConferencingDetails,
|
|
61
|
-
}),
|
|
62
|
-
provider: attributes_1.default.String({
|
|
63
|
-
modelKey: 'provider',
|
|
64
|
-
}),
|
|
65
|
-
autocreate: attributes_1.default.Object({
|
|
66
|
-
modelKey: 'autocreate',
|
|
67
|
-
}),
|
|
68
|
-
};
|
|
69
|
-
return EventConferencing;
|
|
70
|
-
}(model_1.default));
|
|
71
|
-
exports.default = EventConferencing;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attributes';
|
|
2
|
-
import Model from './model';
|
|
3
|
-
export declare enum EventNotificationType {
|
|
4
|
-
Email = "email",
|
|
5
|
-
Sms = "sms",
|
|
6
|
-
Webhook = "webhook"
|
|
7
|
-
}
|
|
8
|
-
export declare type EventNotificationProperties = {
|
|
9
|
-
type: EventNotificationType;
|
|
10
|
-
minutesBeforeEvent: number;
|
|
11
|
-
url?: string;
|
|
12
|
-
payload?: string;
|
|
13
|
-
subject?: string;
|
|
14
|
-
body?: string;
|
|
15
|
-
message?: string;
|
|
16
|
-
};
|
|
17
|
-
export default class EventNotification extends Model implements EventNotificationProperties {
|
|
18
|
-
type: EventNotificationType;
|
|
19
|
-
minutesBeforeEvent: number;
|
|
20
|
-
url?: string;
|
|
21
|
-
payload?: string;
|
|
22
|
-
subject?: string;
|
|
23
|
-
body?: string;
|
|
24
|
-
message?: string;
|
|
25
|
-
static attributes: Record<string, Attribute>;
|
|
26
|
-
constructor(props?: EventNotificationProperties);
|
|
27
|
-
}
|
|
@@ -1,62 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
20
|
-
var model_1 = __importDefault(require("./model"));
|
|
21
|
-
var EventNotificationType;
|
|
22
|
-
(function (EventNotificationType) {
|
|
23
|
-
EventNotificationType["Email"] = "email";
|
|
24
|
-
EventNotificationType["Sms"] = "sms";
|
|
25
|
-
EventNotificationType["Webhook"] = "webhook";
|
|
26
|
-
})(EventNotificationType = exports.EventNotificationType || (exports.EventNotificationType = {}));
|
|
27
|
-
var EventNotification = /** @class */ (function (_super) {
|
|
28
|
-
__extends(EventNotification, _super);
|
|
29
|
-
function EventNotification(props) {
|
|
30
|
-
var _this = _super.call(this) || this;
|
|
31
|
-
_this.type = EventNotificationType.Email;
|
|
32
|
-
_this.minutesBeforeEvent = 0;
|
|
33
|
-
_this.initAttributes(props);
|
|
34
|
-
return _this;
|
|
35
|
-
}
|
|
36
|
-
EventNotification.attributes = {
|
|
37
|
-
type: attributes_1.default.String({
|
|
38
|
-
modelKey: 'type',
|
|
39
|
-
}),
|
|
40
|
-
minutesBeforeEvent: attributes_1.default.Number({
|
|
41
|
-
modelKey: 'minutesBeforeEvent',
|
|
42
|
-
jsonKey: 'minutes_before_event',
|
|
43
|
-
}),
|
|
44
|
-
url: attributes_1.default.String({
|
|
45
|
-
modelKey: 'url',
|
|
46
|
-
}),
|
|
47
|
-
payload: attributes_1.default.String({
|
|
48
|
-
modelKey: 'payload',
|
|
49
|
-
}),
|
|
50
|
-
subject: attributes_1.default.String({
|
|
51
|
-
modelKey: 'subject',
|
|
52
|
-
}),
|
|
53
|
-
body: attributes_1.default.String({
|
|
54
|
-
modelKey: 'body',
|
|
55
|
-
}),
|
|
56
|
-
message: attributes_1.default.String({
|
|
57
|
-
modelKey: 'message',
|
|
58
|
-
}),
|
|
59
|
-
};
|
|
60
|
-
return EventNotification;
|
|
61
|
-
}(model_1.default));
|
|
62
|
-
exports.default = EventNotification;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attributes';
|
|
2
|
-
import Model from './model';
|
|
3
|
-
export declare type EventParticipantProperties = {
|
|
4
|
-
email: string;
|
|
5
|
-
name?: string;
|
|
6
|
-
comment?: string;
|
|
7
|
-
phoneNumber?: string;
|
|
8
|
-
status?: string;
|
|
9
|
-
};
|
|
10
|
-
export default class EventParticipant extends Model implements EventParticipantProperties {
|
|
11
|
-
email: string;
|
|
12
|
-
name?: string;
|
|
13
|
-
comment?: string;
|
|
14
|
-
phoneNumber?: string;
|
|
15
|
-
status?: string;
|
|
16
|
-
static attributes: Record<string, Attribute>;
|
|
17
|
-
constructor(props?: EventParticipantProperties);
|
|
18
|
-
toJSON(enforceReadOnly?: boolean): Record<string, string>;
|
|
19
|
-
}
|
|
@@ -1,56 +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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
-
};
|
|
18
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
20
|
-
var model_1 = __importDefault(require("./model"));
|
|
21
|
-
var EventParticipant = /** @class */ (function (_super) {
|
|
22
|
-
__extends(EventParticipant, _super);
|
|
23
|
-
function EventParticipant(props) {
|
|
24
|
-
var _this = _super.call(this) || this;
|
|
25
|
-
_this.email = '';
|
|
26
|
-
_this.initAttributes(props);
|
|
27
|
-
return _this;
|
|
28
|
-
}
|
|
29
|
-
EventParticipant.prototype.toJSON = function (enforceReadOnly) {
|
|
30
|
-
var json = _super.prototype.toJSON.call(this, enforceReadOnly);
|
|
31
|
-
if (!json['name']) {
|
|
32
|
-
json['name'] = json['email'];
|
|
33
|
-
}
|
|
34
|
-
return json;
|
|
35
|
-
};
|
|
36
|
-
EventParticipant.attributes = {
|
|
37
|
-
name: attributes_1.default.String({
|
|
38
|
-
modelKey: 'name',
|
|
39
|
-
}),
|
|
40
|
-
email: attributes_1.default.String({
|
|
41
|
-
modelKey: 'email',
|
|
42
|
-
}),
|
|
43
|
-
comment: attributes_1.default.String({
|
|
44
|
-
modelKey: 'comment',
|
|
45
|
-
}),
|
|
46
|
-
phoneNumber: attributes_1.default.String({
|
|
47
|
-
modelKey: 'phoneNumber',
|
|
48
|
-
jsonKey: 'phone_number',
|
|
49
|
-
}),
|
|
50
|
-
status: attributes_1.default.String({
|
|
51
|
-
modelKey: 'status',
|
|
52
|
-
}),
|
|
53
|
-
};
|
|
54
|
-
return EventParticipant;
|
|
55
|
-
}(model_1.default));
|
|
56
|
-
exports.default = EventParticipant;
|
package/lib/models/event.d.ts
DELETED
|
@@ -1,96 +0,0 @@
|
|
|
1
|
-
import RestfulModel, { SaveCallback } from './restful-model';
|
|
2
|
-
import { Attribute } from './attributes';
|
|
3
|
-
import EventParticipant, { EventParticipantProperties } from './event-participant';
|
|
4
|
-
import EventConferencing, { EventConferencingProperties } from './event-conferencing';
|
|
5
|
-
import When, { WhenProperties } from './when';
|
|
6
|
-
import NylasConnection from '../nylas-connection';
|
|
7
|
-
import EventNotification, { EventNotificationProperties } from './event-notification';
|
|
8
|
-
export declare enum ICSMethod {
|
|
9
|
-
Request = "request",
|
|
10
|
-
Publish = "publish",
|
|
11
|
-
Reply = "reply",
|
|
12
|
-
Add = "add",
|
|
13
|
-
Cancel = "cancel",
|
|
14
|
-
Refresh = "refresh"
|
|
15
|
-
}
|
|
16
|
-
export declare type ICSOptions = {
|
|
17
|
-
iCalUID?: string;
|
|
18
|
-
prodId?: string;
|
|
19
|
-
method?: ICSMethod;
|
|
20
|
-
};
|
|
21
|
-
export declare type EventProperties = {
|
|
22
|
-
calendarId: string;
|
|
23
|
-
when: WhenProperties;
|
|
24
|
-
iCalUID?: string;
|
|
25
|
-
messageId?: string;
|
|
26
|
-
eventCollectionId?: string | number;
|
|
27
|
-
title?: string;
|
|
28
|
-
description?: string;
|
|
29
|
-
owner?: string;
|
|
30
|
-
participants?: EventParticipantProperties[];
|
|
31
|
-
readOnly?: boolean;
|
|
32
|
-
location?: string;
|
|
33
|
-
busy?: boolean;
|
|
34
|
-
status?: string;
|
|
35
|
-
recurrence?: {
|
|
36
|
-
rrule: string[];
|
|
37
|
-
timezone: string;
|
|
38
|
-
};
|
|
39
|
-
masterEventId?: string;
|
|
40
|
-
originalStartTime?: Date;
|
|
41
|
-
capacity?: number;
|
|
42
|
-
conferencing?: EventConferencingProperties;
|
|
43
|
-
notifications?: EventNotificationProperties[];
|
|
44
|
-
roundRobinOrder?: string[];
|
|
45
|
-
metadata?: object;
|
|
46
|
-
jobStatusId?: string;
|
|
47
|
-
organizerEmail?: string;
|
|
48
|
-
organizerName?: string;
|
|
49
|
-
visibility?: string;
|
|
50
|
-
customerEventId?: string;
|
|
51
|
-
};
|
|
52
|
-
export default class Event extends RestfulModel {
|
|
53
|
-
calendarId: string;
|
|
54
|
-
when: When;
|
|
55
|
-
iCalUID?: string;
|
|
56
|
-
messageId?: string;
|
|
57
|
-
eventCollectionId?: string | number;
|
|
58
|
-
title?: string;
|
|
59
|
-
description?: string;
|
|
60
|
-
owner?: string;
|
|
61
|
-
participants?: EventParticipant[];
|
|
62
|
-
readOnly?: boolean;
|
|
63
|
-
location?: string;
|
|
64
|
-
busy?: boolean;
|
|
65
|
-
status?: string;
|
|
66
|
-
recurrence?: {
|
|
67
|
-
rrule: string[];
|
|
68
|
-
timezone: string;
|
|
69
|
-
};
|
|
70
|
-
masterEventId?: string;
|
|
71
|
-
originalStartTime?: Date;
|
|
72
|
-
capacity?: number;
|
|
73
|
-
conferencing?: EventConferencing;
|
|
74
|
-
reminderMinutes?: string;
|
|
75
|
-
notifications?: EventNotification[];
|
|
76
|
-
roundRobinOrder?: string[];
|
|
77
|
-
metadata?: object;
|
|
78
|
-
jobStatusId?: string;
|
|
79
|
-
organizerEmail?: string;
|
|
80
|
-
organizerName?: string;
|
|
81
|
-
visibility?: string;
|
|
82
|
-
customerEventId?: string;
|
|
83
|
-
static collectionName: string;
|
|
84
|
-
static attributes: Record<string, Attribute>;
|
|
85
|
-
constructor(connection: NylasConnection, props?: EventProperties);
|
|
86
|
-
get start(): string | number | undefined;
|
|
87
|
-
set start(val: string | number | undefined);
|
|
88
|
-
get end(): string | number | undefined;
|
|
89
|
-
set end(val: string | number | undefined);
|
|
90
|
-
deleteRequestQueryString(params?: Record<string, unknown>): Record<string, unknown>;
|
|
91
|
-
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
92
|
-
saveRequestBody(): Record<string, unknown>;
|
|
93
|
-
rsvp(status: string, comment: string, callback?: (error: Error | null, data?: Event) => void): Promise<Event>;
|
|
94
|
-
generateICS(options?: ICSOptions): Promise<string>;
|
|
95
|
-
private validate;
|
|
96
|
-
}
|
package/lib/models/event.js
DELETED
|
@@ -1,297 +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 ICSMethod;
|
|
37
|
-
(function (ICSMethod) {
|
|
38
|
-
ICSMethod["Request"] = "request";
|
|
39
|
-
ICSMethod["Publish"] = "publish";
|
|
40
|
-
ICSMethod["Reply"] = "reply";
|
|
41
|
-
ICSMethod["Add"] = "add";
|
|
42
|
-
ICSMethod["Cancel"] = "cancel";
|
|
43
|
-
ICSMethod["Refresh"] = "refresh";
|
|
44
|
-
})(ICSMethod = exports.ICSMethod || (exports.ICSMethod = {}));
|
|
45
|
-
var Event = /** @class */ (function (_super) {
|
|
46
|
-
__extends(Event, _super);
|
|
47
|
-
function Event(connection, props) {
|
|
48
|
-
var _this = _super.call(this, connection, props) || this;
|
|
49
|
-
_this.calendarId = '';
|
|
50
|
-
_this.when = new when_1.default();
|
|
51
|
-
_this.initAttributes(props);
|
|
52
|
-
return _this;
|
|
53
|
-
}
|
|
54
|
-
Object.defineProperty(Event.prototype, "start", {
|
|
55
|
-
get: function () {
|
|
56
|
-
var _a, _b, _c, _d;
|
|
57
|
-
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));
|
|
58
|
-
},
|
|
59
|
-
set: function (val) {
|
|
60
|
-
if (!this.when) {
|
|
61
|
-
this.when = new when_1.default();
|
|
62
|
-
}
|
|
63
|
-
if (typeof val === 'number') {
|
|
64
|
-
if (val === this.when.endTime) {
|
|
65
|
-
this.when.time = val;
|
|
66
|
-
this.when.endTime = undefined;
|
|
67
|
-
}
|
|
68
|
-
else {
|
|
69
|
-
this.when.time = undefined;
|
|
70
|
-
this.when.startDate = undefined;
|
|
71
|
-
this.when.date = undefined;
|
|
72
|
-
this.when.startTime = val;
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
if (typeof val === 'string') {
|
|
76
|
-
if (val === this.when.endDate) {
|
|
77
|
-
this.when.date = val;
|
|
78
|
-
this.when.endDate = undefined;
|
|
79
|
-
}
|
|
80
|
-
else {
|
|
81
|
-
this.when.time = undefined;
|
|
82
|
-
this.when.startTime = undefined;
|
|
83
|
-
this.when.date = undefined;
|
|
84
|
-
this.when.startDate = val;
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
enumerable: true,
|
|
89
|
-
configurable: true
|
|
90
|
-
});
|
|
91
|
-
Object.defineProperty(Event.prototype, "end", {
|
|
92
|
-
get: function () {
|
|
93
|
-
var _a, _b, _c, _d;
|
|
94
|
-
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));
|
|
95
|
-
},
|
|
96
|
-
set: function (val) {
|
|
97
|
-
if (!this.when) {
|
|
98
|
-
this.when = new when_1.default();
|
|
99
|
-
}
|
|
100
|
-
if (typeof val === 'number') {
|
|
101
|
-
if (val === this.when.startTime) {
|
|
102
|
-
this.when.time = val;
|
|
103
|
-
this.when.startTime = undefined;
|
|
104
|
-
}
|
|
105
|
-
else {
|
|
106
|
-
this.when.time = undefined;
|
|
107
|
-
this.when.endDate = undefined;
|
|
108
|
-
this.when.date = undefined;
|
|
109
|
-
this.when.endTime = val;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
if (typeof val === 'string') {
|
|
113
|
-
if (val === this.when.startDate) {
|
|
114
|
-
this.when.date = val;
|
|
115
|
-
this.when.startDate = undefined;
|
|
116
|
-
}
|
|
117
|
-
else {
|
|
118
|
-
this.when.time = undefined;
|
|
119
|
-
this.when.endTime = undefined;
|
|
120
|
-
this.when.date = undefined;
|
|
121
|
-
this.when.endDate = val;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
enumerable: true,
|
|
126
|
-
configurable: true
|
|
127
|
-
});
|
|
128
|
-
Event.prototype.deleteRequestQueryString = function (params) {
|
|
129
|
-
if (params === void 0) { params = {}; }
|
|
130
|
-
var qs = {};
|
|
131
|
-
if (params.hasOwnProperty('notify_participants')) {
|
|
132
|
-
qs.notify_participants = params.notify_participants;
|
|
133
|
-
}
|
|
134
|
-
return qs;
|
|
135
|
-
};
|
|
136
|
-
Event.prototype.save = function (params, callback) {
|
|
137
|
-
if (params === void 0) { params = {}; }
|
|
138
|
-
this.validate();
|
|
139
|
-
return _super.prototype.save.call(this, params, callback);
|
|
140
|
-
};
|
|
141
|
-
Event.prototype.saveRequestBody = function () {
|
|
142
|
-
var json = _super.prototype.saveRequestBody.call(this);
|
|
143
|
-
if (!this.notifications) {
|
|
144
|
-
delete json.notifications;
|
|
145
|
-
}
|
|
146
|
-
// Participant status cannot be updated
|
|
147
|
-
if (this.id && json.participants) {
|
|
148
|
-
json.participants.forEach(function (participant) { return delete participant.status; });
|
|
149
|
-
}
|
|
150
|
-
return json;
|
|
151
|
-
};
|
|
152
|
-
Event.prototype.rsvp = function (status, comment, callback) {
|
|
153
|
-
var _this = this;
|
|
154
|
-
return this.connection
|
|
155
|
-
.request({
|
|
156
|
-
method: 'POST',
|
|
157
|
-
body: { event_id: this.id, status: status, comment: comment },
|
|
158
|
-
path: '/send-rsvp',
|
|
159
|
-
})
|
|
160
|
-
.then(function (json) {
|
|
161
|
-
_this.fromJSON(json);
|
|
162
|
-
if (callback) {
|
|
163
|
-
callback(null, _this);
|
|
164
|
-
}
|
|
165
|
-
return Promise.resolve(_this);
|
|
166
|
-
})
|
|
167
|
-
.catch(function (err) {
|
|
168
|
-
if (callback) {
|
|
169
|
-
callback(err);
|
|
170
|
-
}
|
|
171
|
-
return Promise.reject(err);
|
|
172
|
-
});
|
|
173
|
-
};
|
|
174
|
-
Event.prototype.generateICS = function (options) {
|
|
175
|
-
if (this.calendarId == '' || !this.when.isSet()) {
|
|
176
|
-
throw new Error('Cannot generate an ICS file for an event without a Calendar ID or when set');
|
|
177
|
-
}
|
|
178
|
-
var optionsPayload = {};
|
|
179
|
-
if (options) {
|
|
180
|
-
optionsPayload = {
|
|
181
|
-
ical_uid: options.iCalUID,
|
|
182
|
-
prodid: options.prodId,
|
|
183
|
-
method: options.method,
|
|
184
|
-
};
|
|
185
|
-
}
|
|
186
|
-
return this.connection
|
|
187
|
-
.request({
|
|
188
|
-
method: 'POST',
|
|
189
|
-
body: __assign(__assign({}, this.saveRequestBody()), { ics_options: optionsPayload }),
|
|
190
|
-
path: '/events/to-ics',
|
|
191
|
-
})
|
|
192
|
-
.then(function (response) {
|
|
193
|
-
if (!response.ics) {
|
|
194
|
-
throw new Error("Unexpected response from the API server. Returned 200 but no 'ics' string found.");
|
|
195
|
-
}
|
|
196
|
-
return response.ics;
|
|
197
|
-
});
|
|
198
|
-
};
|
|
199
|
-
Event.prototype.validate = function () {
|
|
200
|
-
if (this.conferencing &&
|
|
201
|
-
this.conferencing.details &&
|
|
202
|
-
this.conferencing.autocreate) {
|
|
203
|
-
throw new Error("Cannot set both 'details' and 'autocreate' in conferencing object.");
|
|
204
|
-
}
|
|
205
|
-
if (this.capacity &&
|
|
206
|
-
this.capacity != -1 &&
|
|
207
|
-
this.participants &&
|
|
208
|
-
this.participants.length > this.capacity) {
|
|
209
|
-
throw new Error('The number of participants in the event exceeds the set capacity.');
|
|
210
|
-
}
|
|
211
|
-
};
|
|
212
|
-
Event.collectionName = 'events';
|
|
213
|
-
Event.attributes = __assign(__assign({}, restful_model_1.default.attributes), { calendarId: attributes_1.default.String({
|
|
214
|
-
modelKey: 'calendarId',
|
|
215
|
-
jsonKey: 'calendar_id',
|
|
216
|
-
}), iCalUID: attributes_1.default.String({
|
|
217
|
-
modelKey: 'iCalUID',
|
|
218
|
-
jsonKey: 'ical_uid',
|
|
219
|
-
readOnly: true,
|
|
220
|
-
}), messageId: attributes_1.default.String({
|
|
221
|
-
modelKey: 'messageId',
|
|
222
|
-
jsonKey: 'message_id',
|
|
223
|
-
readOnly: true,
|
|
224
|
-
}), eventCollectionId: attributes_1.default.String({
|
|
225
|
-
modelKey: 'eventCollectionId',
|
|
226
|
-
jsonKey: 'event_collection_id',
|
|
227
|
-
}), title: attributes_1.default.String({
|
|
228
|
-
modelKey: 'title',
|
|
229
|
-
}), description: attributes_1.default.String({
|
|
230
|
-
modelKey: 'description',
|
|
231
|
-
}), owner: attributes_1.default.String({
|
|
232
|
-
modelKey: 'owner',
|
|
233
|
-
readOnly: true,
|
|
234
|
-
}), participants: attributes_1.default.Collection({
|
|
235
|
-
modelKey: 'participants',
|
|
236
|
-
itemClass: event_participant_1.default,
|
|
237
|
-
}), readOnly: attributes_1.default.Boolean({
|
|
238
|
-
modelKey: 'readOnly',
|
|
239
|
-
jsonKey: 'read_only',
|
|
240
|
-
}), location: attributes_1.default.String({
|
|
241
|
-
modelKey: 'location',
|
|
242
|
-
}), when: attributes_1.default.Object({
|
|
243
|
-
modelKey: 'when',
|
|
244
|
-
itemClass: when_1.default,
|
|
245
|
-
}), busy: attributes_1.default.Boolean({
|
|
246
|
-
modelKey: 'busy',
|
|
247
|
-
}), status: attributes_1.default.String({
|
|
248
|
-
modelKey: 'status',
|
|
249
|
-
readOnly: true,
|
|
250
|
-
}), recurrence: attributes_1.default.Object({
|
|
251
|
-
modelKey: 'recurrence',
|
|
252
|
-
}), masterEventId: attributes_1.default.String({
|
|
253
|
-
modelKey: 'masterEventId',
|
|
254
|
-
jsonKey: 'master_event_id',
|
|
255
|
-
readOnly: true,
|
|
256
|
-
}), originalStartTime: attributes_1.default.DateTime({
|
|
257
|
-
modelKey: 'originalStartTime',
|
|
258
|
-
jsonKey: 'original_start_time',
|
|
259
|
-
readOnly: true,
|
|
260
|
-
}), capacity: attributes_1.default.Number({
|
|
261
|
-
modelKey: 'capacity',
|
|
262
|
-
}), conferencing: attributes_1.default.Object({
|
|
263
|
-
modelKey: 'conferencing',
|
|
264
|
-
itemClass: event_conferencing_1.default,
|
|
265
|
-
}), reminderMinutes: attributes_1.default.String({
|
|
266
|
-
modelKey: 'reminderMinutes',
|
|
267
|
-
jsonKey: 'reminder_minutes',
|
|
268
|
-
}), notifications: attributes_1.default.Collection({
|
|
269
|
-
modelKey: 'notifications',
|
|
270
|
-
itemClass: event_notification_1.default,
|
|
271
|
-
}), roundRobinOrder: attributes_1.default.StringList({
|
|
272
|
-
modelKey: 'roundRobinOrder',
|
|
273
|
-
jsonKey: 'round_robin_order',
|
|
274
|
-
}), metadata: attributes_1.default.Object({
|
|
275
|
-
modelKey: 'metadata',
|
|
276
|
-
}), jobStatusId: attributes_1.default.String({
|
|
277
|
-
modelKey: 'jobStatusId',
|
|
278
|
-
jsonKey: 'job_status_id',
|
|
279
|
-
readOnly: true,
|
|
280
|
-
}), organizerEmail: attributes_1.default.String({
|
|
281
|
-
modelKey: 'organizerEmail',
|
|
282
|
-
jsonKey: 'organizer_email',
|
|
283
|
-
readOnly: true,
|
|
284
|
-
}), organizerName: attributes_1.default.String({
|
|
285
|
-
modelKey: 'organizerName',
|
|
286
|
-
jsonKey: 'organizer_name',
|
|
287
|
-
readOnly: true,
|
|
288
|
-
}), visibility: attributes_1.default.String({
|
|
289
|
-
modelKey: 'visibility',
|
|
290
|
-
readOnly: true,
|
|
291
|
-
}), customerEventId: attributes_1.default.String({
|
|
292
|
-
modelKey: 'customerEventId',
|
|
293
|
-
jsonKey: 'customer_event_id',
|
|
294
|
-
}) });
|
|
295
|
-
return Event;
|
|
296
|
-
}(restful_model_1.default));
|
|
297
|
-
exports.default = Event;
|