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,56 +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 attributes_1 = __importDefault(require("./attributes"));
20
- var restful_model_1 = __importDefault(require("./restful-model"));
21
- var NeuralSentimentAnalysis = /** @class */ (function (_super) {
22
- __extends(NeuralSentimentAnalysis, _super);
23
- function NeuralSentimentAnalysis(connection, props) {
24
- var _this = _super.call(this, connection, props) || this;
25
- _this.accountId = '';
26
- _this.sentiment = '';
27
- _this.sentimentScore = 0;
28
- _this.processedLength = 0;
29
- _this.text = '';
30
- _this.initAttributes(props);
31
- return _this;
32
- }
33
- NeuralSentimentAnalysis.collectionName = 'sentiment';
34
- NeuralSentimentAnalysis.attributes = {
35
- accountId: attributes_1.default.String({
36
- modelKey: 'accountId',
37
- jsonKey: 'account_id',
38
- }),
39
- sentiment: attributes_1.default.String({
40
- modelKey: 'sentiment',
41
- }),
42
- sentimentScore: attributes_1.default.Number({
43
- modelKey: 'sentimentScore',
44
- jsonKey: 'sentiment_score',
45
- }),
46
- processedLength: attributes_1.default.Number({
47
- modelKey: 'processedLength',
48
- jsonKey: 'processed_length',
49
- }),
50
- text: attributes_1.default.String({
51
- modelKey: 'text',
52
- }),
53
- };
54
- return NeuralSentimentAnalysis;
55
- }(restful_model_1.default));
56
- exports.default = NeuralSentimentAnalysis;
@@ -1,43 +0,0 @@
1
- import { Attribute } from './attributes';
2
- import Contact from './contact';
3
- import Model from './model';
4
- import NylasConnection from '../nylas-connection';
5
- declare type LinkProperties = {
6
- description?: string;
7
- url?: string;
8
- };
9
- declare class Link extends Model implements LinkProperties {
10
- description: string;
11
- url: string;
12
- static attributes: Record<string, Attribute>;
13
- constructor(props?: LinkProperties);
14
- }
15
- declare type NameProperties = {
16
- firstName?: string;
17
- lastName?: string;
18
- };
19
- declare class Name extends Model implements NameProperties {
20
- firstName: string;
21
- lastName: string;
22
- static attributes: Record<string, Attribute>;
23
- constructor(props?: NameProperties);
24
- }
25
- export declare type NeuralSignatureContactProperties = {
26
- jobTitles?: string[];
27
- links?: Link[];
28
- phoneNumbers?: string[];
29
- emails?: string[];
30
- names?: Name[];
31
- };
32
- export default class NeuralSignatureContact extends Model implements NeuralSignatureContactProperties {
33
- jobTitles?: string[];
34
- links?: Link[];
35
- phoneNumbers?: string[];
36
- emails?: string[];
37
- names?: Name[];
38
- static attributes: Record<string, Attribute>;
39
- constructor(props?: NeuralSignatureContactProperties);
40
- toJSON(): Record<string, unknown>;
41
- toContactObject(connection: NylasConnection): Contact;
42
- }
43
- export {};
@@ -1,142 +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
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
22
- result["default"] = mod;
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- var attributes_1 = __importDefault(require("./attributes"));
27
- var contact_1 = __importStar(require("./contact"));
28
- var model_1 = __importDefault(require("./model"));
29
- var Link = /** @class */ (function (_super) {
30
- __extends(Link, _super);
31
- function Link(props) {
32
- var _this = _super.call(this) || this;
33
- _this.description = '';
34
- _this.url = '';
35
- _this.initAttributes(props);
36
- return _this;
37
- }
38
- Link.attributes = {
39
- description: attributes_1.default.String({
40
- modelKey: 'description',
41
- }),
42
- url: attributes_1.default.String({
43
- modelKey: 'url',
44
- }),
45
- };
46
- return Link;
47
- }(model_1.default));
48
- var Name = /** @class */ (function (_super) {
49
- __extends(Name, _super);
50
- function Name(props) {
51
- var _this = _super.call(this) || this;
52
- _this.firstName = '';
53
- _this.lastName = '';
54
- _this.initAttributes(props);
55
- return _this;
56
- }
57
- Name.attributes = {
58
- firstName: attributes_1.default.String({
59
- modelKey: 'firstName',
60
- jsonKey: 'first_name',
61
- }),
62
- lastName: attributes_1.default.String({
63
- modelKey: 'lastName',
64
- jsonKey: 'last_name',
65
- }),
66
- };
67
- return Name;
68
- }(model_1.default));
69
- var NeuralSignatureContact = /** @class */ (function (_super) {
70
- __extends(NeuralSignatureContact, _super);
71
- function NeuralSignatureContact(props) {
72
- var _this = _super.call(this) || this;
73
- _this.initAttributes(props);
74
- return _this;
75
- }
76
- NeuralSignatureContact.prototype.toJSON = function () {
77
- return {
78
- job_titles: this.jobTitles,
79
- links: this.links,
80
- phone_numbers: this.phoneNumbers,
81
- emails: this.emails,
82
- names: this.names ? this.names.map(function (name) { return name.toJSON(); }) : this.names,
83
- };
84
- };
85
- NeuralSignatureContact.prototype.toContactObject = function (connection) {
86
- var contact = new contact_1.default(connection);
87
- if (this.names) {
88
- contact.givenName = this.names[0].firstName;
89
- contact.surname = this.names[0].lastName;
90
- }
91
- if (this.jobTitles) {
92
- contact.jobTitle = this.jobTitles[0];
93
- }
94
- if (this.emails) {
95
- var contactEmails_1 = [];
96
- this.emails.forEach(function (email) {
97
- return contactEmails_1.push(new contact_1.EmailAddress({ type: 'personal', email: email }));
98
- });
99
- contact.emailAddresses = contactEmails_1;
100
- }
101
- if (this.phoneNumbers) {
102
- var contactNumbers_1 = [];
103
- this.phoneNumbers.forEach(function (number) {
104
- return contactNumbers_1.push(new contact_1.PhoneNumber({ type: 'mobile', number: number }));
105
- });
106
- contact.phoneNumbers = contactNumbers_1;
107
- }
108
- if (this.links) {
109
- var webPages_1 = [];
110
- this.links.forEach(function (link) {
111
- if (link['url']) {
112
- webPages_1.push(new contact_1.WebPage({ type: 'homepage', url: link['url'] }));
113
- }
114
- });
115
- contact.webPages = webPages_1;
116
- }
117
- return contact;
118
- };
119
- NeuralSignatureContact.attributes = {
120
- jobTitles: attributes_1.default.StringList({
121
- modelKey: 'jobTitles',
122
- jsonKey: 'job_titles',
123
- }),
124
- links: attributes_1.default.Collection({
125
- modelKey: 'links',
126
- itemClass: Link,
127
- }),
128
- phoneNumbers: attributes_1.default.StringList({
129
- modelKey: 'phoneNumbers',
130
- jsonKey: 'phone_numbers',
131
- }),
132
- emails: attributes_1.default.StringList({
133
- modelKey: 'emails',
134
- }),
135
- names: attributes_1.default.Collection({
136
- modelKey: 'names',
137
- itemClass: Name,
138
- }),
139
- };
140
- return NeuralSignatureContact;
141
- }(model_1.default));
142
- exports.default = NeuralSignatureContact;
@@ -1,17 +0,0 @@
1
- import NeuralSignatureContact from './neural-signature-contact';
2
- import { Attribute } from './attributes';
3
- import Message, { MessageProperties } from './message';
4
- import NylasConnection from '../nylas-connection';
5
- export declare type NeuralSignatureExtractionProperties = MessageProperties & {
6
- signature: string;
7
- modelVersion: string;
8
- contacts?: NeuralSignatureContact;
9
- };
10
- export default class NeuralSignatureExtraction extends Message implements NeuralSignatureExtractionProperties {
11
- signature: string;
12
- modelVersion: string;
13
- contacts?: NeuralSignatureContact;
14
- static collectionName: string;
15
- static attributes: Record<string, Attribute>;
16
- constructor(connection: NylasConnection, props?: NeuralSignatureExtractionProperties);
17
- }
@@ -1,54 +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 neural_signature_contact_1 = __importDefault(require("./neural-signature-contact"));
31
- var attributes_1 = __importDefault(require("./attributes"));
32
- var message_1 = __importDefault(require("./message"));
33
- var NeuralSignatureExtraction = /** @class */ (function (_super) {
34
- __extends(NeuralSignatureExtraction, _super);
35
- function NeuralSignatureExtraction(connection, props) {
36
- var _this = _super.call(this, connection, props) || this;
37
- _this.signature = '';
38
- _this.modelVersion = '';
39
- _this.initAttributes(props);
40
- return _this;
41
- }
42
- NeuralSignatureExtraction.collectionName = 'signature';
43
- NeuralSignatureExtraction.attributes = __assign(__assign({}, message_1.default.attributes), { signature: attributes_1.default.String({
44
- modelKey: 'signature',
45
- }), modelVersion: attributes_1.default.String({
46
- modelKey: 'modelVersion',
47
- jsonKey: 'model_version',
48
- }), contacts: attributes_1.default.Object({
49
- modelKey: 'contacts',
50
- itemClass: neural_signature_contact_1.default,
51
- }) });
52
- return NeuralSignatureExtraction;
53
- }(message_1.default));
54
- exports.default = NeuralSignatureExtraction;
@@ -1,36 +0,0 @@
1
- import RestfulModel from './restful-model';
2
- import NeuralSentimentAnalysis from './neural-sentiment-analysis';
3
- import NeuralSignatureExtraction from './neural-signature-extraction';
4
- import NeuralOcr from './neural-ocr';
5
- import NeuralCategorizer from './neural-categorizer';
6
- import NeuralCleanConversation from './neural-clean-conversation';
7
- import Model from './model';
8
- import { Attribute } from './attributes';
9
- export declare type NeuralMessageOptionsProperties = {
10
- ignoreLinks?: boolean;
11
- ignoreImages?: boolean;
12
- ignoreTables?: boolean;
13
- removeConclusionPhrases?: boolean;
14
- imagesAsMarkdown?: boolean;
15
- parseContacts?: boolean;
16
- };
17
- export declare class NeuralMessageOptions extends Model implements NeuralMessageOptionsProperties {
18
- ignoreLinks?: boolean;
19
- ignoreImages?: boolean;
20
- ignoreTables?: boolean;
21
- removeConclusionPhrases?: boolean;
22
- imagesAsMarkdown?: boolean;
23
- parseContacts?: boolean;
24
- static attributes: Record<string, Attribute>;
25
- constructor(props?: NeuralMessageOptionsProperties);
26
- toJSON(writeParseContact?: boolean): Record<string, boolean>;
27
- }
28
- export default class Neural extends RestfulModel {
29
- sentimentAnalysisMessage(messageIds: string[]): Promise<NeuralSentimentAnalysis[]>;
30
- sentimentAnalysisText(text: string): Promise<NeuralSentimentAnalysis>;
31
- extractSignature(messageIds: string[], options?: NeuralMessageOptionsProperties): Promise<NeuralSignatureExtraction[]>;
32
- ocrRequest(fileId: string, pages?: number[]): Promise<NeuralOcr>;
33
- categorize(messageIds: string[]): Promise<NeuralCategorizer[]>;
34
- cleanConversation(messageIds: string[], options?: NeuralMessageOptionsProperties): Promise<NeuralCleanConversation[]>;
35
- private request;
36
- }
@@ -1,163 +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 neural_sentiment_analysis_1 = __importDefault(require("./neural-sentiment-analysis"));
32
- var neural_signature_extraction_1 = __importDefault(require("./neural-signature-extraction"));
33
- var neural_ocr_1 = __importDefault(require("./neural-ocr"));
34
- var neural_categorizer_1 = __importDefault(require("./neural-categorizer"));
35
- var neural_clean_conversation_1 = __importDefault(require("./neural-clean-conversation"));
36
- var model_1 = __importDefault(require("./model"));
37
- var attributes_1 = __importDefault(require("./attributes"));
38
- var NeuralMessageOptions = /** @class */ (function (_super) {
39
- __extends(NeuralMessageOptions, _super);
40
- function NeuralMessageOptions(props) {
41
- var _this = _super.call(this) || this;
42
- _this.initAttributes(props);
43
- return _this;
44
- }
45
- NeuralMessageOptions.prototype.toJSON = function (writeParseContact) {
46
- var body = _super.prototype.toJSON.call(this);
47
- if (writeParseContact !== true) {
48
- delete body['parse_contacts'];
49
- }
50
- return body;
51
- };
52
- NeuralMessageOptions.attributes = {
53
- ignoreLinks: attributes_1.default.Boolean({
54
- modelKey: 'ignoreLinks',
55
- jsonKey: 'ignore_links',
56
- }),
57
- ignoreImages: attributes_1.default.Boolean({
58
- modelKey: 'ignoreImages',
59
- jsonKey: 'ignore_images',
60
- }),
61
- ignoreTables: attributes_1.default.Boolean({
62
- modelKey: 'ignoreTables',
63
- jsonKey: 'ignore_tables',
64
- }),
65
- removeConclusionPhrases: attributes_1.default.Boolean({
66
- modelKey: 'removeConclusionPhrases',
67
- jsonKey: 'remove_conclusion_phrases',
68
- }),
69
- imagesAsMarkdown: attributes_1.default.Boolean({
70
- modelKey: 'imagesAsMarkdown',
71
- jsonKey: 'images_as_markdown',
72
- }),
73
- parseContacts: attributes_1.default.Boolean({
74
- modelKey: 'parseContacts',
75
- jsonKey: 'parse_contacts',
76
- }),
77
- };
78
- return NeuralMessageOptions;
79
- }(model_1.default));
80
- exports.NeuralMessageOptions = NeuralMessageOptions;
81
- var Neural = /** @class */ (function (_super) {
82
- __extends(Neural, _super);
83
- function Neural() {
84
- return _super !== null && _super.apply(this, arguments) || this;
85
- }
86
- Neural.prototype.sentimentAnalysisMessage = function (messageIds) {
87
- var _this = this;
88
- var body = { message_id: messageIds };
89
- var path = 'sentiment';
90
- return this.request(path, body).then(function (jsonArray) {
91
- return jsonArray.map(function (json) {
92
- return new neural_sentiment_analysis_1.default(_this.connection).fromJSON(json);
93
- });
94
- });
95
- };
96
- Neural.prototype.sentimentAnalysisText = function (text) {
97
- var _this = this;
98
- var body = { text: text };
99
- var path = 'sentiment';
100
- return this.request(path, body).then(function (json) {
101
- return new neural_sentiment_analysis_1.default(_this.connection).fromJSON(json);
102
- });
103
- };
104
- Neural.prototype.extractSignature = function (messageIds, options) {
105
- var _this = this;
106
- var body = { message_id: messageIds };
107
- var path = 'signature';
108
- if (options) {
109
- body = __assign(__assign({}, body), new NeuralMessageOptions(options).toJSON(true));
110
- }
111
- return this.request(path, body).then(function (jsonArray) {
112
- return jsonArray.map(function (json) {
113
- return new neural_signature_extraction_1.default(_this.connection).fromJSON(json);
114
- });
115
- });
116
- };
117
- Neural.prototype.ocrRequest = function (fileId, pages) {
118
- var _this = this;
119
- var body = { file_id: fileId };
120
- var path = 'ocr';
121
- if (pages) {
122
- body['pages'] = pages;
123
- }
124
- return this.request(path, body).then(function (json) {
125
- return new neural_ocr_1.default(_this.connection).fromJSON(json);
126
- });
127
- };
128
- Neural.prototype.categorize = function (messageIds) {
129
- var _this = this;
130
- var body = { message_id: messageIds };
131
- var path = 'categorize';
132
- return this.request(path, body).then(function (jsonArray) {
133
- return jsonArray.map(function (json) {
134
- return new neural_categorizer_1.default(_this.connection).fromJSON(json);
135
- });
136
- });
137
- };
138
- Neural.prototype.cleanConversation = function (messageIds, options) {
139
- var _this = this;
140
- var body = { message_id: messageIds };
141
- var path = 'conversation';
142
- if (options) {
143
- body = __assign(__assign({}, body), options);
144
- }
145
- return this.request(path, body).then(function (jsonArray) {
146
- return jsonArray.map(function (json) {
147
- return new neural_clean_conversation_1.default(_this.connection).fromJSON(json);
148
- });
149
- });
150
- };
151
- Neural.prototype.request = function (path, body) {
152
- return this.connection.request({
153
- method: 'PUT',
154
- path: "/neural/" + path,
155
- body: body,
156
- headers: {
157
- 'Content-Type': 'application/json',
158
- },
159
- });
160
- };
161
- return Neural;
162
- }(restful_model_1.default));
163
- exports.default = Neural;
@@ -1,26 +0,0 @@
1
- /**
2
- * Extended Error class for errors returned from the Nylas API
3
- *
4
- * Properties:
5
- * name - The description of the HTTP status code
6
- * message - The error message returned from the Nylas API payload
7
- * statusCode - The status code returned from the API call
8
- * type - The type of error returned from the Nylas API payload
9
- * stack - The Error stacktrace
10
- * missingFields (optional) - The fields that were missing in the call returned from the Nylas API payload
11
- * serverError (optional) - The error returned by the provider returned from the Nylas API payload
12
- */
13
- export default class NylasApiError extends Error {
14
- statusCode: number;
15
- type: string;
16
- missingFields?: string[];
17
- serverError?: string;
18
- /**
19
- * Mapping of HTTP status codes to error descriptions
20
- *
21
- * For more details on what each status code means head to
22
- * https://developer.nylas.com/docs/developer-tools/api/errors/
23
- */
24
- errorMapping: Record<number, string>;
25
- constructor(statusCode: number, type: string, message: string);
26
- }
@@ -1,61 +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
- Object.defineProperty(exports, "__esModule", { value: true });
16
- /**
17
- * Extended Error class for errors returned from the Nylas API
18
- *
19
- * Properties:
20
- * name - The description of the HTTP status code
21
- * message - The error message returned from the Nylas API payload
22
- * statusCode - The status code returned from the API call
23
- * type - The type of error returned from the Nylas API payload
24
- * stack - The Error stacktrace
25
- * missingFields (optional) - The fields that were missing in the call returned from the Nylas API payload
26
- * serverError (optional) - The error returned by the provider returned from the Nylas API payload
27
- */
28
- var NylasApiError = /** @class */ (function (_super) {
29
- __extends(NylasApiError, _super);
30
- function NylasApiError(statusCode, type, message) {
31
- var _this = _super.call(this, message) || this;
32
- /**
33
- * Mapping of HTTP status codes to error descriptions
34
- *
35
- * For more details on what each status code means head to
36
- * https://developer.nylas.com/docs/developer-tools/api/errors/
37
- */
38
- _this.errorMapping = {
39
- 400: 'Bad Request',
40
- 401: 'Unauthorized',
41
- 402: 'Request Failed or Payment Required',
42
- 403: 'Forbidden',
43
- 404: 'Not Found',
44
- 405: 'Method Not Allowed',
45
- 410: 'Gone',
46
- 418: "I'm a Teapot",
47
- 422: 'Sending Error',
48
- 429: 'Too Many Requests',
49
- 500: 'Server Error',
50
- 502: 'Server Error',
51
- 503: 'Server Error',
52
- 504: 'Server Error',
53
- };
54
- _this.statusCode = statusCode;
55
- _this.name = _this.errorMapping[statusCode];
56
- _this.type = type;
57
- return _this;
58
- }
59
- return NylasApiError;
60
- }(Error));
61
- exports.default = NylasApiError;
@@ -1,20 +0,0 @@
1
- import OutboxMessage, { OutboxMessageProperties } from './outbox-message';
2
- import { Attribute } from './attributes';
3
- import NylasConnection from '../nylas-connection';
4
- import JobStatus, { JobStatusProperties } from './job-status';
5
- export declare type OutboxJobStatusProperties = JobStatusProperties & {
6
- messageId?: string;
7
- threadId?: string;
8
- sendAt?: Date;
9
- originalSendAt?: Date;
10
- originalData?: OutboxMessageProperties;
11
- };
12
- export default class OutboxJobStatus extends JobStatus implements OutboxJobStatusProperties {
13
- messageId?: string;
14
- threadId?: string;
15
- sendAt?: Date;
16
- originalSendAt?: Date;
17
- originalData?: OutboxMessage;
18
- static attributes: Record<string, Attribute>;
19
- constructor(connection: NylasConnection, props?: OutboxJobStatusProperties);
20
- }