nylas 7.0.0-beta.0 → 7.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (204) hide show
  1. package/README.md +27 -19
  2. package/lib/cjs/apiClient.js +114 -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/package.json +3 -0
  17. package/lib/cjs/resources/applications.js +30 -0
  18. package/lib/cjs/resources/auth.js +153 -0
  19. package/lib/cjs/resources/calendars.js +78 -0
  20. package/lib/cjs/resources/events.js +69 -0
  21. package/lib/cjs/resources/grants.js +65 -0
  22. package/lib/cjs/resources/redirectUris.js +64 -0
  23. package/lib/cjs/resources/resource.js +111 -0
  24. package/lib/cjs/resources/webhooks.js +98 -0
  25. package/lib/cjs/utils.js +58 -0
  26. package/lib/cjs/version.js +5 -0
  27. package/lib/esm/apiClient.js +111 -0
  28. package/lib/esm/config.js +29 -0
  29. package/lib/esm/models/applicationDetails.js +1 -0
  30. package/lib/esm/models/auth.js +1 -0
  31. package/lib/esm/models/availability.js +8 -0
  32. package/lib/esm/models/calendars.js +1 -0
  33. package/lib/esm/models/error.js +45 -0
  34. package/lib/esm/models/events.js +1 -0
  35. package/lib/esm/models/grants.js +1 -0
  36. package/lib/esm/models/listQueryParams.js +1 -0
  37. package/lib/esm/models/redirectUri.js +1 -0
  38. package/lib/esm/models/response.js +1 -0
  39. package/lib/esm/models/webhooks.js +15 -0
  40. package/lib/esm/nylas.js +31 -0
  41. package/lib/esm/package.json +3 -0
  42. package/lib/esm/resources/applications.js +26 -0
  43. package/lib/esm/resources/auth.js +149 -0
  44. package/lib/esm/resources/calendars.js +74 -0
  45. package/lib/esm/resources/events.js +65 -0
  46. package/lib/esm/resources/grants.js +61 -0
  47. package/lib/esm/resources/redirectUris.js +60 -0
  48. package/lib/esm/resources/resource.js +107 -0
  49. package/lib/esm/resources/webhooks.js +94 -0
  50. package/lib/esm/utils.js +53 -0
  51. package/lib/esm/version.js +2 -0
  52. package/lib/types/apiClient.d.ts +65 -0
  53. package/lib/types/config.d.ts +50 -0
  54. package/lib/types/models/applicationDetails.d.ts +93 -0
  55. package/lib/types/models/auth.d.ts +196 -0
  56. package/lib/types/models/availability.d.ts +159 -0
  57. package/lib/types/models/calendars.d.ts +121 -0
  58. package/lib/types/models/error.d.ts +104 -0
  59. package/lib/types/models/events.d.ts +494 -0
  60. package/lib/types/models/grants.d.ts +134 -0
  61. package/lib/types/models/listQueryParams.d.ts +4 -0
  62. package/lib/types/models/redirectUri.d.ts +71 -0
  63. package/lib/types/models/response.d.ts +40 -0
  64. package/lib/types/models/webhooks.d.ts +45 -0
  65. package/lib/types/nylas.d.ts +44 -0
  66. package/lib/types/resources/applications.d.ts +26 -0
  67. package/lib/types/resources/auth.d.ts +66 -0
  68. package/lib/types/resources/calendars.d.ts +97 -0
  69. package/lib/types/resources/events.d.ts +87 -0
  70. package/lib/types/resources/grants.d.ts +63 -0
  71. package/lib/types/resources/redirectUris.d.ts +63 -0
  72. package/lib/types/resources/resource.d.ts +55 -0
  73. package/lib/types/resources/webhooks.d.ts +79 -0
  74. package/lib/types/utils.d.ts +22 -0
  75. package/lib/types/version.d.ts +1 -0
  76. package/package.json +33 -42
  77. package/lib/config.d.ts +0 -70
  78. package/lib/config.js +0 -68
  79. package/lib/models/access-token.d.ts +0 -18
  80. package/lib/models/access-token.js +0 -56
  81. package/lib/models/account.d.ts +0 -27
  82. package/lib/models/account.js +0 -73
  83. package/lib/models/application-details.d.ts +0 -14
  84. package/lib/models/application-details.js +0 -47
  85. package/lib/models/attributes.d.ts +0 -151
  86. package/lib/models/attributes.js +0 -382
  87. package/lib/models/calendar-availability.d.ts +0 -76
  88. package/lib/models/calendar-availability.js +0 -121
  89. package/lib/models/calendar-restful-model-collection.d.ts +0 -17
  90. package/lib/models/calendar-restful-model-collection.js +0 -181
  91. package/lib/models/calendar.d.ts +0 -31
  92. package/lib/models/calendar.js +0 -93
  93. package/lib/models/component-restful-model-collection.d.ts +0 -9
  94. package/lib/models/component-restful-model-collection.js +0 -34
  95. package/lib/models/component.d.ts +0 -37
  96. package/lib/models/component.js +0 -91
  97. package/lib/models/connect.d.ts +0 -73
  98. package/lib/models/connect.js +0 -193
  99. package/lib/models/contact-restful-model-collection.d.ts +0 -9
  100. package/lib/models/contact-restful-model-collection.js +0 -60
  101. package/lib/models/contact.d.ts +0 -129
  102. package/lib/models/contact.js +0 -289
  103. package/lib/models/delta-collection.d.ts +0 -17
  104. package/lib/models/delta-collection.js +0 -139
  105. package/lib/models/delta-stream.d.ts +0 -32
  106. package/lib/models/delta-stream.js +0 -250
  107. package/lib/models/delta.d.ts +0 -28
  108. package/lib/models/delta.js +0 -88
  109. package/lib/models/deltas.d.ts +0 -17
  110. package/lib/models/deltas.js +0 -49
  111. package/lib/models/draft.d.ts +0 -27
  112. package/lib/models/draft.js +0 -156
  113. package/lib/models/email-participant.d.ts +0 -13
  114. package/lib/models/email-participant.js +0 -46
  115. package/lib/models/event-conferencing.d.ts +0 -34
  116. package/lib/models/event-conferencing.js +0 -71
  117. package/lib/models/event-notification.d.ts +0 -27
  118. package/lib/models/event-notification.js +0 -62
  119. package/lib/models/event-participant.d.ts +0 -19
  120. package/lib/models/event-participant.js +0 -56
  121. package/lib/models/event.d.ts +0 -96
  122. package/lib/models/event.js +0 -297
  123. package/lib/models/file.d.ts +0 -29
  124. package/lib/models/file.js +0 -136
  125. package/lib/models/folder.d.ts +0 -21
  126. package/lib/models/folder.js +0 -69
  127. package/lib/models/free-busy.d.ts +0 -58
  128. package/lib/models/free-busy.js +0 -132
  129. package/lib/models/job-status-restful-model-collection.d.ts +0 -9
  130. package/lib/models/job-status-restful-model-collection.js +0 -38
  131. package/lib/models/job-status.d.ts +0 -24
  132. package/lib/models/job-status.js +0 -68
  133. package/lib/models/management-account.d.ts +0 -63
  134. package/lib/models/management-account.js +0 -187
  135. package/lib/models/management-model-collection.d.ts +0 -10
  136. package/lib/models/management-model-collection.js +0 -39
  137. package/lib/models/management-model.d.ts +0 -6
  138. package/lib/models/management-model.js +0 -29
  139. package/lib/models/message-restful-model-collection.d.ts +0 -26
  140. package/lib/models/message-restful-model-collection.js +0 -80
  141. package/lib/models/message.d.ts +0 -57
  142. package/lib/models/message.js +0 -173
  143. package/lib/models/model-collection.d.ts +0 -25
  144. package/lib/models/model-collection.js +0 -201
  145. package/lib/models/model.d.ts +0 -12
  146. package/lib/models/model.js +0 -64
  147. package/lib/models/neural-categorizer.d.ts +0 -28
  148. package/lib/models/neural-categorizer.js +0 -139
  149. package/lib/models/neural-clean-conversation.d.ts +0 -16
  150. package/lib/models/neural-clean-conversation.js +0 -114
  151. package/lib/models/neural-ocr.d.ts +0 -14
  152. package/lib/models/neural-ocr.js +0 -50
  153. package/lib/models/neural-sentiment-analysis.d.ts +0 -20
  154. package/lib/models/neural-sentiment-analysis.js +0 -56
  155. package/lib/models/neural-signature-contact.d.ts +0 -43
  156. package/lib/models/neural-signature-contact.js +0 -142
  157. package/lib/models/neural-signature-extraction.d.ts +0 -17
  158. package/lib/models/neural-signature-extraction.js +0 -54
  159. package/lib/models/neural.d.ts +0 -36
  160. package/lib/models/neural.js +0 -163
  161. package/lib/models/nylas-api-error.d.ts +0 -26
  162. package/lib/models/nylas-api-error.js +0 -61
  163. package/lib/models/outbox-job-status.d.ts +0 -20
  164. package/lib/models/outbox-job-status.js +0 -64
  165. package/lib/models/outbox-message.d.ts +0 -16
  166. package/lib/models/outbox-message.js +0 -54
  167. package/lib/models/outbox.d.ts +0 -35
  168. package/lib/models/outbox.js +0 -158
  169. package/lib/models/resource.d.ts +0 -22
  170. package/lib/models/resource.js +0 -66
  171. package/lib/models/restful-model-collection.d.ts +0 -15
  172. package/lib/models/restful-model-collection.js +0 -169
  173. package/lib/models/restful-model-instance.d.ts +0 -9
  174. package/lib/models/restful-model-instance.js +0 -37
  175. package/lib/models/restful-model.d.ts +0 -36
  176. package/lib/models/restful-model.js +0 -146
  177. package/lib/models/scheduler-booking-request.d.ts +0 -64
  178. package/lib/models/scheduler-booking-request.js +0 -148
  179. package/lib/models/scheduler-restful-model-collection.d.ts +0 -26
  180. package/lib/models/scheduler-restful-model-collection.js +0 -133
  181. package/lib/models/scheduler-time-slot.d.ts +0 -20
  182. package/lib/models/scheduler-time-slot.js +0 -53
  183. package/lib/models/scheduler.d.ts +0 -226
  184. package/lib/models/scheduler.js +0 -446
  185. package/lib/models/thread.d.ts +0 -49
  186. package/lib/models/thread.js +0 -127
  187. package/lib/models/webhook-notification.d.ts +0 -108
  188. package/lib/models/webhook-notification.js +0 -239
  189. package/lib/models/webhook.d.ts +0 -50
  190. package/lib/models/webhook.js +0 -101
  191. package/lib/models/when.d.ts +0 -23
  192. package/lib/models/when.js +0 -65
  193. package/lib/nylas-connection.d.ts +0 -71
  194. package/lib/nylas-connection.js +0 -258
  195. package/lib/nylas.d.ts +0 -57
  196. package/lib/nylas.js +0 -210
  197. package/lib/server-bindings/express-binding.d.ts +0 -18
  198. package/lib/server-bindings/express-binding.js +0 -163
  199. package/lib/server-bindings/server-binding.d.ts +0 -65
  200. package/lib/server-bindings/server-binding.js +0 -87
  201. package/lib/services/routes.d.ts +0 -26
  202. package/lib/services/routes.js +0 -95
  203. package/lib/services/tunnel.d.ts +0 -29
  204. package/lib/services/tunnel.js +0 -112
@@ -1,29 +0,0 @@
1
- import { Attribute } from './attributes';
2
- import RestfulModel from './restful-model';
3
- import NylasConnection from '../nylas-connection';
4
- export declare type FileProperties = {
5
- contentType?: string;
6
- size?: number;
7
- filename?: string;
8
- messageIds?: string[];
9
- contentId?: string;
10
- contentDisposition?: string;
11
- data?: unknown;
12
- };
13
- export default class File extends RestfulModel implements FileProperties {
14
- contentType?: string;
15
- size?: number;
16
- filename?: string;
17
- messageIds?: string[];
18
- contentId?: string;
19
- contentDisposition?: string;
20
- data?: unknown;
21
- static collectionName: string;
22
- static attributes: Record<string, Attribute>;
23
- constructor(connection: NylasConnection, props?: FileProperties);
24
- upload(callback?: (error: Error | null, model?: File) => void): Promise<File>;
25
- download(callback?: (error: Error | null, file?: {
26
- body: any;
27
- [key: string]: any;
28
- }) => void): Promise<any>;
29
- }
@@ -1,136 +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 __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- var attributes_1 = __importDefault(require("./attributes"));
31
- var restful_model_1 = __importDefault(require("./restful-model"));
32
- var File = /** @class */ (function (_super) {
33
- __extends(File, _super);
34
- function File(connection, props) {
35
- var _this = _super.call(this, connection, props) || this;
36
- _this.initAttributes(props);
37
- return _this;
38
- }
39
- File.prototype.upload = function (callback) {
40
- var _this = this;
41
- if (!this.filename) {
42
- throw new Error('Please define a filename');
43
- }
44
- if (!this.data) {
45
- throw new Error('Please add some data to the file');
46
- }
47
- if (!this.contentType) {
48
- throw new Error('Please define a content-type');
49
- }
50
- var formOptions = {
51
- filename: this.filename,
52
- contentType: this.contentType,
53
- };
54
- if (this.size) {
55
- formOptions.knownLength = this.size;
56
- }
57
- return this.connection
58
- .request({
59
- method: 'POST',
60
- path: "/" + File.collectionName,
61
- json: true,
62
- formData: {
63
- file: {
64
- value: this.data,
65
- options: formOptions,
66
- },
67
- },
68
- })
69
- .then(function (json) {
70
- // The API returns a list of files. It should
71
- // always have a length of 1 since we only
72
- // upload file-by-file.
73
- if (json.length > 0) {
74
- _this.fromJSON(json[0]);
75
- if (callback) {
76
- callback(null, _this);
77
- }
78
- return Promise.resolve(_this);
79
- }
80
- else {
81
- return Promise.reject(null);
82
- }
83
- })
84
- .catch(function (err) {
85
- if (callback) {
86
- callback(err);
87
- }
88
- return Promise.reject(err);
89
- });
90
- };
91
- File.prototype.download = function (callback) {
92
- if (!this.id) {
93
- throw new Error('Please provide a File id');
94
- }
95
- return this.connection
96
- .request({
97
- path: "/files/" + this.id + "/download",
98
- downloadRequest: true,
99
- })
100
- .then(function (file) {
101
- if (callback) {
102
- callback(null, file);
103
- }
104
- return Promise.resolve(file);
105
- })
106
- .catch(function (err) {
107
- if (callback) {
108
- callback(err);
109
- }
110
- return Promise.reject(err);
111
- });
112
- };
113
- File.collectionName = 'files';
114
- File.attributes = __assign(__assign({}, restful_model_1.default.attributes), { contentType: attributes_1.default.String({
115
- modelKey: 'contentType',
116
- jsonKey: 'content_type',
117
- }), size: attributes_1.default.Number({
118
- modelKey: 'size',
119
- }), filename: attributes_1.default.String({
120
- modelKey: 'filename',
121
- }), messageIds: attributes_1.default.StringList({
122
- modelKey: 'messageIds',
123
- jsonKey: 'message_ids',
124
- }), contentId: attributes_1.default.String({
125
- modelKey: 'contentId',
126
- jsonKey: 'content_id',
127
- }), contentDisposition: attributes_1.default.String({
128
- modelKey: 'contentDisposition',
129
- jsonKey: 'content_disposition',
130
- }), data: attributes_1.default.Object({
131
- modelKey: 'data',
132
- readOnly: true,
133
- }) });
134
- return File;
135
- }(restful_model_1.default));
136
- exports.default = File;
@@ -1,21 +0,0 @@
1
- import RestfulModel, { SaveCallback } from './restful-model';
2
- import { Attribute } from './attributes';
3
- import NylasConnection from '../nylas-connection';
4
- export declare type FolderProperties = {
5
- displayName?: string;
6
- name?: string;
7
- };
8
- export default class Folder extends RestfulModel implements FolderProperties {
9
- displayName?: string;
10
- name?: string;
11
- jobStatusId?: string;
12
- static collectionName: string;
13
- static attributes: Record<string, Attribute>;
14
- constructor(connection: NylasConnection, props?: FolderProperties);
15
- save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
16
- }
17
- export declare class Label extends Folder {
18
- static collectionName: string;
19
- constructor(connection: NylasConnection, props?: FolderProperties);
20
- saveRequestBody(): Record<string, any>;
21
- }
@@ -1,69 +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 __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- var restful_model_1 = __importDefault(require("./restful-model"));
31
- var attributes_1 = __importDefault(require("./attributes"));
32
- var Folder = /** @class */ (function (_super) {
33
- __extends(Folder, _super);
34
- function Folder(connection, props) {
35
- var _this = _super.call(this, connection, props) || this;
36
- _this.initAttributes(props);
37
- return _this;
38
- }
39
- Folder.prototype.save = function (params, callback) {
40
- if (params === void 0) { params = {}; }
41
- return _super.prototype.save.call(this, params, callback);
42
- };
43
- Folder.collectionName = 'folders';
44
- Folder.attributes = __assign(__assign({}, restful_model_1.default.attributes), { name: attributes_1.default.String({
45
- modelKey: 'name',
46
- jsonKey: 'name',
47
- }), displayName: attributes_1.default.String({
48
- modelKey: 'displayName',
49
- jsonKey: 'display_name',
50
- }), jobStatusId: attributes_1.default.String({
51
- modelKey: 'jobStatusId',
52
- jsonKey: 'job_status_id',
53
- readOnly: true,
54
- }) });
55
- return Folder;
56
- }(restful_model_1.default));
57
- exports.default = Folder;
58
- var Label = /** @class */ (function (_super) {
59
- __extends(Label, _super);
60
- function Label(connection, props) {
61
- return _super.call(this, connection, props) || this;
62
- }
63
- Label.prototype.saveRequestBody = function () {
64
- return { display_name: this.displayName };
65
- };
66
- Label.collectionName = 'labels';
67
- return Label;
68
- }(Folder));
69
- exports.Label = Label;
@@ -1,58 +0,0 @@
1
- import Model from './model';
2
- import { Attribute } from './attributes';
3
- export declare type FreeBusyQuery = {
4
- startTime: number;
5
- endTime: number;
6
- emails?: string[];
7
- calendars?: FreeBusyCalendarProperties[];
8
- };
9
- export declare type FreeBusyCalendarProperties = {
10
- accountId: string;
11
- calendarIds: string[];
12
- };
13
- export declare class FreeBusyCalendar extends Model implements FreeBusyCalendarProperties {
14
- accountId: string;
15
- calendarIds: string[];
16
- static attributes: Record<string, Attribute>;
17
- constructor(props?: FreeBusyCalendarProperties);
18
- }
19
- export declare type TimeSlotCapacityProperties = {
20
- eventId: string;
21
- currentCapacity: number;
22
- maxCapacity: number;
23
- };
24
- export declare class TimeSlotCapacity extends Model implements TimeSlotCapacityProperties {
25
- eventId: string;
26
- currentCapacity: number;
27
- maxCapacity: number;
28
- static attributes: Record<string, Attribute>;
29
- constructor(props?: TimeSlotCapacityProperties);
30
- }
31
- export declare type TimeSlotProperties = {
32
- status: string;
33
- startTime: number;
34
- endTime: number;
35
- emails?: string[];
36
- capacity?: TimeSlotCapacityProperties;
37
- };
38
- export declare class TimeSlot extends Model implements TimeSlotProperties {
39
- object: string;
40
- status: string;
41
- startTime: number;
42
- endTime: number;
43
- emails?: string[];
44
- capacity?: TimeSlotCapacity;
45
- static attributes: Record<string, Attribute>;
46
- constructor(props?: TimeSlotProperties);
47
- }
48
- export declare type FreeBusyProperties = {
49
- email: string;
50
- timeSlots: TimeSlotProperties[];
51
- };
52
- export default class FreeBusy extends Model implements FreeBusyProperties {
53
- object: string;
54
- email: string;
55
- timeSlots: TimeSlot[];
56
- static attributes: Record<string, Attribute>;
57
- constructor(props?: FreeBusyProperties);
58
- }
@@ -1,132 +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 __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 FreeBusyCalendar = /** @class */ (function (_super) {
22
- __extends(FreeBusyCalendar, _super);
23
- function FreeBusyCalendar(props) {
24
- var _this = _super.call(this) || this;
25
- _this.accountId = '';
26
- _this.calendarIds = [];
27
- _this.initAttributes(props);
28
- return _this;
29
- }
30
- FreeBusyCalendar.attributes = {
31
- accountId: attributes_1.default.String({
32
- modelKey: 'accountId',
33
- jsonKey: 'account_id',
34
- }),
35
- calendarIds: attributes_1.default.StringList({
36
- modelKey: 'calendarIds',
37
- jsonKey: 'calendar_ids',
38
- }),
39
- };
40
- return FreeBusyCalendar;
41
- }(model_1.default));
42
- exports.FreeBusyCalendar = FreeBusyCalendar;
43
- var TimeSlotCapacity = /** @class */ (function (_super) {
44
- __extends(TimeSlotCapacity, _super);
45
- function TimeSlotCapacity(props) {
46
- var _this = _super.call(this) || this;
47
- _this.eventId = '';
48
- _this.currentCapacity = 0;
49
- _this.maxCapacity = 0;
50
- _this.initAttributes(props);
51
- return _this;
52
- }
53
- TimeSlotCapacity.attributes = {
54
- eventId: attributes_1.default.String({
55
- modelKey: 'eventId',
56
- jsonKey: 'event_id',
57
- }),
58
- currentCapacity: attributes_1.default.Number({
59
- modelKey: 'currentCapacity',
60
- jsonKey: 'current_capacity',
61
- }),
62
- maxCapacity: attributes_1.default.Number({
63
- modelKey: 'maxCapacity',
64
- jsonKey: 'max_capacity',
65
- }),
66
- };
67
- return TimeSlotCapacity;
68
- }(model_1.default));
69
- exports.TimeSlotCapacity = TimeSlotCapacity;
70
- var TimeSlot = /** @class */ (function (_super) {
71
- __extends(TimeSlot, _super);
72
- function TimeSlot(props) {
73
- var _this = _super.call(this) || this;
74
- _this.object = 'time_slot';
75
- _this.status = '';
76
- _this.startTime = 0;
77
- _this.endTime = 0;
78
- _this.initAttributes(props);
79
- return _this;
80
- }
81
- TimeSlot.attributes = {
82
- object: attributes_1.default.String({
83
- modelKey: 'object',
84
- }),
85
- status: attributes_1.default.String({
86
- modelKey: 'status',
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
- emails: attributes_1.default.StringList({
97
- modelKey: 'emails',
98
- }),
99
- capacity: attributes_1.default.Object({
100
- modelKey: 'capacity',
101
- itemClass: TimeSlotCapacity,
102
- }),
103
- };
104
- return TimeSlot;
105
- }(model_1.default));
106
- exports.TimeSlot = TimeSlot;
107
- var FreeBusy = /** @class */ (function (_super) {
108
- __extends(FreeBusy, _super);
109
- function FreeBusy(props) {
110
- var _this = _super.call(this) || this;
111
- _this.object = 'free_busy';
112
- _this.email = '';
113
- _this.timeSlots = [];
114
- _this.initAttributes(props);
115
- return _this;
116
- }
117
- FreeBusy.attributes = {
118
- object: attributes_1.default.String({
119
- modelKey: 'object',
120
- }),
121
- email: attributes_1.default.String({
122
- modelKey: 'email',
123
- }),
124
- timeSlots: attributes_1.default.Collection({
125
- modelKey: 'timeSlots',
126
- jsonKey: 'time_slots',
127
- itemClass: TimeSlot,
128
- }),
129
- };
130
- return FreeBusy;
131
- }(model_1.default));
132
- exports.default = FreeBusy;
@@ -1,9 +0,0 @@
1
- import RestfulModelCollection from './restful-model-collection';
2
- import JobStatus from './job-status';
3
- import NylasConnection from '../nylas-connection';
4
- export default class JobStatusRestfulModelCollection extends RestfulModelCollection<JobStatus> {
5
- connection: NylasConnection;
6
- modelClass: typeof JobStatus;
7
- constructor(connection: NylasConnection);
8
- protected createModel(json: Record<string, unknown>): JobStatus;
9
- }
@@ -1,38 +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 __importDefault = (this && this.__importDefault) || function (mod) {
16
- return (mod && mod.__esModule) ? mod : { "default": mod };
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- var restful_model_collection_1 = __importDefault(require("./restful-model-collection"));
20
- var job_status_1 = __importDefault(require("./job-status"));
21
- var outbox_job_status_1 = __importDefault(require("./outbox-job-status"));
22
- var JobStatusRestfulModelCollection = /** @class */ (function (_super) {
23
- __extends(JobStatusRestfulModelCollection, _super);
24
- function JobStatusRestfulModelCollection(connection) {
25
- var _this = _super.call(this, job_status_1.default, connection) || this;
26
- _this.connection = connection;
27
- _this.modelClass = job_status_1.default;
28
- return _this;
29
- }
30
- JobStatusRestfulModelCollection.prototype.createModel = function (json) {
31
- if (json['object'] && json['object'] === 'message') {
32
- return new outbox_job_status_1.default(this.connection).fromJSON(json);
33
- }
34
- return new this.modelClass(this.connection).fromJSON(json);
35
- };
36
- return JobStatusRestfulModelCollection;
37
- }(restful_model_collection_1.default));
38
- exports.default = JobStatusRestfulModelCollection;
@@ -1,24 +0,0 @@
1
- import RestfulModel from './restful-model';
2
- import { Attribute } from './attributes';
3
- import NylasConnection from '../nylas-connection';
4
- import Message from './message';
5
- export declare type JobStatusProperties = {
6
- action?: string;
7
- createdAt?: Date;
8
- jobStatusId?: string;
9
- status?: string;
10
- originalData?: Message;
11
- metadata?: object;
12
- };
13
- export default class JobStatus extends RestfulModel implements JobStatusProperties {
14
- action?: string;
15
- createdAt?: Date;
16
- jobStatusId?: string;
17
- status?: string;
18
- originalData?: Message;
19
- metadata?: object;
20
- static collectionName: string;
21
- static attributes: Record<string, Attribute>;
22
- constructor(connection: NylasConnection, props?: JobStatusProperties);
23
- isSuccessful(): boolean;
24
- }
@@ -1,68 +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 __assign = (this && this.__assign) || function () {
16
- __assign = Object.assign || function(t) {
17
- for (var s, i = 1, n = arguments.length; i < n; i++) {
18
- s = arguments[i];
19
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
20
- t[p] = s[p];
21
- }
22
- return t;
23
- };
24
- return __assign.apply(this, arguments);
25
- };
26
- var __importDefault = (this && this.__importDefault) || function (mod) {
27
- return (mod && mod.__esModule) ? mod : { "default": mod };
28
- };
29
- Object.defineProperty(exports, "__esModule", { value: true });
30
- var restful_model_1 = __importDefault(require("./restful-model"));
31
- var attributes_1 = __importDefault(require("./attributes"));
32
- var JobStatus = /** @class */ (function (_super) {
33
- __extends(JobStatus, _super);
34
- function JobStatus(connection, props) {
35
- var _this = _super.call(this, connection, props) || this;
36
- _this.initAttributes(props);
37
- return _this;
38
- }
39
- // Returns the status of a job as a boolean
40
- JobStatus.prototype.isSuccessful = function () {
41
- return this.status === 'successful';
42
- };
43
- JobStatus.collectionName = 'job-statuses';
44
- JobStatus.attributes = __assign(__assign({}, restful_model_1.default.attributes), { action: attributes_1.default.String({
45
- modelKey: 'action',
46
- readOnly: true,
47
- }), createdAt: attributes_1.default.DateTime({
48
- modelKey: 'createdAt',
49
- jsonKey: 'created_at',
50
- readOnly: true,
51
- }), jobStatusId: attributes_1.default.String({
52
- modelKey: 'jobStatusId',
53
- jsonKey: 'job_status_id',
54
- readOnly: true,
55
- }), status: attributes_1.default.String({
56
- modelKey: 'status',
57
- readOnly: true,
58
- }), originalData: attributes_1.default.Object({
59
- modelKey: 'originalData',
60
- jsonKey: 'original_data',
61
- readOnly: true,
62
- }), metadata: attributes_1.default.Object({
63
- modelKey: 'metadata',
64
- readOnly: true,
65
- }) });
66
- return JobStatus;
67
- }(restful_model_1.default));
68
- exports.default = JobStatus;
@@ -1,63 +0,0 @@
1
- import ManagementModel from './management-model';
2
- import { Attribute } from './attributes';
3
- import NylasConnection from '../nylas-connection';
4
- import Model from './model';
5
- import { SaveCallback } from './restful-model';
6
- export declare type ApplicationIPAddressesProperties = {
7
- ipAddresses: string[];
8
- updatedAt: number;
9
- };
10
- export declare class ApplicationIPAddresses extends Model implements ApplicationIPAddressesProperties {
11
- ipAddresses: string[];
12
- updatedAt: number;
13
- static attributes: Record<string, Attribute>;
14
- constructor(props?: ApplicationIPAddressesProperties);
15
- }
16
- export declare type AccountTokenInfoProperties = {
17
- scopes: string;
18
- state: string;
19
- createdAt: number;
20
- updatedAt: number;
21
- };
22
- export declare class AccountTokenInfo extends Model implements AccountTokenInfoProperties {
23
- scopes: string;
24
- state: string;
25
- createdAt: number;
26
- updatedAt: number;
27
- static attributes: Record<string, Attribute>;
28
- constructor(props?: AccountTokenInfoProperties);
29
- }
30
- export declare type ManagementAccountProperties = {
31
- billingState: string;
32
- emailAddress: string;
33
- namespaceId: string;
34
- provider: string;
35
- syncState: string;
36
- authenticationType: string;
37
- trial: boolean;
38
- metadata?: object;
39
- };
40
- export declare type AccountOperationResponse = {
41
- success: boolean;
42
- };
43
- export default class ManagementAccount extends ManagementModel implements ManagementAccountProperties {
44
- billingState: string;
45
- emailAddress: string;
46
- namespaceId: string;
47
- provider: string;
48
- syncState: string;
49
- authenticationType: string;
50
- trial: boolean;
51
- metadata?: object;
52
- static collectionName: string;
53
- static attributes: Record<string, Attribute>;
54
- constructor(connection: NylasConnection, clientId: string, props: ManagementAccountProperties);
55
- upgrade(): Promise<AccountOperationResponse>;
56
- downgrade(): Promise<AccountOperationResponse>;
57
- revokeAll(keepAccessToken?: string): Promise<AccountOperationResponse>;
58
- ipAddresses(): Promise<ApplicationIPAddresses>;
59
- tokenInfo(accessToken?: string): Promise<AccountTokenInfo>;
60
- save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
61
- saveRequestBody(): Record<string, unknown>;
62
- saveEndpoint(): string;
63
- }