nylas 5.8.0 → 5.10.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/lib/models/attributes.d.ts +5 -2
- package/lib/models/attributes.js +28 -4
- 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 +18 -0
- package/lib/models/component.js +89 -0
- package/lib/models/event-notification.d.ts +11 -0
- package/lib/models/event-notification.js +65 -0
- package/lib/models/event-participant.js +1 -0
- package/lib/models/event.d.ts +3 -0
- package/lib/models/event.js +11 -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/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 +7 -2
- package/lib/models/scheduler-booking-request.d.ts +31 -0
- package/lib/models/scheduler-booking-request.js +147 -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 +7 -2
- package/package.json +1 -1
|
@@ -10,6 +10,7 @@ export declare class Attribute {
|
|
|
10
10
|
});
|
|
11
11
|
toJSON(val: any): any;
|
|
12
12
|
fromJSON(val: any, _parent: any): any;
|
|
13
|
+
saveRequestBody(val: any): any;
|
|
13
14
|
}
|
|
14
15
|
declare class AttributeObject extends Attribute {
|
|
15
16
|
itemClass?: typeof RestfulModel;
|
|
@@ -19,8 +20,9 @@ declare class AttributeObject extends Attribute {
|
|
|
19
20
|
itemClass?: typeof RestfulModel;
|
|
20
21
|
readOnly?: boolean;
|
|
21
22
|
});
|
|
22
|
-
toJSON(val: any): any;
|
|
23
|
+
toJSON(val: any, saveRequestBody?: boolean): any;
|
|
23
24
|
fromJSON(val: any, _parent: any): any;
|
|
25
|
+
saveRequestBody(val: any): any;
|
|
24
26
|
}
|
|
25
27
|
declare class AttributeNumber extends Attribute {
|
|
26
28
|
toJSON(val: any): any;
|
|
@@ -54,8 +56,9 @@ declare class AttributeCollection extends Attribute {
|
|
|
54
56
|
itemClass: typeof RestfulModel;
|
|
55
57
|
readOnly?: boolean;
|
|
56
58
|
});
|
|
57
|
-
toJSON(vals: any): any[];
|
|
59
|
+
toJSON(vals: any, saveRequestBody?: boolean): any[];
|
|
58
60
|
fromJSON(json: any, _parent: any): RestfulModel[];
|
|
61
|
+
saveRequestBody(val: any): any[] | undefined;
|
|
59
62
|
}
|
|
60
63
|
declare const Attributes: {
|
|
61
64
|
Number(__0: {
|
package/lib/models/attributes.js
CHANGED
|
@@ -38,6 +38,12 @@ var Attribute = /** @class */ (function () {
|
|
|
38
38
|
Attribute.prototype.fromJSON = function (val, _parent) {
|
|
39
39
|
return val || null;
|
|
40
40
|
};
|
|
41
|
+
Attribute.prototype.saveRequestBody = function (val) {
|
|
42
|
+
if (this.readOnly) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
return this.toJSON(val);
|
|
46
|
+
};
|
|
41
47
|
return Attribute;
|
|
42
48
|
}());
|
|
43
49
|
exports.Attribute = Attribute;
|
|
@@ -49,11 +55,14 @@ var AttributeObject = /** @class */ (function (_super) {
|
|
|
49
55
|
_this.itemClass = itemClass;
|
|
50
56
|
return _this;
|
|
51
57
|
}
|
|
52
|
-
AttributeObject.prototype.toJSON = function (val) {
|
|
58
|
+
AttributeObject.prototype.toJSON = function (val, saveRequestBody) {
|
|
53
59
|
if (!val) {
|
|
54
60
|
return val;
|
|
55
61
|
}
|
|
56
|
-
if (val.
|
|
62
|
+
if (saveRequestBody === true && val.saveRequestBody != null) {
|
|
63
|
+
return val.saveRequestBody();
|
|
64
|
+
}
|
|
65
|
+
else if (val.toJSON != null) {
|
|
57
66
|
return val.toJSON();
|
|
58
67
|
}
|
|
59
68
|
return val;
|
|
@@ -64,6 +73,12 @@ var AttributeObject = /** @class */ (function (_super) {
|
|
|
64
73
|
}
|
|
65
74
|
return new this.itemClass(_parent.connection, val);
|
|
66
75
|
};
|
|
76
|
+
AttributeObject.prototype.saveRequestBody = function (val) {
|
|
77
|
+
if (this.readOnly) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
return this.toJSON(val, true);
|
|
81
|
+
};
|
|
67
82
|
return AttributeObject;
|
|
68
83
|
}(Attribute));
|
|
69
84
|
var AttributeNumber = /** @class */ (function (_super) {
|
|
@@ -175,14 +190,17 @@ var AttributeCollection = /** @class */ (function (_super) {
|
|
|
175
190
|
_this.itemClass = itemClass;
|
|
176
191
|
return _this;
|
|
177
192
|
}
|
|
178
|
-
AttributeCollection.prototype.toJSON = function (vals) {
|
|
193
|
+
AttributeCollection.prototype.toJSON = function (vals, saveRequestBody) {
|
|
179
194
|
if (!vals) {
|
|
180
195
|
return [];
|
|
181
196
|
}
|
|
182
197
|
var json = [];
|
|
183
198
|
for (var _i = 0, vals_1 = vals; _i < vals_1.length; _i++) {
|
|
184
199
|
var val = vals_1[_i];
|
|
185
|
-
if (val.
|
|
200
|
+
if (saveRequestBody === true && val.saveRequestBody != null) {
|
|
201
|
+
json.push(val.saveRequestBody());
|
|
202
|
+
}
|
|
203
|
+
else if (val.toJSON != null) {
|
|
186
204
|
json.push(val.toJSON());
|
|
187
205
|
}
|
|
188
206
|
else {
|
|
@@ -203,6 +221,12 @@ var AttributeCollection = /** @class */ (function (_super) {
|
|
|
203
221
|
}
|
|
204
222
|
return objs;
|
|
205
223
|
};
|
|
224
|
+
AttributeCollection.prototype.saveRequestBody = function (val) {
|
|
225
|
+
if (this.readOnly) {
|
|
226
|
+
return;
|
|
227
|
+
}
|
|
228
|
+
return this.toJSON(val, true);
|
|
229
|
+
};
|
|
206
230
|
return AttributeCollection;
|
|
207
231
|
}(Attribute));
|
|
208
232
|
var Attributes = {
|
package/lib/models/calendar.d.ts
CHANGED
|
@@ -8,12 +8,14 @@ export default class Calendar extends RestfulModel {
|
|
|
8
8
|
timezone?: string;
|
|
9
9
|
isPrimary?: boolean;
|
|
10
10
|
jobStatusId?: string;
|
|
11
|
+
metadata?: object;
|
|
11
12
|
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
12
13
|
saveRequestBody(): {
|
|
13
14
|
name: any;
|
|
14
15
|
description: any;
|
|
15
16
|
location: any;
|
|
16
17
|
timezone: any;
|
|
18
|
+
metadata: any;
|
|
17
19
|
};
|
|
18
20
|
getJobStatus(callback?: GetCallback): Promise<import("./job-status").default>;
|
|
19
21
|
}
|
package/lib/models/calendar.js
CHANGED
|
@@ -45,6 +45,7 @@ var Calendar = /** @class */ (function (_super) {
|
|
|
45
45
|
description: calendarJSON.description,
|
|
46
46
|
location: calendarJSON.location,
|
|
47
47
|
timezone: calendarJSON.timezone,
|
|
48
|
+
metadata: calendarJSON.metadata,
|
|
48
49
|
};
|
|
49
50
|
};
|
|
50
51
|
Calendar.prototype.getJobStatus = function (callback) {
|
|
@@ -78,4 +79,6 @@ Calendar.attributes = __assign(__assign({}, restful_model_1.default.attributes),
|
|
|
78
79
|
}), jobStatusId: attributes_1.default.String({
|
|
79
80
|
modelKey: 'jobStatusId',
|
|
80
81
|
jsonKey: 'job_status_id',
|
|
82
|
+
}), metadata: attributes_1.default.Object({
|
|
83
|
+
modelKey: 'metadata',
|
|
81
84
|
}) });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import RestfulModelCollection from './restful-model-collection';
|
|
2
|
+
import NylasConnection from '../nylas-connection';
|
|
3
|
+
import Component from './component';
|
|
4
|
+
export default class ComponentRestfulModelCollection extends RestfulModelCollection<Component> {
|
|
5
|
+
connection: NylasConnection;
|
|
6
|
+
modelClass: typeof Component;
|
|
7
|
+
constructor(connection: NylasConnection);
|
|
8
|
+
path(): string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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_collection_1 = __importDefault(require("./restful-model-collection"));
|
|
20
|
+
var component_1 = __importDefault(require("./component"));
|
|
21
|
+
var ComponentRestfulModelCollection = /** @class */ (function (_super) {
|
|
22
|
+
__extends(ComponentRestfulModelCollection, _super);
|
|
23
|
+
function ComponentRestfulModelCollection(connection) {
|
|
24
|
+
var _this = _super.call(this, component_1.default, connection) || this;
|
|
25
|
+
_this.connection = connection;
|
|
26
|
+
_this.modelClass = component_1.default;
|
|
27
|
+
return _this;
|
|
28
|
+
}
|
|
29
|
+
ComponentRestfulModelCollection.prototype.path = function () {
|
|
30
|
+
return "/component/" + this.connection.clientId;
|
|
31
|
+
};
|
|
32
|
+
return ComponentRestfulModelCollection;
|
|
33
|
+
}(restful_model_collection_1.default));
|
|
34
|
+
exports.default = ComponentRestfulModelCollection;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import RestfulModel, { SaveCallback } from './restful-model';
|
|
2
|
+
export default class Component extends RestfulModel {
|
|
3
|
+
name?: string;
|
|
4
|
+
type?: string;
|
|
5
|
+
action?: number;
|
|
6
|
+
active?: boolean;
|
|
7
|
+
settings?: object;
|
|
8
|
+
allowedDomains?: string[];
|
|
9
|
+
publicAccountId?: string;
|
|
10
|
+
publicTokenId?: string;
|
|
11
|
+
publicApplicationId?: string;
|
|
12
|
+
accessToken?: string;
|
|
13
|
+
createdAt?: Date;
|
|
14
|
+
updatedAt?: Date;
|
|
15
|
+
saveEndpoint(): string;
|
|
16
|
+
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
17
|
+
saveRequestBody(): any;
|
|
18
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __assign = (this && this.__assign) || function () {
|
|
16
|
+
__assign = Object.assign || function(t) {
|
|
17
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
18
|
+
s = arguments[i];
|
|
19
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
20
|
+
t[p] = s[p];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
24
|
+
return __assign.apply(this, arguments);
|
|
25
|
+
};
|
|
26
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
27
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
28
|
+
};
|
|
29
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
+
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
31
|
+
var attributes_1 = __importDefault(require("./attributes"));
|
|
32
|
+
var Component = /** @class */ (function (_super) {
|
|
33
|
+
__extends(Component, _super);
|
|
34
|
+
function Component() {
|
|
35
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
36
|
+
}
|
|
37
|
+
Component.prototype.saveEndpoint = function () {
|
|
38
|
+
return "/component/" + this.connection.clientId;
|
|
39
|
+
};
|
|
40
|
+
Component.prototype.save = function (params, callback) {
|
|
41
|
+
if (params === void 0) { params = {}; }
|
|
42
|
+
return this._save(params, callback);
|
|
43
|
+
};
|
|
44
|
+
Component.prototype.saveRequestBody = function () {
|
|
45
|
+
var json = _super.prototype.saveRequestBody.call(this);
|
|
46
|
+
if (this.id) {
|
|
47
|
+
// Cannot cannot send these values after creation
|
|
48
|
+
delete json.access_token;
|
|
49
|
+
delete json.public_application_id;
|
|
50
|
+
delete json.type;
|
|
51
|
+
}
|
|
52
|
+
return json;
|
|
53
|
+
};
|
|
54
|
+
return Component;
|
|
55
|
+
}(restful_model_1.default));
|
|
56
|
+
exports.default = Component;
|
|
57
|
+
Component.collectionName = 'component';
|
|
58
|
+
Component.attributes = __assign(__assign({}, restful_model_1.default.attributes), { name: attributes_1.default.String({
|
|
59
|
+
modelKey: 'name',
|
|
60
|
+
}), type: attributes_1.default.String({
|
|
61
|
+
modelKey: 'type',
|
|
62
|
+
}), action: attributes_1.default.Number({
|
|
63
|
+
modelKey: 'action',
|
|
64
|
+
}), active: attributes_1.default.Boolean({
|
|
65
|
+
modelKey: 'active',
|
|
66
|
+
}), settings: attributes_1.default.Object({
|
|
67
|
+
modelKey: 'settings',
|
|
68
|
+
}), allowedDomains: attributes_1.default.StringList({
|
|
69
|
+
modelKey: 'allowedDomains',
|
|
70
|
+
jsonKey: 'allowed_domains',
|
|
71
|
+
}), publicAccountId: attributes_1.default.String({
|
|
72
|
+
modelKey: 'publicAccountId',
|
|
73
|
+
jsonKey: 'public_account_id',
|
|
74
|
+
}), publicTokenId: attributes_1.default.String({
|
|
75
|
+
modelKey: 'publicTokenId',
|
|
76
|
+
jsonKey: 'public_token_id',
|
|
77
|
+
}), publicApplicationId: attributes_1.default.String({
|
|
78
|
+
modelKey: 'publicApplicationId',
|
|
79
|
+
jsonKey: 'public_application_id',
|
|
80
|
+
}), accessToken: attributes_1.default.String({
|
|
81
|
+
modelKey: 'accessToken',
|
|
82
|
+
jsonKey: 'access_token',
|
|
83
|
+
}), createdAt: attributes_1.default.Date({
|
|
84
|
+
modelKey: 'createdAt',
|
|
85
|
+
jsonKey: 'created_at',
|
|
86
|
+
}), updatedAt: attributes_1.default.Date({
|
|
87
|
+
modelKey: 'updatedAt',
|
|
88
|
+
jsonKey: 'updated_at',
|
|
89
|
+
}) });
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import RestfulModel from './restful-model';
|
|
2
|
+
export declare class EventNotification extends RestfulModel {
|
|
3
|
+
type?: string;
|
|
4
|
+
minutesBeforeEvent?: number;
|
|
5
|
+
url?: string;
|
|
6
|
+
payload?: string;
|
|
7
|
+
subject?: string;
|
|
8
|
+
body?: string;
|
|
9
|
+
message?: string;
|
|
10
|
+
toJSON(): any;
|
|
11
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.EventNotification = void 0;
|
|
20
|
+
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
21
|
+
var attributes_1 = __importDefault(require("./attributes"));
|
|
22
|
+
var EventNotification = /** @class */ (function (_super) {
|
|
23
|
+
__extends(EventNotification, _super);
|
|
24
|
+
function EventNotification() {
|
|
25
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
26
|
+
}
|
|
27
|
+
EventNotification.prototype.toJSON = function () {
|
|
28
|
+
return {
|
|
29
|
+
type: this.type,
|
|
30
|
+
minutes_before_event: this.minutesBeforeEvent,
|
|
31
|
+
url: this.url,
|
|
32
|
+
payload: this.payload,
|
|
33
|
+
subject: this.subject,
|
|
34
|
+
body: this.body,
|
|
35
|
+
message: this.message,
|
|
36
|
+
};
|
|
37
|
+
};
|
|
38
|
+
return EventNotification;
|
|
39
|
+
}(restful_model_1.default));
|
|
40
|
+
exports.EventNotification = EventNotification;
|
|
41
|
+
EventNotification.collectionName = 'event_notification';
|
|
42
|
+
EventNotification.attributes = {
|
|
43
|
+
type: attributes_1.default.String({
|
|
44
|
+
modelKey: 'type',
|
|
45
|
+
}),
|
|
46
|
+
minutesBeforeEvent: attributes_1.default.Number({
|
|
47
|
+
modelKey: 'minutesBeforeEvent',
|
|
48
|
+
jsonKey: 'minutes_before_event',
|
|
49
|
+
}),
|
|
50
|
+
url: attributes_1.default.String({
|
|
51
|
+
modelKey: 'url',
|
|
52
|
+
}),
|
|
53
|
+
payload: attributes_1.default.String({
|
|
54
|
+
modelKey: 'payload',
|
|
55
|
+
}),
|
|
56
|
+
subject: attributes_1.default.String({
|
|
57
|
+
modelKey: 'subject',
|
|
58
|
+
}),
|
|
59
|
+
body: attributes_1.default.String({
|
|
60
|
+
modelKey: 'body',
|
|
61
|
+
}),
|
|
62
|
+
message: attributes_1.default.String({
|
|
63
|
+
modelKey: 'message',
|
|
64
|
+
}),
|
|
65
|
+
};
|
package/lib/models/event.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import RestfulModel, { SaveCallback } from './restful-model';
|
|
2
2
|
import EventParticipant from './event-participant';
|
|
3
3
|
import { EventConferencing } from './event-conferencing';
|
|
4
|
+
import { EventNotification } from './event-notification';
|
|
4
5
|
export default class Event extends RestfulModel {
|
|
5
6
|
calendarId?: string;
|
|
6
7
|
iCalUID?: string;
|
|
@@ -29,6 +30,7 @@ export default class Event extends RestfulModel {
|
|
|
29
30
|
masterEventId?: string;
|
|
30
31
|
originalStartTime?: number;
|
|
31
32
|
conferencing?: EventConferencing;
|
|
33
|
+
notifications?: EventNotification[];
|
|
32
34
|
metadata?: object;
|
|
33
35
|
jobStatusId?: string;
|
|
34
36
|
get start(): string | number | undefined;
|
|
@@ -41,5 +43,6 @@ export default class Event extends RestfulModel {
|
|
|
41
43
|
[key: string]: any;
|
|
42
44
|
};
|
|
43
45
|
save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
46
|
+
saveRequestBody(): any;
|
|
44
47
|
rsvp(status: string, comment: string, callback?: (error: Error | null, data?: Event) => void): Promise<this>;
|
|
45
48
|
}
|
package/lib/models/event.js
CHANGED
|
@@ -31,6 +31,7 @@ var restful_model_1 = __importDefault(require("./restful-model"));
|
|
|
31
31
|
var attributes_1 = __importDefault(require("./attributes"));
|
|
32
32
|
var event_participant_1 = __importDefault(require("./event-participant"));
|
|
33
33
|
var event_conferencing_1 = require("./event-conferencing");
|
|
34
|
+
var event_notification_1 = require("./event-notification");
|
|
34
35
|
var Event = /** @class */ (function (_super) {
|
|
35
36
|
__extends(Event, _super);
|
|
36
37
|
function Event() {
|
|
@@ -125,6 +126,13 @@ var Event = /** @class */ (function (_super) {
|
|
|
125
126
|
}
|
|
126
127
|
return this._save(params, callback);
|
|
127
128
|
};
|
|
129
|
+
Event.prototype.saveRequestBody = function () {
|
|
130
|
+
var json = _super.prototype.saveRequestBody.call(this);
|
|
131
|
+
if (json.when && json.when.object) {
|
|
132
|
+
delete json.when.object;
|
|
133
|
+
}
|
|
134
|
+
return json;
|
|
135
|
+
};
|
|
128
136
|
Event.prototype.rsvp = function (status, comment, callback) {
|
|
129
137
|
var _this = this;
|
|
130
138
|
return this.connection
|
|
@@ -197,6 +205,9 @@ Event.attributes = __assign(__assign({}, restful_model_1.default.attributes), {
|
|
|
197
205
|
}), conferencing: attributes_1.default.Object({
|
|
198
206
|
modelKey: 'conferencing',
|
|
199
207
|
itemClass: event_conferencing_1.EventConferencing,
|
|
208
|
+
}), notifications: attributes_1.default.Collection({
|
|
209
|
+
modelKey: 'notifications',
|
|
210
|
+
itemClass: event_notification_1.EventNotification,
|
|
200
211
|
}), metadata: attributes_1.default.Object({
|
|
201
212
|
modelKey: 'metadata',
|
|
202
213
|
}), jobStatusId: attributes_1.default.String({
|
|
@@ -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
|
}) });
|
|
@@ -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,8 +37,11 @@ var RestfulModel = /** @class */ (function () {
|
|
|
37
37
|
var json = {};
|
|
38
38
|
var attributes = this.attributes();
|
|
39
39
|
for (var attrName in attributes) {
|
|
40
|
-
|
|
41
|
-
|
|
40
|
+
var attr = attributes[attrName];
|
|
41
|
+
if (enforceReadOnly === true) {
|
|
42
|
+
json[attr.jsonKey] = attr.saveRequestBody(this[attrName]);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
42
45
|
json[attr.jsonKey] = attr.toJSON(this[attrName]);
|
|
43
46
|
}
|
|
44
47
|
}
|
|
@@ -93,6 +96,7 @@ var RestfulModel = /** @class */ (function () {
|
|
|
93
96
|
path: this.id
|
|
94
97
|
? this.saveEndpoint() + "/" + this.id
|
|
95
98
|
: "" + this.saveEndpoint(),
|
|
99
|
+
baseUrl: this.baseUrl,
|
|
96
100
|
})
|
|
97
101
|
.then(function (json) {
|
|
98
102
|
_this.fromJSON(json);
|
|
@@ -117,6 +121,7 @@ var RestfulModel = /** @class */ (function () {
|
|
|
117
121
|
method: 'GET',
|
|
118
122
|
path: "/" + collectionName + "/" + this.id + pathSuffix,
|
|
119
123
|
qs: params,
|
|
124
|
+
baseUrl: this.baseUrl,
|
|
120
125
|
})
|
|
121
126
|
.then(function (response) {
|
|
122
127
|
if (callback) {
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
toJSON(enforceReadOnly?: boolean): Record<string, any>;
|
|
31
|
+
}
|