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,64 +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 outbox_message_1 = __importDefault(require("./outbox-message"));
|
|
31
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
32
|
-
var job_status_1 = __importDefault(require("./job-status"));
|
|
33
|
-
var OutboxJobStatus = /** @class */ (function (_super) {
|
|
34
|
-
__extends(OutboxJobStatus, _super);
|
|
35
|
-
function OutboxJobStatus(connection, props) {
|
|
36
|
-
var _this = _super.call(this, connection, props) || this;
|
|
37
|
-
_this.initAttributes(props);
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
OutboxJobStatus.attributes = __assign(__assign({}, job_status_1.default.attributes), { messageId: attributes_1.default.String({
|
|
41
|
-
modelKey: 'messageId',
|
|
42
|
-
jsonKey: 'message_id',
|
|
43
|
-
readOnly: true,
|
|
44
|
-
}), threadId: attributes_1.default.String({
|
|
45
|
-
modelKey: 'threadId',
|
|
46
|
-
jsonKey: 'thread_id',
|
|
47
|
-
readOnly: true,
|
|
48
|
-
}), sendAt: attributes_1.default.DateTime({
|
|
49
|
-
modelKey: 'sendAt',
|
|
50
|
-
jsonKey: 'send_at',
|
|
51
|
-
readOnly: true,
|
|
52
|
-
}), originalSendAt: attributes_1.default.DateTime({
|
|
53
|
-
modelKey: 'originalSendAt',
|
|
54
|
-
jsonKey: 'original_send_at',
|
|
55
|
-
readOnly: true,
|
|
56
|
-
}), originalData: attributes_1.default.Object({
|
|
57
|
-
modelKey: 'originalData',
|
|
58
|
-
jsonKey: 'original_data',
|
|
59
|
-
itemClass: outbox_message_1.default,
|
|
60
|
-
readOnly: true,
|
|
61
|
-
}) });
|
|
62
|
-
return OutboxJobStatus;
|
|
63
|
-
}(job_status_1.default));
|
|
64
|
-
exports.default = OutboxJobStatus;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import Draft, { DraftProperties } from './draft';
|
|
2
|
-
import { Attribute } from './attributes';
|
|
3
|
-
import NylasConnection from '../nylas-connection';
|
|
4
|
-
export declare type OutboxMessageProperties = DraftProperties & {
|
|
5
|
-
sendAt: Date;
|
|
6
|
-
retryLimitDatetime?: Date;
|
|
7
|
-
originalSendAt?: Date;
|
|
8
|
-
};
|
|
9
|
-
export default class OutboxMessage extends Draft implements OutboxMessageProperties {
|
|
10
|
-
sendAt: Date;
|
|
11
|
-
retryLimitDatetime?: Date;
|
|
12
|
-
originalSendAt?: Date;
|
|
13
|
-
static collectionName: string;
|
|
14
|
-
static attributes: Record<string, Attribute>;
|
|
15
|
-
constructor(connection: NylasConnection, props?: OutboxMessageProperties);
|
|
16
|
-
}
|
|
@@ -1,54 +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 draft_1 = __importDefault(require("./draft"));
|
|
31
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
32
|
-
var OutboxMessage = /** @class */ (function (_super) {
|
|
33
|
-
__extends(OutboxMessage, _super);
|
|
34
|
-
function OutboxMessage(connection, props) {
|
|
35
|
-
var _this = _super.call(this, connection, props) || this;
|
|
36
|
-
_this.sendAt = new Date();
|
|
37
|
-
_this.initAttributes(props);
|
|
38
|
-
return _this;
|
|
39
|
-
}
|
|
40
|
-
OutboxMessage.collectionName = '/v2/outbox';
|
|
41
|
-
OutboxMessage.attributes = __assign(__assign({}, draft_1.default.attributes), { sendAt: attributes_1.default.DateTime({
|
|
42
|
-
modelKey: 'sendAt',
|
|
43
|
-
jsonKey: 'send_at',
|
|
44
|
-
}), retryLimitDatetime: attributes_1.default.DateTime({
|
|
45
|
-
modelKey: 'retryLimitDatetime',
|
|
46
|
-
jsonKey: 'retry_limit_datetime',
|
|
47
|
-
}), originalSendAt: attributes_1.default.DateTime({
|
|
48
|
-
modelKey: 'originalSendAt',
|
|
49
|
-
jsonKey: 'original_send_at',
|
|
50
|
-
readOnly: true,
|
|
51
|
-
}) });
|
|
52
|
-
return OutboxMessage;
|
|
53
|
-
}(draft_1.default));
|
|
54
|
-
exports.default = OutboxMessage;
|
package/lib/models/outbox.d.ts
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import NylasConnection from '../nylas-connection';
|
|
2
|
-
import Draft, { SendCallback } from './draft';
|
|
3
|
-
import OutboxJobStatus from './outbox-job-status';
|
|
4
|
-
import Model from './model';
|
|
5
|
-
import { Attribute } from './attributes';
|
|
6
|
-
declare type SendParams = {
|
|
7
|
-
sendAt: Date | number;
|
|
8
|
-
retryLimitDatetime?: Date | number;
|
|
9
|
-
tracking?: Record<string, any>;
|
|
10
|
-
callback?: SendCallback;
|
|
11
|
-
};
|
|
12
|
-
declare type UpdateParams = {
|
|
13
|
-
updatedMessage?: Draft;
|
|
14
|
-
sendAt?: Date | number;
|
|
15
|
-
retryLimitDatetime?: Date | number;
|
|
16
|
-
};
|
|
17
|
-
export declare class SendGridVerifiedStatus extends Model {
|
|
18
|
-
domainVerified?: boolean;
|
|
19
|
-
senderVerified?: boolean;
|
|
20
|
-
static attributes: Record<string, Attribute>;
|
|
21
|
-
}
|
|
22
|
-
export default class Outbox {
|
|
23
|
-
connection: NylasConnection;
|
|
24
|
-
private path;
|
|
25
|
-
constructor(connection: NylasConnection);
|
|
26
|
-
send(draft: Draft, options: SendParams): Promise<OutboxJobStatus>;
|
|
27
|
-
update(jobStatusId: string, options: UpdateParams): Promise<OutboxJobStatus>;
|
|
28
|
-
delete(jobStatusId: string): Promise<void>;
|
|
29
|
-
sendGridVerificationStatus(): Promise<SendGridVerifiedStatus>;
|
|
30
|
-
deleteSendGridSubUser(email: string): Promise<void>;
|
|
31
|
-
private request;
|
|
32
|
-
private static validateAndFormatDateTime;
|
|
33
|
-
private static dateToEpoch;
|
|
34
|
-
}
|
|
35
|
-
export {};
|
package/lib/models/outbox.js
DELETED
|
@@ -1,158 +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 nylas_connection_1 = require("../nylas-connection");
|
|
20
|
-
var outbox_job_status_1 = __importDefault(require("./outbox-job-status"));
|
|
21
|
-
var model_1 = __importDefault(require("./model"));
|
|
22
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
23
|
-
var SendGridVerifiedStatus = /** @class */ (function (_super) {
|
|
24
|
-
__extends(SendGridVerifiedStatus, _super);
|
|
25
|
-
function SendGridVerifiedStatus() {
|
|
26
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
-
}
|
|
28
|
-
SendGridVerifiedStatus.attributes = {
|
|
29
|
-
domainVerified: attributes_1.default.Boolean({
|
|
30
|
-
modelKey: 'domainVerified',
|
|
31
|
-
jsonKey: 'domain_verified',
|
|
32
|
-
}),
|
|
33
|
-
senderVerified: attributes_1.default.Boolean({
|
|
34
|
-
modelKey: 'senderVerified',
|
|
35
|
-
jsonKey: 'sender_verified',
|
|
36
|
-
}),
|
|
37
|
-
};
|
|
38
|
-
return SendGridVerifiedStatus;
|
|
39
|
-
}(model_1.default));
|
|
40
|
-
exports.SendGridVerifiedStatus = SendGridVerifiedStatus;
|
|
41
|
-
var Outbox = /** @class */ (function () {
|
|
42
|
-
function Outbox(connection) {
|
|
43
|
-
this.path = '/v2/outbox';
|
|
44
|
-
this.connection = connection;
|
|
45
|
-
}
|
|
46
|
-
Outbox.prototype.send = function (draft, options) {
|
|
47
|
-
var _this = this;
|
|
48
|
-
var body = draft.saveRequestBody();
|
|
49
|
-
if (options.tracking) {
|
|
50
|
-
body['tracking'] = options.tracking;
|
|
51
|
-
}
|
|
52
|
-
var _a = Outbox.validateAndFormatDateTime(options.sendAt, options.retryLimitDatetime), sendAt = _a[0], retryLimitDatetime = _a[1];
|
|
53
|
-
body['send_at'] = sendAt;
|
|
54
|
-
body['retry_limit_datetime'] = retryLimitDatetime;
|
|
55
|
-
return this.request({
|
|
56
|
-
method: 'POST',
|
|
57
|
-
path: '',
|
|
58
|
-
body: body,
|
|
59
|
-
})
|
|
60
|
-
.then(function (json) {
|
|
61
|
-
var message = new outbox_job_status_1.default(_this.connection).fromJSON(json);
|
|
62
|
-
if (options.callback) {
|
|
63
|
-
options.callback(null, message);
|
|
64
|
-
}
|
|
65
|
-
return Promise.resolve(message);
|
|
66
|
-
})
|
|
67
|
-
.catch(function (err) {
|
|
68
|
-
if (options.callback) {
|
|
69
|
-
options.callback(err);
|
|
70
|
-
}
|
|
71
|
-
return Promise.reject(err);
|
|
72
|
-
});
|
|
73
|
-
};
|
|
74
|
-
Outbox.prototype.update = function (jobStatusId, options) {
|
|
75
|
-
var _this = this;
|
|
76
|
-
var body = {};
|
|
77
|
-
if (options.updatedMessage) {
|
|
78
|
-
body = options.updatedMessage.saveRequestBody();
|
|
79
|
-
}
|
|
80
|
-
var _a = Outbox.validateAndFormatDateTime(options.sendAt, options.retryLimitDatetime), sendAt = _a[0], retryLimitDatetime = _a[1];
|
|
81
|
-
body['send_at'] = sendAt;
|
|
82
|
-
body['retry_limit_datetime'] = retryLimitDatetime;
|
|
83
|
-
return this.request({
|
|
84
|
-
method: 'PATCH',
|
|
85
|
-
path: "/" + jobStatusId,
|
|
86
|
-
body: body,
|
|
87
|
-
}).then(function (json) {
|
|
88
|
-
var message = new outbox_job_status_1.default(_this.connection).fromJSON(json);
|
|
89
|
-
return Promise.resolve(message);
|
|
90
|
-
});
|
|
91
|
-
};
|
|
92
|
-
Outbox.prototype.delete = function (jobStatusId) {
|
|
93
|
-
return this.request({
|
|
94
|
-
method: 'DELETE',
|
|
95
|
-
path: "/" + jobStatusId,
|
|
96
|
-
});
|
|
97
|
-
};
|
|
98
|
-
Outbox.prototype.sendGridVerificationStatus = function () {
|
|
99
|
-
return this.request({
|
|
100
|
-
method: 'GET',
|
|
101
|
-
path: "/onboard/verified_status",
|
|
102
|
-
}).then(function (json) {
|
|
103
|
-
if (json.results) {
|
|
104
|
-
json = json.results;
|
|
105
|
-
}
|
|
106
|
-
var verifiedStatus = new SendGridVerifiedStatus().fromJSON(json);
|
|
107
|
-
return Promise.resolve(verifiedStatus);
|
|
108
|
-
});
|
|
109
|
-
};
|
|
110
|
-
Outbox.prototype.deleteSendGridSubUser = function (email) {
|
|
111
|
-
return this.request({
|
|
112
|
-
method: 'DELETE',
|
|
113
|
-
path: "/onboard/subuser",
|
|
114
|
-
body: { email: email },
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
Outbox.prototype.request = function (options) {
|
|
118
|
-
var header;
|
|
119
|
-
if (options.body) {
|
|
120
|
-
header = {
|
|
121
|
-
'Content-Type': 'application/json',
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
return this.connection.request({
|
|
125
|
-
method: options.method,
|
|
126
|
-
path: "" + this.path + options.path,
|
|
127
|
-
body: options.body,
|
|
128
|
-
headers: header,
|
|
129
|
-
authMethod: nylas_connection_1.AuthMethod.BEARER,
|
|
130
|
-
});
|
|
131
|
-
};
|
|
132
|
-
Outbox.validateAndFormatDateTime = function (sendAt, retryLimitDatetime) {
|
|
133
|
-
var sendAtEpoch = sendAt instanceof Date ? Outbox.dateToEpoch(sendAt) : sendAt;
|
|
134
|
-
var retryLimitDatetimeEpoch = retryLimitDatetime instanceof Date
|
|
135
|
-
? Outbox.dateToEpoch(retryLimitDatetime)
|
|
136
|
-
: retryLimitDatetime;
|
|
137
|
-
if (sendAtEpoch && sendAtEpoch !== 0) {
|
|
138
|
-
if (sendAtEpoch < Outbox.dateToEpoch(new Date())) {
|
|
139
|
-
throw new Error('Cannot set message to be sent at a time before the current time.');
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
if (retryLimitDatetimeEpoch && retryLimitDatetimeEpoch !== 0) {
|
|
143
|
-
var validSendAt = sendAtEpoch;
|
|
144
|
-
if (!validSendAt || validSendAt === 0) {
|
|
145
|
-
validSendAt = Outbox.dateToEpoch(new Date());
|
|
146
|
-
}
|
|
147
|
-
if (retryLimitDatetimeEpoch < validSendAt) {
|
|
148
|
-
throw new Error('Cannot set message to stop retrying before time to send at.');
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return [sendAtEpoch, retryLimitDatetimeEpoch];
|
|
152
|
-
};
|
|
153
|
-
Outbox.dateToEpoch = function (date) {
|
|
154
|
-
return Math.floor(date.getTime() / 1000.0);
|
|
155
|
-
};
|
|
156
|
-
return Outbox;
|
|
157
|
-
}());
|
|
158
|
-
exports.default = Outbox;
|
package/lib/models/resource.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import RestfulModel from './restful-model';
|
|
2
|
-
import { Attribute } from './attributes';
|
|
3
|
-
import NylasConnection from '../nylas-connection';
|
|
4
|
-
export declare type ResourceProperties = {
|
|
5
|
-
email: string;
|
|
6
|
-
name: string;
|
|
7
|
-
capacity: string;
|
|
8
|
-
building: string;
|
|
9
|
-
floorNumber: string;
|
|
10
|
-
floorName?: string;
|
|
11
|
-
};
|
|
12
|
-
export default class Resource extends RestfulModel {
|
|
13
|
-
email: string;
|
|
14
|
-
name: string;
|
|
15
|
-
capacity: string;
|
|
16
|
-
building: string;
|
|
17
|
-
floorNumber: string;
|
|
18
|
-
floorName?: string;
|
|
19
|
-
static collectionName: string;
|
|
20
|
-
static attributes: Record<string, Attribute>;
|
|
21
|
-
constructor(connection: NylasConnection, props?: ResourceProperties);
|
|
22
|
-
}
|
package/lib/models/resource.js
DELETED
|
@@ -1,66 +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 restful_model_1 = __importDefault(require("./restful-model"));
|
|
20
|
-
var attributes_1 = __importDefault(require("./attributes"));
|
|
21
|
-
var Resource = /** @class */ (function (_super) {
|
|
22
|
-
__extends(Resource, _super);
|
|
23
|
-
function Resource(connection, props) {
|
|
24
|
-
var _this = _super.call(this, connection, props) || this;
|
|
25
|
-
_this.email = '';
|
|
26
|
-
_this.name = '';
|
|
27
|
-
_this.capacity = '';
|
|
28
|
-
_this.building = '';
|
|
29
|
-
_this.floorNumber = '';
|
|
30
|
-
_this.initAttributes(props);
|
|
31
|
-
return _this;
|
|
32
|
-
}
|
|
33
|
-
Resource.collectionName = 'resources';
|
|
34
|
-
Resource.attributes = {
|
|
35
|
-
object: attributes_1.default.String({
|
|
36
|
-
modelKey: 'object',
|
|
37
|
-
readOnly: true,
|
|
38
|
-
}),
|
|
39
|
-
email: attributes_1.default.String({
|
|
40
|
-
modelKey: 'email',
|
|
41
|
-
}),
|
|
42
|
-
name: attributes_1.default.String({
|
|
43
|
-
modelKey: 'name',
|
|
44
|
-
}),
|
|
45
|
-
capacity: attributes_1.default.String({
|
|
46
|
-
modelKey: 'capacity',
|
|
47
|
-
readOnly: true,
|
|
48
|
-
}),
|
|
49
|
-
building: attributes_1.default.String({
|
|
50
|
-
modelKey: 'building',
|
|
51
|
-
readOnly: true,
|
|
52
|
-
}),
|
|
53
|
-
floorName: attributes_1.default.String({
|
|
54
|
-
modelKey: 'floorName',
|
|
55
|
-
jsonKey: 'floor_name',
|
|
56
|
-
readOnly: true,
|
|
57
|
-
}),
|
|
58
|
-
floorNumber: attributes_1.default.String({
|
|
59
|
-
modelKey: 'floorNumber',
|
|
60
|
-
jsonKey: 'floor_number',
|
|
61
|
-
readOnly: true,
|
|
62
|
-
}),
|
|
63
|
-
};
|
|
64
|
-
return Resource;
|
|
65
|
-
}(restful_model_1.default));
|
|
66
|
-
exports.default = Resource;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import NylasConnection from '../nylas-connection';
|
|
2
|
-
import RestfulModel from './restful-model';
|
|
3
|
-
import ModelCollection from './model-collection';
|
|
4
|
-
export declare type GetCallback = (error: Error | null, result?: RestfulModel) => void;
|
|
5
|
-
export default class RestfulModelCollection<T extends RestfulModel> extends ModelCollection<any> {
|
|
6
|
-
modelClass: typeof RestfulModel;
|
|
7
|
-
constructor(modelClass: typeof RestfulModel, connection: NylasConnection);
|
|
8
|
-
count(params?: Record<string, unknown>, callback?: (err: Error | null, num?: number) => void): Promise<number>;
|
|
9
|
-
first(params?: Record<string, unknown>, callback?: (error: Error | null, model?: T) => void): Promise<T>;
|
|
10
|
-
search(query: string, params?: Record<string, unknown>, callback?: (error: Error | null) => void): Promise<T[]>;
|
|
11
|
-
delete(itemOrId: T | string, params?: Record<string, unknown>, callback?: (error: Error | null) => void): any;
|
|
12
|
-
deleteItem(options: Record<string, any>, callbackArg?: (error: Error | null) => void): any;
|
|
13
|
-
protected build(args: Record<string, unknown>): T;
|
|
14
|
-
protected createModel(json: Record<string, unknown>): T;
|
|
15
|
-
}
|
|
@@ -1,169 +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 message_1 = __importDefault(require("./message"));
|
|
31
|
-
var thread_1 = __importDefault(require("./thread"));
|
|
32
|
-
var model_collection_1 = __importDefault(require("./model-collection"));
|
|
33
|
-
var RestfulModelCollection = /** @class */ (function (_super) {
|
|
34
|
-
__extends(RestfulModelCollection, _super);
|
|
35
|
-
function RestfulModelCollection(modelClass, connection) {
|
|
36
|
-
var _this = _super.call(this, modelClass, connection, modelClass.collectionName) || this;
|
|
37
|
-
_this.modelClass = modelClass;
|
|
38
|
-
_this._path = "/" + _this.modelClass.collectionName;
|
|
39
|
-
return _this;
|
|
40
|
-
}
|
|
41
|
-
RestfulModelCollection.prototype.count = function (params, callback) {
|
|
42
|
-
if (params === void 0) { params = {}; }
|
|
43
|
-
return this.connection
|
|
44
|
-
.request({
|
|
45
|
-
method: 'GET',
|
|
46
|
-
path: this.path(),
|
|
47
|
-
qs: __assign({ view: 'count' }, params),
|
|
48
|
-
baseUrl: this.baseUrl,
|
|
49
|
-
})
|
|
50
|
-
.then(function (json) {
|
|
51
|
-
if (callback) {
|
|
52
|
-
callback(null, json.count);
|
|
53
|
-
}
|
|
54
|
-
return Promise.resolve(json.count);
|
|
55
|
-
})
|
|
56
|
-
.catch(function (err) {
|
|
57
|
-
if (callback) {
|
|
58
|
-
callback(err);
|
|
59
|
-
}
|
|
60
|
-
return Promise.reject(err);
|
|
61
|
-
});
|
|
62
|
-
};
|
|
63
|
-
RestfulModelCollection.prototype.first = function (params, callback) {
|
|
64
|
-
if (params === void 0) { params = {}; }
|
|
65
|
-
if (params.view == 'count') {
|
|
66
|
-
var err = new Error('first() cannot be called with the count view');
|
|
67
|
-
if (callback) {
|
|
68
|
-
callback(err);
|
|
69
|
-
}
|
|
70
|
-
return Promise.reject(err);
|
|
71
|
-
}
|
|
72
|
-
return this.getItems(params, 0, 1)
|
|
73
|
-
.then(function (items) {
|
|
74
|
-
if (callback) {
|
|
75
|
-
callback(null, items[0]);
|
|
76
|
-
}
|
|
77
|
-
return Promise.resolve(items[0]);
|
|
78
|
-
})
|
|
79
|
-
.catch(function (err) {
|
|
80
|
-
if (callback) {
|
|
81
|
-
callback(err);
|
|
82
|
-
}
|
|
83
|
-
return Promise.reject(err);
|
|
84
|
-
});
|
|
85
|
-
};
|
|
86
|
-
RestfulModelCollection.prototype.search = function (query, params, callback) {
|
|
87
|
-
if (params === void 0) { params = {}; }
|
|
88
|
-
if (this.modelClass != message_1.default && this.modelClass != thread_1.default) {
|
|
89
|
-
var err = new Error('search() can only be called for messages and threads');
|
|
90
|
-
if (callback) {
|
|
91
|
-
callback(err);
|
|
92
|
-
}
|
|
93
|
-
return Promise.reject(err);
|
|
94
|
-
}
|
|
95
|
-
if (!query) {
|
|
96
|
-
var err = new Error('search() requires a query string');
|
|
97
|
-
if (callback) {
|
|
98
|
-
callback(err);
|
|
99
|
-
}
|
|
100
|
-
return Promise.reject(err);
|
|
101
|
-
}
|
|
102
|
-
params.q = query;
|
|
103
|
-
var limit = params.limit || 40;
|
|
104
|
-
var offset = params.offset;
|
|
105
|
-
var path = this.path() + "/search";
|
|
106
|
-
return this.range({ params: params, offset: offset, limit: limit, path: path });
|
|
107
|
-
};
|
|
108
|
-
RestfulModelCollection.prototype.delete = function (itemOrId, params, callback) {
|
|
109
|
-
if (params === void 0) { params = {}; }
|
|
110
|
-
if (!itemOrId) {
|
|
111
|
-
var err = new Error('delete() requires an item or an id');
|
|
112
|
-
if (callback) {
|
|
113
|
-
callback(err);
|
|
114
|
-
}
|
|
115
|
-
return Promise.reject(err);
|
|
116
|
-
}
|
|
117
|
-
if (typeof params === 'function') {
|
|
118
|
-
callback = params;
|
|
119
|
-
params = {};
|
|
120
|
-
}
|
|
121
|
-
var item = typeof itemOrId === 'string' ? this.build({ id: itemOrId }) : itemOrId;
|
|
122
|
-
var options = item.deleteRequestOptions(params);
|
|
123
|
-
options.item = item;
|
|
124
|
-
return this.deleteItem(options, callback);
|
|
125
|
-
};
|
|
126
|
-
RestfulModelCollection.prototype.deleteItem = function (options, callbackArg) {
|
|
127
|
-
var item = options.item;
|
|
128
|
-
// callback used to be in the options object
|
|
129
|
-
var callback = options.callback ? options.callback : callbackArg;
|
|
130
|
-
var body = options.hasOwnProperty('body')
|
|
131
|
-
? options.body
|
|
132
|
-
: item.deleteRequestBody({});
|
|
133
|
-
var qs = options.hasOwnProperty('qs')
|
|
134
|
-
? options.qs
|
|
135
|
-
: item.deleteRequestQueryString({});
|
|
136
|
-
return this.connection
|
|
137
|
-
.request({
|
|
138
|
-
method: 'DELETE',
|
|
139
|
-
qs: qs,
|
|
140
|
-
body: body,
|
|
141
|
-
path: this.path() + "/" + item.id,
|
|
142
|
-
baseUrl: this.baseUrl,
|
|
143
|
-
})
|
|
144
|
-
.then(function (data) {
|
|
145
|
-
if (callback) {
|
|
146
|
-
callback(null, data);
|
|
147
|
-
}
|
|
148
|
-
return Promise.resolve(data);
|
|
149
|
-
})
|
|
150
|
-
.catch(function (err) {
|
|
151
|
-
if (callback) {
|
|
152
|
-
callback(err);
|
|
153
|
-
}
|
|
154
|
-
return Promise.reject(err);
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
RestfulModelCollection.prototype.build = function (args) {
|
|
158
|
-
var model = this.createModel({});
|
|
159
|
-
for (var key in args) {
|
|
160
|
-
model[key] = args[key];
|
|
161
|
-
}
|
|
162
|
-
return model;
|
|
163
|
-
};
|
|
164
|
-
RestfulModelCollection.prototype.createModel = function (json) {
|
|
165
|
-
return new this.modelClass(this.connection).fromJSON(json);
|
|
166
|
-
};
|
|
167
|
-
return RestfulModelCollection;
|
|
168
|
-
}(model_collection_1.default));
|
|
169
|
-
exports.default = RestfulModelCollection;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import NylasConnection from '../nylas-connection';
|
|
2
|
-
import RestfulModel from './restful-model';
|
|
3
|
-
export default class RestfulModelInstance<T extends RestfulModel> {
|
|
4
|
-
connection: NylasConnection;
|
|
5
|
-
modelClass: typeof RestfulModel;
|
|
6
|
-
constructor(modelClass: typeof RestfulModel, connection: NylasConnection);
|
|
7
|
-
path(): string;
|
|
8
|
-
get(params?: Record<string, unknown>): Promise<T>;
|
|
9
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
var nylas_connection_1 = __importDefault(require("../nylas-connection"));
|
|
7
|
-
var RestfulModelInstance = /** @class */ (function () {
|
|
8
|
-
function RestfulModelInstance(modelClass, connection) {
|
|
9
|
-
this.modelClass = modelClass;
|
|
10
|
-
this.connection = connection;
|
|
11
|
-
if (!(this.connection instanceof nylas_connection_1.default)) {
|
|
12
|
-
throw new Error('Connection object not provided');
|
|
13
|
-
}
|
|
14
|
-
if (!this.modelClass) {
|
|
15
|
-
throw new Error('Model class not provided');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
RestfulModelInstance.prototype.path = function () {
|
|
19
|
-
return "/" + this.modelClass.endpointName;
|
|
20
|
-
};
|
|
21
|
-
RestfulModelInstance.prototype.get = function (params) {
|
|
22
|
-
var _this = this;
|
|
23
|
-
if (params === void 0) { params = {}; }
|
|
24
|
-
return this.connection
|
|
25
|
-
.request({
|
|
26
|
-
method: 'GET',
|
|
27
|
-
path: this.path(),
|
|
28
|
-
qs: params,
|
|
29
|
-
})
|
|
30
|
-
.then(function (json) {
|
|
31
|
-
var model = new _this.modelClass(_this.connection).fromJSON(json);
|
|
32
|
-
return Promise.resolve(model);
|
|
33
|
-
});
|
|
34
|
-
};
|
|
35
|
-
return RestfulModelInstance;
|
|
36
|
-
}());
|
|
37
|
-
exports.default = RestfulModelInstance;
|