nylas 6.2.1 → 6.2.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.
@@ -33,6 +33,7 @@ export declare type ManagementAccountProperties = {
33
33
  namespaceId: string;
34
34
  provider: string;
35
35
  syncState: string;
36
+ authenticationType: string;
36
37
  trial: boolean;
37
38
  metadata?: object;
38
39
  };
@@ -45,6 +46,7 @@ export default class ManagementAccount extends ManagementModel implements Manage
45
46
  namespaceId: string;
46
47
  provider: string;
47
48
  syncState: string;
49
+ authenticationType: string;
48
50
  trial: boolean;
49
51
  metadata?: object;
50
52
  static collectionName: string;
@@ -91,6 +91,7 @@ var ManagementAccount = /** @class */ (function (_super) {
91
91
  _this.namespaceId = '';
92
92
  _this.provider = '';
93
93
  _this.syncState = '';
94
+ _this.authenticationType = '';
94
95
  _this.trial = false;
95
96
  _this.initAttributes(props);
96
97
  return _this;
@@ -173,6 +174,9 @@ var ManagementAccount = /** @class */ (function (_super) {
173
174
  }), syncState: attributes_1.default.String({
174
175
  modelKey: 'syncState',
175
176
  jsonKey: 'sync_state',
177
+ }), authenticationType: attributes_1.default.String({
178
+ modelKey: 'authenticationType',
179
+ jsonKey: 'authentication_type',
176
180
  }), trial: attributes_1.default.Boolean({
177
181
  modelKey: 'trial',
178
182
  }), metadata: attributes_1.default.Object({
@@ -17,4 +17,10 @@ export default class MessageRestfulModelCollection extends RestfulModelCollectio
17
17
  limit?: number;
18
18
  callback?: (error: Error | null, results?: Message[]) => void;
19
19
  }): Promise<Message[]>;
20
+ /**
21
+ * Return raw message contents
22
+ * @param messageId The message to fetch content of
23
+ * @returns The raw message contents
24
+ */
25
+ findRaw(messageId: string): Promise<string>;
20
26
  }
@@ -53,6 +53,22 @@ var MessageRestfulModelCollection = /** @class */ (function (_super) {
53
53
  }
54
54
  return this.range(__assign({ path: this.path() + "/" + messageIds.join() }, options));
55
55
  };
56
+ /**
57
+ * Return raw message contents
58
+ * @param messageId The message to fetch content of
59
+ * @returns The raw message contents
60
+ */
61
+ MessageRestfulModelCollection.prototype.findRaw = function (messageId) {
62
+ return this.connection
63
+ .request({
64
+ method: 'GET',
65
+ headers: {
66
+ Accept: 'message/rfc822',
67
+ },
68
+ path: this.path() + "/" + messageId,
69
+ })
70
+ .catch(function (err) { return Promise.reject(err); });
71
+ };
56
72
  return MessageRestfulModelCollection;
57
73
  }(restful_model_collection_1.default));
58
74
  exports.default = MessageRestfulModelCollection;
@@ -193,7 +193,9 @@ var NylasConnection = /** @class */ (function () {
193
193
  console.warn(warning);
194
194
  }
195
195
  if (response.status > 299) {
196
- return response.json().then(function (body) {
196
+ return response
197
+ .json()
198
+ .then(function (body) {
197
199
  var error = new nylas_api_error_1.default(response.status, body.type, body.message);
198
200
  if (body.missing_fields) {
199
201
  error.missingFields = body.missing_fields;
@@ -202,6 +204,18 @@ var NylasConnection = /** @class */ (function () {
202
204
  error.serverError = body.server_error;
203
205
  }
204
206
  return reject(error);
207
+ })
208
+ .catch(function () {
209
+ return response
210
+ .text()
211
+ .then(function (text) {
212
+ var error = new nylas_api_error_1.default(response.status, response.statusText, text);
213
+ return reject(error);
214
+ })
215
+ .catch(function () {
216
+ var error = new nylas_api_error_1.default(response.status, response.statusText, 'Error encountered during request, unable to extract error message.');
217
+ return reject(error);
218
+ });
205
219
  });
206
220
  }
207
221
  else {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nylas",
3
- "version": "6.2.1",
3
+ "version": "6.2.2",
4
4
  "description": "A NodeJS wrapper for the Nylas REST API for email, contacts, and calendar.",
5
5
  "main": "lib/nylas.js",
6
6
  "types": "lib/nylas.d.ts",