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,73 +0,0 @@
1
- import NylasConnection from '../nylas-connection';
2
- import Model from './model';
3
- import { Attribute } from './attributes';
4
- import Account from './account';
5
- export declare enum Scope {
6
- Email = "email",
7
- EmailModify = "email.modify",
8
- EmailReadOnly = "email.read_only",
9
- EmailSend = "email.send",
10
- EmailFoldersAndLabels = "email.folders_and_labels",
11
- EmailMetadata = "email.metadata",
12
- EmailDrafts = "email.drafts",
13
- Calendar = "calendar",
14
- CalendarReadOnly = "calendar.read_only",
15
- RoomResourcesReadOnly = "room_resources.read_only",
16
- Contacts = "contacts",
17
- ContactsReadOnly = "contacts.read_only"
18
- }
19
- export declare type VirtualCalendarProperties = {
20
- name: string;
21
- emailAddress: string;
22
- clientId?: string;
23
- };
24
- export declare class VirtualCalendar extends Model implements VirtualCalendarProperties {
25
- provider: string;
26
- name: string;
27
- emailAddress: string;
28
- scopes: Scope[];
29
- settings: {};
30
- clientId?: string;
31
- static attributes: Record<string, Attribute>;
32
- constructor(props?: VirtualCalendarProperties);
33
- }
34
- export declare enum NativeAuthenticationProvider {
35
- Gmail = "gmail",
36
- Yahoo = "yahoo",
37
- Exchange = "exchange",
38
- Outlook = "outlook",
39
- Imap = "imap",
40
- Icloud = "icloud",
41
- Hotmail = "hotmail",
42
- Aol = "aol",
43
- Office365 = "office365"
44
- }
45
- export declare type NativeAuthenticationProperties = VirtualCalendarProperties & {
46
- scopes: Scope[];
47
- settings: Record<string, any>;
48
- provider: NativeAuthenticationProvider;
49
- };
50
- declare type AuthorizationCode = {
51
- code: string;
52
- };
53
- export declare class NativeAuthentication extends Model implements NativeAuthenticationProperties {
54
- name: string;
55
- emailAddress: string;
56
- provider: NativeAuthenticationProvider;
57
- settings: {};
58
- scopes: Scope[];
59
- clientId?: string;
60
- static attributes: Record<string, Attribute>;
61
- constructor(props?: NativeAuthenticationProperties);
62
- toJSON(): Record<string, unknown>;
63
- fromJSON(json: Record<string, any>): this;
64
- }
65
- export default class Connect {
66
- connection: NylasConnection;
67
- clientId: string;
68
- clientSecret: string;
69
- constructor(connection: NylasConnection, clientId: string, clientSecret: string);
70
- authorize(auth: VirtualCalendarProperties | NativeAuthenticationProperties): Promise<AuthorizationCode>;
71
- token(code: string): Promise<Account>;
72
- }
73
- export {};
@@ -1,193 +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 account_1 = __importDefault(require("./account"));
22
- var Scope;
23
- (function (Scope) {
24
- Scope["Email"] = "email";
25
- Scope["EmailModify"] = "email.modify";
26
- Scope["EmailReadOnly"] = "email.read_only";
27
- Scope["EmailSend"] = "email.send";
28
- Scope["EmailFoldersAndLabels"] = "email.folders_and_labels";
29
- Scope["EmailMetadata"] = "email.metadata";
30
- Scope["EmailDrafts"] = "email.drafts";
31
- Scope["Calendar"] = "calendar";
32
- Scope["CalendarReadOnly"] = "calendar.read_only";
33
- Scope["RoomResourcesReadOnly"] = "room_resources.read_only";
34
- Scope["Contacts"] = "contacts";
35
- Scope["ContactsReadOnly"] = "contacts.read_only";
36
- })(Scope = exports.Scope || (exports.Scope = {}));
37
- var VirtualCalendar = /** @class */ (function (_super) {
38
- __extends(VirtualCalendar, _super);
39
- function VirtualCalendar(props) {
40
- var _this = _super.call(this) || this;
41
- _this.provider = 'nylas';
42
- _this.name = '';
43
- _this.emailAddress = '';
44
- _this.settings = {};
45
- _this.initAttributes(props);
46
- _this.scopes = [Scope.Calendar];
47
- return _this;
48
- }
49
- VirtualCalendar.attributes = {
50
- provider: attributes_1.default.String({
51
- modelKey: 'provider',
52
- }),
53
- clientId: attributes_1.default.String({
54
- modelKey: 'clientId',
55
- jsonKey: 'client_id',
56
- }),
57
- emailAddress: attributes_1.default.String({
58
- modelKey: 'emailAddress',
59
- jsonKey: 'email',
60
- }),
61
- name: attributes_1.default.String({
62
- modelKey: 'name',
63
- }),
64
- scopes: attributes_1.default.EnumList({
65
- modelKey: 'scopes',
66
- itemClass: Scope,
67
- }),
68
- settings: attributes_1.default.Object({
69
- modelKey: 'settings',
70
- }),
71
- };
72
- return VirtualCalendar;
73
- }(model_1.default));
74
- exports.VirtualCalendar = VirtualCalendar;
75
- var NativeAuthenticationProvider;
76
- (function (NativeAuthenticationProvider) {
77
- NativeAuthenticationProvider["Gmail"] = "gmail";
78
- NativeAuthenticationProvider["Yahoo"] = "yahoo";
79
- NativeAuthenticationProvider["Exchange"] = "exchange";
80
- NativeAuthenticationProvider["Outlook"] = "outlook";
81
- NativeAuthenticationProvider["Imap"] = "imap";
82
- NativeAuthenticationProvider["Icloud"] = "icloud";
83
- NativeAuthenticationProvider["Hotmail"] = "hotmail";
84
- NativeAuthenticationProvider["Aol"] = "aol";
85
- NativeAuthenticationProvider["Office365"] = "office365";
86
- })(NativeAuthenticationProvider = exports.NativeAuthenticationProvider || (exports.NativeAuthenticationProvider = {}));
87
- var NativeAuthentication = /** @class */ (function (_super) {
88
- __extends(NativeAuthentication, _super);
89
- function NativeAuthentication(props) {
90
- var _this = _super.call(this) || this;
91
- _this.name = '';
92
- _this.emailAddress = '';
93
- _this.provider = NativeAuthenticationProvider.Gmail;
94
- _this.settings = {};
95
- _this.scopes = [];
96
- _this.initAttributes(props);
97
- return _this;
98
- }
99
- NativeAuthentication.prototype.toJSON = function () {
100
- var json = _super.prototype.toJSON.call(this);
101
- json['scopes'] = this.scopes.join();
102
- return json;
103
- };
104
- NativeAuthentication.prototype.fromJSON = function (json) {
105
- if (json['scopes']) {
106
- json['scopes'] = json['scopes'].split(',');
107
- }
108
- return _super.prototype.fromJSON.call(this, json);
109
- };
110
- NativeAuthentication.attributes = {
111
- clientId: attributes_1.default.String({
112
- modelKey: 'clientId',
113
- jsonKey: 'client_id',
114
- }),
115
- name: attributes_1.default.String({
116
- modelKey: 'name',
117
- }),
118
- emailAddress: attributes_1.default.String({
119
- modelKey: 'emailAddress',
120
- jsonKey: 'email_address',
121
- }),
122
- provider: attributes_1.default.Enum({
123
- modelKey: 'provider',
124
- itemClass: NativeAuthenticationProvider,
125
- }),
126
- scopes: attributes_1.default.EnumList({
127
- modelKey: 'scopes',
128
- itemClass: Scope,
129
- }),
130
- settings: attributes_1.default.Object({
131
- modelKey: 'settings',
132
- }),
133
- };
134
- return NativeAuthentication;
135
- }(model_1.default));
136
- exports.NativeAuthentication = NativeAuthentication;
137
- var Connect = /** @class */ (function () {
138
- function Connect(connection, clientId, clientSecret) {
139
- this.connection = connection;
140
- this.clientId = clientId;
141
- this.clientSecret = clientSecret;
142
- }
143
- Connect.prototype.authorize = function (auth) {
144
- // https://docs.nylas.com/reference#connectauthorize
145
- if (!this.clientId) {
146
- throw new Error('connect.authorize() cannot be called until you provide a clientId via Nylas.config()');
147
- }
148
- var authClass;
149
- if (!auth.clientId) {
150
- auth.clientId = this.clientId;
151
- }
152
- if (auth.hasOwnProperty('provider') && auth.provider != 'nylas') {
153
- authClass = new NativeAuthentication(auth);
154
- }
155
- else {
156
- authClass = new VirtualCalendar(auth);
157
- }
158
- return this.connection
159
- .request({
160
- method: 'POST',
161
- path: '/connect/authorize',
162
- body: authClass.toJSON(),
163
- })
164
- .then(function (json) {
165
- return json;
166
- });
167
- };
168
- Connect.prototype.token = function (code) {
169
- var _this = this;
170
- // https://docs.nylas.com/reference#connecttoken
171
- if (!this.clientId) {
172
- throw new Error('connect.token() cannot be called until you provide a clientId via Nylas.config()');
173
- }
174
- if (!this.clientSecret) {
175
- throw new Error('connect.token() cannot be called until you provide a clientSecret via Nylas.config()');
176
- }
177
- return this.connection
178
- .request({
179
- method: 'POST',
180
- path: '/connect/token',
181
- body: {
182
- client_id: this.clientId,
183
- client_secret: this.clientSecret,
184
- code: code,
185
- },
186
- })
187
- .then(function (json) {
188
- return new account_1.default(_this.connection).fromJSON(json);
189
- });
190
- };
191
- return Connect;
192
- }());
193
- exports.default = Connect;
@@ -1,9 +0,0 @@
1
- import Contact, { Group } from './contact';
2
- import NylasConnection from '../nylas-connection';
3
- import RestfulModelCollection from './restful-model-collection';
4
- export default class ContactRestfulModelCollection extends RestfulModelCollection<Contact> {
5
- connection: NylasConnection;
6
- modelClass: typeof Contact;
7
- constructor(connection: NylasConnection);
8
- groups(callback?: (error: Error | null, data?: Record<string, any>) => void): Promise<Group[]>;
9
- }
@@ -1,60 +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 __importStar = (this && this.__importStar) || function (mod) {
16
- if (mod && mod.__esModule) return mod;
17
- var result = {};
18
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
19
- result["default"] = mod;
20
- return result;
21
- };
22
- var __importDefault = (this && this.__importDefault) || function (mod) {
23
- return (mod && mod.__esModule) ? mod : { "default": mod };
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- var contact_1 = __importStar(require("./contact"));
27
- var restful_model_collection_1 = __importDefault(require("./restful-model-collection"));
28
- var ContactRestfulModelCollection = /** @class */ (function (_super) {
29
- __extends(ContactRestfulModelCollection, _super);
30
- function ContactRestfulModelCollection(connection) {
31
- var _this = _super.call(this, contact_1.default, connection) || this;
32
- _this.connection = connection;
33
- _this.modelClass = contact_1.default;
34
- return _this;
35
- }
36
- ContactRestfulModelCollection.prototype.groups = function (callback) {
37
- return this.connection
38
- .request({
39
- method: 'GET',
40
- path: "/contacts/groups",
41
- })
42
- .then(function (json) {
43
- var groups = json.map(function (group) {
44
- return new contact_1.Group().fromJSON(group);
45
- });
46
- if (callback) {
47
- callback(null, groups);
48
- }
49
- return Promise.resolve(groups);
50
- })
51
- .catch(function (err) {
52
- if (callback) {
53
- callback(err);
54
- }
55
- return Promise.reject(err);
56
- });
57
- };
58
- return ContactRestfulModelCollection;
59
- }(restful_model_collection_1.default));
60
- exports.default = ContactRestfulModelCollection;
@@ -1,129 +0,0 @@
1
- import RestfulModel, { SaveCallback } from './restful-model';
2
- import { Attribute } from './attributes';
3
- import Model from './model';
4
- import NylasConnection from '../nylas-connection';
5
- export declare type EmailAddressProperties = {
6
- type: string;
7
- email: string;
8
- };
9
- export declare class EmailAddress extends Model implements EmailAddressProperties {
10
- type: string;
11
- email: string;
12
- static attributes: Record<string, Attribute>;
13
- constructor(props?: EmailAddressProperties);
14
- }
15
- export declare type IMAddressProperties = {
16
- type: string;
17
- imAddress: string;
18
- };
19
- export declare class IMAddress extends Model implements IMAddressProperties {
20
- type: string;
21
- imAddress: string;
22
- static attributes: Record<string, Attribute>;
23
- constructor(props?: IMAddressProperties);
24
- }
25
- export declare type PhysicalAddressProperties = {
26
- type: string;
27
- format: string;
28
- streetAddress: string;
29
- city: string;
30
- postalCode: string;
31
- state: string;
32
- country: string;
33
- address?: string;
34
- };
35
- export declare class PhysicalAddress extends Model implements PhysicalAddressProperties {
36
- type: string;
37
- format: string;
38
- streetAddress: string;
39
- city: string;
40
- postalCode: string;
41
- state: string;
42
- country: string;
43
- address: string;
44
- static attributes: Record<string, Attribute>;
45
- constructor(props?: PhysicalAddressProperties);
46
- toJSON(): Record<string, string>;
47
- }
48
- export declare type PhoneNumberProperties = {
49
- type: string;
50
- number: string;
51
- };
52
- export declare class PhoneNumber extends Model implements PhoneNumberProperties {
53
- type: string;
54
- number: string;
55
- static attributes: Record<string, Attribute>;
56
- constructor(props?: PhoneNumberProperties);
57
- }
58
- export declare type WebPageProperties = {
59
- type: string;
60
- url: string;
61
- };
62
- export declare class WebPage extends Model implements WebPageProperties {
63
- type: string;
64
- url: string;
65
- static attributes: Record<string, Attribute>;
66
- constructor(props?: WebPageProperties);
67
- }
68
- export declare type GroupProperties = {
69
- name: string;
70
- path: string;
71
- id?: string;
72
- accountId?: string;
73
- object?: string;
74
- };
75
- export declare class Group extends Model implements GroupProperties {
76
- name: string;
77
- path: string;
78
- id?: string;
79
- accountId?: string;
80
- object?: string;
81
- static attributes: Record<string, Attribute>;
82
- constructor(props?: GroupProperties);
83
- }
84
- export declare type ContactProperties = {
85
- givenName?: string;
86
- middleName?: string;
87
- surname?: string;
88
- suffix?: string;
89
- nickname?: string;
90
- birthday?: string;
91
- companyName?: string;
92
- jobTitle?: string;
93
- officeLocation?: string;
94
- notes?: string;
95
- pictureUrl?: string;
96
- emailAddresses?: EmailAddressProperties[];
97
- imAddresses?: IMAddressProperties[];
98
- physicalAddresses?: PhysicalAddressProperties[];
99
- phoneNumbers?: PhoneNumberProperties[];
100
- webPages?: WebPageProperties[];
101
- groups?: GroupProperties[];
102
- source?: string;
103
- };
104
- export default class Contact extends RestfulModel implements ContactProperties {
105
- givenName?: string;
106
- middleName?: string;
107
- surname?: string;
108
- suffix?: string;
109
- nickname?: string;
110
- birthday?: string;
111
- companyName?: string;
112
- jobTitle?: string;
113
- officeLocation?: string;
114
- notes?: string;
115
- pictureUrl?: string;
116
- emailAddresses?: EmailAddress[];
117
- imAddresses?: IMAddress[];
118
- physicalAddresses?: PhysicalAddress[];
119
- phoneNumbers?: PhoneNumber[];
120
- webPages?: WebPage[];
121
- groups?: Group[];
122
- source?: string;
123
- jobStatusId?: string;
124
- static collectionName: string;
125
- static attributes: Record<string, Attribute>;
126
- constructor(connection: NylasConnection, props?: ContactProperties);
127
- getPicture(params?: Record<string, any>, callback?: (error: Error | null, result?: any) => void): any;
128
- save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
129
- }