nylas 5.6.0 → 5.10.0
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 +7 -7
- package/lib/config.js +1 -0
- package/lib/models/attributes.d.ts +2 -0
- package/lib/models/attributes.js +16 -0
- package/lib/models/calendar-restful-model-collection.d.ts +30 -0
- package/lib/models/calendar-restful-model-collection.js +45 -0
- package/lib/models/calendar.d.ts +2 -0
- package/lib/models/calendar.js +3 -0
- package/lib/models/component-restful-model-collection.d.ts +9 -0
- package/lib/models/component-restful-model-collection.js +34 -0
- package/lib/models/component.d.ts +16 -0
- package/lib/models/component.js +76 -0
- package/lib/models/contact.js +1 -0
- package/lib/models/event-conferencing.d.ts +24 -0
- package/lib/models/event-conferencing.js +84 -0
- package/lib/models/event-notification.d.ts +11 -0
- package/lib/models/event-notification.js +65 -0
- package/lib/models/event.d.ts +7 -0
- package/lib/models/event.js +31 -2
- package/lib/models/folder.js +1 -0
- package/lib/models/management-account.d.ts +7 -0
- package/lib/models/management-account.js +14 -0
- package/lib/models/message.d.ts +1 -0
- package/lib/models/message.js +3 -0
- package/lib/models/neural-categorizer.js +51 -4
- package/lib/models/neural-signature-contact.d.ts +5 -5
- package/lib/models/neural-signature-contact.js +17 -17
- package/lib/models/neural.d.ts +4 -5
- package/lib/models/neural.js +33 -52
- package/lib/models/restful-model-collection.d.ts +1 -0
- package/lib/models/restful-model-collection.js +5 -0
- package/lib/models/restful-model.d.ts +1 -0
- package/lib/models/restful-model.js +3 -1
- package/lib/models/scheduler-booking-request.d.ts +30 -0
- package/lib/models/scheduler-booking-request.js +133 -0
- package/lib/models/scheduler-restful-model-collection.d.ts +25 -0
- package/lib/models/scheduler-restful-model-collection.js +136 -0
- package/lib/models/scheduler-time-slot.d.ts +9 -0
- package/lib/models/scheduler-time-slot.js +52 -0
- package/lib/models/scheduler.d.ts +98 -0
- package/lib/models/scheduler.js +140 -0
- package/lib/nylas-connection.d.ts +5 -0
- package/lib/nylas-connection.js +28 -6
- package/lib/nylas.js +19 -7
- package/package.json +1 -1
- package/CHANGELOG.md +0 -200
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import ManagementModel from './management-model';
|
|
2
|
+
import { SaveCallback } from './restful-model';
|
|
2
3
|
export default class ManagementAccount extends ManagementModel {
|
|
3
4
|
billingState?: string;
|
|
4
5
|
emailAddress?: string;
|
|
@@ -6,9 +7,15 @@ export default class ManagementAccount extends ManagementModel {
|
|
|
6
7
|
provider?: string;
|
|
7
8
|
syncState?: string;
|
|
8
9
|
trial?: boolean;
|
|
10
|
+
metadata?: object;
|
|
9
11
|
upgrade(): Promise<any>;
|
|
10
12
|
downgrade(): Promise<any>;
|
|
11
13
|
revokeAll(keepAccessToken?: string): Promise<any>;
|
|
12
14
|
ipAddresses(): Promise<any>;
|
|
13
15
|
tokenInfo(accessToken?: string): Promise<any>;
|
|
16
|
+
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
17
|
+
saveRequestBody(): {
|
|
18
|
+
metadata: object | undefined;
|
|
19
|
+
};
|
|
20
|
+
saveEndpoint(): string;
|
|
14
21
|
}
|
|
@@ -78,6 +78,18 @@ var ManagementAccount = /** @class */ (function (_super) {
|
|
|
78
78
|
})
|
|
79
79
|
.catch(function (err) { return Promise.reject(err); });
|
|
80
80
|
};
|
|
81
|
+
ManagementAccount.prototype.save = function (params, callback) {
|
|
82
|
+
if (params === void 0) { params = {}; }
|
|
83
|
+
return this._save(params, callback);
|
|
84
|
+
};
|
|
85
|
+
ManagementAccount.prototype.saveRequestBody = function () {
|
|
86
|
+
return {
|
|
87
|
+
metadata: this.metadata,
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
ManagementAccount.prototype.saveEndpoint = function () {
|
|
91
|
+
return "/a/" + this.connection.clientId + "/accounts";
|
|
92
|
+
};
|
|
81
93
|
return ManagementAccount;
|
|
82
94
|
}(management_model_1.default));
|
|
83
95
|
exports.default = ManagementAccount;
|
|
@@ -98,4 +110,6 @@ ManagementAccount.attributes = __assign(__assign({}, management_model_1.default.
|
|
|
98
110
|
jsonKey: 'sync_state',
|
|
99
111
|
}), trial: attributes_1.default.Boolean({
|
|
100
112
|
modelKey: 'trial',
|
|
113
|
+
}), metadata: attributes_1.default.Object({
|
|
114
|
+
modelKey: 'metadata',
|
|
101
115
|
}) });
|
package/lib/models/message.d.ts
CHANGED
package/lib/models/message.js
CHANGED
|
@@ -95,6 +95,7 @@ var Message = /** @class */ (function (_super) {
|
|
|
95
95
|
}
|
|
96
96
|
json['starred'] = this.starred;
|
|
97
97
|
json['unread'] = this.unread;
|
|
98
|
+
json['metadata'] = this.metadata;
|
|
98
99
|
return json;
|
|
99
100
|
};
|
|
100
101
|
Message.prototype.save = function (params, callback) {
|
|
@@ -149,6 +150,8 @@ Message.attributes = __assign(__assign({}, restful_model_1.default.attributes),
|
|
|
149
150
|
}), labels: attributes_1.default.Collection({
|
|
150
151
|
modelKey: 'labels',
|
|
151
152
|
itemClass: folder_1.Label,
|
|
153
|
+
}), metadata: attributes_1.default.Object({
|
|
154
|
+
modelKey: 'metadata',
|
|
152
155
|
}), headers: attributes_1.default.Object({
|
|
153
156
|
modelKey: 'headers',
|
|
154
157
|
}) });
|
|
@@ -23,10 +23,47 @@ var __assign = (this && this.__assign) || function () {
|
|
|
23
23
|
};
|
|
24
24
|
return __assign.apply(this, arguments);
|
|
25
25
|
};
|
|
26
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
27
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
28
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
29
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
30
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
31
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
32
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
33
|
+
});
|
|
34
|
+
};
|
|
35
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
36
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
37
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
38
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
39
|
+
function step(op) {
|
|
40
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
41
|
+
while (_) try {
|
|
42
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
43
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
44
|
+
switch (op[0]) {
|
|
45
|
+
case 0: case 1: t = op; break;
|
|
46
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
47
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
48
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
49
|
+
default:
|
|
50
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
51
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
52
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
53
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
54
|
+
if (t[2]) _.ops.pop();
|
|
55
|
+
_.trys.pop(); continue;
|
|
56
|
+
}
|
|
57
|
+
op = body.call(thisArg, _);
|
|
58
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
59
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
60
|
+
}
|
|
61
|
+
};
|
|
26
62
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
63
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
64
|
};
|
|
29
65
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
66
|
+
exports.Categorize = void 0;
|
|
30
67
|
var attributes_1 = __importDefault(require("./attributes"));
|
|
31
68
|
var message_1 = __importDefault(require("./message"));
|
|
32
69
|
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
@@ -51,7 +88,7 @@ Categorize.attributes = {
|
|
|
51
88
|
category: attributes_1.default.String({
|
|
52
89
|
modelKey: 'category',
|
|
53
90
|
}),
|
|
54
|
-
categorizedAt: attributes_1.default.
|
|
91
|
+
categorizedAt: attributes_1.default.DateTime({
|
|
55
92
|
modelKey: 'categorizedAt',
|
|
56
93
|
jsonKey: 'categorized_at',
|
|
57
94
|
}),
|
|
@@ -79,9 +116,19 @@ var NeuralCategorizer = /** @class */ (function (_super) {
|
|
|
79
116
|
'Content-Type': 'application/json',
|
|
80
117
|
},
|
|
81
118
|
})
|
|
82
|
-
.then(function (json) {
|
|
83
|
-
|
|
84
|
-
|
|
119
|
+
.then(function (json) { return __awaiter(_this, void 0, void 0, function () {
|
|
120
|
+
var categorizeResponse;
|
|
121
|
+
return __generator(this, function (_a) {
|
|
122
|
+
switch (_a.label) {
|
|
123
|
+
case 0: return [4 /*yield*/, this.connection.neural.categorize([
|
|
124
|
+
json['message_id'],
|
|
125
|
+
])];
|
|
126
|
+
case 1:
|
|
127
|
+
categorizeResponse = _a.sent();
|
|
128
|
+
return [2 /*return*/, categorizeResponse[0]];
|
|
129
|
+
}
|
|
130
|
+
});
|
|
131
|
+
}); });
|
|
85
132
|
};
|
|
86
133
|
return NeuralCategorizer;
|
|
87
134
|
}(message_1.default));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import RestfulModel from './restful-model';
|
|
2
2
|
import { Contact } from './contact';
|
|
3
|
-
declare class
|
|
3
|
+
declare class Link extends RestfulModel {
|
|
4
4
|
description?: string;
|
|
5
5
|
url?: string;
|
|
6
6
|
toJSON(): {
|
|
@@ -8,7 +8,7 @@ declare class Links extends RestfulModel {
|
|
|
8
8
|
url: string | undefined;
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
|
-
declare class
|
|
11
|
+
declare class Name extends RestfulModel {
|
|
12
12
|
firstName?: string;
|
|
13
13
|
lastName?: string;
|
|
14
14
|
toJSON(): {
|
|
@@ -18,13 +18,13 @@ declare class Names extends RestfulModel {
|
|
|
18
18
|
}
|
|
19
19
|
export default class NeuralSignatureContact extends RestfulModel {
|
|
20
20
|
jobTitles?: string[];
|
|
21
|
-
links?:
|
|
21
|
+
links?: Link[];
|
|
22
22
|
phoneNumbers?: string[];
|
|
23
23
|
emails?: string[];
|
|
24
|
-
names?:
|
|
24
|
+
names?: Name[];
|
|
25
25
|
toJSON(): {
|
|
26
26
|
job_titles: string[] | undefined;
|
|
27
|
-
links:
|
|
27
|
+
links: Link[] | undefined;
|
|
28
28
|
phone_numbers: string[] | undefined;
|
|
29
29
|
emails: string[] | undefined;
|
|
30
30
|
names: {
|
|
@@ -19,21 +19,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
19
19
|
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
20
20
|
var attributes_1 = __importDefault(require("./attributes"));
|
|
21
21
|
var contact_1 = require("./contact");
|
|
22
|
-
var
|
|
23
|
-
__extends(
|
|
24
|
-
function
|
|
22
|
+
var Link = /** @class */ (function (_super) {
|
|
23
|
+
__extends(Link, _super);
|
|
24
|
+
function Link() {
|
|
25
25
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
26
|
}
|
|
27
|
-
|
|
27
|
+
Link.prototype.toJSON = function () {
|
|
28
28
|
return {
|
|
29
29
|
description: this.description,
|
|
30
30
|
url: this.url,
|
|
31
31
|
};
|
|
32
32
|
};
|
|
33
|
-
return
|
|
33
|
+
return Link;
|
|
34
34
|
}(restful_model_1.default));
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
Link.collectionName = 'link';
|
|
36
|
+
Link.attributes = {
|
|
37
37
|
description: attributes_1.default.String({
|
|
38
38
|
modelKey: 'description',
|
|
39
39
|
}),
|
|
@@ -41,21 +41,21 @@ Links.attributes = {
|
|
|
41
41
|
modelKey: 'url',
|
|
42
42
|
}),
|
|
43
43
|
};
|
|
44
|
-
var
|
|
45
|
-
__extends(
|
|
46
|
-
function
|
|
44
|
+
var Name = /** @class */ (function (_super) {
|
|
45
|
+
__extends(Name, _super);
|
|
46
|
+
function Name() {
|
|
47
47
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
48
48
|
}
|
|
49
|
-
|
|
49
|
+
Name.prototype.toJSON = function () {
|
|
50
50
|
return {
|
|
51
51
|
type: this.firstName,
|
|
52
52
|
email: this.lastName,
|
|
53
53
|
};
|
|
54
54
|
};
|
|
55
|
-
return
|
|
55
|
+
return Name;
|
|
56
56
|
}(restful_model_1.default));
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
Name.collectionName = 'name';
|
|
58
|
+
Name.attributes = {
|
|
59
59
|
firstName: attributes_1.default.String({
|
|
60
60
|
modelKey: 'firstName',
|
|
61
61
|
jsonKey: 'first_name',
|
|
@@ -125,9 +125,9 @@ NeuralSignatureContact.attributes = {
|
|
|
125
125
|
}),
|
|
126
126
|
links: attributes_1.default.Collection({
|
|
127
127
|
modelKey: 'links',
|
|
128
|
-
itemClass:
|
|
128
|
+
itemClass: Link,
|
|
129
129
|
}),
|
|
130
|
-
phoneNumbers: attributes_1.default.
|
|
130
|
+
phoneNumbers: attributes_1.default.StringList({
|
|
131
131
|
modelKey: 'phoneNumbers',
|
|
132
132
|
jsonKey: 'phone_numbers',
|
|
133
133
|
}),
|
|
@@ -136,6 +136,6 @@ NeuralSignatureContact.attributes = {
|
|
|
136
136
|
}),
|
|
137
137
|
names: attributes_1.default.Collection({
|
|
138
138
|
modelKey: 'names',
|
|
139
|
-
itemClass:
|
|
139
|
+
itemClass: Name,
|
|
140
140
|
}),
|
|
141
141
|
};
|
package/lib/models/neural.d.ts
CHANGED
|
@@ -12,12 +12,11 @@ export declare type NeuralMessageOptions = {
|
|
|
12
12
|
images_as_markdowns?: boolean;
|
|
13
13
|
};
|
|
14
14
|
export default class Neural extends RestfulModel {
|
|
15
|
-
sentimentAnalysisMessage(
|
|
15
|
+
sentimentAnalysisMessage(messageIds: string[]): Promise<NeuralSentimentAnalysis[]>;
|
|
16
16
|
sentimentAnalysisText(text: string): Promise<NeuralSentimentAnalysis>;
|
|
17
|
-
extractSignature(
|
|
17
|
+
extractSignature(messageIds: string[], parseContact?: boolean, options?: NeuralMessageOptions): Promise<NeuralSignatureExtraction[]>;
|
|
18
18
|
ocrRequest(fileId: string, pages?: number[]): Promise<NeuralOcr>;
|
|
19
|
-
categorize(
|
|
20
|
-
cleanConversation(
|
|
21
|
-
_sentimentAnalysis(body: object): Promise<NeuralSentimentAnalysis>;
|
|
19
|
+
categorize(messageIds: string[]): Promise<NeuralCategorizer[]>;
|
|
20
|
+
cleanConversation(messageIds: string[], options?: NeuralMessageOptions): Promise<NeuralCleanConversation[]>;
|
|
22
21
|
_request(path?: string, body?: object): Promise<any>;
|
|
23
22
|
}
|
package/lib/models/neural.js
CHANGED
|
@@ -26,37 +26,39 @@ var __assign = (this && this.__assign) || function () {
|
|
|
26
26
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
28
|
};
|
|
29
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
30
|
-
if (mod && mod.__esModule) return mod;
|
|
31
|
-
var result = {};
|
|
32
|
-
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
|
33
|
-
result["default"] = mod;
|
|
34
|
-
return result;
|
|
35
|
-
};
|
|
36
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
37
30
|
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
38
31
|
var neural_sentiment_analysis_1 = __importDefault(require("./neural-sentiment-analysis"));
|
|
39
32
|
var neural_signature_extraction_1 = __importDefault(require("./neural-signature-extraction"));
|
|
40
33
|
var neural_ocr_1 = __importDefault(require("./neural-ocr"));
|
|
41
|
-
var neural_categorizer_1 =
|
|
34
|
+
var neural_categorizer_1 = __importDefault(require("./neural-categorizer"));
|
|
42
35
|
var neural_clean_conversation_1 = __importDefault(require("./neural-clean-conversation"));
|
|
43
|
-
var neural_signature_contact_1 = __importDefault(require("./neural-signature-contact"));
|
|
44
36
|
var Neural = /** @class */ (function (_super) {
|
|
45
37
|
__extends(Neural, _super);
|
|
46
38
|
function Neural() {
|
|
47
39
|
return _super !== null && _super.apply(this, arguments) || this;
|
|
48
40
|
}
|
|
49
|
-
Neural.prototype.sentimentAnalysisMessage = function (
|
|
50
|
-
var
|
|
51
|
-
|
|
41
|
+
Neural.prototype.sentimentAnalysisMessage = function (messageIds) {
|
|
42
|
+
var _this = this;
|
|
43
|
+
var body = { message_id: messageIds };
|
|
44
|
+
var path = 'sentiment';
|
|
45
|
+
return this._request(path, body).then(function (jsonArray) {
|
|
46
|
+
return jsonArray.map(function (json) {
|
|
47
|
+
return new neural_sentiment_analysis_1.default(_this.connection, json);
|
|
48
|
+
});
|
|
49
|
+
});
|
|
52
50
|
};
|
|
53
51
|
Neural.prototype.sentimentAnalysisText = function (text) {
|
|
52
|
+
var _this = this;
|
|
54
53
|
var body = { text: text };
|
|
55
|
-
|
|
54
|
+
var path = 'sentiment';
|
|
55
|
+
return this._request(path, body).then(function (json) {
|
|
56
|
+
return new neural_sentiment_analysis_1.default(_this.connection, json);
|
|
57
|
+
});
|
|
56
58
|
};
|
|
57
|
-
Neural.prototype.extractSignature = function (
|
|
59
|
+
Neural.prototype.extractSignature = function (messageIds, parseContact, options) {
|
|
58
60
|
var _this = this;
|
|
59
|
-
var body = { message_id:
|
|
61
|
+
var body = { message_id: messageIds };
|
|
60
62
|
var path = 'signature';
|
|
61
63
|
if (options) {
|
|
62
64
|
body = __assign(__assign({}, body), options);
|
|
@@ -64,15 +66,10 @@ var Neural = /** @class */ (function (_super) {
|
|
|
64
66
|
if (parseContact) {
|
|
65
67
|
body['parse_contact'] = parseContact;
|
|
66
68
|
}
|
|
67
|
-
return this._request(path, body).then(function (
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
}
|
|
71
|
-
var signature = new neural_signature_extraction_1.default(_this.connection, json);
|
|
72
|
-
if (parseContact !== false) {
|
|
73
|
-
signature.contacts = new neural_signature_contact_1.default(_this.connection, signature.contacts);
|
|
74
|
-
}
|
|
75
|
-
return signature;
|
|
69
|
+
return this._request(path, body).then(function (jsonArray) {
|
|
70
|
+
return jsonArray.map(function (json) {
|
|
71
|
+
return new neural_signature_extraction_1.default(_this.connection, json);
|
|
72
|
+
});
|
|
76
73
|
});
|
|
77
74
|
};
|
|
78
75
|
Neural.prototype.ocrRequest = function (fileId, pages) {
|
|
@@ -86,43 +83,27 @@ var Neural = /** @class */ (function (_super) {
|
|
|
86
83
|
return new neural_ocr_1.default(_this.connection, json);
|
|
87
84
|
});
|
|
88
85
|
};
|
|
89
|
-
Neural.prototype.categorize = function (
|
|
86
|
+
Neural.prototype.categorize = function (messageIds) {
|
|
90
87
|
var _this = this;
|
|
91
|
-
var body = { message_id:
|
|
88
|
+
var body = { message_id: messageIds };
|
|
92
89
|
var path = 'categorize';
|
|
93
|
-
return this._request(path, body).then(function (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
97
|
-
var category = new neural_categorizer_1.default(_this.connection, json);
|
|
98
|
-
category.categorizer = new neural_categorizer_1.Categorize(_this.connection, category.categorizer);
|
|
99
|
-
return category;
|
|
90
|
+
return this._request(path, body).then(function (jsonArray) {
|
|
91
|
+
return jsonArray.map(function (json) {
|
|
92
|
+
return new neural_categorizer_1.default(_this.connection, json);
|
|
93
|
+
});
|
|
100
94
|
});
|
|
101
95
|
};
|
|
102
|
-
Neural.prototype.cleanConversation = function (
|
|
96
|
+
Neural.prototype.cleanConversation = function (messageIds, options) {
|
|
103
97
|
var _this = this;
|
|
104
|
-
var body = { message_id:
|
|
98
|
+
var body = { message_id: messageIds };
|
|
105
99
|
var path = 'conversation';
|
|
106
100
|
if (options) {
|
|
107
101
|
body = __assign(__assign({}, body), options);
|
|
108
102
|
}
|
|
109
|
-
return this._request(path, body).then(function (
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
json = json[0];
|
|
114
|
-
}
|
|
115
|
-
return new neural_clean_conversation_1.default(_this.connection, json);
|
|
116
|
-
});
|
|
117
|
-
};
|
|
118
|
-
Neural.prototype._sentimentAnalysis = function (body) {
|
|
119
|
-
var _this = this;
|
|
120
|
-
var path = 'sentiment';
|
|
121
|
-
return this._request(path, body).then(function (json) {
|
|
122
|
-
if (Array.isArray(json)) {
|
|
123
|
-
json = json[0];
|
|
124
|
-
}
|
|
125
|
-
return new neural_sentiment_analysis_1.default(_this.connection, json);
|
|
103
|
+
return this._request(path, body).then(function (jsonArray) {
|
|
104
|
+
return jsonArray.map(function (json) {
|
|
105
|
+
return new neural_clean_conversation_1.default(_this.connection, json);
|
|
106
|
+
});
|
|
126
107
|
});
|
|
127
108
|
};
|
|
128
109
|
Neural.prototype._request = function (path, body) {
|
|
@@ -4,6 +4,7 @@ export declare type GetCallback = (error: Error | null, result?: RestfulModel) =
|
|
|
4
4
|
export default class RestfulModelCollection<T extends RestfulModel> {
|
|
5
5
|
connection: NylasConnection;
|
|
6
6
|
modelClass: typeof RestfulModel;
|
|
7
|
+
baseUrl?: string;
|
|
7
8
|
constructor(modelClass: typeof RestfulModel, connection: NylasConnection);
|
|
8
9
|
forEach(params: {
|
|
9
10
|
[key: string]: any;
|
|
@@ -70,6 +70,7 @@ var RestfulModelCollection = /** @class */ (function () {
|
|
|
70
70
|
method: 'GET',
|
|
71
71
|
path: this.path(),
|
|
72
72
|
qs: __assign({ view: 'count' }, params),
|
|
73
|
+
baseUrl: this.baseUrl,
|
|
73
74
|
})
|
|
74
75
|
.then(function (json) {
|
|
75
76
|
if (callback) {
|
|
@@ -220,6 +221,7 @@ var RestfulModelCollection = /** @class */ (function () {
|
|
|
220
221
|
qs: qs,
|
|
221
222
|
body: body,
|
|
222
223
|
path: this.path() + "/" + item.id,
|
|
224
|
+
baseUrl: this.baseUrl,
|
|
223
225
|
})
|
|
224
226
|
.then(function (data) {
|
|
225
227
|
if (callback) {
|
|
@@ -284,6 +286,7 @@ var RestfulModelCollection = /** @class */ (function () {
|
|
|
284
286
|
method: 'GET',
|
|
285
287
|
path: path,
|
|
286
288
|
qs: __assign(__assign({}, params), { offset: offset, limit: limit }),
|
|
289
|
+
baseUrl: this.baseUrl,
|
|
287
290
|
});
|
|
288
291
|
}
|
|
289
292
|
return this._getModelCollection(params, offset, limit, path);
|
|
@@ -299,6 +302,7 @@ var RestfulModelCollection = /** @class */ (function () {
|
|
|
299
302
|
method: 'GET',
|
|
300
303
|
path: this.path() + "/" + id,
|
|
301
304
|
qs: params,
|
|
305
|
+
baseUrl: this.baseUrl,
|
|
302
306
|
})
|
|
303
307
|
.then(function (json) {
|
|
304
308
|
var model = _this._createModel(json);
|
|
@@ -312,6 +316,7 @@ var RestfulModelCollection = /** @class */ (function () {
|
|
|
312
316
|
method: 'GET',
|
|
313
317
|
path: path,
|
|
314
318
|
qs: __assign(__assign({}, params), { offset: offset, limit: limit }),
|
|
319
|
+
baseUrl: this.baseUrl,
|
|
315
320
|
})
|
|
316
321
|
.then(function (jsonArray) {
|
|
317
322
|
var models = jsonArray.map(function (json) {
|
|
@@ -37,7 +37,7 @@ var RestfulModel = /** @class */ (function () {
|
|
|
37
37
|
var json = {};
|
|
38
38
|
var attributes = this.attributes();
|
|
39
39
|
for (var attrName in attributes) {
|
|
40
|
-
if (!
|
|
40
|
+
if (!attributes[attrName].readOnly || enforceReadOnly !== true) {
|
|
41
41
|
var attr = attributes[attrName];
|
|
42
42
|
json[attr.jsonKey] = attr.toJSON(this[attrName]);
|
|
43
43
|
}
|
|
@@ -93,6 +93,7 @@ var RestfulModel = /** @class */ (function () {
|
|
|
93
93
|
path: this.id
|
|
94
94
|
? this.saveEndpoint() + "/" + this.id
|
|
95
95
|
: "" + this.saveEndpoint(),
|
|
96
|
+
baseUrl: this.baseUrl,
|
|
96
97
|
})
|
|
97
98
|
.then(function (json) {
|
|
98
99
|
_this.fromJSON(json);
|
|
@@ -117,6 +118,7 @@ var RestfulModel = /** @class */ (function () {
|
|
|
117
118
|
method: 'GET',
|
|
118
119
|
path: "/" + collectionName + "/" + this.id + pathSuffix,
|
|
119
120
|
qs: params,
|
|
121
|
+
baseUrl: this.baseUrl,
|
|
120
122
|
})
|
|
121
123
|
.then(function (response) {
|
|
122
124
|
if (callback) {
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import RestfulModel from './restful-model';
|
|
2
|
+
import SchedulerTimeSlot from './scheduler-time-slot';
|
|
3
|
+
export declare class SchedulerBookingConfirmation extends RestfulModel {
|
|
4
|
+
id?: string;
|
|
5
|
+
accountId?: string;
|
|
6
|
+
additionalFieldValues?: object;
|
|
7
|
+
calendarEventId?: string;
|
|
8
|
+
calendarId?: string;
|
|
9
|
+
editHash?: string;
|
|
10
|
+
startTime?: Date;
|
|
11
|
+
endTime?: Date;
|
|
12
|
+
isConfirmed?: boolean;
|
|
13
|
+
location?: string;
|
|
14
|
+
recipientEmail?: string;
|
|
15
|
+
recipientLocale?: string;
|
|
16
|
+
recipientName?: string;
|
|
17
|
+
recipientTz?: string;
|
|
18
|
+
title?: string;
|
|
19
|
+
}
|
|
20
|
+
export default class SchedulerBookingRequest extends RestfulModel {
|
|
21
|
+
additionalEmails?: string[];
|
|
22
|
+
additionalValues?: object;
|
|
23
|
+
email?: string;
|
|
24
|
+
locale?: string;
|
|
25
|
+
name?: string;
|
|
26
|
+
pageHostname?: string;
|
|
27
|
+
replacesBookingHash?: string;
|
|
28
|
+
slot?: SchedulerTimeSlot;
|
|
29
|
+
timezone?: string;
|
|
30
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
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
|
+
exports.SchedulerBookingConfirmation = void 0;
|
|
20
|
+
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
21
|
+
var attributes_1 = __importDefault(require("./attributes"));
|
|
22
|
+
var scheduler_time_slot_1 = __importDefault(require("./scheduler-time-slot"));
|
|
23
|
+
var SchedulerBookingConfirmation = /** @class */ (function (_super) {
|
|
24
|
+
__extends(SchedulerBookingConfirmation, _super);
|
|
25
|
+
function SchedulerBookingConfirmation() {
|
|
26
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
27
|
+
}
|
|
28
|
+
return SchedulerBookingConfirmation;
|
|
29
|
+
}(restful_model_1.default));
|
|
30
|
+
exports.SchedulerBookingConfirmation = SchedulerBookingConfirmation;
|
|
31
|
+
SchedulerBookingConfirmation.collectionName = 'booking_confirmation';
|
|
32
|
+
SchedulerBookingConfirmation.attributes = {
|
|
33
|
+
id: attributes_1.default.Number({
|
|
34
|
+
modelKey: 'id',
|
|
35
|
+
}),
|
|
36
|
+
accountId: attributes_1.default.String({
|
|
37
|
+
modelKey: 'accountId',
|
|
38
|
+
jsonKey: 'account_id',
|
|
39
|
+
}),
|
|
40
|
+
additionalFieldValues: attributes_1.default.Object({
|
|
41
|
+
modelKey: 'additionalFieldValues',
|
|
42
|
+
jsonKey: 'additional_field_values',
|
|
43
|
+
}),
|
|
44
|
+
calendarEventId: attributes_1.default.String({
|
|
45
|
+
modelKey: 'calendarEventId',
|
|
46
|
+
jsonKey: 'calendar_event_id',
|
|
47
|
+
}),
|
|
48
|
+
calendarId: attributes_1.default.String({
|
|
49
|
+
modelKey: 'calendarId',
|
|
50
|
+
jsonKey: 'calendar_id',
|
|
51
|
+
}),
|
|
52
|
+
editHash: attributes_1.default.String({
|
|
53
|
+
modelKey: 'editHash',
|
|
54
|
+
jsonKey: 'edit_hash',
|
|
55
|
+
}),
|
|
56
|
+
startTime: attributes_1.default.DateTime({
|
|
57
|
+
modelKey: 'startTime',
|
|
58
|
+
jsonKey: 'start_time',
|
|
59
|
+
}),
|
|
60
|
+
endTime: attributes_1.default.DateTime({
|
|
61
|
+
modelKey: 'endTime',
|
|
62
|
+
jsonKey: 'end_time',
|
|
63
|
+
}),
|
|
64
|
+
isConfirmed: attributes_1.default.Boolean({
|
|
65
|
+
modelKey: 'isConfirmed',
|
|
66
|
+
jsonKey: 'is_confirmed',
|
|
67
|
+
}),
|
|
68
|
+
location: attributes_1.default.String({
|
|
69
|
+
modelKey: 'location',
|
|
70
|
+
}),
|
|
71
|
+
recipientEmail: attributes_1.default.String({
|
|
72
|
+
modelKey: 'recipientEmail',
|
|
73
|
+
jsonKey: 'recipient_email',
|
|
74
|
+
}),
|
|
75
|
+
recipientLocale: attributes_1.default.String({
|
|
76
|
+
modelKey: 'recipientLocale',
|
|
77
|
+
jsonKey: 'recipient_locale',
|
|
78
|
+
}),
|
|
79
|
+
recipientName: attributes_1.default.String({
|
|
80
|
+
modelKey: 'recipientName',
|
|
81
|
+
jsonKey: 'recipient_name',
|
|
82
|
+
}),
|
|
83
|
+
recipientTz: attributes_1.default.String({
|
|
84
|
+
modelKey: 'recipientTz',
|
|
85
|
+
jsonKey: 'recipient_tz',
|
|
86
|
+
}),
|
|
87
|
+
title: attributes_1.default.String({
|
|
88
|
+
modelKey: 'title',
|
|
89
|
+
}),
|
|
90
|
+
};
|
|
91
|
+
var SchedulerBookingRequest = /** @class */ (function (_super) {
|
|
92
|
+
__extends(SchedulerBookingRequest, _super);
|
|
93
|
+
function SchedulerBookingRequest() {
|
|
94
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
95
|
+
}
|
|
96
|
+
return SchedulerBookingRequest;
|
|
97
|
+
}(restful_model_1.default));
|
|
98
|
+
exports.default = SchedulerBookingRequest;
|
|
99
|
+
SchedulerBookingRequest.collectionName = 'booking_request';
|
|
100
|
+
SchedulerBookingRequest.attributes = {
|
|
101
|
+
additionalEmails: attributes_1.default.StringList({
|
|
102
|
+
modelKey: 'additionalEmails',
|
|
103
|
+
jsonKey: 'additional_emails',
|
|
104
|
+
}),
|
|
105
|
+
additionalValues: attributes_1.default.Object({
|
|
106
|
+
modelKey: 'additionalValues',
|
|
107
|
+
jsonKey: 'additional_values',
|
|
108
|
+
}),
|
|
109
|
+
email: attributes_1.default.String({
|
|
110
|
+
modelKey: 'email',
|
|
111
|
+
}),
|
|
112
|
+
locale: attributes_1.default.String({
|
|
113
|
+
modelKey: 'locale',
|
|
114
|
+
}),
|
|
115
|
+
name: attributes_1.default.String({
|
|
116
|
+
modelKey: 'name',
|
|
117
|
+
}),
|
|
118
|
+
pageHostname: attributes_1.default.String({
|
|
119
|
+
modelKey: 'pageHostname',
|
|
120
|
+
jsonKey: 'page_hostname',
|
|
121
|
+
}),
|
|
122
|
+
replacesBookingHash: attributes_1.default.String({
|
|
123
|
+
modelKey: 'replacesBookingHash',
|
|
124
|
+
jsonKey: 'replaces_booking_hash',
|
|
125
|
+
}),
|
|
126
|
+
slot: attributes_1.default.Object({
|
|
127
|
+
modelKey: 'slot',
|
|
128
|
+
itemClass: scheduler_time_slot_1.default,
|
|
129
|
+
}),
|
|
130
|
+
timezone: attributes_1.default.String({
|
|
131
|
+
modelKey: 'timezone',
|
|
132
|
+
}),
|
|
133
|
+
};
|