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,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
- }
@@ -1,187 +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 management_model_1 = __importDefault(require("./management-model"));
31
- var attributes_1 = __importDefault(require("./attributes"));
32
- var model_1 = __importDefault(require("./model"));
33
- var ApplicationIPAddresses = /** @class */ (function (_super) {
34
- __extends(ApplicationIPAddresses, _super);
35
- function ApplicationIPAddresses(props) {
36
- var _this = _super.call(this) || this;
37
- _this.ipAddresses = [];
38
- _this.updatedAt = 0;
39
- _this.initAttributes(props);
40
- return _this;
41
- }
42
- ApplicationIPAddresses.attributes = {
43
- ipAddresses: attributes_1.default.StringList({
44
- modelKey: 'ipAddresses',
45
- jsonKey: 'ip_addresses',
46
- }),
47
- updatedAt: attributes_1.default.Number({
48
- modelKey: 'updatedAt',
49
- jsonKey: 'updated_at',
50
- }),
51
- };
52
- return ApplicationIPAddresses;
53
- }(model_1.default));
54
- exports.ApplicationIPAddresses = ApplicationIPAddresses;
55
- var AccountTokenInfo = /** @class */ (function (_super) {
56
- __extends(AccountTokenInfo, _super);
57
- function AccountTokenInfo(props) {
58
- var _this = _super.call(this) || this;
59
- _this.scopes = '';
60
- _this.state = '';
61
- _this.createdAt = 0;
62
- _this.updatedAt = 0;
63
- _this.initAttributes(props);
64
- return _this;
65
- }
66
- AccountTokenInfo.attributes = {
67
- scopes: attributes_1.default.String({
68
- modelKey: 'scopes',
69
- }),
70
- state: attributes_1.default.String({
71
- modelKey: 'state',
72
- }),
73
- createdAt: attributes_1.default.Number({
74
- modelKey: 'createdAt',
75
- jsonKey: 'created_at',
76
- }),
77
- updatedAt: attributes_1.default.Number({
78
- modelKey: 'updatedAt',
79
- jsonKey: 'updated_at',
80
- }),
81
- };
82
- return AccountTokenInfo;
83
- }(model_1.default));
84
- exports.AccountTokenInfo = AccountTokenInfo;
85
- var ManagementAccount = /** @class */ (function (_super) {
86
- __extends(ManagementAccount, _super);
87
- function ManagementAccount(connection, clientId, props) {
88
- var _this = _super.call(this, connection, clientId, props) || this;
89
- _this.billingState = '';
90
- _this.emailAddress = '';
91
- _this.namespaceId = '';
92
- _this.provider = '';
93
- _this.syncState = '';
94
- _this.authenticationType = '';
95
- _this.trial = false;
96
- _this.initAttributes(props);
97
- return _this;
98
- }
99
- ManagementAccount.prototype.upgrade = function () {
100
- return this.connection
101
- .request({
102
- method: 'POST',
103
- path: "/a/" + this.clientId + "/" + this.constructor.collectionName + "/" + this.id + "/upgrade",
104
- })
105
- .then(function (json) { return Promise.resolve(json); })
106
- .catch(function (err) { return Promise.reject(err); });
107
- };
108
- ManagementAccount.prototype.downgrade = function () {
109
- return this.connection
110
- .request({
111
- method: 'POST',
112
- path: "/a/" + this.clientId + "/" + this.constructor.collectionName + "/" + this.id + "/downgrade",
113
- })
114
- .then(function (json) { return Promise.resolve(json); })
115
- .catch(function (err) { return Promise.reject(err); });
116
- };
117
- ManagementAccount.prototype.revokeAll = function (keepAccessToken) {
118
- return this.connection
119
- .request({
120
- method: 'POST',
121
- path: "/a/" + this.clientId + "/" + this.constructor.collectionName + "/" + this.id + "/revoke-all",
122
- body: { keep_access_token: keepAccessToken },
123
- })
124
- .then(function (json) { return Promise.resolve(json); })
125
- .catch(function (err) { return Promise.reject(err); });
126
- };
127
- ManagementAccount.prototype.ipAddresses = function () {
128
- return this.connection
129
- .request({
130
- method: 'GET',
131
- path: "/a/" + this.clientId + "/ip_addresses",
132
- })
133
- .then(function (json) {
134
- return Promise.resolve(new ApplicationIPAddresses().fromJSON(json));
135
- })
136
- .catch(function (err) { return Promise.reject(err); });
137
- };
138
- ManagementAccount.prototype.tokenInfo = function (accessToken) {
139
- return this.connection
140
- .request({
141
- method: 'POST',
142
- path: "/a/" + this.clientId + "/" + this.constructor.collectionName + "/" + this.id + "/token-info",
143
- body: {
144
- access_token: accessToken,
145
- },
146
- })
147
- .then(function (json) { return Promise.resolve(new AccountTokenInfo().fromJSON(json)); })
148
- .catch(function (err) { return Promise.reject(err); });
149
- };
150
- ManagementAccount.prototype.save = function (params, callback) {
151
- if (params === void 0) { params = {}; }
152
- return _super.prototype.save.call(this, params, callback);
153
- };
154
- ManagementAccount.prototype.saveRequestBody = function () {
155
- return {
156
- metadata: this.metadata,
157
- };
158
- };
159
- ManagementAccount.prototype.saveEndpoint = function () {
160
- return "/a/" + this.connection.clientId + "/accounts";
161
- };
162
- ManagementAccount.collectionName = 'accounts';
163
- ManagementAccount.attributes = __assign(__assign({}, management_model_1.default.attributes), { billingState: attributes_1.default.String({
164
- modelKey: 'billingState',
165
- jsonKey: 'billing_state',
166
- }), emailAddress: attributes_1.default.String({
167
- modelKey: 'emailAddress',
168
- jsonKey: 'email',
169
- }), namespaceId: attributes_1.default.String({
170
- modelKey: 'namespaceId',
171
- jsonKey: 'namespace_id',
172
- }), provider: attributes_1.default.String({
173
- modelKey: 'provider',
174
- }), syncState: attributes_1.default.String({
175
- modelKey: 'syncState',
176
- jsonKey: 'sync_state',
177
- }), authenticationType: attributes_1.default.String({
178
- modelKey: 'authenticationType',
179
- jsonKey: 'authentication_type',
180
- }), trial: attributes_1.default.Boolean({
181
- modelKey: 'trial',
182
- }), metadata: attributes_1.default.Object({
183
- modelKey: 'metadata',
184
- }) });
185
- return ManagementAccount;
186
- }(management_model_1.default));
187
- exports.default = ManagementAccount;
@@ -1,10 +0,0 @@
1
- import ManagementModel from './management-model';
2
- import NylasConnection from '../nylas-connection';
3
- import RestfulModelCollection from './restful-model-collection';
4
- export default class ManagementModelCollection<T extends ManagementModel> extends RestfulModelCollection<T> {
5
- clientId: string;
6
- constructor(modelClass: typeof ManagementModel, connection: NylasConnection, clientId: string);
7
- build(args: Record<string, unknown>): T;
8
- path(): string;
9
- protected createModel(json: Record<string, unknown>): T;
10
- }
@@ -1,39 +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 ManagementModelCollection = /** @class */ (function (_super) {
21
- __extends(ManagementModelCollection, _super);
22
- function ManagementModelCollection(modelClass, connection, clientId) {
23
- var _this = _super.call(this, modelClass, connection) || this;
24
- _this.clientId = clientId;
25
- return _this;
26
- }
27
- ManagementModelCollection.prototype.build = function (args) {
28
- return _super.prototype.build.call(this, args);
29
- };
30
- ManagementModelCollection.prototype.path = function () {
31
- return "/a/" + this.clientId + "/" + this.modelClass.collectionName;
32
- };
33
- ManagementModelCollection.prototype.createModel = function (json) {
34
- var props = this.modelClass.propsFromJSON(json, this);
35
- return new this.modelClass(this.connection, this.clientId, props);
36
- };
37
- return ManagementModelCollection;
38
- }(restful_model_collection_1.default));
39
- exports.default = ManagementModelCollection;
@@ -1,6 +0,0 @@
1
- import RestfulModel from './restful-model';
2
- import NylasConnection from '../nylas-connection';
3
- export default class ManagementModel extends RestfulModel {
4
- clientId: string;
5
- constructor(connection: NylasConnection, clientId: string, props: Record<string, unknown>);
6
- }
@@ -1,29 +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_1 = __importDefault(require("./restful-model"));
20
- var ManagementModel = /** @class */ (function (_super) {
21
- __extends(ManagementModel, _super);
22
- function ManagementModel(connection, clientId, props) {
23
- var _this = _super.call(this, connection, props) || this;
24
- _this.clientId = clientId;
25
- return _this;
26
- }
27
- return ManagementModel;
28
- }(restful_model_1.default));
29
- exports.default = ManagementModel;
@@ -1,26 +0,0 @@
1
- import RestfulModelCollection from './restful-model-collection';
2
- import Message from './message';
3
- import NylasConnection from '../nylas-connection';
4
- export default class MessageRestfulModelCollection extends RestfulModelCollection<Message> {
5
- connection: NylasConnection;
6
- modelClass: typeof Message;
7
- constructor(connection: NylasConnection);
8
- /**
9
- * Return Multiple Messages by a list of Message IDs.
10
- * @param messageIds The list of message ids to find.
11
- * @param options Additional options including: view, offset, limit, and callback
12
- * @returns The list of messages.
13
- */
14
- findMultiple(messageIds: string[], options?: {
15
- view?: string;
16
- offset?: number;
17
- limit?: number;
18
- callback?: (error: Error | null, results?: Message[]) => void;
19
- }): Promise<Message[]>;
20
- /**
21
- * Return raw message contents
22
- * @param messageId The message to fetch content of
23
- * @returns The raw message contents
24
- */
25
- findRaw(messageId: string): Promise<string>;
26
- }