nylas 5.9.0 → 6.0.0-canary.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.
Files changed (86) hide show
  1. package/lib/models/account.d.ts +20 -7
  2. package/lib/models/account.js +13 -2
  3. package/lib/models/attributes.d.ts +67 -23
  4. package/lib/models/attributes.js +108 -13
  5. package/lib/models/calendar-availability.d.ts +41 -0
  6. package/lib/models/calendar-availability.js +88 -0
  7. package/lib/models/calendar-restful-model-collection.d.ts +17 -55
  8. package/lib/models/calendar-restful-model-collection.js +35 -24
  9. package/lib/models/calendar.d.ts +19 -13
  10. package/lib/models/calendar.js +12 -12
  11. package/lib/models/component.d.ts +16 -1
  12. package/lib/models/component.js +5 -3
  13. package/lib/models/connect.d.ts +67 -5
  14. package/lib/models/connect.js +155 -15
  15. package/lib/models/contact-restful-model-collection.d.ts +2 -4
  16. package/lib/models/contact-restful-model-collection.js +1 -2
  17. package/lib/models/contact.d.ts +92 -48
  18. package/lib/models/contact.js +117 -81
  19. package/lib/models/delta-stream.d.ts +5 -7
  20. package/lib/models/delta-stream.js +8 -8
  21. package/lib/models/delta.d.ts +5 -4
  22. package/lib/models/delta.js +2 -3
  23. package/lib/models/draft.d.ts +14 -17
  24. package/lib/models/draft.js +9 -8
  25. package/lib/models/email-participant.d.ts +9 -4
  26. package/lib/models/email-participant.js +9 -7
  27. package/lib/models/event-conferencing.d.ts +21 -13
  28. package/lib/models/event-conferencing.js +12 -25
  29. package/lib/models/event-participant.d.ts +10 -4
  30. package/lib/models/event-participant.js +7 -5
  31. package/lib/models/event.d.ts +32 -18
  32. package/lib/models/event.js +41 -33
  33. package/lib/models/file.d.ts +15 -6
  34. package/lib/models/file.js +8 -4
  35. package/lib/models/folder.d.ts +9 -7
  36. package/lib/models/folder.js +7 -11
  37. package/lib/models/free-busy.d.ts +23 -0
  38. package/lib/models/free-busy.js +77 -0
  39. package/lib/models/job-status.d.ts +9 -1
  40. package/lib/models/job-status.js +4 -2
  41. package/lib/models/management-account.d.ts +48 -12
  42. package/lib/models/management-account.js +71 -2
  43. package/lib/models/management-model-collection.d.ts +2 -3
  44. package/lib/models/management-model-collection.js +6 -2
  45. package/lib/models/management-model.d.ts +1 -3
  46. package/lib/models/management-model.js +2 -2
  47. package/lib/models/message.d.ts +31 -14
  48. package/lib/models/message.js +8 -11
  49. package/lib/models/model-collection.d.ts +24 -0
  50. package/lib/models/model-collection.js +198 -0
  51. package/lib/models/model.d.ts +11 -0
  52. package/lib/models/model.js +57 -0
  53. package/lib/models/neural-categorizer.d.ts +21 -15
  54. package/lib/models/neural-categorizer.js +15 -15
  55. package/lib/models/neural-clean-conversation.d.ts +10 -4
  56. package/lib/models/neural-clean-conversation.js +6 -2
  57. package/lib/models/neural-ocr.d.ts +10 -4
  58. package/lib/models/neural-ocr.js +6 -2
  59. package/lib/models/neural-sentiment-analysis.d.ts +15 -6
  60. package/lib/models/neural-sentiment-analysis.js +9 -2
  61. package/lib/models/neural-signature-contact.d.ts +25 -23
  62. package/lib/models/neural-signature-contact.js +26 -31
  63. package/lib/models/neural-signature-extraction.d.ts +11 -4
  64. package/lib/models/neural-signature-extraction.js +6 -2
  65. package/lib/models/neural.d.ts +21 -9
  66. package/lib/models/neural.js +61 -21
  67. package/lib/models/nylas-api-error.d.ts +1 -3
  68. package/lib/models/resource.d.ts +15 -5
  69. package/lib/models/resource.js +9 -2
  70. package/lib/models/restful-model-collection.d.ts +9 -53
  71. package/lib/models/restful-model-collection.js +27 -185
  72. package/lib/models/restful-model-instance.d.ts +1 -3
  73. package/lib/models/restful-model-instance.js +1 -1
  74. package/lib/models/restful-model.d.ts +14 -28
  75. package/lib/models/restful-model.js +34 -37
  76. package/lib/models/scheduler.d.ts +169 -71
  77. package/lib/models/scheduler.js +267 -3
  78. package/lib/models/thread.d.ts +36 -20
  79. package/lib/models/thread.js +15 -7
  80. package/lib/models/webhook.d.ts +15 -7
  81. package/lib/models/webhook.js +8 -3
  82. package/lib/models/when.d.ts +20 -0
  83. package/lib/models/when.js +57 -0
  84. package/lib/nylas-connection.d.ts +6 -14
  85. package/lib/nylas-connection.js +2 -2
  86. package/package.json +1 -1
@@ -1,10 +1,23 @@
1
1
  import RestfulModel from './restful-model';
2
- export default class Account extends RestfulModel {
3
- name?: string;
4
- emailAddress?: string;
5
- provider?: string;
6
- organizationUnit?: string;
7
- syncState?: string;
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
- linkedAt?: Date;
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
+ billingState?: string;
21
+ accessToken?: string;
22
+ constructor(connection: NylasConnection, props?: AccountProperties);
10
23
  }
@@ -31,8 +31,16 @@ 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
- return _super !== null && _super.apply(this, arguments) || this;
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.initAttributes(props);
43
+ return _this;
36
44
  }
37
45
  return Account;
38
46
  }(restful_model_1.default));
@@ -58,4 +66,7 @@ Account.attributes = __assign(__assign({}, restful_model_1.default.attributes),
58
66
  }), linkedAt: attributes_1.default.DateTime({
59
67
  modelKey: 'linkedAt',
60
68
  jsonKey: 'linked_at',
69
+ }), accessToken: attributes_1.default.String({
70
+ modelKey: 'accessToken',
71
+ jsonKey: 'access_token',
61
72
  }) });
@@ -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,54 +9,80 @@ 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
  }
14
15
  declare class AttributeObject extends Attribute {
15
- itemClass?: typeof RestfulModel;
16
+ itemClass?: any;
16
17
  constructor({ modelKey, jsonKey, itemClass, readOnly, }: {
17
18
  modelKey: string;
18
19
  jsonKey?: string;
19
- itemClass?: typeof RestfulModel;
20
+ itemClass?: typeof Model | typeof RestfulModel;
20
21
  readOnly?: boolean;
21
22
  });
22
- toJSON(val: any): any;
23
+ toJSON(val: any): unknown;
23
24
  fromJSON(val: any, _parent: any): any;
24
25
  }
25
26
  declare class AttributeNumber extends Attribute {
26
- toJSON(val: any): any;
27
- fromJSON(val: any, _parent: any): number | null;
27
+ toJSON(val: number): number;
28
+ fromJSON(val: any): number | null;
29
+ }
30
+ declare class AttributeNumberList extends Attribute {
31
+ toJSON(val: any): number;
32
+ fromJSON(json: any, _parent: any): number[];
28
33
  }
29
34
  declare class AttributeBoolean extends Attribute {
30
- toJSON(val: any): any;
31
- fromJSON(val: any, _parent: any): boolean;
35
+ toJSON(val: boolean): boolean;
36
+ fromJSON(val: string | boolean): boolean;
32
37
  }
33
38
  declare class AttributeString extends Attribute {
34
- toJSON(val: any): any;
35
- fromJSON(val: any, _parent: any): any;
39
+ toJSON(val: string): string;
40
+ fromJSON(val: string): string;
36
41
  }
37
42
  declare class AttributeStringList extends Attribute {
38
- toJSON(val: any): any;
39
- fromJSON(val: any, _parent: any): any;
43
+ toJSON(val: []): [];
44
+ fromJSON(val: []): [];
40
45
  }
41
46
  declare class AttributeDate extends Attribute {
42
- toJSON(val: any): any;
47
+ toJSON(val: Date): string;
43
48
  fromJSON(val: any, _parent: any): Date | null;
44
49
  }
45
50
  declare class AttributeDateTime extends Attribute {
46
- toJSON(val: any): number | null;
47
- fromJSON(val: any, _parent: any): Date | null;
51
+ toJSON(val: Date): number | null;
52
+ fromJSON(val: number, _parent: any): Date | null;
48
53
  }
49
54
  declare class AttributeCollection extends Attribute {
50
- itemClass: typeof RestfulModel;
55
+ itemClass: any;
51
56
  constructor({ modelKey, jsonKey, itemClass, readOnly, }: {
52
57
  modelKey: string;
53
58
  jsonKey?: string;
54
- itemClass: typeof RestfulModel;
59
+ itemClass: typeof Model | typeof RestfulModel;
60
+ readOnly?: boolean;
61
+ });
62
+ toJSON(vals: any[]): unknown[];
63
+ fromJSON(json: unknown[], _parent: any): typeof Model[] | typeof RestfulModel[] | unknown[];
64
+ }
65
+ declare class AttributeEnum extends Attribute {
66
+ itemClass: any;
67
+ constructor({ modelKey, itemClass, jsonKey, readOnly, }: {
68
+ modelKey: string;
69
+ itemClass: any;
70
+ jsonKey?: string;
71
+ readOnly?: boolean;
72
+ });
73
+ toJSON(val: any): string;
74
+ fromJSON(val: unknown): unknown;
75
+ }
76
+ declare class AttributeEnumList extends Attribute {
77
+ itemClass: any;
78
+ constructor({ modelKey, itemClass, jsonKey, readOnly, }: {
79
+ modelKey: string;
80
+ itemClass: any;
81
+ jsonKey?: string;
55
82
  readOnly?: boolean;
56
83
  });
57
- toJSON(vals: any): any[];
58
- fromJSON(json: any, _parent: any): RestfulModel[];
84
+ toJSON(val: any[]): string[];
85
+ fromJSON(val: any[], _parent: any): any[];
59
86
  }
60
87
  declare const Attributes: {
61
88
  Number(__0: {
@@ -63,6 +90,11 @@ declare const Attributes: {
63
90
  jsonKey?: string | undefined;
64
91
  readOnly?: boolean | undefined;
65
92
  }): AttributeNumber;
93
+ NumberList(__0: {
94
+ modelKey: string;
95
+ jsonKey?: string | undefined;
96
+ readOnly?: boolean | undefined;
97
+ }): AttributeNumberList;
66
98
  String(__0: {
67
99
  modelKey: string;
68
100
  jsonKey?: string | undefined;
@@ -86,7 +118,7 @@ declare const Attributes: {
86
118
  Collection(__0: {
87
119
  modelKey: string;
88
120
  jsonKey?: string | undefined;
89
- itemClass: typeof RestfulModel;
121
+ itemClass: typeof Model | typeof RestfulModel;
90
122
  readOnly?: boolean | undefined;
91
123
  }): AttributeCollection;
92
124
  Boolean(__0: {
@@ -97,8 +129,20 @@ declare const Attributes: {
97
129
  Object(__0: {
98
130
  modelKey: string;
99
131
  jsonKey?: string | undefined;
100
- itemClass?: typeof RestfulModel | undefined;
132
+ itemClass?: typeof Model | typeof RestfulModel | undefined;
101
133
  readOnly?: boolean | undefined;
102
134
  }): AttributeObject;
135
+ Enum(__0: {
136
+ modelKey: string;
137
+ itemClass: any;
138
+ jsonKey?: string | undefined;
139
+ readOnly?: boolean | undefined;
140
+ }): AttributeEnum;
141
+ EnumList(__0: {
142
+ modelKey: string;
143
+ itemClass: any;
144
+ jsonKey?: string | undefined;
145
+ readOnly?: boolean | undefined;
146
+ }): AttributeEnumList;
103
147
  };
104
148
  export default Attributes;
@@ -19,8 +19,12 @@ 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
  exports.Attribute = void 0;
27
+ var restful_model_1 = __importDefault(require("./restful-model"));
24
28
  // The Attribute class represents a single model attribute, like 'namespace_id'
25
29
  // Subclasses of Attribute like AttributeDateTime know how to covert between
26
30
  // the JSON representation of that type and the javascript representation.
@@ -32,12 +36,6 @@ var Attribute = /** @class */ (function () {
32
36
  this.jsonKey = jsonKey || modelKey;
33
37
  this.readOnly = readOnly || false;
34
38
  }
35
- Attribute.prototype.toJSON = function (val) {
36
- return val;
37
- };
38
- Attribute.prototype.fromJSON = function (val, _parent) {
39
- return val || null;
40
- };
41
39
  return Attribute;
42
40
  }());
43
41
  exports.Attribute = Attribute;
@@ -62,7 +60,10 @@ var AttributeObject = /** @class */ (function (_super) {
62
60
  if (!val || !this.itemClass) {
63
61
  return val;
64
62
  }
65
- return new this.itemClass(_parent.connection, val);
63
+ if (this.itemClass.prototype instanceof restful_model_1.default) {
64
+ return new this.itemClass(_parent.connection).fromJSON(val);
65
+ }
66
+ return new this.itemClass(val).fromJSON(val);
66
67
  };
67
68
  return AttributeObject;
68
69
  }(Attribute));
@@ -74,8 +75,8 @@ var AttributeNumber = /** @class */ (function (_super) {
74
75
  AttributeNumber.prototype.toJSON = function (val) {
75
76
  return val;
76
77
  };
77
- AttributeNumber.prototype.fromJSON = function (val, _parent) {
78
- if (!isNaN(val)) {
78
+ AttributeNumber.prototype.fromJSON = function (val) {
79
+ if (!isNaN(Number(val))) {
79
80
  return Number(val);
80
81
  }
81
82
  else {
@@ -84,6 +85,28 @@ var AttributeNumber = /** @class */ (function (_super) {
84
85
  };
85
86
  return AttributeNumber;
86
87
  }(Attribute));
88
+ var AttributeNumberList = /** @class */ (function (_super) {
89
+ __extends(AttributeNumberList, _super);
90
+ function AttributeNumberList() {
91
+ return _super !== null && _super.apply(this, arguments) || this;
92
+ }
93
+ AttributeNumberList.prototype.toJSON = function (val) {
94
+ return val;
95
+ };
96
+ AttributeNumberList.prototype.fromJSON = function (json, _parent) {
97
+ if (!json || !(json instanceof Array)) {
98
+ return [];
99
+ }
100
+ var nums = [];
101
+ for (var num in json) {
102
+ if (!isNaN(Number(num))) {
103
+ nums.push(Number(num));
104
+ }
105
+ }
106
+ return nums;
107
+ };
108
+ return AttributeNumberList;
109
+ }(Attribute));
87
110
  var AttributeBoolean = /** @class */ (function (_super) {
88
111
  __extends(AttributeBoolean, _super);
89
112
  function AttributeBoolean() {
@@ -92,7 +115,7 @@ var AttributeBoolean = /** @class */ (function (_super) {
92
115
  AttributeBoolean.prototype.toJSON = function (val) {
93
116
  return val;
94
117
  };
95
- AttributeBoolean.prototype.fromJSON = function (val, _parent) {
118
+ AttributeBoolean.prototype.fromJSON = function (val) {
96
119
  return val === 'true' || val === true || false;
97
120
  };
98
121
  return AttributeBoolean;
@@ -105,7 +128,7 @@ var AttributeString = /** @class */ (function (_super) {
105
128
  AttributeString.prototype.toJSON = function (val) {
106
129
  return val;
107
130
  };
108
- AttributeString.prototype.fromJSON = function (val, _parent) {
131
+ AttributeString.prototype.fromJSON = function (val) {
109
132
  return val || '';
110
133
  };
111
134
  return AttributeString;
@@ -118,7 +141,7 @@ var AttributeStringList = /** @class */ (function (_super) {
118
141
  AttributeStringList.prototype.toJSON = function (val) {
119
142
  return val;
120
143
  };
121
- AttributeStringList.prototype.fromJSON = function (val, _parent) {
144
+ AttributeStringList.prototype.fromJSON = function (val) {
122
145
  return val || [];
123
146
  };
124
147
  return AttributeStringList;
@@ -198,13 +221,64 @@ var AttributeCollection = /** @class */ (function (_super) {
198
221
  var objs = [];
199
222
  for (var _i = 0, json_1 = json; _i < json_1.length; _i++) {
200
223
  var objJSON = json_1[_i];
201
- var obj = new this.itemClass(_parent.connection, objJSON);
224
+ var obj = void 0;
225
+ if (this.itemClass.prototype instanceof restful_model_1.default) {
226
+ obj = new this.itemClass(_parent.connection).fromJSON(objJSON);
227
+ }
228
+ else {
229
+ obj = new this.itemClass(objJSON).fromJSON(objJSON);
230
+ }
202
231
  objs.push(obj);
203
232
  }
204
233
  return objs;
205
234
  };
206
235
  return AttributeCollection;
207
236
  }(Attribute));
237
+ var AttributeEnum = /** @class */ (function (_super) {
238
+ __extends(AttributeEnum, _super);
239
+ function AttributeEnum(_a) {
240
+ var modelKey = _a.modelKey, itemClass = _a.itemClass, jsonKey = _a.jsonKey, readOnly = _a.readOnly;
241
+ var _this = _super.call(this, { modelKey: modelKey, jsonKey: jsonKey, readOnly: readOnly }) || this;
242
+ _this.itemClass = itemClass;
243
+ return _this;
244
+ }
245
+ AttributeEnum.prototype.toJSON = function (val) {
246
+ return val.toString();
247
+ };
248
+ AttributeEnum.prototype.fromJSON = function (val) {
249
+ if (Object.values(this.itemClass).includes(val)) {
250
+ return val;
251
+ }
252
+ return;
253
+ };
254
+ return AttributeEnum;
255
+ }(Attribute));
256
+ var AttributeEnumList = /** @class */ (function (_super) {
257
+ __extends(AttributeEnumList, _super);
258
+ function AttributeEnumList(_a) {
259
+ var modelKey = _a.modelKey, itemClass = _a.itemClass, jsonKey = _a.jsonKey, readOnly = _a.readOnly;
260
+ var _this = _super.call(this, { modelKey: modelKey, jsonKey: jsonKey, readOnly: readOnly }) || this;
261
+ _this.itemClass = itemClass;
262
+ return _this;
263
+ }
264
+ AttributeEnumList.prototype.toJSON = function (val) {
265
+ var enumList = [];
266
+ for (var v in val) {
267
+ enumList.push(v.toString());
268
+ }
269
+ return enumList;
270
+ };
271
+ AttributeEnumList.prototype.fromJSON = function (val, _parent) {
272
+ var enumList = [];
273
+ for (var v in val) {
274
+ if (Object.values(this.itemClass).includes(val[v])) {
275
+ enumList.push(val[v]);
276
+ }
277
+ }
278
+ return enumList;
279
+ };
280
+ return AttributeEnumList;
281
+ }(Attribute));
208
282
  var Attributes = {
209
283
  Number: function () {
210
284
  var args = [];
@@ -213,6 +287,13 @@ var Attributes = {
213
287
  }
214
288
  return new (AttributeNumber.bind.apply(AttributeNumber, __spreadArrays([void 0], args)))();
215
289
  },
290
+ NumberList: function () {
291
+ var args = [];
292
+ for (var _i = 0; _i < arguments.length; _i++) {
293
+ args[_i] = arguments[_i];
294
+ }
295
+ return new (AttributeNumberList.bind.apply(AttributeNumberList, __spreadArrays([void 0], args)))();
296
+ },
216
297
  String: function () {
217
298
  var args = [];
218
299
  for (var _i = 0; _i < arguments.length; _i++) {
@@ -262,5 +343,19 @@ var Attributes = {
262
343
  }
263
344
  return new (AttributeObject.bind.apply(AttributeObject, __spreadArrays([void 0], args)))();
264
345
  },
346
+ Enum: function () {
347
+ var args = [];
348
+ for (var _i = 0; _i < arguments.length; _i++) {
349
+ args[_i] = arguments[_i];
350
+ }
351
+ return new (AttributeEnum.bind.apply(AttributeEnum, __spreadArrays([void 0], args)))();
352
+ },
353
+ EnumList: function () {
354
+ var args = [];
355
+ for (var _i = 0; _i < arguments.length; _i++) {
356
+ args[_i] = arguments[_i];
357
+ }
358
+ return new (AttributeEnumList.bind.apply(AttributeEnumList, __spreadArrays([void 0], args)))();
359
+ },
265
360
  };
266
361
  exports.default = Attributes;
@@ -0,0 +1,41 @@
1
+ import Model from './model';
2
+ import { TimeSlot, TimeSlotProperties } from './free-busy';
3
+ export declare enum RoundRobin {
4
+ MaxAvailability = "max-availability",
5
+ MaxFairness = "max-fairness"
6
+ }
7
+ export declare type OpenHoursProperties = {
8
+ emails: string[];
9
+ days: number[];
10
+ timezone: string;
11
+ start: string;
12
+ end: string;
13
+ };
14
+ export declare class OpenHours extends Model implements OpenHoursProperties {
15
+ objectType: string;
16
+ emails: string[];
17
+ days: number[];
18
+ timezone: string;
19
+ start: string;
20
+ end: string;
21
+ constructor(props?: OpenHoursProperties);
22
+ }
23
+ export declare type CalendarConsecutiveAvailabilityProperties = {
24
+ emails: string[];
25
+ start_time: number;
26
+ end_time: number;
27
+ };
28
+ export declare class CalendarConsecutiveAvailability extends Model implements CalendarConsecutiveAvailabilityProperties {
29
+ emails: string[];
30
+ start_time: number;
31
+ end_time: number;
32
+ constructor(props?: CalendarConsecutiveAvailabilityProperties);
33
+ }
34
+ export declare type CalendarAvailabilityProperties = {
35
+ timeSlots: TimeSlotProperties[];
36
+ };
37
+ export default class CalendarAvailability extends Model implements CalendarAvailabilityProperties {
38
+ object: string;
39
+ timeSlots: TimeSlot[];
40
+ constructor(props?: CalendarAvailabilityProperties);
41
+ }
@@ -0,0 +1,88 @@
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.CalendarConsecutiveAvailability = exports.OpenHours = exports.RoundRobin = void 0;
20
+ var model_1 = __importDefault(require("./model"));
21
+ var attributes_1 = __importDefault(require("./attributes"));
22
+ var RoundRobin;
23
+ (function (RoundRobin) {
24
+ RoundRobin["MaxAvailability"] = "max-availability";
25
+ RoundRobin["MaxFairness"] = "max-fairness";
26
+ })(RoundRobin = exports.RoundRobin || (exports.RoundRobin = {}));
27
+ var OpenHours = /** @class */ (function (_super) {
28
+ __extends(OpenHours, _super);
29
+ function OpenHours(props) {
30
+ var _this = _super.call(this) || this;
31
+ _this.objectType = 'open_hours';
32
+ _this.emails = [];
33
+ _this.days = [];
34
+ _this.timezone = '';
35
+ _this.start = '';
36
+ _this.end = '';
37
+ _this.initAttributes(props);
38
+ return _this;
39
+ }
40
+ return OpenHours;
41
+ }(model_1.default));
42
+ 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
+ var CalendarConsecutiveAvailability = /** @class */ (function (_super) {
65
+ __extends(CalendarConsecutiveAvailability, _super);
66
+ function CalendarConsecutiveAvailability(props) {
67
+ var _this = _super.call(this) || this;
68
+ _this.emails = [];
69
+ _this.start_time = 0;
70
+ _this.end_time = 0;
71
+ _this.initAttributes(props);
72
+ return _this;
73
+ }
74
+ return CalendarConsecutiveAvailability;
75
+ }(model_1.default));
76
+ exports.CalendarConsecutiveAvailability = CalendarConsecutiveAvailability;
77
+ var CalendarAvailability = /** @class */ (function (_super) {
78
+ __extends(CalendarAvailability, _super);
79
+ function CalendarAvailability(props) {
80
+ var _this = _super.call(this) || this;
81
+ _this.object = 'availability';
82
+ _this.timeSlots = [];
83
+ _this.initAttributes(props);
84
+ return _this;
85
+ }
86
+ return CalendarAvailability;
87
+ }(model_1.default));
88
+ exports.default = CalendarAvailability;
@@ -1,76 +1,38 @@
1
1
  import Calendar from './calendar';
2
2
  import NylasConnection from '../nylas-connection';
3
3
  import RestfulModelCollection from './restful-model-collection';
4
+ import FreeBusy, { FreeBusyProperties } from './free-busy';
5
+ import CalendarAvailability, { CalendarConsecutiveAvailability, OpenHoursProperties, RoundRobin } from './calendar-availability';
4
6
  export default class CalendarRestfulModelCollection extends RestfulModelCollection<Calendar> {
5
7
  connection: NylasConnection;
6
8
  modelClass: typeof Calendar;
7
9
  constructor(connection: NylasConnection);
8
10
  freeBusy(options: {
9
- start_time?: string;
10
- startTime?: string;
11
- end_time?: string;
12
- endTime?: string;
11
+ startTime: number;
12
+ endTime: number;
13
13
  emails: string[];
14
- }, callback?: (error: Error | null, data?: {
15
- [key: string]: any;
16
- }) => void): Promise<any>;
14
+ }, callback?: (error: Error | null, data?: Record<string, unknown>) => void): Promise<FreeBusy[]>;
17
15
  availability(options: {
18
16
  emails: string[];
19
17
  duration: number;
20
18
  interval: number;
21
- start_time?: string;
22
- startTime?: string;
23
- end_time?: string;
24
- endTime?: string;
25
- free_busy?: Array<{
26
- emails: string;
27
- object: string;
28
- time_slots: Array<{
29
- object: string;
30
- status: string;
31
- start_time: string;
32
- end_time: string;
33
- }>;
34
- }>;
35
- open_hours: Array<{
36
- emails: string[];
37
- days: string[];
38
- timezone: string;
39
- start: string;
40
- end: string;
41
- object_type: string;
42
- }>;
43
- }, callback?: (error: Error | null, data?: {
44
- [key: string]: any;
45
- }) => void): Promise<any>;
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>;
46
26
  consecutiveAvailability(options: {
47
27
  emails: Array<string[]>;
48
28
  duration: number;
49
29
  interval: number;
50
- start_time?: number;
51
- startTime?: number;
52
- end_time?: number;
53
- endTime?: number;
30
+ startTime: number;
31
+ endTime: number;
54
32
  buffer?: number;
55
- free_busy?: Array<{
56
- email: string;
57
- object: string;
58
- time_slots: Array<{
59
- object: string;
60
- status: string;
61
- start_time: number;
62
- end_time: number;
63
- }>;
64
- }>;
65
- open_hours: Array<{
66
- emails: string[];
67
- days: number[];
68
- timezone: string;
69
- start: string;
70
- end: string;
71
- object_type: string;
72
- }>;
33
+ freeBusy?: FreeBusyProperties[];
34
+ openHours?: OpenHoursProperties[];
73
35
  }, callback?: (error: Error | null, data?: {
74
36
  [key: string]: any;
75
- }) => void): Promise<any>;
37
+ }) => void): Promise<CalendarConsecutiveAvailability>;
76
38
  }