nylas 6.10.0 → 7.0.0-beta.1

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 (197) hide show
  1. package/README.md +26 -14
  2. package/lib/cjs/apiClient.js +115 -0
  3. package/lib/cjs/config.js +32 -0
  4. package/lib/cjs/models/applicationDetails.js +2 -0
  5. package/lib/cjs/models/auth.js +2 -0
  6. package/lib/cjs/models/availability.js +11 -0
  7. package/lib/cjs/models/calendars.js +2 -0
  8. package/lib/cjs/models/error.js +53 -0
  9. package/lib/cjs/models/events.js +2 -0
  10. package/lib/cjs/models/grants.js +2 -0
  11. package/lib/cjs/models/listQueryParams.js +2 -0
  12. package/lib/cjs/models/redirectUri.js +2 -0
  13. package/lib/cjs/models/response.js +2 -0
  14. package/lib/cjs/models/webhooks.js +18 -0
  15. package/lib/cjs/nylas.js +34 -0
  16. package/lib/cjs/resources/applications.js +30 -0
  17. package/lib/cjs/resources/auth.js +153 -0
  18. package/lib/cjs/resources/calendars.js +78 -0
  19. package/lib/cjs/resources/events.js +69 -0
  20. package/lib/cjs/resources/grants.js +65 -0
  21. package/lib/cjs/resources/redirectUris.js +64 -0
  22. package/lib/cjs/resources/resource.js +111 -0
  23. package/lib/cjs/resources/webhooks.js +98 -0
  24. package/lib/cjs/utils.js +58 -0
  25. package/lib/esm/apiClient.js +112 -0
  26. package/lib/esm/config.js +29 -0
  27. package/lib/esm/models/applicationDetails.js +1 -0
  28. package/lib/esm/models/auth.js +1 -0
  29. package/lib/esm/models/availability.js +8 -0
  30. package/lib/esm/models/calendars.js +1 -0
  31. package/lib/esm/models/error.js +45 -0
  32. package/lib/esm/models/events.js +1 -0
  33. package/lib/esm/models/grants.js +1 -0
  34. package/lib/esm/models/listQueryParams.js +1 -0
  35. package/lib/esm/models/redirectUri.js +1 -0
  36. package/lib/esm/models/response.js +1 -0
  37. package/lib/esm/models/webhooks.js +15 -0
  38. package/lib/esm/nylas.js +31 -0
  39. package/lib/esm/resources/applications.js +26 -0
  40. package/lib/esm/resources/auth.js +149 -0
  41. package/lib/esm/resources/calendars.js +74 -0
  42. package/lib/esm/resources/events.js +65 -0
  43. package/lib/esm/resources/grants.js +61 -0
  44. package/lib/esm/resources/redirectUris.js +60 -0
  45. package/lib/esm/resources/resource.js +107 -0
  46. package/lib/esm/resources/webhooks.js +94 -0
  47. package/lib/esm/utils.js +53 -0
  48. package/lib/types/apiClient.d.ts +65 -0
  49. package/lib/types/config.d.ts +50 -0
  50. package/lib/types/models/applicationDetails.d.ts +93 -0
  51. package/lib/types/models/auth.d.ts +196 -0
  52. package/lib/types/models/availability.d.ts +159 -0
  53. package/lib/types/models/calendars.d.ts +121 -0
  54. package/lib/types/models/error.d.ts +104 -0
  55. package/lib/types/models/events.d.ts +494 -0
  56. package/lib/types/models/grants.d.ts +134 -0
  57. package/lib/types/models/listQueryParams.d.ts +4 -0
  58. package/lib/types/models/redirectUri.d.ts +71 -0
  59. package/lib/types/models/response.d.ts +40 -0
  60. package/lib/types/models/webhooks.d.ts +45 -0
  61. package/lib/types/nylas.d.ts +44 -0
  62. package/lib/types/resources/applications.d.ts +26 -0
  63. package/lib/types/resources/auth.d.ts +66 -0
  64. package/lib/types/resources/calendars.d.ts +97 -0
  65. package/lib/types/resources/events.d.ts +87 -0
  66. package/lib/types/resources/grants.d.ts +63 -0
  67. package/lib/types/resources/redirectUris.d.ts +63 -0
  68. package/lib/types/resources/resource.d.ts +55 -0
  69. package/lib/types/resources/webhooks.d.ts +79 -0
  70. package/lib/types/utils.d.ts +22 -0
  71. package/package.json +28 -39
  72. package/lib/config.d.ts +0 -52
  73. package/lib/config.js +0 -47
  74. package/lib/models/access-token.d.ts +0 -18
  75. package/lib/models/access-token.js +0 -56
  76. package/lib/models/account.d.ts +0 -27
  77. package/lib/models/account.js +0 -73
  78. package/lib/models/application-details.d.ts +0 -14
  79. package/lib/models/application-details.js +0 -47
  80. package/lib/models/attributes.d.ts +0 -151
  81. package/lib/models/attributes.js +0 -382
  82. package/lib/models/calendar-availability.d.ts +0 -76
  83. package/lib/models/calendar-availability.js +0 -121
  84. package/lib/models/calendar-restful-model-collection.d.ts +0 -17
  85. package/lib/models/calendar-restful-model-collection.js +0 -181
  86. package/lib/models/calendar.d.ts +0 -33
  87. package/lib/models/calendar.js +0 -97
  88. package/lib/models/component-restful-model-collection.d.ts +0 -9
  89. package/lib/models/component-restful-model-collection.js +0 -34
  90. package/lib/models/component.d.ts +0 -37
  91. package/lib/models/component.js +0 -91
  92. package/lib/models/connect.d.ts +0 -73
  93. package/lib/models/connect.js +0 -193
  94. package/lib/models/contact-restful-model-collection.d.ts +0 -9
  95. package/lib/models/contact-restful-model-collection.js +0 -60
  96. package/lib/models/contact.d.ts +0 -129
  97. package/lib/models/contact.js +0 -289
  98. package/lib/models/delta-collection.d.ts +0 -17
  99. package/lib/models/delta-collection.js +0 -139
  100. package/lib/models/delta-stream.d.ts +0 -32
  101. package/lib/models/delta-stream.js +0 -250
  102. package/lib/models/delta.d.ts +0 -28
  103. package/lib/models/delta.js +0 -88
  104. package/lib/models/deltas.d.ts +0 -17
  105. package/lib/models/deltas.js +0 -49
  106. package/lib/models/draft.d.ts +0 -27
  107. package/lib/models/draft.js +0 -156
  108. package/lib/models/email-participant.d.ts +0 -13
  109. package/lib/models/email-participant.js +0 -46
  110. package/lib/models/event-conferencing.d.ts +0 -34
  111. package/lib/models/event-conferencing.js +0 -71
  112. package/lib/models/event-notification.d.ts +0 -27
  113. package/lib/models/event-notification.js +0 -62
  114. package/lib/models/event-participant.d.ts +0 -19
  115. package/lib/models/event-participant.js +0 -56
  116. package/lib/models/event-reminder-method.d.ts +0 -18
  117. package/lib/models/event-reminder-method.js +0 -47
  118. package/lib/models/event.d.ts +0 -104
  119. package/lib/models/event.js +0 -308
  120. package/lib/models/file.d.ts +0 -29
  121. package/lib/models/file.js +0 -136
  122. package/lib/models/folder.d.ts +0 -21
  123. package/lib/models/folder.js +0 -69
  124. package/lib/models/free-busy.d.ts +0 -58
  125. package/lib/models/free-busy.js +0 -132
  126. package/lib/models/job-status-restful-model-collection.d.ts +0 -9
  127. package/lib/models/job-status-restful-model-collection.js +0 -38
  128. package/lib/models/job-status.d.ts +0 -24
  129. package/lib/models/job-status.js +0 -68
  130. package/lib/models/management-account.d.ts +0 -63
  131. package/lib/models/management-account.js +0 -187
  132. package/lib/models/management-model-collection.d.ts +0 -10
  133. package/lib/models/management-model-collection.js +0 -39
  134. package/lib/models/management-model.d.ts +0 -6
  135. package/lib/models/management-model.js +0 -29
  136. package/lib/models/message-restful-model-collection.d.ts +0 -26
  137. package/lib/models/message-restful-model-collection.js +0 -80
  138. package/lib/models/message.d.ts +0 -57
  139. package/lib/models/message.js +0 -173
  140. package/lib/models/model-collection.d.ts +0 -25
  141. package/lib/models/model-collection.js +0 -201
  142. package/lib/models/model.d.ts +0 -12
  143. package/lib/models/model.js +0 -64
  144. package/lib/models/neural-categorizer.d.ts +0 -28
  145. package/lib/models/neural-categorizer.js +0 -139
  146. package/lib/models/neural-clean-conversation.d.ts +0 -16
  147. package/lib/models/neural-clean-conversation.js +0 -114
  148. package/lib/models/neural-ocr.d.ts +0 -14
  149. package/lib/models/neural-ocr.js +0 -50
  150. package/lib/models/neural-sentiment-analysis.d.ts +0 -20
  151. package/lib/models/neural-sentiment-analysis.js +0 -56
  152. package/lib/models/neural-signature-contact.d.ts +0 -43
  153. package/lib/models/neural-signature-contact.js +0 -142
  154. package/lib/models/neural-signature-extraction.d.ts +0 -17
  155. package/lib/models/neural-signature-extraction.js +0 -54
  156. package/lib/models/neural.d.ts +0 -36
  157. package/lib/models/neural.js +0 -163
  158. package/lib/models/nylas-api-error.d.ts +0 -26
  159. package/lib/models/nylas-api-error.js +0 -62
  160. package/lib/models/outbox-job-status.d.ts +0 -20
  161. package/lib/models/outbox-job-status.js +0 -64
  162. package/lib/models/outbox-message.d.ts +0 -16
  163. package/lib/models/outbox-message.js +0 -54
  164. package/lib/models/outbox.d.ts +0 -35
  165. package/lib/models/outbox.js +0 -158
  166. package/lib/models/rate-limit-error.d.ts +0 -26
  167. package/lib/models/rate-limit-error.js +0 -47
  168. package/lib/models/resource.d.ts +0 -22
  169. package/lib/models/resource.js +0 -66
  170. package/lib/models/restful-model-collection.d.ts +0 -15
  171. package/lib/models/restful-model-collection.js +0 -169
  172. package/lib/models/restful-model-instance.d.ts +0 -9
  173. package/lib/models/restful-model-instance.js +0 -37
  174. package/lib/models/restful-model.d.ts +0 -36
  175. package/lib/models/restful-model.js +0 -146
  176. package/lib/models/scheduler-booking-request.d.ts +0 -64
  177. package/lib/models/scheduler-booking-request.js +0 -148
  178. package/lib/models/scheduler-restful-model-collection.d.ts +0 -26
  179. package/lib/models/scheduler-restful-model-collection.js +0 -133
  180. package/lib/models/scheduler-time-slot.d.ts +0 -20
  181. package/lib/models/scheduler-time-slot.js +0 -53
  182. package/lib/models/scheduler.d.ts +0 -226
  183. package/lib/models/scheduler.js +0 -446
  184. package/lib/models/thread.d.ts +0 -49
  185. package/lib/models/thread.js +0 -127
  186. package/lib/models/webhook-notification.d.ts +0 -133
  187. package/lib/models/webhook-notification.js +0 -314
  188. package/lib/models/webhook.d.ts +0 -50
  189. package/lib/models/webhook.js +0 -101
  190. package/lib/models/when.d.ts +0 -29
  191. package/lib/models/when.js +0 -76
  192. package/lib/nylas-connection.d.ts +0 -71
  193. package/lib/nylas-connection.js +0 -282
  194. package/lib/nylas.d.ts +0 -34
  195. package/lib/nylas.js +0 -199
  196. package/lib/services/tunnel.d.ts +0 -28
  197. package/lib/services/tunnel.js +0 -89
@@ -1,151 +0,0 @@
1
- import Model from './model';
2
- declare type AnyModel = new (...args: any[]) => Model;
3
- export declare abstract class Attribute {
4
- modelKey: string;
5
- jsonKey: string;
6
- readOnly: boolean;
7
- constructor({ modelKey, jsonKey, readOnly, }: {
8
- modelKey: string;
9
- jsonKey?: string;
10
- readOnly?: boolean;
11
- });
12
- abstract toJSON(val: any, _parent?: any): any;
13
- abstract fromJSON(val: any, _parent: any): any;
14
- saveRequestBody(val: any): any;
15
- }
16
- declare class AttributeObject extends Attribute {
17
- itemClass?: any;
18
- constructor({ modelKey, jsonKey, itemClass, readOnly, }: {
19
- modelKey: string;
20
- jsonKey?: string;
21
- itemClass?: AnyModel;
22
- readOnly?: boolean;
23
- });
24
- toJSON(val: any, saveRequestBody?: boolean): unknown;
25
- fromJSON(val: any, _parent: any): any;
26
- saveRequestBody(val: any): unknown;
27
- }
28
- declare class AttributeNumber extends Attribute {
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[];
35
- }
36
- declare class AttributeBoolean extends Attribute {
37
- toJSON(val: boolean): boolean;
38
- fromJSON(val: string | boolean): boolean;
39
- }
40
- declare class AttributeString extends Attribute {
41
- toJSON(val: string): string;
42
- fromJSON(val: string): string;
43
- }
44
- declare class AttributeStringList extends Attribute {
45
- toJSON(val: []): [];
46
- fromJSON(val: []): [];
47
- }
48
- declare class AttributeDate extends Attribute {
49
- toJSON(val: Date): string;
50
- fromJSON(val: any, _parent: any): Date | null;
51
- }
52
- declare class AttributeDateTime extends Attribute {
53
- toJSON(val: Date): number | null;
54
- fromJSON(val: number, _parent: any): Date | null;
55
- }
56
- declare class AttributeCollection extends Attribute {
57
- itemClass: any;
58
- constructor({ modelKey, jsonKey, itemClass, readOnly, }: {
59
- modelKey: string;
60
- jsonKey?: string;
61
- itemClass: AnyModel;
62
- readOnly?: boolean;
63
- });
64
- toJSON(vals: any, saveRequestBody?: boolean): AnyModel[];
65
- fromJSON(json: unknown[], _parent: any): AnyModel[];
66
- saveRequestBody(val: any): AnyModel[] | undefined;
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[];
89
- }
90
- declare const Attributes: {
91
- Number(__0: {
92
- modelKey: string;
93
- jsonKey?: string | undefined;
94
- readOnly?: boolean | undefined;
95
- }): AttributeNumber;
96
- NumberList(__0: {
97
- modelKey: string;
98
- jsonKey?: string | undefined;
99
- readOnly?: boolean | undefined;
100
- }): AttributeNumberList;
101
- String(__0: {
102
- modelKey: string;
103
- jsonKey?: string | undefined;
104
- readOnly?: boolean | undefined;
105
- }): AttributeString;
106
- StringList(__0: {
107
- modelKey: string;
108
- jsonKey?: string | undefined;
109
- readOnly?: boolean | undefined;
110
- }): AttributeStringList;
111
- DateTime(__0: {
112
- modelKey: string;
113
- jsonKey?: string | undefined;
114
- readOnly?: boolean | undefined;
115
- }): AttributeDateTime;
116
- Date(__0: {
117
- modelKey: string;
118
- jsonKey?: string | undefined;
119
- readOnly?: boolean | undefined;
120
- }): AttributeDate;
121
- Collection(__0: {
122
- modelKey: string;
123
- jsonKey?: string | undefined;
124
- itemClass: AnyModel;
125
- readOnly?: boolean | undefined;
126
- }): AttributeCollection;
127
- Boolean(__0: {
128
- modelKey: string;
129
- jsonKey?: string | undefined;
130
- readOnly?: boolean | undefined;
131
- }): AttributeBoolean;
132
- Object(__0: {
133
- modelKey: string;
134
- jsonKey?: string | undefined;
135
- itemClass?: AnyModel | undefined;
136
- readOnly?: boolean | undefined;
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;
150
- };
151
- export default Attributes;
@@ -1,382 +0,0 @@
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 __spreadArrays = (this && this.__spreadArrays) || function () {
16
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
17
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
18
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
19
- r[k] = a[j];
20
- return r;
21
- };
22
- Object.defineProperty(exports, "__esModule", { value: true });
23
- function isRestfulModel(cls) {
24
- // A 'RestfulModel' has 'endpointName' and 'collectionName' unlike 'Model'
25
- return cls.endpointName !== undefined && cls.collectionName !== undefined;
26
- }
27
- var Attribute = /** @class */ (function () {
28
- function Attribute(_a) {
29
- var modelKey = _a.modelKey, jsonKey = _a.jsonKey, readOnly = _a.readOnly;
30
- this.modelKey = modelKey;
31
- this.jsonKey = jsonKey || modelKey;
32
- this.readOnly = readOnly || false;
33
- }
34
- Attribute.prototype.saveRequestBody = function (val) {
35
- if (this.readOnly) {
36
- return undefined;
37
- }
38
- return this.toJSON(val);
39
- };
40
- return Attribute;
41
- }());
42
- exports.Attribute = Attribute;
43
- var AttributeObject = /** @class */ (function (_super) {
44
- __extends(AttributeObject, _super);
45
- function AttributeObject(_a) {
46
- var modelKey = _a.modelKey, jsonKey = _a.jsonKey, itemClass = _a.itemClass, readOnly = _a.readOnly;
47
- var _this = _super.call(this, { modelKey: modelKey, jsonKey: jsonKey, readOnly: readOnly }) || this;
48
- _this.itemClass = itemClass;
49
- return _this;
50
- }
51
- AttributeObject.prototype.toJSON = function (val, saveRequestBody) {
52
- if (!val) {
53
- return val;
54
- }
55
- if (saveRequestBody === true && val.saveRequestBody != null) {
56
- return val.saveRequestBody();
57
- }
58
- else if (val.toJSON != null) {
59
- return val.toJSON();
60
- }
61
- return val;
62
- };
63
- AttributeObject.prototype.fromJSON = function (val, _parent) {
64
- if (!val || !this.itemClass) {
65
- return val;
66
- }
67
- if (isRestfulModel(this.itemClass)) {
68
- return new this.itemClass(_parent.connection, val).fromJSON(val);
69
- }
70
- return new this.itemClass(val).fromJSON(val);
71
- };
72
- AttributeObject.prototype.saveRequestBody = function (val) {
73
- if (this.readOnly) {
74
- return;
75
- }
76
- return this.toJSON(val, true);
77
- };
78
- return AttributeObject;
79
- }(Attribute));
80
- var AttributeNumber = /** @class */ (function (_super) {
81
- __extends(AttributeNumber, _super);
82
- function AttributeNumber() {
83
- return _super !== null && _super.apply(this, arguments) || this;
84
- }
85
- AttributeNumber.prototype.toJSON = function (val) {
86
- return val;
87
- };
88
- AttributeNumber.prototype.fromJSON = function (val) {
89
- if (!isNaN(Number(val))) {
90
- return Number(val);
91
- }
92
- else {
93
- return null;
94
- }
95
- };
96
- return AttributeNumber;
97
- }(Attribute));
98
- var AttributeNumberList = /** @class */ (function (_super) {
99
- __extends(AttributeNumberList, _super);
100
- function AttributeNumberList() {
101
- return _super !== null && _super.apply(this, arguments) || this;
102
- }
103
- AttributeNumberList.prototype.toJSON = function (val) {
104
- return val;
105
- };
106
- AttributeNumberList.prototype.fromJSON = function (json, _parent) {
107
- if (!json || !(json instanceof Array)) {
108
- return [];
109
- }
110
- var nums = [];
111
- for (var num in json) {
112
- if (!isNaN(Number(num))) {
113
- nums.push(Number(num));
114
- }
115
- }
116
- return nums;
117
- };
118
- return AttributeNumberList;
119
- }(Attribute));
120
- var AttributeBoolean = /** @class */ (function (_super) {
121
- __extends(AttributeBoolean, _super);
122
- function AttributeBoolean() {
123
- return _super !== null && _super.apply(this, arguments) || this;
124
- }
125
- AttributeBoolean.prototype.toJSON = function (val) {
126
- return val;
127
- };
128
- AttributeBoolean.prototype.fromJSON = function (val) {
129
- return val === 'true' || val === true || false;
130
- };
131
- return AttributeBoolean;
132
- }(Attribute));
133
- var AttributeString = /** @class */ (function (_super) {
134
- __extends(AttributeString, _super);
135
- function AttributeString() {
136
- return _super !== null && _super.apply(this, arguments) || this;
137
- }
138
- AttributeString.prototype.toJSON = function (val) {
139
- return val;
140
- };
141
- AttributeString.prototype.fromJSON = function (val) {
142
- return val || '';
143
- };
144
- return AttributeString;
145
- }(Attribute));
146
- var AttributeStringList = /** @class */ (function (_super) {
147
- __extends(AttributeStringList, _super);
148
- function AttributeStringList() {
149
- return _super !== null && _super.apply(this, arguments) || this;
150
- }
151
- AttributeStringList.prototype.toJSON = function (val) {
152
- return val;
153
- };
154
- AttributeStringList.prototype.fromJSON = function (val) {
155
- return val || [];
156
- };
157
- return AttributeStringList;
158
- }(Attribute));
159
- var AttributeDate = /** @class */ (function (_super) {
160
- __extends(AttributeDate, _super);
161
- function AttributeDate() {
162
- return _super !== null && _super.apply(this, arguments) || this;
163
- }
164
- AttributeDate.prototype.toJSON = function (val) {
165
- if (!val) {
166
- return val;
167
- }
168
- if (!(val instanceof Date)) {
169
- throw new Error("Attempting to toJSON AttributeDate which is not a date:\n " + this.modelKey + "\n = " + val);
170
- }
171
- return val.toISOString();
172
- };
173
- AttributeDate.prototype.fromJSON = function (val, _parent) {
174
- if (!val) {
175
- return null;
176
- }
177
- return new Date(val);
178
- };
179
- return AttributeDate;
180
- }(Attribute));
181
- var AttributeDateTime = /** @class */ (function (_super) {
182
- __extends(AttributeDateTime, _super);
183
- function AttributeDateTime() {
184
- return _super !== null && _super.apply(this, arguments) || this;
185
- }
186
- AttributeDateTime.prototype.toJSON = function (val) {
187
- if (!val) {
188
- return null;
189
- }
190
- if (!(val instanceof Date)) {
191
- throw new Error("Attempting to toJSON AttributeDateTime which is not a date:\n " + this.modelKey + "\n = " + val);
192
- }
193
- return val.getTime() / 1000.0;
194
- };
195
- AttributeDateTime.prototype.fromJSON = function (val, _parent) {
196
- if (!val) {
197
- return null;
198
- }
199
- return new Date(val * 1000);
200
- };
201
- return AttributeDateTime;
202
- }(Attribute));
203
- var AttributeCollection = /** @class */ (function (_super) {
204
- __extends(AttributeCollection, _super);
205
- function AttributeCollection(_a) {
206
- var modelKey = _a.modelKey, jsonKey = _a.jsonKey, itemClass = _a.itemClass, readOnly = _a.readOnly;
207
- var _this = _super.call(this, { modelKey: modelKey, jsonKey: jsonKey, readOnly: readOnly }) || this;
208
- _this.itemClass = itemClass;
209
- return _this;
210
- }
211
- AttributeCollection.prototype.toJSON = function (vals, saveRequestBody) {
212
- if (!vals) {
213
- return [];
214
- }
215
- var json = [];
216
- for (var _i = 0, vals_1 = vals; _i < vals_1.length; _i++) {
217
- var val = vals_1[_i];
218
- if (saveRequestBody === true && val.saveRequestBody != null) {
219
- json.push(val.saveRequestBody());
220
- }
221
- else if (val.toJSON != null) {
222
- json.push(val.toJSON());
223
- }
224
- else {
225
- json.push(val);
226
- }
227
- }
228
- return json;
229
- };
230
- AttributeCollection.prototype.fromJSON = function (json, _parent) {
231
- if (!json || !(json instanceof Array)) {
232
- return [];
233
- }
234
- var objs = [];
235
- for (var _i = 0, json_1 = json; _i < json_1.length; _i++) {
236
- var objJSON = json_1[_i];
237
- var obj = void 0;
238
- if (isRestfulModel(this.itemClass)) {
239
- obj = new this.itemClass(_parent.connection, objJSON).fromJSON(objJSON);
240
- }
241
- else {
242
- obj = new this.itemClass(objJSON).fromJSON(objJSON);
243
- }
244
- objs.push(obj);
245
- }
246
- return objs;
247
- };
248
- AttributeCollection.prototype.saveRequestBody = function (val) {
249
- if (this.readOnly) {
250
- return;
251
- }
252
- return this.toJSON(val, true);
253
- };
254
- return AttributeCollection;
255
- }(Attribute));
256
- var AttributeEnum = /** @class */ (function (_super) {
257
- __extends(AttributeEnum, _super);
258
- function AttributeEnum(_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
- AttributeEnum.prototype.toJSON = function (val) {
265
- return val.toString();
266
- };
267
- AttributeEnum.prototype.fromJSON = function (val) {
268
- if (Object.values(this.itemClass).includes(val)) {
269
- return val;
270
- }
271
- return;
272
- };
273
- return AttributeEnum;
274
- }(Attribute));
275
- var AttributeEnumList = /** @class */ (function (_super) {
276
- __extends(AttributeEnumList, _super);
277
- function AttributeEnumList(_a) {
278
- var modelKey = _a.modelKey, itemClass = _a.itemClass, jsonKey = _a.jsonKey, readOnly = _a.readOnly;
279
- var _this = _super.call(this, { modelKey: modelKey, jsonKey: jsonKey, readOnly: readOnly }) || this;
280
- _this.itemClass = itemClass;
281
- return _this;
282
- }
283
- AttributeEnumList.prototype.toJSON = function (val) {
284
- var enumList = [];
285
- for (var _i = 0, val_1 = val; _i < val_1.length; _i++) {
286
- var v = val_1[_i];
287
- enumList.push(v.toString());
288
- }
289
- return enumList;
290
- };
291
- AttributeEnumList.prototype.fromJSON = function (val, _parent) {
292
- var enumList = [];
293
- for (var _i = 0, val_2 = val; _i < val_2.length; _i++) {
294
- var v = val_2[_i];
295
- if (Object.values(this.itemClass).includes(v)) {
296
- enumList.push(v);
297
- }
298
- }
299
- return enumList;
300
- };
301
- return AttributeEnumList;
302
- }(Attribute));
303
- var Attributes = {
304
- Number: function () {
305
- var args = [];
306
- for (var _i = 0; _i < arguments.length; _i++) {
307
- args[_i] = arguments[_i];
308
- }
309
- return new (AttributeNumber.bind.apply(AttributeNumber, __spreadArrays([void 0], args)))();
310
- },
311
- NumberList: function () {
312
- var args = [];
313
- for (var _i = 0; _i < arguments.length; _i++) {
314
- args[_i] = arguments[_i];
315
- }
316
- return new (AttributeNumberList.bind.apply(AttributeNumberList, __spreadArrays([void 0], args)))();
317
- },
318
- String: function () {
319
- var args = [];
320
- for (var _i = 0; _i < arguments.length; _i++) {
321
- args[_i] = arguments[_i];
322
- }
323
- return new (AttributeString.bind.apply(AttributeString, __spreadArrays([void 0], args)))();
324
- },
325
- StringList: function () {
326
- var args = [];
327
- for (var _i = 0; _i < arguments.length; _i++) {
328
- args[_i] = arguments[_i];
329
- }
330
- return new (AttributeStringList.bind.apply(AttributeStringList, __spreadArrays([void 0], args)))();
331
- },
332
- DateTime: function () {
333
- var args = [];
334
- for (var _i = 0; _i < arguments.length; _i++) {
335
- args[_i] = arguments[_i];
336
- }
337
- return new (AttributeDateTime.bind.apply(AttributeDateTime, __spreadArrays([void 0], args)))();
338
- },
339
- Date: function () {
340
- var args = [];
341
- for (var _i = 0; _i < arguments.length; _i++) {
342
- args[_i] = arguments[_i];
343
- }
344
- return new (AttributeDate.bind.apply(AttributeDate, __spreadArrays([void 0], args)))();
345
- },
346
- Collection: function () {
347
- var args = [];
348
- for (var _i = 0; _i < arguments.length; _i++) {
349
- args[_i] = arguments[_i];
350
- }
351
- return new (AttributeCollection.bind.apply(AttributeCollection, __spreadArrays([void 0], args)))();
352
- },
353
- Boolean: function () {
354
- var args = [];
355
- for (var _i = 0; _i < arguments.length; _i++) {
356
- args[_i] = arguments[_i];
357
- }
358
- return new (AttributeBoolean.bind.apply(AttributeBoolean, __spreadArrays([void 0], args)))();
359
- },
360
- Object: function () {
361
- var args = [];
362
- for (var _i = 0; _i < arguments.length; _i++) {
363
- args[_i] = arguments[_i];
364
- }
365
- return new (AttributeObject.bind.apply(AttributeObject, __spreadArrays([void 0], args)))();
366
- },
367
- Enum: function () {
368
- var args = [];
369
- for (var _i = 0; _i < arguments.length; _i++) {
370
- args[_i] = arguments[_i];
371
- }
372
- return new (AttributeEnum.bind.apply(AttributeEnum, __spreadArrays([void 0], args)))();
373
- },
374
- EnumList: function () {
375
- var args = [];
376
- for (var _i = 0; _i < arguments.length; _i++) {
377
- args[_i] = arguments[_i];
378
- }
379
- return new (AttributeEnumList.bind.apply(AttributeEnumList, __spreadArrays([void 0], args)))();
380
- },
381
- };
382
- exports.default = Attributes;
@@ -1,76 +0,0 @@
1
- import Model from './model';
2
- import { Attribute } from './attributes';
3
- import { FreeBusyProperties, TimeSlot, TimeSlotProperties, FreeBusyCalendarProperties } from './free-busy';
4
- export declare enum RoundRobin {
5
- MaxAvailability = "max-availability",
6
- MaxFairness = "max-fairness"
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
- };
36
- export declare type OpenHoursProperties = {
37
- emails: string[];
38
- days: Days[];
39
- timezone: string;
40
- start: string;
41
- end: string;
42
- };
43
- export declare class OpenHours extends Model implements OpenHoursProperties {
44
- objectType: string;
45
- emails: string[];
46
- days: Days[];
47
- timezone: string;
48
- start: string;
49
- end: string;
50
- static attributes: Record<string, Attribute>;
51
- constructor(props?: OpenHoursProperties);
52
- }
53
- export declare type CalendarConsecutiveAvailabilityProperties = {
54
- emails: string[];
55
- startTime: number;
56
- endTime: number;
57
- };
58
- export declare class CalendarConsecutiveAvailability extends Model implements CalendarConsecutiveAvailabilityProperties {
59
- emails: string[];
60
- startTime: number;
61
- endTime: number;
62
- static attributes: Record<string, Attribute>;
63
- constructor(props?: CalendarConsecutiveAvailabilityProperties);
64
- }
65
- export declare type CalendarAvailabilityProperties = {
66
- timeSlots: TimeSlotProperties[];
67
- order?: string[];
68
- };
69
- export default class CalendarAvailability extends Model implements CalendarAvailabilityProperties {
70
- object: string;
71
- timeSlots: TimeSlot[];
72
- order?: string[];
73
- static attributes: Record<string, Attribute>;
74
- constructor(props?: CalendarAvailabilityProperties);
75
- }
76
- export {};