nylas 6.1.0 → 6.2.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/lib/models/attributes.d.ts +8 -8
- package/lib/models/attributes.js +14 -16
- package/lib/models/connect.d.ts +1 -2
- package/lib/models/connect.js +2 -2
- package/lib/models/delta-collection.d.ts +17 -0
- package/lib/models/delta-collection.js +139 -0
- package/lib/models/delta-stream.d.ts +11 -7
- package/lib/models/delta-stream.js +29 -4
- package/lib/models/delta.d.ts +22 -6
- package/lib/models/delta.js +77 -79
- package/lib/models/deltas.d.ts +17 -0
- package/lib/models/deltas.js +49 -0
- package/lib/models/draft.d.ts +2 -0
- package/lib/models/draft.js +8 -1
- package/lib/models/message-restful-model-collection.d.ts +20 -0
- package/lib/models/message-restful-model-collection.js +58 -0
- package/lib/models/outbox-job-status.d.ts +21 -0
- package/lib/models/outbox-job-status.js +70 -0
- package/lib/models/outbox-message.d.ts +16 -0
- package/lib/models/outbox-message.js +54 -0
- package/lib/models/outbox.d.ts +35 -0
- package/lib/models/outbox.js +158 -0
- package/lib/models/scheduler.d.ts +7 -2
- package/lib/models/scheduler.js +13 -1
- package/lib/models/webhook-notification.d.ts +108 -0
- package/lib/models/webhook-notification.js +239 -0
- package/lib/models/webhook.d.ts +23 -0
- package/lib/models/webhook.js +24 -0
- package/lib/nylas-connection.d.ts +11 -4
- package/lib/nylas-connection.js +23 -7
- package/package.json +1 -1
|
@@ -0,0 +1,49 @@
|
|
|
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 model_1 = __importDefault(require("./model"));
|
|
20
|
+
var attributes_1 = __importDefault(require("./attributes"));
|
|
21
|
+
var delta_1 = __importDefault(require("./delta"));
|
|
22
|
+
var Deltas = /** @class */ (function (_super) {
|
|
23
|
+
__extends(Deltas, _super);
|
|
24
|
+
function Deltas(connection, props) {
|
|
25
|
+
var _this = _super.call(this) || this;
|
|
26
|
+
_this.cursorStart = '';
|
|
27
|
+
_this.cursorEnd = '';
|
|
28
|
+
_this.deltas = [];
|
|
29
|
+
_this.connection = connection;
|
|
30
|
+
_this.initAttributes(props);
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
Deltas.attributes = {
|
|
34
|
+
cursorStart: attributes_1.default.String({
|
|
35
|
+
modelKey: 'cursorStart',
|
|
36
|
+
jsonKey: 'cursor_start',
|
|
37
|
+
}),
|
|
38
|
+
cursorEnd: attributes_1.default.String({
|
|
39
|
+
modelKey: 'cursorEnd',
|
|
40
|
+
jsonKey: 'cursor_end',
|
|
41
|
+
}),
|
|
42
|
+
deltas: attributes_1.default.Collection({
|
|
43
|
+
modelKey: 'deltas',
|
|
44
|
+
itemClass: delta_1.default,
|
|
45
|
+
}),
|
|
46
|
+
};
|
|
47
|
+
return Deltas;
|
|
48
|
+
}(model_1.default));
|
|
49
|
+
exports.Deltas = Deltas;
|
package/lib/models/draft.d.ts
CHANGED
|
@@ -12,9 +12,11 @@ export default class Draft extends Message implements DraftProperties {
|
|
|
12
12
|
rawMime?: string;
|
|
13
13
|
replyToMessageId?: string;
|
|
14
14
|
version?: number;
|
|
15
|
+
fileIdsToAttach?: string[];
|
|
15
16
|
static collectionName: string;
|
|
16
17
|
static attributes: Record<string, Attribute>;
|
|
17
18
|
constructor(connection: NylasConnection, props?: DraftProperties);
|
|
19
|
+
fileIds(): (string | undefined)[];
|
|
18
20
|
toJSON(enforceReadOnly?: boolean): Record<string, any>;
|
|
19
21
|
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
20
22
|
saveRequestBody(): Record<string, unknown>;
|
package/lib/models/draft.js
CHANGED
|
@@ -36,12 +36,19 @@ var Draft = /** @class */ (function (_super) {
|
|
|
36
36
|
_this.initAttributes(props);
|
|
37
37
|
return _this;
|
|
38
38
|
}
|
|
39
|
+
Draft.prototype.fileIds = function () {
|
|
40
|
+
var fileIds = _super.prototype.fileIds.call(this);
|
|
41
|
+
if (this.fileIdsToAttach) {
|
|
42
|
+
fileIds = Array.from(new Set(fileIds.concat(this.fileIdsToAttach)));
|
|
43
|
+
}
|
|
44
|
+
return fileIds;
|
|
45
|
+
};
|
|
39
46
|
Draft.prototype.toJSON = function (enforceReadOnly) {
|
|
40
47
|
if (this.rawMime) {
|
|
41
48
|
throw Error('toJSON() cannot be called for raw MIME drafts');
|
|
42
49
|
}
|
|
43
50
|
var json = _super.prototype.toJSON.call(this, enforceReadOnly);
|
|
44
|
-
json.file_ids =
|
|
51
|
+
json.file_ids = this.fileIds();
|
|
45
52
|
return json;
|
|
46
53
|
};
|
|
47
54
|
Draft.prototype.save = function (params, callback) {
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import RestfulModelCollection from './restful-model-collection';
|
|
2
|
+
import Message from './message';
|
|
3
|
+
import NylasConnection from '../nylas-connection';
|
|
4
|
+
export default class MessageRestfulModelCollection extends RestfulModelCollection<Message> {
|
|
5
|
+
connection: NylasConnection;
|
|
6
|
+
modelClass: typeof Message;
|
|
7
|
+
constructor(connection: NylasConnection);
|
|
8
|
+
/**
|
|
9
|
+
* Return Multiple Messages by a list of Message IDs.
|
|
10
|
+
* @param messageIds The list of message ids to find.
|
|
11
|
+
* @param options Additional options including: view, offset, limit, and callback
|
|
12
|
+
* @returns The list of messages.
|
|
13
|
+
*/
|
|
14
|
+
findMultiple(messageIds: string[], options?: {
|
|
15
|
+
view?: string;
|
|
16
|
+
offset?: number;
|
|
17
|
+
limit?: number;
|
|
18
|
+
callback?: (error: Error | null, results?: Message[]) => void;
|
|
19
|
+
}): Promise<Message[]>;
|
|
20
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
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_collection_1 = __importDefault(require("./restful-model-collection"));
|
|
31
|
+
var message_1 = __importDefault(require("./message"));
|
|
32
|
+
var MessageRestfulModelCollection = /** @class */ (function (_super) {
|
|
33
|
+
__extends(MessageRestfulModelCollection, _super);
|
|
34
|
+
function MessageRestfulModelCollection(connection) {
|
|
35
|
+
var _this = _super.call(this, message_1.default, connection) || this;
|
|
36
|
+
_this.connection = connection;
|
|
37
|
+
_this.modelClass = message_1.default;
|
|
38
|
+
return _this;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Return Multiple Messages by a list of Message IDs.
|
|
42
|
+
* @param messageIds The list of message ids to find.
|
|
43
|
+
* @param options Additional options including: view, offset, limit, and callback
|
|
44
|
+
* @returns The list of messages.
|
|
45
|
+
*/
|
|
46
|
+
MessageRestfulModelCollection.prototype.findMultiple = function (messageIds, options) {
|
|
47
|
+
if (options && options.view) {
|
|
48
|
+
// view is a parameter, so move it into a params object
|
|
49
|
+
options.params = {
|
|
50
|
+
view: options.view,
|
|
51
|
+
};
|
|
52
|
+
delete options.view;
|
|
53
|
+
}
|
|
54
|
+
return this.range(__assign({ path: this.path() + "/" + messageIds.join() }, options));
|
|
55
|
+
};
|
|
56
|
+
return MessageRestfulModelCollection;
|
|
57
|
+
}(restful_model_collection_1.default));
|
|
58
|
+
exports.default = MessageRestfulModelCollection;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import OutboxMessage, { OutboxMessageProperties } from './outbox-message';
|
|
2
|
+
import Model from './model';
|
|
3
|
+
import { Attribute } from './attributes';
|
|
4
|
+
import NylasConnection from '../nylas-connection';
|
|
5
|
+
export declare type OutboxJobStatusProperties = {
|
|
6
|
+
jobStatusId: string;
|
|
7
|
+
accountId: string;
|
|
8
|
+
status: string;
|
|
9
|
+
originalData?: OutboxMessageProperties;
|
|
10
|
+
};
|
|
11
|
+
export default class OutboxJobStatus extends Model implements OutboxJobStatusProperties {
|
|
12
|
+
jobStatusId: string;
|
|
13
|
+
status: string;
|
|
14
|
+
accountId: string;
|
|
15
|
+
originalData?: OutboxMessage;
|
|
16
|
+
private _connection?;
|
|
17
|
+
static attributes: Record<string, Attribute>;
|
|
18
|
+
constructor(props?: OutboxJobStatusProperties);
|
|
19
|
+
get connection(): NylasConnection | undefined;
|
|
20
|
+
fromJSON(json: Record<string, unknown>, connection?: NylasConnection): this;
|
|
21
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
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 outbox_message_1 = __importDefault(require("./outbox-message"));
|
|
20
|
+
var model_1 = __importDefault(require("./model"));
|
|
21
|
+
var attributes_1 = __importDefault(require("./attributes"));
|
|
22
|
+
var OutboxJobStatus = /** @class */ (function (_super) {
|
|
23
|
+
__extends(OutboxJobStatus, _super);
|
|
24
|
+
function OutboxJobStatus(props) {
|
|
25
|
+
var _this = _super.call(this) || this;
|
|
26
|
+
_this.jobStatusId = '';
|
|
27
|
+
_this.status = '';
|
|
28
|
+
_this.accountId = '';
|
|
29
|
+
_this.initAttributes(props);
|
|
30
|
+
return _this;
|
|
31
|
+
}
|
|
32
|
+
Object.defineProperty(OutboxJobStatus.prototype, "connection", {
|
|
33
|
+
get: function () {
|
|
34
|
+
return this._connection;
|
|
35
|
+
},
|
|
36
|
+
enumerable: true,
|
|
37
|
+
configurable: true
|
|
38
|
+
});
|
|
39
|
+
OutboxJobStatus.prototype.fromJSON = function (json, connection) {
|
|
40
|
+
// Allow a connection object to be passed in to instantiate a Calendar sub object
|
|
41
|
+
if (connection) {
|
|
42
|
+
this._connection = connection;
|
|
43
|
+
}
|
|
44
|
+
return _super.prototype.fromJSON.call(this, json);
|
|
45
|
+
};
|
|
46
|
+
OutboxJobStatus.attributes = {
|
|
47
|
+
jobStatusId: attributes_1.default.String({
|
|
48
|
+
modelKey: 'jobStatusId',
|
|
49
|
+
jsonKey: 'job_status_id',
|
|
50
|
+
readOnly: true,
|
|
51
|
+
}),
|
|
52
|
+
status: attributes_1.default.String({
|
|
53
|
+
modelKey: 'status',
|
|
54
|
+
readOnly: true,
|
|
55
|
+
}),
|
|
56
|
+
accountId: attributes_1.default.String({
|
|
57
|
+
modelKey: 'accountId',
|
|
58
|
+
jsonKey: 'account_id',
|
|
59
|
+
readOnly: true,
|
|
60
|
+
}),
|
|
61
|
+
originalData: attributes_1.default.Object({
|
|
62
|
+
modelKey: 'originalData',
|
|
63
|
+
jsonKey: 'original_data',
|
|
64
|
+
itemClass: outbox_message_1.default,
|
|
65
|
+
readOnly: true,
|
|
66
|
+
}),
|
|
67
|
+
};
|
|
68
|
+
return OutboxJobStatus;
|
|
69
|
+
}(model_1.default));
|
|
70
|
+
exports.default = OutboxJobStatus;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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;
|
|
@@ -0,0 +1,35 @@
|
|
|
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 {};
|
|
@@ -0,0 +1,158 @@
|
|
|
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().fromJSON(json, _this.connection);
|
|
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().fromJSON(json, _this.connection);
|
|
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;
|
|
@@ -34,6 +34,7 @@ export declare type SchedulerAppearanceProperties = {
|
|
|
34
34
|
showAutoschedule?: boolean;
|
|
35
35
|
showNylasBranding?: boolean;
|
|
36
36
|
showTimezoneOptions?: boolean;
|
|
37
|
+
showWeekView?: boolean;
|
|
37
38
|
submitText?: string;
|
|
38
39
|
thankYouRedirect?: string;
|
|
39
40
|
thankYouText?: string;
|
|
@@ -47,6 +48,7 @@ export declare class SchedulerAppearance extends Model implements SchedulerAppea
|
|
|
47
48
|
showAutoschedule?: boolean;
|
|
48
49
|
showNylasBranding?: boolean;
|
|
49
50
|
showTimezoneOptions?: boolean;
|
|
51
|
+
showWeekView?: boolean;
|
|
50
52
|
submitText?: string;
|
|
51
53
|
thankYouRedirect?: string;
|
|
52
54
|
thankYouText?: string;
|
|
@@ -78,13 +80,13 @@ export declare class SchedulerBookingAdditionalFields extends Model implements S
|
|
|
78
80
|
}
|
|
79
81
|
export declare type SchedulerBookingOpeningHoursProperties = {
|
|
80
82
|
accountId?: string;
|
|
81
|
-
days?: string;
|
|
83
|
+
days?: string[];
|
|
82
84
|
end?: string;
|
|
83
85
|
start?: string;
|
|
84
86
|
};
|
|
85
87
|
export declare class SchedulerBookingOpeningHours extends Model implements SchedulerBookingOpeningHoursProperties {
|
|
86
88
|
accountId?: string;
|
|
87
|
-
days?: string;
|
|
89
|
+
days?: string[];
|
|
88
90
|
end?: string;
|
|
89
91
|
start?: string;
|
|
90
92
|
static attributes: Record<string, Attribute>;
|
|
@@ -92,6 +94,7 @@ export declare class SchedulerBookingOpeningHours extends Model implements Sched
|
|
|
92
94
|
}
|
|
93
95
|
export declare type SchedulerBookingProperties = {
|
|
94
96
|
additionalFields?: SchedulerBookingAdditionalFieldsProperties[];
|
|
97
|
+
additionalGuestsHidden?: boolean;
|
|
95
98
|
availableDaysInFuture?: number;
|
|
96
99
|
calendarInviteToGuests?: boolean;
|
|
97
100
|
cancellationPolicy?: string;
|
|
@@ -107,6 +110,7 @@ export declare type SchedulerBookingProperties = {
|
|
|
107
110
|
};
|
|
108
111
|
export declare class SchedulerBooking extends Model implements SchedulerBookingProperties {
|
|
109
112
|
additionalFields?: SchedulerBookingAdditionalFields[];
|
|
113
|
+
additionalGuestsHidden?: boolean;
|
|
110
114
|
availableDaysInFuture?: number;
|
|
111
115
|
calendarInviteToGuests?: boolean;
|
|
112
116
|
cancellationPolicy?: string;
|
|
@@ -179,6 +183,7 @@ export declare class SchedulerConfig extends Model implements SchedulerConfigPro
|
|
|
179
183
|
date?: number;
|
|
180
184
|
uses?: number;
|
|
181
185
|
};
|
|
186
|
+
disableEmails?: boolean;
|
|
182
187
|
locale?: string;
|
|
183
188
|
localeForGuests?: string;
|
|
184
189
|
reminders?: SchedulerRemindersProperties[];
|
package/lib/models/scheduler.js
CHANGED
|
@@ -108,6 +108,10 @@ var SchedulerAppearance = /** @class */ (function (_super) {
|
|
|
108
108
|
modelKey: 'showTimezoneOptions',
|
|
109
109
|
jsonKey: 'show_timezone_options',
|
|
110
110
|
}),
|
|
111
|
+
showWeekView: attributes_1.default.Boolean({
|
|
112
|
+
modelKey: 'showWeekView',
|
|
113
|
+
jsonKey: 'show_week_view',
|
|
114
|
+
}),
|
|
111
115
|
submitText: attributes_1.default.String({
|
|
112
116
|
modelKey: 'submitText',
|
|
113
117
|
jsonKey: 'submit_text',
|
|
@@ -178,7 +182,7 @@ var SchedulerBookingOpeningHours = /** @class */ (function (_super) {
|
|
|
178
182
|
modelKey: 'accountId',
|
|
179
183
|
jsonKey: 'account_id',
|
|
180
184
|
}),
|
|
181
|
-
days: attributes_1.default.
|
|
185
|
+
days: attributes_1.default.StringList({
|
|
182
186
|
modelKey: 'days',
|
|
183
187
|
}),
|
|
184
188
|
end: attributes_1.default.String({
|
|
@@ -204,6 +208,10 @@ var SchedulerBooking = /** @class */ (function (_super) {
|
|
|
204
208
|
jsonKey: 'additional_fields',
|
|
205
209
|
itemClass: SchedulerBookingAdditionalFields,
|
|
206
210
|
}),
|
|
211
|
+
additionalGuestsHidden: attributes_1.default.Boolean({
|
|
212
|
+
modelKey: 'additionalGuestsHidden',
|
|
213
|
+
jsonKey: 'additional_guests_hidden',
|
|
214
|
+
}),
|
|
207
215
|
availableDaysInFuture: attributes_1.default.Number({
|
|
208
216
|
modelKey: 'availableDaysInFuture',
|
|
209
217
|
jsonKey: 'available_days_in_future',
|
|
@@ -316,6 +324,10 @@ var SchedulerConfig = /** @class */ (function (_super) {
|
|
|
316
324
|
modelKey: 'expireAfter',
|
|
317
325
|
jsonKey: 'expire_after',
|
|
318
326
|
}),
|
|
327
|
+
disableEmails: attributes_1.default.Boolean({
|
|
328
|
+
modelKey: 'disableEmails',
|
|
329
|
+
jsonKey: 'disable_emails',
|
|
330
|
+
}),
|
|
319
331
|
locale: attributes_1.default.String({
|
|
320
332
|
modelKey: 'locale',
|
|
321
333
|
}),
|