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
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import Model from './model';
|
|
3
|
-
import { Attribute } from './attributes';
|
|
4
|
-
export declare type LinkClickProperties = {
|
|
5
|
-
id: number;
|
|
6
|
-
ip: string;
|
|
7
|
-
userAgent: string;
|
|
8
|
-
timestamp: Date;
|
|
9
|
-
linkIndex?: number;
|
|
10
|
-
};
|
|
11
|
-
export declare class LinkClick extends Model implements LinkClickProperties {
|
|
12
|
-
id: number;
|
|
13
|
-
ip: string;
|
|
14
|
-
userAgent: string;
|
|
15
|
-
timestamp: Date;
|
|
16
|
-
linkIndex?: number;
|
|
17
|
-
static attributes: Record<string, Attribute>;
|
|
18
|
-
constructor(props?: LinkClickCountProperties);
|
|
19
|
-
}
|
|
20
|
-
export declare type LinkClickCountProperties = {
|
|
21
|
-
url: string;
|
|
22
|
-
count: number;
|
|
23
|
-
};
|
|
24
|
-
export declare class LinkClickCount extends Model implements LinkClickCountProperties {
|
|
25
|
-
url: string;
|
|
26
|
-
count: number;
|
|
27
|
-
static attributes: Record<string, Attribute>;
|
|
28
|
-
constructor(props?: LinkClickCountProperties);
|
|
29
|
-
}
|
|
30
|
-
export declare type MessageTrackingDataProperties = {
|
|
31
|
-
messageId: string;
|
|
32
|
-
payload: string;
|
|
33
|
-
senderAppId: number;
|
|
34
|
-
threadId?: string;
|
|
35
|
-
replyToMessageId?: string;
|
|
36
|
-
timestamp?: Date;
|
|
37
|
-
count?: number;
|
|
38
|
-
fromSelf?: boolean;
|
|
39
|
-
recents?: LinkClickProperties[];
|
|
40
|
-
linkData?: LinkClickCountProperties[];
|
|
41
|
-
};
|
|
42
|
-
export declare class MessageTrackingData extends Model implements MessageTrackingDataProperties {
|
|
43
|
-
messageId: string;
|
|
44
|
-
payload: string;
|
|
45
|
-
senderAppId: number;
|
|
46
|
-
replyToMessageId?: string;
|
|
47
|
-
timestamp?: Date;
|
|
48
|
-
threadId?: string;
|
|
49
|
-
fromSelf?: boolean;
|
|
50
|
-
count?: number;
|
|
51
|
-
linkData?: LinkClickCount[];
|
|
52
|
-
recents?: LinkClick[];
|
|
53
|
-
static attributes: Record<string, Attribute>;
|
|
54
|
-
constructor(props?: MessageTrackingDataProperties);
|
|
55
|
-
}
|
|
56
|
-
export declare type WebhookObjectExtrasProperties = {
|
|
57
|
-
reason?: string;
|
|
58
|
-
sendAt?: Date;
|
|
59
|
-
originalSendAt?: Date;
|
|
60
|
-
};
|
|
61
|
-
export declare class WebhookObjectExtras extends Model implements WebhookObjectExtrasProperties {
|
|
62
|
-
reason?: string;
|
|
63
|
-
sendAt?: Date;
|
|
64
|
-
originalSendAt?: Date;
|
|
65
|
-
static attributes: Record<string, Attribute>;
|
|
66
|
-
}
|
|
67
|
-
export declare type WebhookObjectAttributesProperties = {
|
|
68
|
-
action?: string;
|
|
69
|
-
jobStatusId?: string;
|
|
70
|
-
threadId?: string;
|
|
71
|
-
receivedDate?: Date;
|
|
72
|
-
};
|
|
73
|
-
export declare class WebhookObjectAttributes extends Model implements WebhookObjectAttributesProperties {
|
|
74
|
-
action?: string;
|
|
75
|
-
jobStatusId?: string;
|
|
76
|
-
messageId?: string;
|
|
77
|
-
extras?: WebhookObjectExtrasProperties;
|
|
78
|
-
threadId?: string;
|
|
79
|
-
receivedDate?: Date;
|
|
80
|
-
calendarId?: string;
|
|
81
|
-
createdBeforeAccountConnection?: boolean;
|
|
82
|
-
static attributes: Record<string, Attribute>;
|
|
83
|
-
constructor(props?: WebhookObjectAttributesProperties);
|
|
84
|
-
}
|
|
85
|
-
export declare type WebhookObjectDataProperties = {
|
|
86
|
-
id: string;
|
|
87
|
-
accountId: string;
|
|
88
|
-
namespaceId: string;
|
|
89
|
-
object: string;
|
|
90
|
-
metadata?: MessageTrackingDataProperties | Record<string, unknown>;
|
|
91
|
-
objectAttributes?: WebhookObjectAttributesProperties;
|
|
92
|
-
};
|
|
93
|
-
export declare class WebhookObjectData extends Model implements WebhookObjectDataProperties {
|
|
94
|
-
id: string;
|
|
95
|
-
accountId: string;
|
|
96
|
-
namespaceId: string;
|
|
97
|
-
object: string;
|
|
98
|
-
metadata?: MessageTrackingData | Record<string, unknown>;
|
|
99
|
-
objectAttributes?: WebhookObjectAttributes;
|
|
100
|
-
static attributes: Record<string, Attribute>;
|
|
101
|
-
constructor(props?: WebhookObjectDataProperties);
|
|
102
|
-
fromJSON(json: Record<string, unknown>): this;
|
|
103
|
-
}
|
|
104
|
-
export declare type WebhookDeltaProperties = {
|
|
105
|
-
object: string;
|
|
106
|
-
type: string;
|
|
107
|
-
date: Date;
|
|
108
|
-
objectData: WebhookObjectDataProperties;
|
|
109
|
-
};
|
|
110
|
-
export declare class WebhookDelta extends Model implements WebhookDeltaProperties {
|
|
111
|
-
date: Date;
|
|
112
|
-
object: string;
|
|
113
|
-
type: string;
|
|
114
|
-
objectData: WebhookObjectData;
|
|
115
|
-
static attributes: Record<string, Attribute>;
|
|
116
|
-
constructor(props?: WebhookDeltaProperties);
|
|
117
|
-
}
|
|
118
|
-
export declare type WebhookNotificationProperties = {
|
|
119
|
-
deltas: WebhookDeltaProperties[];
|
|
120
|
-
};
|
|
121
|
-
export default class WebhookNotification extends Model implements WebhookNotificationProperties {
|
|
122
|
-
deltas: WebhookDelta[];
|
|
123
|
-
static attributes: Record<string, Attribute>;
|
|
124
|
-
constructor(props?: WebhookNotificationProperties);
|
|
125
|
-
/**
|
|
126
|
-
* Verify incoming webhook signature came from Nylas
|
|
127
|
-
* @param xNylasSignature The signature to verify
|
|
128
|
-
* @param rawBody The raw body from the payload
|
|
129
|
-
* @param clientSecret Overriding client secret of the app receiving the webhook
|
|
130
|
-
* @return true if the webhook signature was verified from Nylas
|
|
131
|
-
*/
|
|
132
|
-
static verifyWebhookSignature(xNylasSignature: string, rawBody: Buffer, clientSecret?: string): boolean;
|
|
133
|
-
}
|
|
@@ -1,314 +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
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
22
|
-
result["default"] = mod;
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
var crypto_1 = __importDefault(require("crypto"));
|
|
27
|
-
var model_1 = __importDefault(require("./model"));
|
|
28
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
29
|
-
var config = __importStar(require("../config"));
|
|
30
|
-
var LinkClick = /** @class */ (function (_super) {
|
|
31
|
-
__extends(LinkClick, _super);
|
|
32
|
-
function LinkClick(props) {
|
|
33
|
-
var _this = _super.call(this) || this;
|
|
34
|
-
_this.id = 0;
|
|
35
|
-
_this.ip = '';
|
|
36
|
-
_this.userAgent = '';
|
|
37
|
-
_this.timestamp = new Date();
|
|
38
|
-
_this.initAttributes(props);
|
|
39
|
-
return _this;
|
|
40
|
-
}
|
|
41
|
-
LinkClick.attributes = {
|
|
42
|
-
id: attributes_1.default.Number({
|
|
43
|
-
modelKey: 'id',
|
|
44
|
-
}),
|
|
45
|
-
ip: attributes_1.default.String({
|
|
46
|
-
modelKey: 'ip',
|
|
47
|
-
}),
|
|
48
|
-
userAgent: attributes_1.default.String({
|
|
49
|
-
modelKey: 'userAgent',
|
|
50
|
-
jsonKey: 'user_agent',
|
|
51
|
-
}),
|
|
52
|
-
timestamp: attributes_1.default.DateTime({
|
|
53
|
-
modelKey: 'timestamp',
|
|
54
|
-
}),
|
|
55
|
-
linkIndex: attributes_1.default.Number({
|
|
56
|
-
modelKey: 'linkIndex',
|
|
57
|
-
jsonKey: 'link_index',
|
|
58
|
-
}),
|
|
59
|
-
};
|
|
60
|
-
return LinkClick;
|
|
61
|
-
}(model_1.default));
|
|
62
|
-
exports.LinkClick = LinkClick;
|
|
63
|
-
var LinkClickCount = /** @class */ (function (_super) {
|
|
64
|
-
__extends(LinkClickCount, _super);
|
|
65
|
-
function LinkClickCount(props) {
|
|
66
|
-
var _this = _super.call(this) || this;
|
|
67
|
-
_this.url = '';
|
|
68
|
-
_this.count = 0;
|
|
69
|
-
_this.initAttributes(props);
|
|
70
|
-
return _this;
|
|
71
|
-
}
|
|
72
|
-
LinkClickCount.attributes = {
|
|
73
|
-
url: attributes_1.default.String({
|
|
74
|
-
modelKey: 'url',
|
|
75
|
-
}),
|
|
76
|
-
count: attributes_1.default.Number({
|
|
77
|
-
modelKey: 'count',
|
|
78
|
-
}),
|
|
79
|
-
};
|
|
80
|
-
return LinkClickCount;
|
|
81
|
-
}(model_1.default));
|
|
82
|
-
exports.LinkClickCount = LinkClickCount;
|
|
83
|
-
var MessageTrackingData = /** @class */ (function (_super) {
|
|
84
|
-
__extends(MessageTrackingData, _super);
|
|
85
|
-
function MessageTrackingData(props) {
|
|
86
|
-
var _this = _super.call(this) || this;
|
|
87
|
-
_this.messageId = '';
|
|
88
|
-
_this.payload = '';
|
|
89
|
-
_this.senderAppId = 0;
|
|
90
|
-
_this.initAttributes(props);
|
|
91
|
-
return _this;
|
|
92
|
-
}
|
|
93
|
-
MessageTrackingData.attributes = {
|
|
94
|
-
messageId: attributes_1.default.String({
|
|
95
|
-
modelKey: 'messageId',
|
|
96
|
-
jsonKey: 'message_id',
|
|
97
|
-
}),
|
|
98
|
-
payload: attributes_1.default.String({
|
|
99
|
-
modelKey: 'payload',
|
|
100
|
-
}),
|
|
101
|
-
senderAppId: attributes_1.default.Number({
|
|
102
|
-
modelKey: 'senderAppId',
|
|
103
|
-
jsonKey: 'sender_app_id',
|
|
104
|
-
}),
|
|
105
|
-
replyToMessageId: attributes_1.default.String({
|
|
106
|
-
modelKey: 'replyToMessageId',
|
|
107
|
-
jsonKey: 'reply_to_message_id',
|
|
108
|
-
}),
|
|
109
|
-
timestamp: attributes_1.default.DateTime({
|
|
110
|
-
modelKey: 'timestamp',
|
|
111
|
-
}),
|
|
112
|
-
threadId: attributes_1.default.String({
|
|
113
|
-
modelKey: 'threadId',
|
|
114
|
-
jsonKey: 'thread_id',
|
|
115
|
-
}),
|
|
116
|
-
fromSelf: attributes_1.default.Boolean({
|
|
117
|
-
modelKey: 'fromSelf',
|
|
118
|
-
jsonKey: 'from_self',
|
|
119
|
-
}),
|
|
120
|
-
count: attributes_1.default.Number({
|
|
121
|
-
modelKey: 'count',
|
|
122
|
-
}),
|
|
123
|
-
linkData: attributes_1.default.Collection({
|
|
124
|
-
modelKey: 'linkData',
|
|
125
|
-
jsonKey: 'link_data',
|
|
126
|
-
itemClass: LinkClickCount,
|
|
127
|
-
}),
|
|
128
|
-
recents: attributes_1.default.Collection({
|
|
129
|
-
modelKey: 'recents',
|
|
130
|
-
itemClass: LinkClick,
|
|
131
|
-
}),
|
|
132
|
-
};
|
|
133
|
-
return MessageTrackingData;
|
|
134
|
-
}(model_1.default));
|
|
135
|
-
exports.MessageTrackingData = MessageTrackingData;
|
|
136
|
-
var WebhookObjectExtras = /** @class */ (function (_super) {
|
|
137
|
-
__extends(WebhookObjectExtras, _super);
|
|
138
|
-
function WebhookObjectExtras() {
|
|
139
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
140
|
-
}
|
|
141
|
-
WebhookObjectExtras.attributes = {
|
|
142
|
-
reason: attributes_1.default.String({
|
|
143
|
-
modelKey: 'reason',
|
|
144
|
-
}),
|
|
145
|
-
sendAt: attributes_1.default.DateTime({
|
|
146
|
-
modelKey: 'sendAt',
|
|
147
|
-
jsonKey: 'send_at',
|
|
148
|
-
}),
|
|
149
|
-
originalSendAt: attributes_1.default.DateTime({
|
|
150
|
-
modelKey: 'originalSendAt',
|
|
151
|
-
jsonKey: 'original_send_at',
|
|
152
|
-
}),
|
|
153
|
-
};
|
|
154
|
-
return WebhookObjectExtras;
|
|
155
|
-
}(model_1.default));
|
|
156
|
-
exports.WebhookObjectExtras = WebhookObjectExtras;
|
|
157
|
-
var WebhookObjectAttributes = /** @class */ (function (_super) {
|
|
158
|
-
__extends(WebhookObjectAttributes, _super);
|
|
159
|
-
function WebhookObjectAttributes(props) {
|
|
160
|
-
var _this = _super.call(this) || this;
|
|
161
|
-
_this.initAttributes(props);
|
|
162
|
-
return _this;
|
|
163
|
-
}
|
|
164
|
-
WebhookObjectAttributes.attributes = {
|
|
165
|
-
action: attributes_1.default.String({
|
|
166
|
-
modelKey: 'action',
|
|
167
|
-
}),
|
|
168
|
-
jobStatusId: attributes_1.default.String({
|
|
169
|
-
modelKey: 'jobStatusId',
|
|
170
|
-
jsonKey: 'job_status_id',
|
|
171
|
-
}),
|
|
172
|
-
messageId: attributes_1.default.String({
|
|
173
|
-
modelKey: 'messageId',
|
|
174
|
-
jsonKey: 'message_id',
|
|
175
|
-
}),
|
|
176
|
-
threadId: attributes_1.default.String({
|
|
177
|
-
modelKey: 'threadId',
|
|
178
|
-
jsonKey: 'thread_id',
|
|
179
|
-
}),
|
|
180
|
-
calendarId: attributes_1.default.String({
|
|
181
|
-
modelKey: 'calendarId',
|
|
182
|
-
jsonKey: 'calendar_id',
|
|
183
|
-
}),
|
|
184
|
-
receivedDate: attributes_1.default.DateTime({
|
|
185
|
-
modelKey: 'receivedDate',
|
|
186
|
-
jsonKey: 'received_date',
|
|
187
|
-
}),
|
|
188
|
-
createdBeforeAccountConnection: attributes_1.default.Boolean({
|
|
189
|
-
modelKey: 'createdBeforeAccountConnection',
|
|
190
|
-
jsonKey: 'created_before_account_connection',
|
|
191
|
-
}),
|
|
192
|
-
extras: attributes_1.default.Object({
|
|
193
|
-
modelKey: 'extras',
|
|
194
|
-
itemClass: WebhookObjectExtras,
|
|
195
|
-
}),
|
|
196
|
-
};
|
|
197
|
-
return WebhookObjectAttributes;
|
|
198
|
-
}(model_1.default));
|
|
199
|
-
exports.WebhookObjectAttributes = WebhookObjectAttributes;
|
|
200
|
-
var WebhookObjectData = /** @class */ (function (_super) {
|
|
201
|
-
__extends(WebhookObjectData, _super);
|
|
202
|
-
function WebhookObjectData(props) {
|
|
203
|
-
var _this = _super.call(this) || this;
|
|
204
|
-
_this.id = '';
|
|
205
|
-
_this.accountId = '';
|
|
206
|
-
_this.namespaceId = '';
|
|
207
|
-
_this.object = '';
|
|
208
|
-
_this.initAttributes(props);
|
|
209
|
-
if (_this.metadata &&
|
|
210
|
-
(_this.object === 'message' || _this.object === 'thread')) {
|
|
211
|
-
_this.metadata = new MessageTrackingData(_this.metadata);
|
|
212
|
-
}
|
|
213
|
-
return _this;
|
|
214
|
-
}
|
|
215
|
-
WebhookObjectData.prototype.fromJSON = function (json) {
|
|
216
|
-
var notification = _super.prototype.fromJSON.call(this, json);
|
|
217
|
-
if (notification.metadata &&
|
|
218
|
-
(notification.object === 'message' || notification.object === 'thread')) {
|
|
219
|
-
notification.metadata = new MessageTrackingData().fromJSON(json['metadata']);
|
|
220
|
-
}
|
|
221
|
-
return notification;
|
|
222
|
-
};
|
|
223
|
-
WebhookObjectData.attributes = {
|
|
224
|
-
id: attributes_1.default.String({
|
|
225
|
-
modelKey: 'id',
|
|
226
|
-
}),
|
|
227
|
-
accountId: attributes_1.default.String({
|
|
228
|
-
modelKey: 'accountId',
|
|
229
|
-
jsonKey: 'account_id',
|
|
230
|
-
}),
|
|
231
|
-
namespaceId: attributes_1.default.String({
|
|
232
|
-
modelKey: 'namespaceId',
|
|
233
|
-
jsonKey: 'namespace_id',
|
|
234
|
-
}),
|
|
235
|
-
object: attributes_1.default.String({
|
|
236
|
-
modelKey: 'object',
|
|
237
|
-
}),
|
|
238
|
-
metadata: attributes_1.default.Object({
|
|
239
|
-
modelKey: 'metadata',
|
|
240
|
-
}),
|
|
241
|
-
objectAttributes: attributes_1.default.Object({
|
|
242
|
-
modelKey: 'objectAttributes',
|
|
243
|
-
jsonKey: 'attributes',
|
|
244
|
-
itemClass: WebhookObjectAttributes,
|
|
245
|
-
}),
|
|
246
|
-
};
|
|
247
|
-
return WebhookObjectData;
|
|
248
|
-
}(model_1.default));
|
|
249
|
-
exports.WebhookObjectData = WebhookObjectData;
|
|
250
|
-
var WebhookDelta = /** @class */ (function (_super) {
|
|
251
|
-
__extends(WebhookDelta, _super);
|
|
252
|
-
function WebhookDelta(props) {
|
|
253
|
-
var _this = _super.call(this) || this;
|
|
254
|
-
_this.date = new Date();
|
|
255
|
-
_this.object = '';
|
|
256
|
-
_this.type = '';
|
|
257
|
-
_this.objectData = new WebhookObjectData();
|
|
258
|
-
_this.initAttributes(props);
|
|
259
|
-
return _this;
|
|
260
|
-
}
|
|
261
|
-
WebhookDelta.attributes = {
|
|
262
|
-
date: attributes_1.default.DateTime({
|
|
263
|
-
modelKey: 'date',
|
|
264
|
-
}),
|
|
265
|
-
object: attributes_1.default.String({
|
|
266
|
-
modelKey: 'object',
|
|
267
|
-
}),
|
|
268
|
-
type: attributes_1.default.String({
|
|
269
|
-
modelKey: 'type',
|
|
270
|
-
}),
|
|
271
|
-
objectData: attributes_1.default.Object({
|
|
272
|
-
modelKey: 'objectData',
|
|
273
|
-
jsonKey: 'object_data',
|
|
274
|
-
itemClass: WebhookObjectData,
|
|
275
|
-
}),
|
|
276
|
-
};
|
|
277
|
-
return WebhookDelta;
|
|
278
|
-
}(model_1.default));
|
|
279
|
-
exports.WebhookDelta = WebhookDelta;
|
|
280
|
-
var WebhookNotification = /** @class */ (function (_super) {
|
|
281
|
-
__extends(WebhookNotification, _super);
|
|
282
|
-
function WebhookNotification(props) {
|
|
283
|
-
var _this = _super.call(this) || this;
|
|
284
|
-
_this.deltas = [];
|
|
285
|
-
_this.initAttributes(props);
|
|
286
|
-
return _this;
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
|
-
* Verify incoming webhook signature came from Nylas
|
|
290
|
-
* @param xNylasSignature The signature to verify
|
|
291
|
-
* @param rawBody The raw body from the payload
|
|
292
|
-
* @param clientSecret Overriding client secret of the app receiving the webhook
|
|
293
|
-
* @return true if the webhook signature was verified from Nylas
|
|
294
|
-
*/
|
|
295
|
-
WebhookNotification.verifyWebhookSignature = function (xNylasSignature, rawBody, clientSecret) {
|
|
296
|
-
var clientSecretToUse = clientSecret || config.clientSecret;
|
|
297
|
-
if (!clientSecretToUse) {
|
|
298
|
-
throw new Error('Client secret is required to verify webhook signature');
|
|
299
|
-
}
|
|
300
|
-
var digest = crypto_1.default
|
|
301
|
-
.createHmac('sha256', clientSecretToUse)
|
|
302
|
-
.update(rawBody)
|
|
303
|
-
.digest('hex');
|
|
304
|
-
return digest === xNylasSignature;
|
|
305
|
-
};
|
|
306
|
-
WebhookNotification.attributes = {
|
|
307
|
-
deltas: attributes_1.default.Collection({
|
|
308
|
-
modelKey: 'deltas',
|
|
309
|
-
itemClass: WebhookDelta,
|
|
310
|
-
}),
|
|
311
|
-
};
|
|
312
|
-
return WebhookNotification;
|
|
313
|
-
}(model_1.default));
|
|
314
|
-
exports.default = WebhookNotification;
|
package/lib/models/webhook.d.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import ManagementModel from './management-model';
|
|
2
|
-
import { Attribute } from './attributes';
|
|
3
|
-
import { SaveCallback } from './restful-model';
|
|
4
|
-
import NylasConnection from '../nylas-connection';
|
|
5
|
-
export declare enum WebhookTriggers {
|
|
6
|
-
AccountConnected = "account.connected",
|
|
7
|
-
AccountRunning = "account.running",
|
|
8
|
-
AccountStopped = "account.stopped",
|
|
9
|
-
AccountInvalid = "account.invalid",
|
|
10
|
-
AccountSyncError = "account.sync_error",
|
|
11
|
-
MessageBounced = "message.bounced",
|
|
12
|
-
MessageCreated = "message.created",
|
|
13
|
-
MessageOpened = "message.opened",
|
|
14
|
-
MessageUpdated = "message.updated",
|
|
15
|
-
MessageLinkClicked = "message.link_clicked",
|
|
16
|
-
ThreadReplied = "thread.replied",
|
|
17
|
-
ContactCreated = "contact.created",
|
|
18
|
-
ContactUpdated = "contact.updated",
|
|
19
|
-
ContactDeleted = "contact.deleted",
|
|
20
|
-
CalendarCreated = "calendar.created",
|
|
21
|
-
CalendarUpdated = "calendar.updated",
|
|
22
|
-
CalendarDeleted = "calendar.deleted",
|
|
23
|
-
EventCreated = "event.created",
|
|
24
|
-
EventUpdated = "event.updated",
|
|
25
|
-
EventDeleted = "event.deleted",
|
|
26
|
-
JobSuccessful = "job.successful",
|
|
27
|
-
JobFailed = "job.failed"
|
|
28
|
-
}
|
|
29
|
-
export declare type WebhookProperties = {
|
|
30
|
-
callbackUrl: string;
|
|
31
|
-
state: string;
|
|
32
|
-
triggers: string[];
|
|
33
|
-
id?: string;
|
|
34
|
-
applicationId?: string;
|
|
35
|
-
version?: string;
|
|
36
|
-
};
|
|
37
|
-
export default class Webhook extends ManagementModel implements WebhookProperties {
|
|
38
|
-
callbackUrl: string;
|
|
39
|
-
state: string;
|
|
40
|
-
triggers: string[];
|
|
41
|
-
id?: string;
|
|
42
|
-
applicationId?: string;
|
|
43
|
-
version?: string;
|
|
44
|
-
static collectionName: string;
|
|
45
|
-
static attributes: Record<string, Attribute>;
|
|
46
|
-
constructor(connection: NylasConnection, clientId: string, props: WebhookProperties);
|
|
47
|
-
pathPrefix(): string;
|
|
48
|
-
saveRequestBody(): Record<string, unknown>;
|
|
49
|
-
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
50
|
-
}
|
package/lib/models/webhook.js
DELETED
|
@@ -1,101 +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 management_model_1 = __importDefault(require("./management-model"));
|
|
20
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
21
|
-
var WebhookTriggers;
|
|
22
|
-
(function (WebhookTriggers) {
|
|
23
|
-
WebhookTriggers["AccountConnected"] = "account.connected";
|
|
24
|
-
WebhookTriggers["AccountRunning"] = "account.running";
|
|
25
|
-
WebhookTriggers["AccountStopped"] = "account.stopped";
|
|
26
|
-
WebhookTriggers["AccountInvalid"] = "account.invalid";
|
|
27
|
-
WebhookTriggers["AccountSyncError"] = "account.sync_error";
|
|
28
|
-
WebhookTriggers["MessageBounced"] = "message.bounced";
|
|
29
|
-
WebhookTriggers["MessageCreated"] = "message.created";
|
|
30
|
-
WebhookTriggers["MessageOpened"] = "message.opened";
|
|
31
|
-
WebhookTriggers["MessageUpdated"] = "message.updated";
|
|
32
|
-
WebhookTriggers["MessageLinkClicked"] = "message.link_clicked";
|
|
33
|
-
WebhookTriggers["ThreadReplied"] = "thread.replied";
|
|
34
|
-
WebhookTriggers["ContactCreated"] = "contact.created";
|
|
35
|
-
WebhookTriggers["ContactUpdated"] = "contact.updated";
|
|
36
|
-
WebhookTriggers["ContactDeleted"] = "contact.deleted";
|
|
37
|
-
WebhookTriggers["CalendarCreated"] = "calendar.created";
|
|
38
|
-
WebhookTriggers["CalendarUpdated"] = "calendar.updated";
|
|
39
|
-
WebhookTriggers["CalendarDeleted"] = "calendar.deleted";
|
|
40
|
-
WebhookTriggers["EventCreated"] = "event.created";
|
|
41
|
-
WebhookTriggers["EventUpdated"] = "event.updated";
|
|
42
|
-
WebhookTriggers["EventDeleted"] = "event.deleted";
|
|
43
|
-
WebhookTriggers["JobSuccessful"] = "job.successful";
|
|
44
|
-
WebhookTriggers["JobFailed"] = "job.failed";
|
|
45
|
-
})(WebhookTriggers = exports.WebhookTriggers || (exports.WebhookTriggers = {}));
|
|
46
|
-
var Webhook = /** @class */ (function (_super) {
|
|
47
|
-
__extends(Webhook, _super);
|
|
48
|
-
function Webhook(connection, clientId, props) {
|
|
49
|
-
var _this = _super.call(this, connection, clientId, props) || this;
|
|
50
|
-
_this.callbackUrl = '';
|
|
51
|
-
_this.state = '';
|
|
52
|
-
_this.triggers = [];
|
|
53
|
-
_this.initAttributes(props);
|
|
54
|
-
return _this;
|
|
55
|
-
}
|
|
56
|
-
Webhook.prototype.pathPrefix = function () {
|
|
57
|
-
return "/a/" + this.clientId;
|
|
58
|
-
};
|
|
59
|
-
Webhook.prototype.saveRequestBody = function () {
|
|
60
|
-
var json = {};
|
|
61
|
-
// We can only update the state of an existing webhook
|
|
62
|
-
if (this.id) {
|
|
63
|
-
json['state'] = this.state;
|
|
64
|
-
}
|
|
65
|
-
else {
|
|
66
|
-
json['callback_url'] = this.callbackUrl;
|
|
67
|
-
json['state'] = this.state ? this.state : 'active';
|
|
68
|
-
json['triggers'] = Webhook.attributes.triggers.toJSON(this.triggers);
|
|
69
|
-
}
|
|
70
|
-
return json;
|
|
71
|
-
};
|
|
72
|
-
Webhook.prototype.save = function (params, callback) {
|
|
73
|
-
if (params === void 0) { params = {}; }
|
|
74
|
-
return _super.prototype.save.call(this, params, callback);
|
|
75
|
-
};
|
|
76
|
-
Webhook.collectionName = 'webhooks';
|
|
77
|
-
Webhook.attributes = {
|
|
78
|
-
id: attributes_1.default.String({
|
|
79
|
-
modelKey: 'id',
|
|
80
|
-
}),
|
|
81
|
-
applicationId: attributes_1.default.String({
|
|
82
|
-
modelKey: 'applicationId',
|
|
83
|
-
jsonKey: 'application_id',
|
|
84
|
-
}),
|
|
85
|
-
callbackUrl: attributes_1.default.String({
|
|
86
|
-
modelKey: 'callbackUrl',
|
|
87
|
-
jsonKey: 'callback_url',
|
|
88
|
-
}),
|
|
89
|
-
state: attributes_1.default.String({
|
|
90
|
-
modelKey: 'state',
|
|
91
|
-
}),
|
|
92
|
-
triggers: attributes_1.default.StringList({
|
|
93
|
-
modelKey: 'triggers',
|
|
94
|
-
}),
|
|
95
|
-
version: attributes_1.default.String({
|
|
96
|
-
modelKey: 'version',
|
|
97
|
-
}),
|
|
98
|
-
};
|
|
99
|
-
return Webhook;
|
|
100
|
-
}(management_model_1.default));
|
|
101
|
-
exports.default = Webhook;
|
package/lib/models/when.d.ts
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import Model from './model';
|
|
2
|
-
import { Attribute } from './attributes';
|
|
3
|
-
export declare type WhenProperties = {
|
|
4
|
-
startTime?: number;
|
|
5
|
-
endTime?: number;
|
|
6
|
-
startTimezone?: string;
|
|
7
|
-
endTimezone?: string;
|
|
8
|
-
time?: number;
|
|
9
|
-
timezone?: string;
|
|
10
|
-
startDate?: string;
|
|
11
|
-
endDate?: string;
|
|
12
|
-
date?: string;
|
|
13
|
-
object?: string;
|
|
14
|
-
};
|
|
15
|
-
export default class When extends Model implements WhenProperties {
|
|
16
|
-
startTime?: number;
|
|
17
|
-
endTime?: number;
|
|
18
|
-
startTimezone?: string;
|
|
19
|
-
endTimezone?: string;
|
|
20
|
-
time?: number;
|
|
21
|
-
timezone?: string;
|
|
22
|
-
startDate?: string;
|
|
23
|
-
endDate?: string;
|
|
24
|
-
date?: string;
|
|
25
|
-
object?: string;
|
|
26
|
-
static attributes: Record<string, Attribute>;
|
|
27
|
-
constructor(props?: WhenProperties);
|
|
28
|
-
isSet(): boolean;
|
|
29
|
-
}
|