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,49 +0,0 @@
1
- import Message, { MessageProperties } from './message';
2
- import RestfulModel, { SaveCallback } from './restful-model';
3
- import { Attribute } from './attributes';
4
- import EmailParticipant, { EmailParticipantProperties } from './email-participant';
5
- import Folder, { Label, FolderProperties } from './folder';
6
- import NylasConnection from '../nylas-connection';
7
- export declare type ThreadProperties = {
8
- subject: string;
9
- participants: EmailParticipantProperties[];
10
- lastMessageTimestamp: Date;
11
- lastMessageReceivedTimestamp: Date;
12
- firstMessageTimestamp: Date;
13
- messageIds: string[];
14
- snippet: string;
15
- unread: boolean;
16
- starred: boolean;
17
- version: string;
18
- hasAttachments?: boolean;
19
- lastMessageSentTimestamp?: Date;
20
- folders?: FolderProperties[];
21
- labels?: FolderProperties[];
22
- draftIds?: string[];
23
- messages?: MessageProperties[];
24
- drafts?: MessageProperties[];
25
- };
26
- export default class Thread extends RestfulModel implements ThreadProperties {
27
- subject: string;
28
- participants: EmailParticipant[];
29
- lastMessageTimestamp: Date;
30
- lastMessageReceivedTimestamp: Date;
31
- firstMessageTimestamp: Date;
32
- messageIds: string[];
33
- snippet: string;
34
- unread: boolean;
35
- starred: boolean;
36
- version: string;
37
- hasAttachments?: boolean;
38
- lastMessageSentTimestamp?: Date;
39
- folders?: Folder[];
40
- labels?: Label[];
41
- draftIds?: string[];
42
- messages?: Message[];
43
- drafts?: Message[];
44
- static collectionName: string;
45
- static attributes: Record<string, Attribute>;
46
- constructor(connection: NylasConnection, props?: ThreadProperties);
47
- saveRequestBody(): Record<string, unknown>;
48
- save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
49
- }
@@ -1,127 +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
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
33
- result["default"] = mod;
34
- return result;
35
- };
36
- Object.defineProperty(exports, "__esModule", { value: true });
37
- var message_1 = __importDefault(require("./message"));
38
- var restful_model_1 = __importDefault(require("./restful-model"));
39
- var attributes_1 = __importDefault(require("./attributes"));
40
- var email_participant_1 = __importDefault(require("./email-participant"));
41
- var folder_1 = __importStar(require("./folder"));
42
- var Thread = /** @class */ (function (_super) {
43
- __extends(Thread, _super);
44
- function Thread(connection, props) {
45
- var _this = _super.call(this, connection, props) || this;
46
- _this.subject = '';
47
- _this.participants = [];
48
- _this.lastMessageTimestamp = new Date();
49
- _this.lastMessageReceivedTimestamp = new Date();
50
- _this.firstMessageTimestamp = new Date();
51
- _this.messageIds = [];
52
- _this.snippet = '';
53
- _this.unread = false;
54
- _this.starred = false;
55
- _this.version = '';
56
- _this.initAttributes(props);
57
- return _this;
58
- }
59
- Thread.prototype.saveRequestBody = function () {
60
- var json = {};
61
- if (this.labels) {
62
- json['label_ids'] = this.labels.map(function (label) { return label.id; });
63
- }
64
- else if (this.folders && this.folders.length === 1) {
65
- json['folder_id'] = this.folders[0].id;
66
- }
67
- json['starred'] = this.starred;
68
- json['unread'] = this.unread;
69
- return json;
70
- };
71
- Thread.prototype.save = function (params, callback) {
72
- if (params === void 0) { params = {}; }
73
- return _super.prototype.save.call(this, params, callback);
74
- };
75
- Thread.collectionName = 'threads';
76
- Thread.attributes = __assign(__assign({}, restful_model_1.default.attributes), { subject: attributes_1.default.String({
77
- modelKey: 'subject',
78
- }), participants: attributes_1.default.Collection({
79
- modelKey: 'participants',
80
- itemClass: email_participant_1.default,
81
- }), lastMessageTimestamp: attributes_1.default.DateTime({
82
- modelKey: 'lastMessageTimestamp',
83
- jsonKey: 'last_message_timestamp',
84
- }), lastMessageReceivedTimestamp: attributes_1.default.DateTime({
85
- modelKey: 'lastMessageReceivedTimestamp',
86
- jsonKey: 'last_message_received_timestamp',
87
- }), lastMessageSentTimestamp: attributes_1.default.DateTime({
88
- modelKey: 'lastMessageSentTimestamp',
89
- jsonKey: 'last_message_sent_timestamp',
90
- }), firstMessageTimestamp: attributes_1.default.DateTime({
91
- modelKey: 'firstMessageTimestamp',
92
- jsonKey: 'first_message_timestamp',
93
- }), snippet: attributes_1.default.String({
94
- modelKey: 'snippet',
95
- }), unread: attributes_1.default.Boolean({
96
- modelKey: 'unread',
97
- }), starred: attributes_1.default.Boolean({
98
- modelKey: 'starred',
99
- }), hasAttachments: attributes_1.default.Boolean({
100
- modelKey: 'has_attachments',
101
- }), version: attributes_1.default.String({
102
- modelKey: 'version',
103
- jsonKey: 'version',
104
- }), folders: attributes_1.default.Collection({
105
- modelKey: 'folders',
106
- itemClass: folder_1.default,
107
- jsonKey: 'folders',
108
- }), labels: attributes_1.default.Collection({
109
- modelKey: 'labels',
110
- itemClass: folder_1.Label,
111
- jsonKey: 'labels',
112
- }), messageIds: attributes_1.default.StringList({
113
- modelKey: 'messageIds',
114
- jsonKey: 'message_ids',
115
- }), draftIds: attributes_1.default.StringList({
116
- modelKey: 'draftIds',
117
- jsonKey: 'draft_ids',
118
- }), messages: attributes_1.default.Collection({
119
- modelKey: 'messages',
120
- itemClass: message_1.default,
121
- }), drafts: attributes_1.default.Collection({
122
- modelKey: 'drafts',
123
- itemClass: message_1.default,
124
- }) });
125
- return Thread;
126
- }(restful_model_1.default));
127
- exports.default = Thread;
@@ -1,108 +0,0 @@
1
- import Model from './model';
2
- import { Attribute } from './attributes';
3
- export declare type LinkClickProperties = {
4
- id: number;
5
- ip: string;
6
- userAgent: string;
7
- timestamp: Date;
8
- linkIndex?: number;
9
- };
10
- export declare class LinkClick extends Model implements LinkClickProperties {
11
- id: number;
12
- ip: string;
13
- userAgent: string;
14
- timestamp: Date;
15
- linkIndex?: number;
16
- static attributes: Record<string, Attribute>;
17
- constructor(props?: LinkClickCountProperties);
18
- }
19
- export declare type LinkClickCountProperties = {
20
- url: string;
21
- count: number;
22
- };
23
- export declare class LinkClickCount extends Model implements LinkClickCountProperties {
24
- url: string;
25
- count: number;
26
- static attributes: Record<string, Attribute>;
27
- constructor(props?: LinkClickCountProperties);
28
- }
29
- export declare type MessageTrackingDataProperties = {
30
- messageId: string;
31
- payload: string;
32
- senderAppId: number;
33
- threadId?: string;
34
- replyToMessageId?: string;
35
- timestamp?: Date;
36
- count?: number;
37
- fromSelf?: boolean;
38
- recents?: LinkClickProperties[];
39
- linkData?: LinkClickCountProperties[];
40
- };
41
- export declare class MessageTrackingData extends Model implements MessageTrackingDataProperties {
42
- messageId: string;
43
- payload: string;
44
- senderAppId: number;
45
- replyToMessageId?: string;
46
- timestamp?: Date;
47
- threadId?: string;
48
- fromSelf?: boolean;
49
- count?: number;
50
- linkData?: LinkClickCount[];
51
- recents?: LinkClick[];
52
- static attributes: Record<string, Attribute>;
53
- constructor(props?: MessageTrackingDataProperties);
54
- }
55
- export declare type WebhookObjectAttributesProperties = {
56
- action?: string;
57
- jobStatusId?: string;
58
- threadId?: string;
59
- receivedDate?: Date;
60
- };
61
- export declare class WebhookObjectAttributes extends Model implements WebhookObjectAttributesProperties {
62
- action?: string;
63
- jobStatusId?: string;
64
- threadId?: string;
65
- receivedDate?: Date;
66
- static attributes: Record<string, Attribute>;
67
- constructor(props?: WebhookObjectAttributesProperties);
68
- }
69
- export declare type WebhookObjectDataProperties = {
70
- id: string;
71
- accountId: string;
72
- namespaceId: string;
73
- object: string;
74
- metadata?: MessageTrackingDataProperties;
75
- objectAttributes?: WebhookObjectAttributesProperties;
76
- };
77
- export declare class WebhookObjectData extends Model implements WebhookObjectDataProperties {
78
- id: string;
79
- accountId: string;
80
- namespaceId: string;
81
- object: string;
82
- metadata?: MessageTrackingData;
83
- objectAttributes?: WebhookObjectAttributes;
84
- static attributes: Record<string, Attribute>;
85
- constructor(props?: WebhookObjectDataProperties);
86
- }
87
- export declare type WebhookDeltaProperties = {
88
- object: string;
89
- type: string;
90
- date: Date;
91
- objectData: WebhookObjectDataProperties;
92
- };
93
- export declare class WebhookDelta extends Model implements WebhookDeltaProperties {
94
- date: Date;
95
- object: string;
96
- type: string;
97
- objectData: WebhookObjectData;
98
- static attributes: Record<string, Attribute>;
99
- constructor(props?: WebhookDeltaProperties);
100
- }
101
- export declare type WebhookNotificationProperties = {
102
- deltas: WebhookDeltaProperties[];
103
- };
104
- export default class WebhookNotification extends Model implements WebhookNotificationProperties {
105
- deltas: WebhookDelta[];
106
- static attributes: Record<string, Attribute>;
107
- constructor(props?: WebhookNotificationProperties);
108
- }
@@ -1,239 +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 LinkClick = /** @class */ (function (_super) {
22
- __extends(LinkClick, _super);
23
- function LinkClick(props) {
24
- var _this = _super.call(this) || this;
25
- _this.id = 0;
26
- _this.ip = '';
27
- _this.userAgent = '';
28
- _this.timestamp = new Date();
29
- _this.initAttributes(props);
30
- return _this;
31
- }
32
- LinkClick.attributes = {
33
- id: attributes_1.default.Number({
34
- modelKey: 'id',
35
- }),
36
- ip: attributes_1.default.String({
37
- modelKey: 'ip',
38
- }),
39
- userAgent: attributes_1.default.String({
40
- modelKey: 'userAgent',
41
- jsonKey: 'user_agent',
42
- }),
43
- timestamp: attributes_1.default.DateTime({
44
- modelKey: 'timestamp',
45
- }),
46
- linkIndex: attributes_1.default.Number({
47
- modelKey: 'linkIndex',
48
- jsonKey: 'link_index',
49
- }),
50
- };
51
- return LinkClick;
52
- }(model_1.default));
53
- exports.LinkClick = LinkClick;
54
- var LinkClickCount = /** @class */ (function (_super) {
55
- __extends(LinkClickCount, _super);
56
- function LinkClickCount(props) {
57
- var _this = _super.call(this) || this;
58
- _this.url = '';
59
- _this.count = 0;
60
- _this.initAttributes(props);
61
- return _this;
62
- }
63
- LinkClickCount.attributes = {
64
- url: attributes_1.default.String({
65
- modelKey: 'url',
66
- }),
67
- count: attributes_1.default.Number({
68
- modelKey: 'count',
69
- }),
70
- };
71
- return LinkClickCount;
72
- }(model_1.default));
73
- exports.LinkClickCount = LinkClickCount;
74
- var MessageTrackingData = /** @class */ (function (_super) {
75
- __extends(MessageTrackingData, _super);
76
- function MessageTrackingData(props) {
77
- var _this = _super.call(this) || this;
78
- _this.messageId = '';
79
- _this.payload = '';
80
- _this.senderAppId = 0;
81
- _this.initAttributes(props);
82
- return _this;
83
- }
84
- MessageTrackingData.attributes = {
85
- messageId: attributes_1.default.String({
86
- modelKey: 'messageId',
87
- jsonKey: 'message_id',
88
- }),
89
- payload: attributes_1.default.String({
90
- modelKey: 'payload',
91
- }),
92
- senderAppId: attributes_1.default.Number({
93
- modelKey: 'senderAppId',
94
- jsonKey: 'sender_app_id',
95
- }),
96
- replyToMessageId: attributes_1.default.String({
97
- modelKey: 'replyToMessageId',
98
- jsonKey: 'reply_to_message_id',
99
- }),
100
- timestamp: attributes_1.default.DateTime({
101
- modelKey: 'timestamp',
102
- }),
103
- threadId: attributes_1.default.String({
104
- modelKey: 'threadId',
105
- jsonKey: 'thread_id',
106
- }),
107
- fromSelf: attributes_1.default.Boolean({
108
- modelKey: 'fromSelf',
109
- jsonKey: 'from_self',
110
- }),
111
- count: attributes_1.default.Number({
112
- modelKey: 'count',
113
- }),
114
- linkData: attributes_1.default.Collection({
115
- modelKey: 'linkData',
116
- jsonKey: 'link_data',
117
- itemClass: LinkClickCount,
118
- }),
119
- recents: attributes_1.default.Collection({
120
- modelKey: 'recents',
121
- itemClass: LinkClick,
122
- }),
123
- };
124
- return MessageTrackingData;
125
- }(model_1.default));
126
- exports.MessageTrackingData = MessageTrackingData;
127
- var WebhookObjectAttributes = /** @class */ (function (_super) {
128
- __extends(WebhookObjectAttributes, _super);
129
- function WebhookObjectAttributes(props) {
130
- var _this = _super.call(this) || this;
131
- _this.initAttributes(props);
132
- return _this;
133
- }
134
- WebhookObjectAttributes.attributes = {
135
- action: attributes_1.default.String({
136
- modelKey: 'action',
137
- }),
138
- jobStatusId: attributes_1.default.String({
139
- modelKey: 'jobStatusId',
140
- jsonKey: 'job_status_id',
141
- }),
142
- threadId: attributes_1.default.String({
143
- modelKey: 'threadId',
144
- jsonKey: 'thread_id',
145
- }),
146
- receivedDate: attributes_1.default.DateTime({
147
- modelKey: 'receivedDate',
148
- jsonKey: 'received_date',
149
- }),
150
- };
151
- return WebhookObjectAttributes;
152
- }(model_1.default));
153
- exports.WebhookObjectAttributes = WebhookObjectAttributes;
154
- var WebhookObjectData = /** @class */ (function (_super) {
155
- __extends(WebhookObjectData, _super);
156
- function WebhookObjectData(props) {
157
- var _this = _super.call(this) || this;
158
- _this.id = '';
159
- _this.accountId = '';
160
- _this.namespaceId = '';
161
- _this.object = '';
162
- _this.initAttributes(props);
163
- return _this;
164
- }
165
- WebhookObjectData.attributes = {
166
- id: attributes_1.default.String({
167
- modelKey: 'id',
168
- }),
169
- accountId: attributes_1.default.String({
170
- modelKey: 'accountId',
171
- jsonKey: 'account_id',
172
- }),
173
- namespaceId: attributes_1.default.String({
174
- modelKey: 'namespaceId',
175
- jsonKey: 'namespace_id',
176
- }),
177
- object: attributes_1.default.String({
178
- modelKey: 'object',
179
- }),
180
- metadata: attributes_1.default.Object({
181
- modelKey: 'metadata',
182
- itemClass: MessageTrackingData,
183
- }),
184
- objectAttributes: attributes_1.default.Object({
185
- modelKey: 'objectAttributes',
186
- jsonKey: 'attributes',
187
- itemClass: WebhookObjectAttributes,
188
- }),
189
- };
190
- return WebhookObjectData;
191
- }(model_1.default));
192
- exports.WebhookObjectData = WebhookObjectData;
193
- var WebhookDelta = /** @class */ (function (_super) {
194
- __extends(WebhookDelta, _super);
195
- function WebhookDelta(props) {
196
- var _this = _super.call(this) || this;
197
- _this.date = new Date();
198
- _this.object = '';
199
- _this.type = '';
200
- _this.objectData = new WebhookObjectData();
201
- _this.initAttributes(props);
202
- return _this;
203
- }
204
- WebhookDelta.attributes = {
205
- date: attributes_1.default.DateTime({
206
- modelKey: 'date',
207
- }),
208
- object: attributes_1.default.String({
209
- modelKey: 'object',
210
- }),
211
- type: attributes_1.default.String({
212
- modelKey: 'type',
213
- }),
214
- objectData: attributes_1.default.Object({
215
- modelKey: 'objectData',
216
- jsonKey: 'object_data',
217
- itemClass: WebhookObjectData,
218
- }),
219
- };
220
- return WebhookDelta;
221
- }(model_1.default));
222
- exports.WebhookDelta = WebhookDelta;
223
- var WebhookNotification = /** @class */ (function (_super) {
224
- __extends(WebhookNotification, _super);
225
- function WebhookNotification(props) {
226
- var _this = _super.call(this) || this;
227
- _this.deltas = [];
228
- _this.initAttributes(props);
229
- return _this;
230
- }
231
- WebhookNotification.attributes = {
232
- deltas: attributes_1.default.Collection({
233
- modelKey: 'deltas',
234
- itemClass: WebhookDelta,
235
- }),
236
- };
237
- return WebhookNotification;
238
- }(model_1.default));
239
- exports.default = WebhookNotification;
@@ -1,50 +0,0 @@
1
- import ManagementModel from './management-model';
2
- import { Attribute } from './attributes';
3
- import { SaveCallback } from './restful-model';
4
- import NylasConnection from '../nylas-connection';
5
- export declare enum WebhookTriggers {
6
- AccountConnected = "account.connected",
7
- AccountRunning = "account.running",
8
- AccountStopped = "account.stopped",
9
- AccountInvalid = "account.invalid",
10
- AccountSyncError = "account.sync_error",
11
- MessageBounced = "message.bounced",
12
- MessageCreated = "message.created",
13
- MessageOpened = "message.opened",
14
- MessageUpdated = "message.updated",
15
- MessageLinkClicked = "message.link_clicked",
16
- ThreadReplied = "thread.replied",
17
- ContactCreated = "contact.created",
18
- ContactUpdated = "contact.updated",
19
- ContactDeleted = "contact.deleted",
20
- CalendarCreated = "calendar.created",
21
- CalendarUpdated = "calendar.updated",
22
- CalendarDeleted = "calendar.deleted",
23
- EventCreated = "event.created",
24
- EventUpdated = "event.updated",
25
- EventDeleted = "event.deleted",
26
- JobSuccessful = "job.successful",
27
- JobFailed = "job.failed"
28
- }
29
- export declare type WebhookProperties = {
30
- callbackUrl: string;
31
- state: string;
32
- triggers: string[];
33
- id?: string;
34
- applicationId?: string;
35
- version?: string;
36
- };
37
- export default class Webhook extends ManagementModel implements WebhookProperties {
38
- callbackUrl: string;
39
- state: string;
40
- triggers: string[];
41
- id?: string;
42
- applicationId?: string;
43
- version?: string;
44
- static collectionName: string;
45
- static attributes: Record<string, Attribute>;
46
- constructor(connection: NylasConnection, clientId: string, props: WebhookProperties);
47
- pathPrefix(): string;
48
- saveRequestBody(): Record<string, unknown>;
49
- save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
50
- }
@@ -1,101 +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 management_model_1 = __importDefault(require("./management-model"));
20
- var attributes_1 = __importDefault(require("./attributes"));
21
- var WebhookTriggers;
22
- (function (WebhookTriggers) {
23
- WebhookTriggers["AccountConnected"] = "account.connected";
24
- WebhookTriggers["AccountRunning"] = "account.running";
25
- WebhookTriggers["AccountStopped"] = "account.stopped";
26
- WebhookTriggers["AccountInvalid"] = "account.invalid";
27
- WebhookTriggers["AccountSyncError"] = "account.sync_error";
28
- WebhookTriggers["MessageBounced"] = "message.bounced";
29
- WebhookTriggers["MessageCreated"] = "message.created";
30
- WebhookTriggers["MessageOpened"] = "message.opened";
31
- WebhookTriggers["MessageUpdated"] = "message.updated";
32
- WebhookTriggers["MessageLinkClicked"] = "message.link_clicked";
33
- WebhookTriggers["ThreadReplied"] = "thread.replied";
34
- WebhookTriggers["ContactCreated"] = "contact.created";
35
- WebhookTriggers["ContactUpdated"] = "contact.updated";
36
- WebhookTriggers["ContactDeleted"] = "contact.deleted";
37
- WebhookTriggers["CalendarCreated"] = "calendar.created";
38
- WebhookTriggers["CalendarUpdated"] = "calendar.updated";
39
- WebhookTriggers["CalendarDeleted"] = "calendar.deleted";
40
- WebhookTriggers["EventCreated"] = "event.created";
41
- WebhookTriggers["EventUpdated"] = "event.updated";
42
- WebhookTriggers["EventDeleted"] = "event.deleted";
43
- WebhookTriggers["JobSuccessful"] = "job.successful";
44
- WebhookTriggers["JobFailed"] = "job.failed";
45
- })(WebhookTriggers = exports.WebhookTriggers || (exports.WebhookTriggers = {}));
46
- var Webhook = /** @class */ (function (_super) {
47
- __extends(Webhook, _super);
48
- function Webhook(connection, clientId, props) {
49
- var _this = _super.call(this, connection, clientId, props) || this;
50
- _this.callbackUrl = '';
51
- _this.state = '';
52
- _this.triggers = [];
53
- _this.initAttributes(props);
54
- return _this;
55
- }
56
- Webhook.prototype.pathPrefix = function () {
57
- return "/a/" + this.clientId;
58
- };
59
- Webhook.prototype.saveRequestBody = function () {
60
- var json = {};
61
- // We can only update the state of an existing webhook
62
- if (this.id) {
63
- json['state'] = this.state;
64
- }
65
- else {
66
- json['callback_url'] = this.callbackUrl;
67
- json['state'] = this.state ? this.state : 'active';
68
- json['triggers'] = Webhook.attributes.triggers.toJSON(this.triggers);
69
- }
70
- return json;
71
- };
72
- Webhook.prototype.save = function (params, callback) {
73
- if (params === void 0) { params = {}; }
74
- return _super.prototype.save.call(this, params, callback);
75
- };
76
- Webhook.collectionName = 'webhooks';
77
- Webhook.attributes = {
78
- id: attributes_1.default.String({
79
- modelKey: 'id',
80
- }),
81
- applicationId: attributes_1.default.String({
82
- modelKey: 'applicationId',
83
- jsonKey: 'application_id',
84
- }),
85
- callbackUrl: attributes_1.default.String({
86
- modelKey: 'callbackUrl',
87
- jsonKey: 'callback_url',
88
- }),
89
- state: attributes_1.default.String({
90
- modelKey: 'state',
91
- }),
92
- triggers: attributes_1.default.StringList({
93
- modelKey: 'triggers',
94
- }),
95
- version: attributes_1.default.String({
96
- modelKey: 'version',
97
- }),
98
- };
99
- return Webhook;
100
- }(management_model_1.default));
101
- exports.default = Webhook;