nylas 6.2.1 → 6.3.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.
- package/lib/config.d.ts +1 -0
- package/lib/models/calendar-availability.d.ts +2 -0
- package/lib/models/calendar-availability.js +3 -0
- package/lib/models/free-busy.d.ts +2 -0
- package/lib/models/free-busy.js +3 -0
- package/lib/models/job-status-restful-model-collection.d.ts +9 -0
- package/lib/models/job-status-restful-model-collection.js +38 -0
- package/lib/models/management-account.d.ts +2 -0
- package/lib/models/management-account.js +4 -0
- package/lib/models/message-restful-model-collection.d.ts +6 -0
- package/lib/models/message-restful-model-collection.js +22 -0
- package/lib/models/outbox-job-status.d.ts +12 -13
- package/lib/models/outbox-job-status.js +30 -36
- package/lib/models/outbox.js +2 -2
- package/lib/nylas-connection.d.ts +2 -2
- package/lib/nylas-connection.js +25 -5
- package/lib/nylas.d.ts +5 -0
- package/lib/nylas.js +15 -0
- package/package.json +1 -1
package/lib/config.d.ts
CHANGED
|
@@ -64,10 +64,12 @@ export declare class CalendarConsecutiveAvailability extends Model implements Ca
|
|
|
64
64
|
}
|
|
65
65
|
export declare type CalendarAvailabilityProperties = {
|
|
66
66
|
timeSlots: TimeSlotProperties[];
|
|
67
|
+
order?: string[];
|
|
67
68
|
};
|
|
68
69
|
export default class CalendarAvailability extends Model implements CalendarAvailabilityProperties {
|
|
69
70
|
object: string;
|
|
70
71
|
timeSlots: TimeSlot[];
|
|
72
|
+
order?: string[];
|
|
71
73
|
static attributes: Record<string, Attribute>;
|
|
72
74
|
constructor(props?: CalendarAvailabilityProperties);
|
|
73
75
|
}
|
|
@@ -112,6 +112,9 @@ var CalendarAvailability = /** @class */ (function (_super) {
|
|
|
112
112
|
jsonKey: 'time_slots',
|
|
113
113
|
itemClass: free_busy_1.TimeSlot,
|
|
114
114
|
}),
|
|
115
|
+
order: attributes_1.default.StringList({
|
|
116
|
+
modelKey: 'order',
|
|
117
|
+
}),
|
|
115
118
|
};
|
|
116
119
|
return CalendarAvailability;
|
|
117
120
|
}(model_1.default));
|
|
@@ -20,12 +20,14 @@ export declare type TimeSlotProperties = {
|
|
|
20
20
|
status: string;
|
|
21
21
|
startTime: number;
|
|
22
22
|
endTime: number;
|
|
23
|
+
emails?: string[];
|
|
23
24
|
};
|
|
24
25
|
export declare class TimeSlot extends Model implements TimeSlotProperties {
|
|
25
26
|
object: string;
|
|
26
27
|
status: string;
|
|
27
28
|
startTime: number;
|
|
28
29
|
endTime: number;
|
|
30
|
+
emails?: string[];
|
|
29
31
|
static attributes: Record<string, Attribute>;
|
|
30
32
|
constructor(props?: TimeSlotProperties);
|
|
31
33
|
}
|
package/lib/models/free-busy.js
CHANGED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import RestfulModelCollection from './restful-model-collection';
|
|
2
|
+
import JobStatus from './job-status';
|
|
3
|
+
import NylasConnection from '../nylas-connection';
|
|
4
|
+
export default class JobStatusRestfulModelCollection extends RestfulModelCollection<JobStatus> {
|
|
5
|
+
connection: NylasConnection;
|
|
6
|
+
modelClass: typeof JobStatus;
|
|
7
|
+
constructor(connection: NylasConnection);
|
|
8
|
+
protected createModel(json: Record<string, unknown>): JobStatus;
|
|
9
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __extends = (this && this.__extends) || (function () {
|
|
3
|
+
var extendStatics = function (d, b) {
|
|
4
|
+
extendStatics = Object.setPrototypeOf ||
|
|
5
|
+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
|
7
|
+
return extendStatics(d, b);
|
|
8
|
+
};
|
|
9
|
+
return function (d, b) {
|
|
10
|
+
extendStatics(d, b);
|
|
11
|
+
function __() { this.constructor = d; }
|
|
12
|
+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
|
+
};
|
|
14
|
+
})();
|
|
15
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
|
+
};
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
var restful_model_collection_1 = __importDefault(require("./restful-model-collection"));
|
|
20
|
+
var job_status_1 = __importDefault(require("./job-status"));
|
|
21
|
+
var outbox_job_status_1 = __importDefault(require("./outbox-job-status"));
|
|
22
|
+
var JobStatusRestfulModelCollection = /** @class */ (function (_super) {
|
|
23
|
+
__extends(JobStatusRestfulModelCollection, _super);
|
|
24
|
+
function JobStatusRestfulModelCollection(connection) {
|
|
25
|
+
var _this = _super.call(this, job_status_1.default, connection) || this;
|
|
26
|
+
_this.connection = connection;
|
|
27
|
+
_this.modelClass = job_status_1.default;
|
|
28
|
+
return _this;
|
|
29
|
+
}
|
|
30
|
+
JobStatusRestfulModelCollection.prototype.createModel = function (json) {
|
|
31
|
+
if (json['object'] && json['object'] === 'message') {
|
|
32
|
+
return new outbox_job_status_1.default(this.connection).fromJSON(json);
|
|
33
|
+
}
|
|
34
|
+
return new this.modelClass(this.connection).fromJSON(json);
|
|
35
|
+
};
|
|
36
|
+
return JobStatusRestfulModelCollection;
|
|
37
|
+
}(restful_model_collection_1.default));
|
|
38
|
+
exports.default = JobStatusRestfulModelCollection;
|
|
@@ -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
|
}
|
|
@@ -51,8 +51,30 @@ var MessageRestfulModelCollection = /** @class */ (function (_super) {
|
|
|
51
51
|
};
|
|
52
52
|
delete options.view;
|
|
53
53
|
}
|
|
54
|
+
// If only one message ID was passed in, use the normal find function
|
|
55
|
+
if (messageIds.length == 1) {
|
|
56
|
+
return this.find(messageIds[0], options).then(function (message) {
|
|
57
|
+
return [message];
|
|
58
|
+
});
|
|
59
|
+
}
|
|
54
60
|
return this.range(__assign({ path: this.path() + "/" + messageIds.join() }, options));
|
|
55
61
|
};
|
|
62
|
+
/**
|
|
63
|
+
* Return raw message contents
|
|
64
|
+
* @param messageId The message to fetch content of
|
|
65
|
+
* @returns The raw message contents
|
|
66
|
+
*/
|
|
67
|
+
MessageRestfulModelCollection.prototype.findRaw = function (messageId) {
|
|
68
|
+
return this.connection
|
|
69
|
+
.request({
|
|
70
|
+
method: 'GET',
|
|
71
|
+
headers: {
|
|
72
|
+
Accept: 'message/rfc822',
|
|
73
|
+
},
|
|
74
|
+
path: this.path() + "/" + messageId,
|
|
75
|
+
})
|
|
76
|
+
.catch(function (err) { return Promise.reject(err); });
|
|
77
|
+
};
|
|
56
78
|
return MessageRestfulModelCollection;
|
|
57
79
|
}(restful_model_collection_1.default));
|
|
58
80
|
exports.default = MessageRestfulModelCollection;
|
|
@@ -1,21 +1,20 @@
|
|
|
1
1
|
import OutboxMessage, { OutboxMessageProperties } from './outbox-message';
|
|
2
|
-
import Model from './model';
|
|
3
2
|
import { Attribute } from './attributes';
|
|
4
3
|
import NylasConnection from '../nylas-connection';
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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;
|
|
9
10
|
originalData?: OutboxMessageProperties;
|
|
10
11
|
};
|
|
11
|
-
export default class OutboxJobStatus extends
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
export default class OutboxJobStatus extends JobStatus implements OutboxJobStatusProperties {
|
|
13
|
+
messageId?: string;
|
|
14
|
+
threadId?: string;
|
|
15
|
+
sendAt?: Date;
|
|
16
|
+
originalSendAt?: Date;
|
|
15
17
|
originalData?: OutboxMessage;
|
|
16
|
-
private _connection?;
|
|
17
18
|
static attributes: Record<string, Attribute>;
|
|
18
|
-
constructor(props?: OutboxJobStatusProperties);
|
|
19
|
-
get connection(): NylasConnection | undefined;
|
|
20
|
-
fromJSON(json: Record<string, unknown>, connection?: NylasConnection): this;
|
|
19
|
+
constructor(connection: NylasConnection, props?: OutboxJobStatusProperties);
|
|
21
20
|
}
|
|
@@ -12,59 +12,53 @@ var __extends = (this && this.__extends) || (function () {
|
|
|
12
12
|
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
13
13
|
};
|
|
14
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
|
+
};
|
|
15
26
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
16
27
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
17
28
|
};
|
|
18
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
30
|
var outbox_message_1 = __importDefault(require("./outbox-message"));
|
|
20
|
-
var model_1 = __importDefault(require("./model"));
|
|
21
31
|
var attributes_1 = __importDefault(require("./attributes"));
|
|
32
|
+
var job_status_1 = __importDefault(require("./job-status"));
|
|
22
33
|
var OutboxJobStatus = /** @class */ (function (_super) {
|
|
23
34
|
__extends(OutboxJobStatus, _super);
|
|
24
|
-
function OutboxJobStatus(props) {
|
|
25
|
-
var _this = _super.call(this) || this;
|
|
26
|
-
_this.jobStatusId = '';
|
|
27
|
-
_this.status = '';
|
|
28
|
-
_this.accountId = '';
|
|
35
|
+
function OutboxJobStatus(connection, props) {
|
|
36
|
+
var _this = _super.call(this, connection, props) || this;
|
|
29
37
|
_this.initAttributes(props);
|
|
30
38
|
return _this;
|
|
31
39
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
OutboxJobStatus.prototype.fromJSON = function (json, connection) {
|
|
40
|
-
// Allow a connection object to be passed in to instantiate a Calendar sub object
|
|
41
|
-
if (connection) {
|
|
42
|
-
this._connection = connection;
|
|
43
|
-
}
|
|
44
|
-
return _super.prototype.fromJSON.call(this, json);
|
|
45
|
-
};
|
|
46
|
-
OutboxJobStatus.attributes = {
|
|
47
|
-
jobStatusId: attributes_1.default.String({
|
|
48
|
-
modelKey: 'jobStatusId',
|
|
49
|
-
jsonKey: 'job_status_id',
|
|
40
|
+
OutboxJobStatus.attributes = __assign(__assign({}, job_status_1.default.attributes), { messageId: attributes_1.default.String({
|
|
41
|
+
modelKey: 'messageId',
|
|
42
|
+
jsonKey: 'message_id',
|
|
43
|
+
readOnly: true,
|
|
44
|
+
}), threadId: attributes_1.default.String({
|
|
45
|
+
modelKey: 'threadId',
|
|
46
|
+
jsonKey: 'thread_id',
|
|
50
47
|
readOnly: true,
|
|
51
|
-
}),
|
|
52
|
-
|
|
53
|
-
|
|
48
|
+
}), sendAt: attributes_1.default.DateTime({
|
|
49
|
+
modelKey: 'sendAt',
|
|
50
|
+
jsonKey: 'send_at',
|
|
54
51
|
readOnly: true,
|
|
55
|
-
}),
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
jsonKey: 'account_id',
|
|
52
|
+
}), originalSendAt: attributes_1.default.DateTime({
|
|
53
|
+
modelKey: 'originalSendAt',
|
|
54
|
+
jsonKey: 'original_send_at',
|
|
59
55
|
readOnly: true,
|
|
60
|
-
}),
|
|
61
|
-
originalData: attributes_1.default.Object({
|
|
56
|
+
}), originalData: attributes_1.default.Object({
|
|
62
57
|
modelKey: 'originalData',
|
|
63
58
|
jsonKey: 'original_data',
|
|
64
59
|
itemClass: outbox_message_1.default,
|
|
65
60
|
readOnly: true,
|
|
66
|
-
})
|
|
67
|
-
};
|
|
61
|
+
}) });
|
|
68
62
|
return OutboxJobStatus;
|
|
69
|
-
}(
|
|
63
|
+
}(job_status_1.default));
|
|
70
64
|
exports.default = OutboxJobStatus;
|
package/lib/models/outbox.js
CHANGED
|
@@ -58,7 +58,7 @@ var Outbox = /** @class */ (function () {
|
|
|
58
58
|
body: body,
|
|
59
59
|
})
|
|
60
60
|
.then(function (json) {
|
|
61
|
-
var message = new outbox_job_status_1.default().fromJSON(json
|
|
61
|
+
var message = new outbox_job_status_1.default(_this.connection).fromJSON(json);
|
|
62
62
|
if (options.callback) {
|
|
63
63
|
options.callback(null, message);
|
|
64
64
|
}
|
|
@@ -85,7 +85,7 @@ var Outbox = /** @class */ (function () {
|
|
|
85
85
|
path: "/" + jobStatusId,
|
|
86
86
|
body: body,
|
|
87
87
|
}).then(function (json) {
|
|
88
|
-
var message = new outbox_job_status_1.default().fromJSON(json
|
|
88
|
+
var message = new outbox_job_status_1.default(_this.connection).fromJSON(json);
|
|
89
89
|
return Promise.resolve(message);
|
|
90
90
|
});
|
|
91
91
|
};
|
|
@@ -10,7 +10,6 @@ import Thread from './models/thread';
|
|
|
10
10
|
import Draft from './models/draft';
|
|
11
11
|
import File from './models/file';
|
|
12
12
|
import Event from './models/event';
|
|
13
|
-
import JobStatus from './models/job-status';
|
|
14
13
|
import Resource from './models/resource';
|
|
15
14
|
import Folder, { Label } from './models/folder';
|
|
16
15
|
import { AppendOptions } from 'form-data';
|
|
@@ -20,6 +19,7 @@ import SchedulerRestfulModelCollection from './models/scheduler-restful-model-co
|
|
|
20
19
|
import MessageRestfulModelCollection from './models/message-restful-model-collection';
|
|
21
20
|
import DeltaCollection from './models/delta-collection';
|
|
22
21
|
import Outbox from './models/outbox';
|
|
22
|
+
import JobStatusRestfulModelCollection from './models/job-status-restful-model-collection';
|
|
23
23
|
export declare enum AuthMethod {
|
|
24
24
|
BASIC = 0,
|
|
25
25
|
BEARER = 1
|
|
@@ -50,7 +50,7 @@ export default class NylasConnection {
|
|
|
50
50
|
drafts: RestfulModelCollection<Draft>;
|
|
51
51
|
files: RestfulModelCollection<File>;
|
|
52
52
|
calendars: CalendarRestfulModelCollection;
|
|
53
|
-
jobStatuses:
|
|
53
|
+
jobStatuses: JobStatusRestfulModelCollection;
|
|
54
54
|
events: RestfulModelCollection<Event>;
|
|
55
55
|
resources: RestfulModelCollection<Resource>;
|
|
56
56
|
deltas: DeltaCollection;
|
package/lib/nylas-connection.js
CHANGED
|
@@ -34,7 +34,6 @@ var thread_1 = __importDefault(require("./models/thread"));
|
|
|
34
34
|
var draft_1 = __importDefault(require("./models/draft"));
|
|
35
35
|
var file_1 = __importDefault(require("./models/file"));
|
|
36
36
|
var event_1 = __importDefault(require("./models/event"));
|
|
37
|
-
var job_status_1 = __importDefault(require("./models/job-status"));
|
|
38
37
|
var resource_1 = __importDefault(require("./models/resource"));
|
|
39
38
|
var folder_1 = __importStar(require("./models/folder"));
|
|
40
39
|
var form_data_1 = __importDefault(require("form-data"));
|
|
@@ -45,6 +44,7 @@ var scheduler_restful_model_collection_1 = __importDefault(require("./models/sch
|
|
|
45
44
|
var message_restful_model_collection_1 = __importDefault(require("./models/message-restful-model-collection"));
|
|
46
45
|
var delta_collection_1 = __importDefault(require("./models/delta-collection"));
|
|
47
46
|
var outbox_1 = __importDefault(require("./models/outbox"));
|
|
47
|
+
var job_status_restful_model_collection_1 = __importDefault(require("./models/job-status-restful-model-collection"));
|
|
48
48
|
var PACKAGE_JSON = require('../package.json');
|
|
49
49
|
var SDK_VERSION = PACKAGE_JSON.version;
|
|
50
50
|
var SUPPORTED_API_VERSION = '2.5';
|
|
@@ -62,7 +62,7 @@ var NylasConnection = /** @class */ (function () {
|
|
|
62
62
|
this.drafts = new restful_model_collection_1.default(draft_1.default, this);
|
|
63
63
|
this.files = new restful_model_collection_1.default(file_1.default, this);
|
|
64
64
|
this.calendars = new calendar_restful_model_collection_1.default(this);
|
|
65
|
-
this.jobStatuses = new
|
|
65
|
+
this.jobStatuses = new job_status_restful_model_collection_1.default(this);
|
|
66
66
|
this.events = new restful_model_collection_1.default(event_1.default, this);
|
|
67
67
|
this.resources = new restful_model_collection_1.default(resource_1.default, this);
|
|
68
68
|
this.deltas = new delta_collection_1.default(this);
|
|
@@ -193,7 +193,10 @@ var NylasConnection = /** @class */ (function () {
|
|
|
193
193
|
console.warn(warning);
|
|
194
194
|
}
|
|
195
195
|
if (response.status > 299) {
|
|
196
|
-
return response
|
|
196
|
+
return response
|
|
197
|
+
.clone()
|
|
198
|
+
.json()
|
|
199
|
+
.then(function (body) {
|
|
197
200
|
var error = new nylas_api_error_1.default(response.status, body.type, body.message);
|
|
198
201
|
if (body.missing_fields) {
|
|
199
202
|
error.missingFields = body.missing_fields;
|
|
@@ -202,6 +205,18 @@ var NylasConnection = /** @class */ (function () {
|
|
|
202
205
|
error.serverError = body.server_error;
|
|
203
206
|
}
|
|
204
207
|
return reject(error);
|
|
208
|
+
})
|
|
209
|
+
.catch(function () {
|
|
210
|
+
return response
|
|
211
|
+
.text()
|
|
212
|
+
.then(function (text) {
|
|
213
|
+
var error = new nylas_api_error_1.default(response.status, response.statusText, text);
|
|
214
|
+
return reject(error);
|
|
215
|
+
})
|
|
216
|
+
.catch(function () {
|
|
217
|
+
var error = new nylas_api_error_1.default(response.status, response.statusText, 'Error encountered during request, unable to extract error message.');
|
|
218
|
+
return reject(error);
|
|
219
|
+
});
|
|
205
220
|
});
|
|
206
221
|
}
|
|
207
222
|
else {
|
|
@@ -223,13 +238,18 @@ var NylasConnection = /** @class */ (function () {
|
|
|
223
238
|
}
|
|
224
239
|
else if (response.headers.get('content-length') &&
|
|
225
240
|
Number(response.headers.get('content-length')) == 0) {
|
|
226
|
-
return resolve();
|
|
241
|
+
return resolve(undefined);
|
|
227
242
|
}
|
|
228
243
|
else if (response.headers.get('Content-Type') === 'message/rfc822') {
|
|
229
244
|
return resolve(response.text());
|
|
230
245
|
}
|
|
231
246
|
else {
|
|
232
|
-
return
|
|
247
|
+
return response
|
|
248
|
+
.clone()
|
|
249
|
+
.json()
|
|
250
|
+
.catch(function () { return response.text(); })
|
|
251
|
+
.then(function (data) { return resolve(data); })
|
|
252
|
+
.catch(function () { return resolve(undefined); });
|
|
233
253
|
}
|
|
234
254
|
}
|
|
235
255
|
})
|
package/lib/nylas.d.ts
CHANGED
|
@@ -23,5 +23,10 @@ declare class Nylas {
|
|
|
23
23
|
static application(options?: ApplicationDetailsProperties): Promise<ApplicationDetails>;
|
|
24
24
|
static exchangeCodeForToken(code: string, callback?: (error: Error | null, accessToken?: string) => void): Promise<AccessToken>;
|
|
25
25
|
static urlForAuthentication(options: AuthenticateUrlConfig): string;
|
|
26
|
+
/**
|
|
27
|
+
* Revoke a single access token
|
|
28
|
+
* @param accessToken The access token to revoke
|
|
29
|
+
*/
|
|
30
|
+
static revoke(accessToken: string): Promise<void>;
|
|
26
31
|
}
|
|
27
32
|
export = Nylas;
|
package/lib/nylas.js
CHANGED
|
@@ -163,8 +163,23 @@ var Nylas = /** @class */ (function () {
|
|
|
163
163
|
if (options.provider != null) {
|
|
164
164
|
url += "&provider=" + options.provider;
|
|
165
165
|
}
|
|
166
|
+
if (options.redirectOnError) {
|
|
167
|
+
url += '&redirect_on_error=true';
|
|
168
|
+
}
|
|
166
169
|
return url;
|
|
167
170
|
};
|
|
171
|
+
/**
|
|
172
|
+
* Revoke a single access token
|
|
173
|
+
* @param accessToken The access token to revoke
|
|
174
|
+
*/
|
|
175
|
+
Nylas.revoke = function (accessToken) {
|
|
176
|
+
return Nylas.with(accessToken)
|
|
177
|
+
.request({
|
|
178
|
+
method: 'POST',
|
|
179
|
+
path: '/oauth/revoke',
|
|
180
|
+
})
|
|
181
|
+
.catch(function (err) { return Promise.reject(err); });
|
|
182
|
+
};
|
|
168
183
|
Nylas.clientId = '';
|
|
169
184
|
return Nylas;
|
|
170
185
|
}());
|