nylas 5.10.4 → 6.0.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 +16 -0
- package/lib/models/access-token.js +56 -0
- package/lib/models/account.d.ts +20 -7
- package/lib/models/account.js +14 -2
- package/lib/models/application-details.d.ts +12 -0
- package/lib/models/application-details.js +47 -0
- package/lib/models/attributes.d.ts +69 -25
- package/lib/models/attributes.js +109 -15
- package/lib/models/calendar-availability.d.ts +68 -0
- package/lib/models/calendar-availability.js +118 -0
- package/lib/models/calendar-restful-model-collection.d.ts +6 -67
- package/lib/models/calendar-restful-model-collection.js +61 -25
- package/lib/models/calendar.d.ts +21 -14
- package/lib/models/calendar.js +11 -3
- package/lib/models/component.d.ts +18 -2
- package/lib/models/component.js +5 -3
- package/lib/models/connect.d.ts +64 -5
- package/lib/models/connect.js +157 -15
- package/lib/models/contact-restful-model-collection.d.ts +2 -4
- package/lib/models/contact-restful-model-collection.js +11 -5
- package/lib/models/contact.d.ts +91 -47
- package/lib/models/contact.js +121 -81
- package/lib/models/delta-stream.d.ts +5 -7
- package/lib/models/delta-stream.js +8 -8
- package/lib/models/delta.d.ts +5 -4
- package/lib/models/delta.js +2 -3
- package/lib/models/draft.d.ts +14 -17
- package/lib/models/draft.js +9 -8
- package/lib/models/email-participant.d.ts +9 -4
- package/lib/models/email-participant.js +9 -7
- package/lib/models/event-conferencing.d.ts +21 -14
- package/lib/models/event-conferencing.js +14 -27
- package/lib/models/event-notification.d.ts +19 -5
- package/lib/models/event-notification.js +15 -18
- package/lib/models/event-participant.d.ts +10 -4
- package/lib/models/event-participant.js +7 -5
- package/lib/models/event.d.ts +35 -20
- package/lib/models/event.js +47 -39
- package/lib/models/file.d.ts +14 -6
- package/lib/models/file.js +7 -22
- package/lib/models/folder.d.ts +9 -7
- package/lib/models/folder.js +8 -13
- package/lib/models/free-busy.d.ts +28 -0
- package/lib/models/free-busy.js +76 -0
- package/lib/models/job-status.d.ts +10 -1
- package/lib/models/job-status.js +4 -2
- package/lib/models/management-account.d.ts +50 -15
- package/lib/models/management-account.js +71 -3
- package/lib/models/management-model-collection.d.ts +2 -3
- package/lib/models/management-model-collection.js +6 -2
- package/lib/models/management-model.d.ts +1 -3
- package/lib/models/management-model.js +2 -2
- package/lib/models/message.d.ts +33 -14
- package/lib/models/message.js +17 -13
- package/lib/models/model-collection.d.ts +24 -0
- package/lib/models/model-collection.js +198 -0
- package/lib/models/model.d.ts +11 -0
- package/lib/models/model.js +59 -0
- package/lib/models/neural-categorizer.d.ts +21 -15
- package/lib/models/neural-categorizer.js +15 -16
- package/lib/models/neural-clean-conversation.d.ts +10 -4
- package/lib/models/neural-clean-conversation.js +6 -2
- package/lib/models/neural-ocr.d.ts +10 -4
- package/lib/models/neural-ocr.js +6 -2
- package/lib/models/neural-sentiment-analysis.d.ts +15 -6
- package/lib/models/neural-sentiment-analysis.js +9 -2
- package/lib/models/neural-signature-contact.d.ts +26 -24
- package/lib/models/neural-signature-contact.js +33 -32
- package/lib/models/neural-signature-extraction.d.ts +11 -4
- package/lib/models/neural-signature-extraction.js +6 -2
- package/lib/models/neural.d.ts +21 -9
- package/lib/models/neural.js +60 -21
- package/lib/models/nylas-api-error.d.ts +1 -3
- package/lib/models/resource.d.ts +15 -5
- package/lib/models/resource.js +9 -2
- package/lib/models/restful-model-collection.d.ts +9 -53
- package/lib/models/restful-model-collection.js +27 -188
- package/lib/models/restful-model-instance.d.ts +1 -3
- package/lib/models/restful-model-instance.js +1 -1
- package/lib/models/restful-model.d.ts +14 -28
- package/lib/models/restful-model.js +33 -40
- package/lib/models/scheduler-booking-request.d.ts +33 -3
- package/lib/models/scheduler-booking-request.js +11 -10
- package/lib/models/scheduler-restful-model-collection.js +4 -7
- package/lib/models/scheduler-time-slot.d.ts +11 -2
- package/lib/models/scheduler-time-slot.js +6 -5
- package/lib/models/scheduler.d.ts +183 -75
- package/lib/models/scheduler.js +290 -9
- package/lib/models/thread.d.ts +36 -20
- package/lib/models/thread.js +24 -9
- package/lib/models/webhook.d.ts +15 -7
- package/lib/models/webhook.js +8 -3
- package/lib/models/when.d.ts +20 -0
- package/lib/models/when.js +57 -0
- package/lib/nylas-connection.d.ts +7 -15
- package/lib/nylas-connection.js +6 -18
- package/lib/nylas.d.ts +10 -22
- package/lib/nylas.js +25 -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,16 @@
|
|
|
1
|
+
import Model from './model';
|
|
2
|
+
export declare type AccessTokenProperties = {
|
|
3
|
+
accessToken: string;
|
|
4
|
+
accountId: string;
|
|
5
|
+
emailAddress: string;
|
|
6
|
+
provider: string;
|
|
7
|
+
tokenType: string;
|
|
8
|
+
};
|
|
9
|
+
export default class AccessToken extends Model implements AccessTokenProperties {
|
|
10
|
+
accessToken: string;
|
|
11
|
+
accountId: string;
|
|
12
|
+
emailAddress: string;
|
|
13
|
+
provider: string;
|
|
14
|
+
tokenType: string;
|
|
15
|
+
constructor(props?: AccessTokenProperties);
|
|
16
|
+
}
|
|
@@ -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
|
+
return AccessToken;
|
|
34
|
+
}(model_1.default));
|
|
35
|
+
exports.default = AccessToken;
|
|
36
|
+
AccessToken.attributes = {
|
|
37
|
+
accessToken: attributes_1.default.String({
|
|
38
|
+
modelKey: 'accessToken',
|
|
39
|
+
jsonKey: 'access_token',
|
|
40
|
+
}),
|
|
41
|
+
accountId: attributes_1.default.String({
|
|
42
|
+
modelKey: 'accountId',
|
|
43
|
+
jsonKey: 'account_id',
|
|
44
|
+
}),
|
|
45
|
+
emailAddress: attributes_1.default.String({
|
|
46
|
+
modelKey: 'emailAddress',
|
|
47
|
+
jsonKey: 'email_address',
|
|
48
|
+
}),
|
|
49
|
+
provider: attributes_1.default.String({
|
|
50
|
+
modelKey: 'provider',
|
|
51
|
+
}),
|
|
52
|
+
tokenType: attributes_1.default.String({
|
|
53
|
+
modelKey: 'tokenType',
|
|
54
|
+
jsonKey: 'token_type',
|
|
55
|
+
}),
|
|
56
|
+
};
|
package/lib/models/account.d.ts
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
import RestfulModel from './restful-model';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import NylasConnection from '../nylas-connection';
|
|
3
|
+
export declare type AccountProperties = {
|
|
4
|
+
name: string;
|
|
5
|
+
emailAddress: string;
|
|
6
|
+
provider: string;
|
|
7
|
+
organizationUnit: string;
|
|
8
|
+
syncState: string;
|
|
9
|
+
linkedAt: Date;
|
|
8
10
|
billingState?: string;
|
|
9
|
-
|
|
11
|
+
accessToken?: string;
|
|
12
|
+
};
|
|
13
|
+
export default class Account extends RestfulModel implements AccountProperties {
|
|
14
|
+
name: string;
|
|
15
|
+
emailAddress: string;
|
|
16
|
+
provider: string;
|
|
17
|
+
organizationUnit: string;
|
|
18
|
+
syncState: string;
|
|
19
|
+
linkedAt: Date;
|
|
20
|
+
accessToken: string;
|
|
21
|
+
billingState?: string;
|
|
22
|
+
constructor(connection: NylasConnection, props?: AccountProperties);
|
|
10
23
|
}
|
package/lib/models/account.js
CHANGED
|
@@ -31,8 +31,17 @@ var restful_model_1 = __importDefault(require("./restful-model"));
|
|
|
31
31
|
var attributes_1 = __importDefault(require("./attributes"));
|
|
32
32
|
var Account = /** @class */ (function (_super) {
|
|
33
33
|
__extends(Account, _super);
|
|
34
|
-
function Account() {
|
|
35
|
-
|
|
34
|
+
function Account(connection, props) {
|
|
35
|
+
var _this = _super.call(this, connection, props) || this;
|
|
36
|
+
_this.name = '';
|
|
37
|
+
_this.emailAddress = '';
|
|
38
|
+
_this.provider = '';
|
|
39
|
+
_this.organizationUnit = '';
|
|
40
|
+
_this.syncState = '';
|
|
41
|
+
_this.linkedAt = new Date();
|
|
42
|
+
_this.accessToken = '';
|
|
43
|
+
_this.initAttributes(props);
|
|
44
|
+
return _this;
|
|
36
45
|
}
|
|
37
46
|
return Account;
|
|
38
47
|
}(restful_model_1.default));
|
|
@@ -58,4 +67,7 @@ Account.attributes = __assign(__assign({}, restful_model_1.default.attributes),
|
|
|
58
67
|
}), linkedAt: attributes_1.default.DateTime({
|
|
59
68
|
modelKey: 'linkedAt',
|
|
60
69
|
jsonKey: 'linked_at',
|
|
70
|
+
}), accessToken: attributes_1.default.String({
|
|
71
|
+
modelKey: 'accessToken',
|
|
72
|
+
jsonKey: 'access_token',
|
|
61
73
|
}) });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import Model from './model';
|
|
2
|
+
export declare type ApplicationDetailsProperties = {
|
|
3
|
+
applicationName?: string;
|
|
4
|
+
iconUrl?: string;
|
|
5
|
+
redirectUris?: string[];
|
|
6
|
+
};
|
|
7
|
+
export default class ApplicationDetails extends Model implements ApplicationDetailsProperties {
|
|
8
|
+
applicationName: string;
|
|
9
|
+
iconUrl: string;
|
|
10
|
+
redirectUris: string[];
|
|
11
|
+
constructor(props?: ApplicationDetailsProperties);
|
|
12
|
+
}
|
|
@@ -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
|
+
return ApplicationDetails;
|
|
32
|
+
}(model_1.default));
|
|
33
|
+
exports.default = ApplicationDetails;
|
|
34
|
+
ApplicationDetails.attributes = {
|
|
35
|
+
applicationName: attributes_1.default.String({
|
|
36
|
+
modelKey: 'applicationName',
|
|
37
|
+
jsonKey: 'application_name',
|
|
38
|
+
}),
|
|
39
|
+
iconUrl: attributes_1.default.String({
|
|
40
|
+
modelKey: 'iconUrl',
|
|
41
|
+
jsonKey: 'icon_url',
|
|
42
|
+
}),
|
|
43
|
+
redirectUris: attributes_1.default.StringList({
|
|
44
|
+
modelKey: 'redirectUris',
|
|
45
|
+
jsonKey: 'redirect_uris',
|
|
46
|
+
}),
|
|
47
|
+
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import Model from './model';
|
|
1
2
|
import RestfulModel from './restful-model';
|
|
2
|
-
export declare class Attribute {
|
|
3
|
+
export declare abstract class Attribute {
|
|
3
4
|
modelKey: string;
|
|
4
5
|
jsonKey: string;
|
|
5
6
|
readOnly: boolean;
|
|
@@ -8,57 +9,83 @@ export declare class Attribute {
|
|
|
8
9
|
jsonKey?: string;
|
|
9
10
|
readOnly?: boolean;
|
|
10
11
|
});
|
|
11
|
-
toJSON(val: any): any;
|
|
12
|
-
fromJSON(val: any, _parent: any): any;
|
|
12
|
+
abstract toJSON(val: any, _parent?: any): any;
|
|
13
|
+
abstract fromJSON(val: any, _parent: any): any;
|
|
13
14
|
saveRequestBody(val: any): any;
|
|
14
15
|
}
|
|
15
16
|
declare class AttributeObject extends Attribute {
|
|
16
|
-
itemClass?:
|
|
17
|
+
itemClass?: any;
|
|
17
18
|
constructor({ modelKey, jsonKey, itemClass, readOnly, }: {
|
|
18
19
|
modelKey: string;
|
|
19
20
|
jsonKey?: string;
|
|
20
|
-
itemClass?: typeof RestfulModel;
|
|
21
|
+
itemClass?: typeof Model | typeof RestfulModel;
|
|
21
22
|
readOnly?: boolean;
|
|
22
23
|
});
|
|
23
|
-
toJSON(val: any, saveRequestBody?: boolean):
|
|
24
|
+
toJSON(val: any, saveRequestBody?: boolean): unknown;
|
|
24
25
|
fromJSON(val: any, _parent: any): any;
|
|
25
|
-
saveRequestBody(val: any):
|
|
26
|
+
saveRequestBody(val: any): unknown;
|
|
26
27
|
}
|
|
27
28
|
declare class AttributeNumber extends Attribute {
|
|
28
|
-
toJSON(val:
|
|
29
|
-
fromJSON(val: any
|
|
29
|
+
toJSON(val: number): number;
|
|
30
|
+
fromJSON(val: any): number | null;
|
|
31
|
+
}
|
|
32
|
+
declare class AttributeNumberList extends Attribute {
|
|
33
|
+
toJSON(val: any): number;
|
|
34
|
+
fromJSON(json: any, _parent: any): number[];
|
|
30
35
|
}
|
|
31
36
|
declare class AttributeBoolean extends Attribute {
|
|
32
|
-
toJSON(val:
|
|
33
|
-
fromJSON(val:
|
|
37
|
+
toJSON(val: boolean): boolean;
|
|
38
|
+
fromJSON(val: string | boolean): boolean;
|
|
34
39
|
}
|
|
35
40
|
declare class AttributeString extends Attribute {
|
|
36
|
-
toJSON(val:
|
|
37
|
-
fromJSON(val:
|
|
41
|
+
toJSON(val: string): string;
|
|
42
|
+
fromJSON(val: string): string;
|
|
38
43
|
}
|
|
39
44
|
declare class AttributeStringList extends Attribute {
|
|
40
|
-
toJSON(val:
|
|
41
|
-
fromJSON(val:
|
|
45
|
+
toJSON(val: []): [];
|
|
46
|
+
fromJSON(val: []): [];
|
|
42
47
|
}
|
|
43
48
|
declare class AttributeDate extends Attribute {
|
|
44
|
-
toJSON(val:
|
|
49
|
+
toJSON(val: Date): string;
|
|
45
50
|
fromJSON(val: any, _parent: any): Date | null;
|
|
46
51
|
}
|
|
47
52
|
declare class AttributeDateTime extends Attribute {
|
|
48
|
-
toJSON(val:
|
|
49
|
-
fromJSON(val:
|
|
53
|
+
toJSON(val: Date): number | null;
|
|
54
|
+
fromJSON(val: number, _parent: any): Date | null;
|
|
50
55
|
}
|
|
51
56
|
declare class AttributeCollection extends Attribute {
|
|
52
|
-
itemClass:
|
|
57
|
+
itemClass: any;
|
|
53
58
|
constructor({ modelKey, jsonKey, itemClass, readOnly, }: {
|
|
54
59
|
modelKey: string;
|
|
55
60
|
jsonKey?: string;
|
|
56
|
-
itemClass: typeof RestfulModel;
|
|
61
|
+
itemClass: typeof Model | typeof RestfulModel;
|
|
57
62
|
readOnly?: boolean;
|
|
58
63
|
});
|
|
59
|
-
toJSON(vals: any, saveRequestBody?: boolean):
|
|
60
|
-
fromJSON(json:
|
|
61
|
-
saveRequestBody(val: any):
|
|
64
|
+
toJSON(vals: any, saveRequestBody?: boolean): unknown[];
|
|
65
|
+
fromJSON(json: unknown[], _parent: any): typeof Model[] | typeof RestfulModel[] | unknown[];
|
|
66
|
+
saveRequestBody(val: any): unknown;
|
|
67
|
+
}
|
|
68
|
+
declare class AttributeEnum extends Attribute {
|
|
69
|
+
itemClass: any;
|
|
70
|
+
constructor({ modelKey, itemClass, jsonKey, readOnly, }: {
|
|
71
|
+
modelKey: string;
|
|
72
|
+
itemClass: any;
|
|
73
|
+
jsonKey?: string;
|
|
74
|
+
readOnly?: boolean;
|
|
75
|
+
});
|
|
76
|
+
toJSON(val: any): string;
|
|
77
|
+
fromJSON(val: unknown): unknown;
|
|
78
|
+
}
|
|
79
|
+
declare class AttributeEnumList extends Attribute {
|
|
80
|
+
itemClass: any;
|
|
81
|
+
constructor({ modelKey, itemClass, jsonKey, readOnly, }: {
|
|
82
|
+
modelKey: string;
|
|
83
|
+
itemClass: any;
|
|
84
|
+
jsonKey?: string;
|
|
85
|
+
readOnly?: boolean;
|
|
86
|
+
});
|
|
87
|
+
toJSON(val: any[]): string[];
|
|
88
|
+
fromJSON(val: any[], _parent: any): any[];
|
|
62
89
|
}
|
|
63
90
|
declare const Attributes: {
|
|
64
91
|
Number(__0: {
|
|
@@ -66,6 +93,11 @@ declare const Attributes: {
|
|
|
66
93
|
jsonKey?: string | undefined;
|
|
67
94
|
readOnly?: boolean | undefined;
|
|
68
95
|
}): AttributeNumber;
|
|
96
|
+
NumberList(__0: {
|
|
97
|
+
modelKey: string;
|
|
98
|
+
jsonKey?: string | undefined;
|
|
99
|
+
readOnly?: boolean | undefined;
|
|
100
|
+
}): AttributeNumberList;
|
|
69
101
|
String(__0: {
|
|
70
102
|
modelKey: string;
|
|
71
103
|
jsonKey?: string | undefined;
|
|
@@ -89,7 +121,7 @@ declare const Attributes: {
|
|
|
89
121
|
Collection(__0: {
|
|
90
122
|
modelKey: string;
|
|
91
123
|
jsonKey?: string | undefined;
|
|
92
|
-
itemClass: typeof RestfulModel;
|
|
124
|
+
itemClass: typeof Model | typeof RestfulModel;
|
|
93
125
|
readOnly?: boolean | undefined;
|
|
94
126
|
}): AttributeCollection;
|
|
95
127
|
Boolean(__0: {
|
|
@@ -100,8 +132,20 @@ declare const Attributes: {
|
|
|
100
132
|
Object(__0: {
|
|
101
133
|
modelKey: string;
|
|
102
134
|
jsonKey?: string | undefined;
|
|
103
|
-
itemClass?: typeof RestfulModel | undefined;
|
|
135
|
+
itemClass?: typeof Model | typeof RestfulModel | undefined;
|
|
104
136
|
readOnly?: boolean | undefined;
|
|
105
137
|
}): AttributeObject;
|
|
138
|
+
Enum(__0: {
|
|
139
|
+
modelKey: string;
|
|
140
|
+
itemClass: any;
|
|
141
|
+
jsonKey?: string | undefined;
|
|
142
|
+
readOnly?: boolean | undefined;
|
|
143
|
+
}): AttributeEnum;
|
|
144
|
+
EnumList(__0: {
|
|
145
|
+
modelKey: string;
|
|
146
|
+
itemClass: any;
|
|
147
|
+
jsonKey?: string | undefined;
|
|
148
|
+
readOnly?: boolean | undefined;
|
|
149
|
+
}): AttributeEnumList;
|
|
106
150
|
};
|
|
107
151
|
export default Attributes;
|
package/lib/models/attributes.js
CHANGED
|
@@ -19,8 +19,11 @@ var __spreadArrays = (this && this.__spreadArrays) || function () {
|
|
|
19
19
|
r[k] = a[j];
|
|
20
20
|
return r;
|
|
21
21
|
};
|
|
22
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
23
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
24
|
+
};
|
|
22
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
23
|
-
|
|
26
|
+
var restful_model_1 = __importDefault(require("./restful-model"));
|
|
24
27
|
// The Attribute class represents a single model attribute, like 'namespace_id'
|
|
25
28
|
// Subclasses of Attribute like AttributeDateTime know how to covert between
|
|
26
29
|
// the JSON representation of that type and the javascript representation.
|
|
@@ -32,15 +35,9 @@ var Attribute = /** @class */ (function () {
|
|
|
32
35
|
this.jsonKey = jsonKey || modelKey;
|
|
33
36
|
this.readOnly = readOnly || false;
|
|
34
37
|
}
|
|
35
|
-
Attribute.prototype.toJSON = function (val) {
|
|
36
|
-
return val;
|
|
37
|
-
};
|
|
38
|
-
Attribute.prototype.fromJSON = function (val, _parent) {
|
|
39
|
-
return val || null;
|
|
40
|
-
};
|
|
41
38
|
Attribute.prototype.saveRequestBody = function (val) {
|
|
42
39
|
if (this.readOnly) {
|
|
43
|
-
return;
|
|
40
|
+
return undefined;
|
|
44
41
|
}
|
|
45
42
|
return this.toJSON(val);
|
|
46
43
|
};
|
|
@@ -71,7 +68,10 @@ var AttributeObject = /** @class */ (function (_super) {
|
|
|
71
68
|
if (!val || !this.itemClass) {
|
|
72
69
|
return val;
|
|
73
70
|
}
|
|
74
|
-
|
|
71
|
+
if (this.itemClass.prototype instanceof restful_model_1.default) {
|
|
72
|
+
return new this.itemClass(_parent.connection).fromJSON(val);
|
|
73
|
+
}
|
|
74
|
+
return new this.itemClass(val).fromJSON(val);
|
|
75
75
|
};
|
|
76
76
|
AttributeObject.prototype.saveRequestBody = function (val) {
|
|
77
77
|
if (this.readOnly) {
|
|
@@ -89,8 +89,8 @@ var AttributeNumber = /** @class */ (function (_super) {
|
|
|
89
89
|
AttributeNumber.prototype.toJSON = function (val) {
|
|
90
90
|
return val;
|
|
91
91
|
};
|
|
92
|
-
AttributeNumber.prototype.fromJSON = function (val
|
|
93
|
-
if (!isNaN(val)) {
|
|
92
|
+
AttributeNumber.prototype.fromJSON = function (val) {
|
|
93
|
+
if (!isNaN(Number(val))) {
|
|
94
94
|
return Number(val);
|
|
95
95
|
}
|
|
96
96
|
else {
|
|
@@ -99,6 +99,28 @@ var AttributeNumber = /** @class */ (function (_super) {
|
|
|
99
99
|
};
|
|
100
100
|
return AttributeNumber;
|
|
101
101
|
}(Attribute));
|
|
102
|
+
var AttributeNumberList = /** @class */ (function (_super) {
|
|
103
|
+
__extends(AttributeNumberList, _super);
|
|
104
|
+
function AttributeNumberList() {
|
|
105
|
+
return _super !== null && _super.apply(this, arguments) || this;
|
|
106
|
+
}
|
|
107
|
+
AttributeNumberList.prototype.toJSON = function (val) {
|
|
108
|
+
return val;
|
|
109
|
+
};
|
|
110
|
+
AttributeNumberList.prototype.fromJSON = function (json, _parent) {
|
|
111
|
+
if (!json || !(json instanceof Array)) {
|
|
112
|
+
return [];
|
|
113
|
+
}
|
|
114
|
+
var nums = [];
|
|
115
|
+
for (var num in json) {
|
|
116
|
+
if (!isNaN(Number(num))) {
|
|
117
|
+
nums.push(Number(num));
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return nums;
|
|
121
|
+
};
|
|
122
|
+
return AttributeNumberList;
|
|
123
|
+
}(Attribute));
|
|
102
124
|
var AttributeBoolean = /** @class */ (function (_super) {
|
|
103
125
|
__extends(AttributeBoolean, _super);
|
|
104
126
|
function AttributeBoolean() {
|
|
@@ -107,7 +129,7 @@ var AttributeBoolean = /** @class */ (function (_super) {
|
|
|
107
129
|
AttributeBoolean.prototype.toJSON = function (val) {
|
|
108
130
|
return val;
|
|
109
131
|
};
|
|
110
|
-
AttributeBoolean.prototype.fromJSON = function (val
|
|
132
|
+
AttributeBoolean.prototype.fromJSON = function (val) {
|
|
111
133
|
return val === 'true' || val === true || false;
|
|
112
134
|
};
|
|
113
135
|
return AttributeBoolean;
|
|
@@ -120,7 +142,7 @@ var AttributeString = /** @class */ (function (_super) {
|
|
|
120
142
|
AttributeString.prototype.toJSON = function (val) {
|
|
121
143
|
return val;
|
|
122
144
|
};
|
|
123
|
-
AttributeString.prototype.fromJSON = function (val
|
|
145
|
+
AttributeString.prototype.fromJSON = function (val) {
|
|
124
146
|
return val || '';
|
|
125
147
|
};
|
|
126
148
|
return AttributeString;
|
|
@@ -133,7 +155,7 @@ var AttributeStringList = /** @class */ (function (_super) {
|
|
|
133
155
|
AttributeStringList.prototype.toJSON = function (val) {
|
|
134
156
|
return val;
|
|
135
157
|
};
|
|
136
|
-
AttributeStringList.prototype.fromJSON = function (val
|
|
158
|
+
AttributeStringList.prototype.fromJSON = function (val) {
|
|
137
159
|
return val || [];
|
|
138
160
|
};
|
|
139
161
|
return AttributeStringList;
|
|
@@ -216,7 +238,13 @@ var AttributeCollection = /** @class */ (function (_super) {
|
|
|
216
238
|
var objs = [];
|
|
217
239
|
for (var _i = 0, json_1 = json; _i < json_1.length; _i++) {
|
|
218
240
|
var objJSON = json_1[_i];
|
|
219
|
-
var obj =
|
|
241
|
+
var obj = void 0;
|
|
242
|
+
if (this.itemClass.prototype instanceof restful_model_1.default) {
|
|
243
|
+
obj = new this.itemClass(_parent.connection).fromJSON(objJSON);
|
|
244
|
+
}
|
|
245
|
+
else {
|
|
246
|
+
obj = new this.itemClass(objJSON).fromJSON(objJSON);
|
|
247
|
+
}
|
|
220
248
|
objs.push(obj);
|
|
221
249
|
}
|
|
222
250
|
return objs;
|
|
@@ -229,6 +257,51 @@ var AttributeCollection = /** @class */ (function (_super) {
|
|
|
229
257
|
};
|
|
230
258
|
return AttributeCollection;
|
|
231
259
|
}(Attribute));
|
|
260
|
+
var AttributeEnum = /** @class */ (function (_super) {
|
|
261
|
+
__extends(AttributeEnum, _super);
|
|
262
|
+
function AttributeEnum(_a) {
|
|
263
|
+
var modelKey = _a.modelKey, itemClass = _a.itemClass, jsonKey = _a.jsonKey, readOnly = _a.readOnly;
|
|
264
|
+
var _this = _super.call(this, { modelKey: modelKey, jsonKey: jsonKey, readOnly: readOnly }) || this;
|
|
265
|
+
_this.itemClass = itemClass;
|
|
266
|
+
return _this;
|
|
267
|
+
}
|
|
268
|
+
AttributeEnum.prototype.toJSON = function (val) {
|
|
269
|
+
return val.toString();
|
|
270
|
+
};
|
|
271
|
+
AttributeEnum.prototype.fromJSON = function (val) {
|
|
272
|
+
if (Object.values(this.itemClass).includes(val)) {
|
|
273
|
+
return val;
|
|
274
|
+
}
|
|
275
|
+
return;
|
|
276
|
+
};
|
|
277
|
+
return AttributeEnum;
|
|
278
|
+
}(Attribute));
|
|
279
|
+
var AttributeEnumList = /** @class */ (function (_super) {
|
|
280
|
+
__extends(AttributeEnumList, _super);
|
|
281
|
+
function AttributeEnumList(_a) {
|
|
282
|
+
var modelKey = _a.modelKey, itemClass = _a.itemClass, jsonKey = _a.jsonKey, readOnly = _a.readOnly;
|
|
283
|
+
var _this = _super.call(this, { modelKey: modelKey, jsonKey: jsonKey, readOnly: readOnly }) || this;
|
|
284
|
+
_this.itemClass = itemClass;
|
|
285
|
+
return _this;
|
|
286
|
+
}
|
|
287
|
+
AttributeEnumList.prototype.toJSON = function (val) {
|
|
288
|
+
var enumList = [];
|
|
289
|
+
for (var v in val) {
|
|
290
|
+
enumList.push(v.toString());
|
|
291
|
+
}
|
|
292
|
+
return enumList;
|
|
293
|
+
};
|
|
294
|
+
AttributeEnumList.prototype.fromJSON = function (val, _parent) {
|
|
295
|
+
var enumList = [];
|
|
296
|
+
for (var v in val) {
|
|
297
|
+
if (Object.values(this.itemClass).includes(val[v])) {
|
|
298
|
+
enumList.push(val[v]);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
return enumList;
|
|
302
|
+
};
|
|
303
|
+
return AttributeEnumList;
|
|
304
|
+
}(Attribute));
|
|
232
305
|
var Attributes = {
|
|
233
306
|
Number: function () {
|
|
234
307
|
var args = [];
|
|
@@ -237,6 +310,13 @@ var Attributes = {
|
|
|
237
310
|
}
|
|
238
311
|
return new (AttributeNumber.bind.apply(AttributeNumber, __spreadArrays([void 0], args)))();
|
|
239
312
|
},
|
|
313
|
+
NumberList: function () {
|
|
314
|
+
var args = [];
|
|
315
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
316
|
+
args[_i] = arguments[_i];
|
|
317
|
+
}
|
|
318
|
+
return new (AttributeNumberList.bind.apply(AttributeNumberList, __spreadArrays([void 0], args)))();
|
|
319
|
+
},
|
|
240
320
|
String: function () {
|
|
241
321
|
var args = [];
|
|
242
322
|
for (var _i = 0; _i < arguments.length; _i++) {
|
|
@@ -286,5 +366,19 @@ var Attributes = {
|
|
|
286
366
|
}
|
|
287
367
|
return new (AttributeObject.bind.apply(AttributeObject, __spreadArrays([void 0], args)))();
|
|
288
368
|
},
|
|
369
|
+
Enum: function () {
|
|
370
|
+
var args = [];
|
|
371
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
372
|
+
args[_i] = arguments[_i];
|
|
373
|
+
}
|
|
374
|
+
return new (AttributeEnum.bind.apply(AttributeEnum, __spreadArrays([void 0], args)))();
|
|
375
|
+
},
|
|
376
|
+
EnumList: function () {
|
|
377
|
+
var args = [];
|
|
378
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
379
|
+
args[_i] = arguments[_i];
|
|
380
|
+
}
|
|
381
|
+
return new (AttributeEnumList.bind.apply(AttributeEnumList, __spreadArrays([void 0], args)))();
|
|
382
|
+
},
|
|
289
383
|
};
|
|
290
384
|
exports.default = Attributes;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import Model from './model';
|
|
2
|
+
import { FreeBusyProperties, TimeSlot, TimeSlotProperties } from './free-busy';
|
|
3
|
+
export declare enum RoundRobin {
|
|
4
|
+
MaxAvailability = "max-availability",
|
|
5
|
+
MaxFairness = "max-fairness"
|
|
6
|
+
}
|
|
7
|
+
export declare enum Days {
|
|
8
|
+
Monday = 0,
|
|
9
|
+
Tuesday = 1,
|
|
10
|
+
Wednesday = 2,
|
|
11
|
+
Thursday = 3,
|
|
12
|
+
Friday = 4,
|
|
13
|
+
Saturday = 5,
|
|
14
|
+
Sunday = 6
|
|
15
|
+
}
|
|
16
|
+
declare type AvailabilityQuery = {
|
|
17
|
+
duration: number;
|
|
18
|
+
interval: number;
|
|
19
|
+
startTime: number;
|
|
20
|
+
endTime: number;
|
|
21
|
+
buffer?: number;
|
|
22
|
+
tentativeBusy?: boolean;
|
|
23
|
+
freeBusy?: FreeBusyProperties[];
|
|
24
|
+
openHours?: OpenHoursProperties[];
|
|
25
|
+
};
|
|
26
|
+
export declare type SingleAvailabilityQuery = AvailabilityQuery & {
|
|
27
|
+
emails: string[];
|
|
28
|
+
roundRobin?: RoundRobin;
|
|
29
|
+
};
|
|
30
|
+
export declare type ConsecutiveAvailabilityQuery = AvailabilityQuery & {
|
|
31
|
+
emails: Array<string[]>;
|
|
32
|
+
};
|
|
33
|
+
export declare type OpenHoursProperties = {
|
|
34
|
+
emails: string[];
|
|
35
|
+
days: Days[];
|
|
36
|
+
timezone: string;
|
|
37
|
+
start: string;
|
|
38
|
+
end: string;
|
|
39
|
+
};
|
|
40
|
+
export declare class OpenHours extends Model implements OpenHoursProperties {
|
|
41
|
+
objectType: string;
|
|
42
|
+
emails: string[];
|
|
43
|
+
days: Days[];
|
|
44
|
+
timezone: string;
|
|
45
|
+
start: string;
|
|
46
|
+
end: string;
|
|
47
|
+
constructor(props?: OpenHoursProperties);
|
|
48
|
+
}
|
|
49
|
+
export declare type CalendarConsecutiveAvailabilityProperties = {
|
|
50
|
+
emails: string[];
|
|
51
|
+
startTime: number;
|
|
52
|
+
endTime: number;
|
|
53
|
+
};
|
|
54
|
+
export declare class CalendarConsecutiveAvailability extends Model implements CalendarConsecutiveAvailabilityProperties {
|
|
55
|
+
emails: string[];
|
|
56
|
+
startTime: number;
|
|
57
|
+
endTime: number;
|
|
58
|
+
constructor(props?: CalendarConsecutiveAvailabilityProperties);
|
|
59
|
+
}
|
|
60
|
+
export declare type CalendarAvailabilityProperties = {
|
|
61
|
+
timeSlots: TimeSlotProperties[];
|
|
62
|
+
};
|
|
63
|
+
export default class CalendarAvailability extends Model implements CalendarAvailabilityProperties {
|
|
64
|
+
object: string;
|
|
65
|
+
timeSlots: TimeSlot[];
|
|
66
|
+
constructor(props?: CalendarAvailabilityProperties);
|
|
67
|
+
}
|
|
68
|
+
export {};
|