nylas 6.0.0-canary.2 → 6.2.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/lib/config.d.ts +12 -0
- package/lib/config.js +0 -1
- package/lib/models/access-token.d.ts +18 -0
- package/lib/models/access-token.js +56 -0
- package/lib/models/account.d.ts +5 -1
- package/lib/models/account.js +26 -25
- package/lib/models/application-details.d.ts +14 -0
- package/lib/models/application-details.js +47 -0
- package/lib/models/attributes.d.ts +5 -2
- package/lib/models/attributes.js +34 -9
- package/lib/models/calendar-availability.d.ts +40 -7
- package/lib/models/calendar-availability.js +54 -24
- package/lib/models/calendar-restful-model-collection.d.ts +7 -28
- package/lib/models/calendar-restful-model-collection.js +81 -39
- package/lib/models/calendar.d.ts +6 -0
- package/lib/models/calendar.js +34 -22
- package/lib/models/component.d.ts +6 -0
- package/lib/models/component.js +43 -30
- package/lib/models/connect.d.ts +23 -24
- package/lib/models/connect.js +65 -63
- package/lib/models/contact-restful-model-collection.js +2 -14
- package/lib/models/contact.d.ts +11 -2
- package/lib/models/contact.js +145 -141
- 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 +5 -0
- package/lib/models/draft.js +18 -11
- package/lib/models/email-participant.d.ts +2 -0
- package/lib/models/email-participant.js +8 -8
- package/lib/models/event-conferencing.d.ts +5 -3
- package/lib/models/event-conferencing.js +32 -32
- package/lib/models/event-notification.d.ts +27 -0
- package/lib/models/event-notification.js +62 -0
- package/lib/models/event-participant.d.ts +6 -0
- package/lib/models/event-participant.js +19 -11
- package/lib/models/event.d.ts +22 -1
- package/lib/models/event.js +103 -58
- package/lib/models/file.d.ts +3 -1
- package/lib/models/file.js +21 -40
- package/lib/models/folder.d.ts +6 -1
- package/lib/models/folder.js +14 -11
- package/lib/models/free-busy.d.ts +19 -0
- package/lib/models/free-busy.js +51 -30
- package/lib/models/job-status.d.ts +7 -0
- package/lib/models/job-status.js +24 -12
- package/lib/models/management-account.d.ts +11 -0
- package/lib/models/management-account.js +58 -45
- package/lib/models/message-restful-model-collection.d.ts +20 -0
- package/lib/models/message-restful-model-collection.js +58 -0
- package/lib/models/message.d.ts +8 -1
- package/lib/models/message.js +63 -49
- package/lib/models/model.d.ts +1 -0
- package/lib/models/model.js +11 -4
- package/lib/models/neural-categorizer.d.ts +4 -0
- package/lib/models/neural-categorizer.js +21 -22
- package/lib/models/neural-clean-conversation.d.ts +3 -0
- package/lib/models/neural-clean-conversation.js +7 -7
- package/lib/models/neural-ocr.d.ts +3 -0
- package/lib/models/neural-ocr.js +7 -7
- package/lib/models/neural-sentiment-analysis.d.ts +3 -0
- package/lib/models/neural-sentiment-analysis.js +21 -21
- package/lib/models/neural-signature-contact.d.ts +4 -0
- package/lib/models/neural-signature-contact.js +44 -57
- package/lib/models/neural-signature-extraction.d.ts +3 -0
- package/lib/models/neural-signature-extraction.js +10 -10
- package/lib/models/neural.d.ts +2 -0
- package/lib/models/neural.js +26 -27
- package/lib/models/resource.d.ts +3 -0
- package/lib/models/resource.js +31 -31
- package/lib/models/restful-model-collection.d.ts +1 -0
- package/lib/models/restful-model-collection.js +2 -0
- package/lib/models/restful-model.d.ts +3 -1
- package/lib/models/restful-model.js +17 -21
- package/lib/models/scheduler-booking-request.d.ts +64 -0
- package/lib/models/scheduler-booking-request.js +148 -0
- package/lib/models/scheduler-restful-model-collection.d.ts +25 -0
- package/lib/models/scheduler-restful-model-collection.js +133 -0
- package/lib/models/scheduler-time-slot.d.ts +20 -0
- package/lib/models/scheduler-time-slot.js +53 -0
- package/lib/models/scheduler.d.ts +35 -2
- package/lib/models/scheduler.js +288 -235
- package/lib/models/thread.d.ts +4 -1
- package/lib/models/thread.js +58 -51
- package/lib/models/webhook-notification.d.ts +108 -0
- package/lib/models/webhook-notification.js +239 -0
- package/lib/models/webhook.d.ts +26 -0
- package/lib/models/webhook.js +47 -23
- package/lib/models/when.d.ts +3 -0
- package/lib/models/when.js +35 -27
- package/lib/nylas-connection.d.ts +7 -8
- package/lib/nylas-connection.js +11 -23
- package/lib/nylas.d.ts +10 -21
- package/lib/nylas.js +28 -35
- package/package.json +1 -1
package/lib/config.d.ts
CHANGED
|
@@ -2,3 +2,15 @@ export declare let apiServer: string | null;
|
|
|
2
2
|
export declare function setApiServer(newApiServer: string | null): void;
|
|
3
3
|
export declare let clientSecret: string;
|
|
4
4
|
export declare function setClientSecret(newClientSecret: string): void;
|
|
5
|
+
export declare type NylasConfig = {
|
|
6
|
+
clientId: string;
|
|
7
|
+
clientSecret: string;
|
|
8
|
+
apiServer?: string;
|
|
9
|
+
};
|
|
10
|
+
export declare type AuthenticateUrlConfig = {
|
|
11
|
+
redirectURI: string;
|
|
12
|
+
loginHint?: string;
|
|
13
|
+
state?: string;
|
|
14
|
+
provider?: string;
|
|
15
|
+
scopes?: string[];
|
|
16
|
+
};
|
package/lib/config.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.setClientSecret = exports.clientSecret = exports.setApiServer = exports.apiServer = void 0;
|
|
4
3
|
exports.apiServer = null;
|
|
5
4
|
function setApiServer(newApiServer) {
|
|
6
5
|
exports.apiServer = newApiServer;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import Model from './model';
|
|
2
|
+
import { Attribute } from './attributes';
|
|
3
|
+
export declare type AccessTokenProperties = {
|
|
4
|
+
accessToken: string;
|
|
5
|
+
accountId: string;
|
|
6
|
+
emailAddress: string;
|
|
7
|
+
provider: string;
|
|
8
|
+
tokenType: string;
|
|
9
|
+
};
|
|
10
|
+
export default class AccessToken extends Model implements AccessTokenProperties {
|
|
11
|
+
accessToken: string;
|
|
12
|
+
accountId: string;
|
|
13
|
+
emailAddress: string;
|
|
14
|
+
provider: string;
|
|
15
|
+
tokenType: string;
|
|
16
|
+
static attributes: Record<string, Attribute>;
|
|
17
|
+
constructor(props?: AccessTokenProperties);
|
|
18
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
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 AccessToken = /** @class */ (function (_super) {
|
|
22
|
+
__extends(AccessToken, _super);
|
|
23
|
+
function AccessToken(props) {
|
|
24
|
+
var _this = _super.call(this) || this;
|
|
25
|
+
_this.accessToken = '';
|
|
26
|
+
_this.accountId = '';
|
|
27
|
+
_this.emailAddress = '';
|
|
28
|
+
_this.provider = '';
|
|
29
|
+
_this.tokenType = 'bearer';
|
|
30
|
+
_this.initAttributes(props);
|
|
31
|
+
return _this;
|
|
32
|
+
}
|
|
33
|
+
AccessToken.attributes = {
|
|
34
|
+
accessToken: attributes_1.default.String({
|
|
35
|
+
modelKey: 'accessToken',
|
|
36
|
+
jsonKey: 'access_token',
|
|
37
|
+
}),
|
|
38
|
+
accountId: attributes_1.default.String({
|
|
39
|
+
modelKey: 'accountId',
|
|
40
|
+
jsonKey: 'account_id',
|
|
41
|
+
}),
|
|
42
|
+
emailAddress: attributes_1.default.String({
|
|
43
|
+
modelKey: 'emailAddress',
|
|
44
|
+
jsonKey: 'email_address',
|
|
45
|
+
}),
|
|
46
|
+
provider: attributes_1.default.String({
|
|
47
|
+
modelKey: 'provider',
|
|
48
|
+
}),
|
|
49
|
+
tokenType: attributes_1.default.String({
|
|
50
|
+
modelKey: 'tokenType',
|
|
51
|
+
jsonKey: 'token_type',
|
|
52
|
+
}),
|
|
53
|
+
};
|
|
54
|
+
return AccessToken;
|
|
55
|
+
}(model_1.default));
|
|
56
|
+
exports.default = AccessToken;
|
package/lib/models/account.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import RestfulModel from './restful-model';
|
|
2
|
+
import { Attribute } from './attributes';
|
|
2
3
|
import NylasConnection from '../nylas-connection';
|
|
3
4
|
export declare type AccountProperties = {
|
|
4
5
|
name: string;
|
|
@@ -17,7 +18,10 @@ export default class Account extends RestfulModel implements AccountProperties {
|
|
|
17
18
|
organizationUnit: string;
|
|
18
19
|
syncState: string;
|
|
19
20
|
linkedAt: Date;
|
|
21
|
+
accessToken: string;
|
|
20
22
|
billingState?: string;
|
|
21
|
-
|
|
23
|
+
static collectionName: string;
|
|
24
|
+
static endpointName: string;
|
|
25
|
+
static attributes: Record<string, Attribute>;
|
|
22
26
|
constructor(connection: NylasConnection, props?: AccountProperties);
|
|
23
27
|
}
|
package/lib/models/account.js
CHANGED
|
@@ -39,34 +39,35 @@ var Account = /** @class */ (function (_super) {
|
|
|
39
39
|
_this.organizationUnit = '';
|
|
40
40
|
_this.syncState = '';
|
|
41
41
|
_this.linkedAt = new Date();
|
|
42
|
+
_this.accessToken = '';
|
|
42
43
|
_this.initAttributes(props);
|
|
43
44
|
return _this;
|
|
44
45
|
}
|
|
46
|
+
Account.collectionName = 'accounts';
|
|
47
|
+
Account.endpointName = 'account';
|
|
48
|
+
Account.attributes = __assign(__assign({}, restful_model_1.default.attributes), { name: attributes_1.default.String({
|
|
49
|
+
modelKey: 'name',
|
|
50
|
+
}), emailAddress: attributes_1.default.String({
|
|
51
|
+
modelKey: 'emailAddress',
|
|
52
|
+
jsonKey: 'email_address',
|
|
53
|
+
}), provider: attributes_1.default.String({
|
|
54
|
+
modelKey: 'provider',
|
|
55
|
+
}), organizationUnit: attributes_1.default.String({
|
|
56
|
+
modelKey: 'organizationUnit',
|
|
57
|
+
jsonKey: 'organization_unit',
|
|
58
|
+
}), syncState: attributes_1.default.String({
|
|
59
|
+
modelKey: 'syncState',
|
|
60
|
+
jsonKey: 'sync_state',
|
|
61
|
+
}), billingState: attributes_1.default.String({
|
|
62
|
+
modelKey: 'billingState',
|
|
63
|
+
jsonKey: 'billing_state',
|
|
64
|
+
}), linkedAt: attributes_1.default.DateTime({
|
|
65
|
+
modelKey: 'linkedAt',
|
|
66
|
+
jsonKey: 'linked_at',
|
|
67
|
+
}), accessToken: attributes_1.default.String({
|
|
68
|
+
modelKey: 'accessToken',
|
|
69
|
+
jsonKey: 'access_token',
|
|
70
|
+
}) });
|
|
45
71
|
return Account;
|
|
46
72
|
}(restful_model_1.default));
|
|
47
73
|
exports.default = Account;
|
|
48
|
-
Account.collectionName = 'accounts';
|
|
49
|
-
Account.endpointName = 'account';
|
|
50
|
-
Account.attributes = __assign(__assign({}, restful_model_1.default.attributes), { name: attributes_1.default.String({
|
|
51
|
-
modelKey: 'name',
|
|
52
|
-
}), emailAddress: attributes_1.default.String({
|
|
53
|
-
modelKey: 'emailAddress',
|
|
54
|
-
jsonKey: 'email_address',
|
|
55
|
-
}), provider: attributes_1.default.String({
|
|
56
|
-
modelKey: 'provider',
|
|
57
|
-
}), organizationUnit: attributes_1.default.String({
|
|
58
|
-
modelKey: 'organizationUnit',
|
|
59
|
-
jsonKey: 'organization_unit',
|
|
60
|
-
}), syncState: attributes_1.default.String({
|
|
61
|
-
modelKey: 'syncState',
|
|
62
|
-
jsonKey: 'sync_state',
|
|
63
|
-
}), billingState: attributes_1.default.String({
|
|
64
|
-
modelKey: 'billingState',
|
|
65
|
-
jsonKey: 'billing_state',
|
|
66
|
-
}), linkedAt: attributes_1.default.DateTime({
|
|
67
|
-
modelKey: 'linkedAt',
|
|
68
|
-
jsonKey: 'linked_at',
|
|
69
|
-
}), accessToken: attributes_1.default.String({
|
|
70
|
-
modelKey: 'accessToken',
|
|
71
|
-
jsonKey: 'access_token',
|
|
72
|
-
}) });
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Model from './model';
|
|
2
|
+
import { Attribute } from './attributes';
|
|
3
|
+
export declare type ApplicationDetailsProperties = {
|
|
4
|
+
applicationName?: string;
|
|
5
|
+
iconUrl?: string;
|
|
6
|
+
redirectUris?: string[];
|
|
7
|
+
};
|
|
8
|
+
export default class ApplicationDetails extends Model implements ApplicationDetailsProperties {
|
|
9
|
+
applicationName: string;
|
|
10
|
+
iconUrl: string;
|
|
11
|
+
redirectUris: string[];
|
|
12
|
+
static attributes: Record<string, Attribute>;
|
|
13
|
+
constructor(props?: ApplicationDetailsProperties);
|
|
14
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
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 ApplicationDetails = /** @class */ (function (_super) {
|
|
22
|
+
__extends(ApplicationDetails, _super);
|
|
23
|
+
function ApplicationDetails(props) {
|
|
24
|
+
var _this = _super.call(this) || this;
|
|
25
|
+
_this.applicationName = '';
|
|
26
|
+
_this.iconUrl = '';
|
|
27
|
+
_this.redirectUris = [];
|
|
28
|
+
_this.initAttributes(props);
|
|
29
|
+
return _this;
|
|
30
|
+
}
|
|
31
|
+
ApplicationDetails.attributes = {
|
|
32
|
+
applicationName: attributes_1.default.String({
|
|
33
|
+
modelKey: 'applicationName',
|
|
34
|
+
jsonKey: 'application_name',
|
|
35
|
+
}),
|
|
36
|
+
iconUrl: attributes_1.default.String({
|
|
37
|
+
modelKey: 'iconUrl',
|
|
38
|
+
jsonKey: 'icon_url',
|
|
39
|
+
}),
|
|
40
|
+
redirectUris: attributes_1.default.StringList({
|
|
41
|
+
modelKey: 'redirectUris',
|
|
42
|
+
jsonKey: 'redirect_uris',
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
return ApplicationDetails;
|
|
46
|
+
}(model_1.default));
|
|
47
|
+
exports.default = ApplicationDetails;
|
|
@@ -11,6 +11,7 @@ export declare abstract class Attribute {
|
|
|
11
11
|
});
|
|
12
12
|
abstract toJSON(val: any, _parent?: any): any;
|
|
13
13
|
abstract fromJSON(val: any, _parent: any): any;
|
|
14
|
+
saveRequestBody(val: any): any;
|
|
14
15
|
}
|
|
15
16
|
declare class AttributeObject extends Attribute {
|
|
16
17
|
itemClass?: any;
|
|
@@ -20,8 +21,9 @@ declare class AttributeObject extends Attribute {
|
|
|
20
21
|
itemClass?: typeof Model | typeof RestfulModel;
|
|
21
22
|
readOnly?: boolean;
|
|
22
23
|
});
|
|
23
|
-
toJSON(val: any): unknown;
|
|
24
|
+
toJSON(val: any, saveRequestBody?: boolean): unknown;
|
|
24
25
|
fromJSON(val: any, _parent: any): any;
|
|
26
|
+
saveRequestBody(val: any): unknown;
|
|
25
27
|
}
|
|
26
28
|
declare class AttributeNumber extends Attribute {
|
|
27
29
|
toJSON(val: number): number;
|
|
@@ -59,8 +61,9 @@ declare class AttributeCollection extends Attribute {
|
|
|
59
61
|
itemClass: typeof Model | typeof RestfulModel;
|
|
60
62
|
readOnly?: boolean;
|
|
61
63
|
});
|
|
62
|
-
toJSON(vals: any
|
|
64
|
+
toJSON(vals: any, saveRequestBody?: boolean): unknown[];
|
|
63
65
|
fromJSON(json: unknown[], _parent: any): typeof Model[] | typeof RestfulModel[] | unknown[];
|
|
66
|
+
saveRequestBody(val: any): unknown;
|
|
64
67
|
}
|
|
65
68
|
declare class AttributeEnum extends Attribute {
|
|
66
69
|
itemClass: any;
|
package/lib/models/attributes.js
CHANGED
|
@@ -23,7 +23,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
23
23
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.Attribute = void 0;
|
|
27
26
|
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
28
27
|
// The Attribute class represents a single model attribute, like 'namespace_id'
|
|
29
28
|
// Subclasses of Attribute like AttributeDateTime know how to covert between
|
|
@@ -36,6 +35,12 @@ var Attribute = /** @class */ (function () {
|
|
|
36
35
|
this.jsonKey = jsonKey || modelKey;
|
|
37
36
|
this.readOnly = readOnly || false;
|
|
38
37
|
}
|
|
38
|
+
Attribute.prototype.saveRequestBody = function (val) {
|
|
39
|
+
if (this.readOnly) {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
return this.toJSON(val);
|
|
43
|
+
};
|
|
39
44
|
return Attribute;
|
|
40
45
|
}());
|
|
41
46
|
exports.Attribute = Attribute;
|
|
@@ -47,11 +52,14 @@ var AttributeObject = /** @class */ (function (_super) {
|
|
|
47
52
|
_this.itemClass = itemClass;
|
|
48
53
|
return _this;
|
|
49
54
|
}
|
|
50
|
-
AttributeObject.prototype.toJSON = function (val) {
|
|
55
|
+
AttributeObject.prototype.toJSON = function (val, saveRequestBody) {
|
|
51
56
|
if (!val) {
|
|
52
57
|
return val;
|
|
53
58
|
}
|
|
54
|
-
if (val.
|
|
59
|
+
if (saveRequestBody === true && val.saveRequestBody != null) {
|
|
60
|
+
return val.saveRequestBody();
|
|
61
|
+
}
|
|
62
|
+
else if (val.toJSON != null) {
|
|
55
63
|
return val.toJSON();
|
|
56
64
|
}
|
|
57
65
|
return val;
|
|
@@ -65,6 +73,12 @@ var AttributeObject = /** @class */ (function (_super) {
|
|
|
65
73
|
}
|
|
66
74
|
return new this.itemClass(val).fromJSON(val);
|
|
67
75
|
};
|
|
76
|
+
AttributeObject.prototype.saveRequestBody = function (val) {
|
|
77
|
+
if (this.readOnly) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
return this.toJSON(val, true);
|
|
81
|
+
};
|
|
68
82
|
return AttributeObject;
|
|
69
83
|
}(Attribute));
|
|
70
84
|
var AttributeNumber = /** @class */ (function (_super) {
|
|
@@ -198,14 +212,17 @@ var AttributeCollection = /** @class */ (function (_super) {
|
|
|
198
212
|
_this.itemClass = itemClass;
|
|
199
213
|
return _this;
|
|
200
214
|
}
|
|
201
|
-
AttributeCollection.prototype.toJSON = function (vals) {
|
|
215
|
+
AttributeCollection.prototype.toJSON = function (vals, saveRequestBody) {
|
|
202
216
|
if (!vals) {
|
|
203
217
|
return [];
|
|
204
218
|
}
|
|
205
219
|
var json = [];
|
|
206
220
|
for (var _i = 0, vals_1 = vals; _i < vals_1.length; _i++) {
|
|
207
221
|
var val = vals_1[_i];
|
|
208
|
-
if (val.
|
|
222
|
+
if (saveRequestBody === true && val.saveRequestBody != null) {
|
|
223
|
+
json.push(val.saveRequestBody());
|
|
224
|
+
}
|
|
225
|
+
else if (val.toJSON != null) {
|
|
209
226
|
json.push(val.toJSON());
|
|
210
227
|
}
|
|
211
228
|
else {
|
|
@@ -232,6 +249,12 @@ var AttributeCollection = /** @class */ (function (_super) {
|
|
|
232
249
|
}
|
|
233
250
|
return objs;
|
|
234
251
|
};
|
|
252
|
+
AttributeCollection.prototype.saveRequestBody = function (val) {
|
|
253
|
+
if (this.readOnly) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
return this.toJSON(val, true);
|
|
257
|
+
};
|
|
235
258
|
return AttributeCollection;
|
|
236
259
|
}(Attribute));
|
|
237
260
|
var AttributeEnum = /** @class */ (function (_super) {
|
|
@@ -263,16 +286,18 @@ var AttributeEnumList = /** @class */ (function (_super) {
|
|
|
263
286
|
}
|
|
264
287
|
AttributeEnumList.prototype.toJSON = function (val) {
|
|
265
288
|
var enumList = [];
|
|
266
|
-
for (var
|
|
289
|
+
for (var _i = 0, val_1 = val; _i < val_1.length; _i++) {
|
|
290
|
+
var v = val_1[_i];
|
|
267
291
|
enumList.push(v.toString());
|
|
268
292
|
}
|
|
269
293
|
return enumList;
|
|
270
294
|
};
|
|
271
295
|
AttributeEnumList.prototype.fromJSON = function (val, _parent) {
|
|
272
296
|
var enumList = [];
|
|
273
|
-
for (var
|
|
274
|
-
|
|
275
|
-
|
|
297
|
+
for (var _i = 0, val_2 = val; _i < val_2.length; _i++) {
|
|
298
|
+
var v = val_2[_i];
|
|
299
|
+
if (Object.values(this.itemClass).includes(v)) {
|
|
300
|
+
enumList.push(v);
|
|
276
301
|
}
|
|
277
302
|
}
|
|
278
303
|
return enumList;
|
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
import Model from './model';
|
|
2
|
-
import {
|
|
2
|
+
import { Attribute } from './attributes';
|
|
3
|
+
import { FreeBusyProperties, TimeSlot, TimeSlotProperties, FreeBusyCalendarProperties } from './free-busy';
|
|
3
4
|
export declare enum RoundRobin {
|
|
4
5
|
MaxAvailability = "max-availability",
|
|
5
6
|
MaxFairness = "max-fairness"
|
|
6
7
|
}
|
|
8
|
+
export declare enum Days {
|
|
9
|
+
Monday = 0,
|
|
10
|
+
Tuesday = 1,
|
|
11
|
+
Wednesday = 2,
|
|
12
|
+
Thursday = 3,
|
|
13
|
+
Friday = 4,
|
|
14
|
+
Saturday = 5,
|
|
15
|
+
Sunday = 6
|
|
16
|
+
}
|
|
17
|
+
declare type AvailabilityQuery = {
|
|
18
|
+
duration: number;
|
|
19
|
+
interval: number;
|
|
20
|
+
startTime: number;
|
|
21
|
+
endTime: number;
|
|
22
|
+
buffer?: number;
|
|
23
|
+
tentativeBusy?: boolean;
|
|
24
|
+
freeBusy?: FreeBusyProperties[];
|
|
25
|
+
openHours?: OpenHoursProperties[];
|
|
26
|
+
calendars?: FreeBusyCalendarProperties[];
|
|
27
|
+
};
|
|
28
|
+
export declare type SingleAvailabilityQuery = AvailabilityQuery & {
|
|
29
|
+
emails?: string[];
|
|
30
|
+
eventCollectionId?: string;
|
|
31
|
+
roundRobin?: RoundRobin;
|
|
32
|
+
};
|
|
33
|
+
export declare type ConsecutiveAvailabilityQuery = AvailabilityQuery & {
|
|
34
|
+
emails?: Array<string[]>;
|
|
35
|
+
};
|
|
7
36
|
export declare type OpenHoursProperties = {
|
|
8
37
|
emails: string[];
|
|
9
|
-
days:
|
|
38
|
+
days: Days[];
|
|
10
39
|
timezone: string;
|
|
11
40
|
start: string;
|
|
12
41
|
end: string;
|
|
@@ -14,21 +43,23 @@ export declare type OpenHoursProperties = {
|
|
|
14
43
|
export declare class OpenHours extends Model implements OpenHoursProperties {
|
|
15
44
|
objectType: string;
|
|
16
45
|
emails: string[];
|
|
17
|
-
days:
|
|
46
|
+
days: Days[];
|
|
18
47
|
timezone: string;
|
|
19
48
|
start: string;
|
|
20
49
|
end: string;
|
|
50
|
+
static attributes: Record<string, Attribute>;
|
|
21
51
|
constructor(props?: OpenHoursProperties);
|
|
22
52
|
}
|
|
23
53
|
export declare type CalendarConsecutiveAvailabilityProperties = {
|
|
24
54
|
emails: string[];
|
|
25
|
-
|
|
26
|
-
|
|
55
|
+
startTime: number;
|
|
56
|
+
endTime: number;
|
|
27
57
|
};
|
|
28
58
|
export declare class CalendarConsecutiveAvailability extends Model implements CalendarConsecutiveAvailabilityProperties {
|
|
29
59
|
emails: string[];
|
|
30
|
-
|
|
31
|
-
|
|
60
|
+
startTime: number;
|
|
61
|
+
endTime: number;
|
|
62
|
+
static attributes: Record<string, Attribute>;
|
|
32
63
|
constructor(props?: CalendarConsecutiveAvailabilityProperties);
|
|
33
64
|
}
|
|
34
65
|
export declare type CalendarAvailabilityProperties = {
|
|
@@ -37,5 +68,7 @@ export declare type CalendarAvailabilityProperties = {
|
|
|
37
68
|
export default class CalendarAvailability extends Model implements CalendarAvailabilityProperties {
|
|
38
69
|
object: string;
|
|
39
70
|
timeSlots: TimeSlot[];
|
|
71
|
+
static attributes: Record<string, Attribute>;
|
|
40
72
|
constructor(props?: CalendarAvailabilityProperties);
|
|
41
73
|
}
|
|
74
|
+
export {};
|
|
@@ -16,14 +16,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
16
16
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
17
|
};
|
|
18
18
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
-
exports.CalendarConsecutiveAvailability = exports.OpenHours = exports.RoundRobin = void 0;
|
|
20
19
|
var model_1 = __importDefault(require("./model"));
|
|
21
20
|
var attributes_1 = __importDefault(require("./attributes"));
|
|
21
|
+
var free_busy_1 = require("./free-busy");
|
|
22
22
|
var RoundRobin;
|
|
23
23
|
(function (RoundRobin) {
|
|
24
24
|
RoundRobin["MaxAvailability"] = "max-availability";
|
|
25
25
|
RoundRobin["MaxFairness"] = "max-fairness";
|
|
26
26
|
})(RoundRobin = exports.RoundRobin || (exports.RoundRobin = {}));
|
|
27
|
+
var Days;
|
|
28
|
+
(function (Days) {
|
|
29
|
+
Days[Days["Monday"] = 0] = "Monday";
|
|
30
|
+
Days[Days["Tuesday"] = 1] = "Tuesday";
|
|
31
|
+
Days[Days["Wednesday"] = 2] = "Wednesday";
|
|
32
|
+
Days[Days["Thursday"] = 3] = "Thursday";
|
|
33
|
+
Days[Days["Friday"] = 4] = "Friday";
|
|
34
|
+
Days[Days["Saturday"] = 5] = "Saturday";
|
|
35
|
+
Days[Days["Sunday"] = 6] = "Sunday";
|
|
36
|
+
})(Days = exports.Days || (exports.Days = {}));
|
|
27
37
|
var OpenHours = /** @class */ (function (_super) {
|
|
28
38
|
__extends(OpenHours, _super);
|
|
29
39
|
function OpenHours(props) {
|
|
@@ -37,40 +47,53 @@ var OpenHours = /** @class */ (function (_super) {
|
|
|
37
47
|
_this.initAttributes(props);
|
|
38
48
|
return _this;
|
|
39
49
|
}
|
|
50
|
+
OpenHours.attributes = {
|
|
51
|
+
objectType: attributes_1.default.String({
|
|
52
|
+
modelKey: 'objectType',
|
|
53
|
+
jsonKey: 'object_type',
|
|
54
|
+
}),
|
|
55
|
+
emails: attributes_1.default.StringList({
|
|
56
|
+
modelKey: 'emails',
|
|
57
|
+
}),
|
|
58
|
+
days: attributes_1.default.NumberList({
|
|
59
|
+
modelKey: 'days',
|
|
60
|
+
}),
|
|
61
|
+
timezone: attributes_1.default.String({
|
|
62
|
+
modelKey: 'timezone',
|
|
63
|
+
}),
|
|
64
|
+
start: attributes_1.default.String({
|
|
65
|
+
modelKey: 'start',
|
|
66
|
+
}),
|
|
67
|
+
end: attributes_1.default.String({
|
|
68
|
+
modelKey: 'end',
|
|
69
|
+
}),
|
|
70
|
+
};
|
|
40
71
|
return OpenHours;
|
|
41
72
|
}(model_1.default));
|
|
42
73
|
exports.OpenHours = OpenHours;
|
|
43
|
-
OpenHours.attributes = {
|
|
44
|
-
objectType: attributes_1.default.String({
|
|
45
|
-
modelKey: 'objectType',
|
|
46
|
-
jsonKey: 'object_type',
|
|
47
|
-
}),
|
|
48
|
-
emails: attributes_1.default.StringList({
|
|
49
|
-
modelKey: 'emails',
|
|
50
|
-
}),
|
|
51
|
-
days: attributes_1.default.NumberList({
|
|
52
|
-
modelKey: 'days',
|
|
53
|
-
}),
|
|
54
|
-
timezone: attributes_1.default.String({
|
|
55
|
-
modelKey: 'timezone',
|
|
56
|
-
}),
|
|
57
|
-
start: attributes_1.default.String({
|
|
58
|
-
modelKey: 'start',
|
|
59
|
-
}),
|
|
60
|
-
end: attributes_1.default.String({
|
|
61
|
-
modelKey: 'end',
|
|
62
|
-
}),
|
|
63
|
-
};
|
|
64
74
|
var CalendarConsecutiveAvailability = /** @class */ (function (_super) {
|
|
65
75
|
__extends(CalendarConsecutiveAvailability, _super);
|
|
66
76
|
function CalendarConsecutiveAvailability(props) {
|
|
67
77
|
var _this = _super.call(this) || this;
|
|
68
78
|
_this.emails = [];
|
|
69
|
-
_this.
|
|
70
|
-
_this.
|
|
79
|
+
_this.startTime = 0;
|
|
80
|
+
_this.endTime = 0;
|
|
71
81
|
_this.initAttributes(props);
|
|
72
82
|
return _this;
|
|
73
83
|
}
|
|
84
|
+
CalendarConsecutiveAvailability.attributes = {
|
|
85
|
+
emails: attributes_1.default.StringList({
|
|
86
|
+
modelKey: 'emails',
|
|
87
|
+
}),
|
|
88
|
+
startTime: attributes_1.default.Number({
|
|
89
|
+
modelKey: 'startTime',
|
|
90
|
+
jsonKey: 'start_time',
|
|
91
|
+
}),
|
|
92
|
+
endTime: attributes_1.default.Number({
|
|
93
|
+
modelKey: 'endTime',
|
|
94
|
+
jsonKey: 'end_time',
|
|
95
|
+
}),
|
|
96
|
+
};
|
|
74
97
|
return CalendarConsecutiveAvailability;
|
|
75
98
|
}(model_1.default));
|
|
76
99
|
exports.CalendarConsecutiveAvailability = CalendarConsecutiveAvailability;
|
|
@@ -83,6 +106,13 @@ var CalendarAvailability = /** @class */ (function (_super) {
|
|
|
83
106
|
_this.initAttributes(props);
|
|
84
107
|
return _this;
|
|
85
108
|
}
|
|
109
|
+
CalendarAvailability.attributes = {
|
|
110
|
+
timeSlots: attributes_1.default.Collection({
|
|
111
|
+
modelKey: 'timeSlots',
|
|
112
|
+
jsonKey: 'time_slots',
|
|
113
|
+
itemClass: free_busy_1.TimeSlot,
|
|
114
|
+
}),
|
|
115
|
+
};
|
|
86
116
|
return CalendarAvailability;
|
|
87
117
|
}(model_1.default));
|
|
88
118
|
exports.default = CalendarAvailability;
|
|
@@ -1,38 +1,17 @@
|
|
|
1
1
|
import Calendar from './calendar';
|
|
2
2
|
import NylasConnection from '../nylas-connection';
|
|
3
3
|
import RestfulModelCollection from './restful-model-collection';
|
|
4
|
-
import FreeBusy, {
|
|
5
|
-
import CalendarAvailability, { CalendarConsecutiveAvailability,
|
|
4
|
+
import FreeBusy, { FreeBusyQuery } from './free-busy';
|
|
5
|
+
import CalendarAvailability, { CalendarConsecutiveAvailability, ConsecutiveAvailabilityQuery, SingleAvailabilityQuery } from './calendar-availability';
|
|
6
6
|
export default class CalendarRestfulModelCollection extends RestfulModelCollection<Calendar> {
|
|
7
7
|
connection: NylasConnection;
|
|
8
8
|
modelClass: typeof Calendar;
|
|
9
9
|
constructor(connection: NylasConnection);
|
|
10
|
-
freeBusy(options:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
emails: string[];
|
|
14
|
-
}, callback?: (error: Error | null, data?: Record<string, unknown>) => void): Promise<FreeBusy[]>;
|
|
15
|
-
availability(options: {
|
|
16
|
-
emails: string[];
|
|
17
|
-
duration: number;
|
|
18
|
-
interval: number;
|
|
19
|
-
startTime: number;
|
|
20
|
-
endTime: number;
|
|
21
|
-
buffer?: number;
|
|
22
|
-
roundRobin?: RoundRobin;
|
|
23
|
-
freeBusy?: FreeBusyProperties[];
|
|
24
|
-
openHours?: OpenHoursProperties[];
|
|
25
|
-
}, callback?: (error: Error | null, data?: Record<string, any>) => void): Promise<CalendarAvailability>;
|
|
26
|
-
consecutiveAvailability(options: {
|
|
27
|
-
emails: Array<string[]>;
|
|
28
|
-
duration: number;
|
|
29
|
-
interval: number;
|
|
30
|
-
startTime: number;
|
|
31
|
-
endTime: number;
|
|
32
|
-
buffer?: number;
|
|
33
|
-
freeBusy?: FreeBusyProperties[];
|
|
34
|
-
openHours?: OpenHoursProperties[];
|
|
35
|
-
}, callback?: (error: Error | null, data?: {
|
|
10
|
+
freeBusy(options: FreeBusyQuery, callback?: (error: Error | null, data?: Record<string, unknown>) => void): Promise<FreeBusy[]>;
|
|
11
|
+
availability(options: SingleAvailabilityQuery, callback?: (error: Error | null, data?: Record<string, any>) => void): Promise<CalendarAvailability>;
|
|
12
|
+
consecutiveAvailability(options: ConsecutiveAvailabilityQuery, callback?: (error: Error | null, data?: {
|
|
36
13
|
[key: string]: any;
|
|
37
14
|
}) => void): Promise<CalendarConsecutiveAvailability>;
|
|
15
|
+
private buildAvailabilityPayload;
|
|
16
|
+
private queryIsValid;
|
|
38
17
|
}
|