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.
- package/README.md +27 -19
- package/lib/cjs/apiClient.js +114 -0
- package/lib/cjs/config.js +32 -0
- package/lib/cjs/models/applicationDetails.js +2 -0
- package/lib/cjs/models/auth.js +2 -0
- package/lib/cjs/models/availability.js +11 -0
- package/lib/cjs/models/calendars.js +2 -0
- package/lib/cjs/models/error.js +53 -0
- package/lib/cjs/models/events.js +2 -0
- package/lib/cjs/models/grants.js +2 -0
- package/lib/cjs/models/listQueryParams.js +2 -0
- package/lib/cjs/models/redirectUri.js +2 -0
- package/lib/cjs/models/response.js +2 -0
- package/lib/cjs/models/webhooks.js +18 -0
- package/lib/cjs/nylas.js +34 -0
- package/lib/cjs/package.json +3 -0
- package/lib/cjs/resources/applications.js +30 -0
- package/lib/cjs/resources/auth.js +153 -0
- package/lib/cjs/resources/calendars.js +78 -0
- package/lib/cjs/resources/events.js +69 -0
- package/lib/cjs/resources/grants.js +65 -0
- package/lib/cjs/resources/redirectUris.js +64 -0
- package/lib/cjs/resources/resource.js +111 -0
- package/lib/cjs/resources/webhooks.js +98 -0
- package/lib/cjs/utils.js +58 -0
- package/lib/cjs/version.js +5 -0
- package/lib/esm/apiClient.js +111 -0
- package/lib/esm/config.js +29 -0
- package/lib/esm/models/applicationDetails.js +1 -0
- package/lib/esm/models/auth.js +1 -0
- package/lib/esm/models/availability.js +8 -0
- package/lib/esm/models/calendars.js +1 -0
- package/lib/esm/models/error.js +45 -0
- package/lib/esm/models/events.js +1 -0
- package/lib/esm/models/grants.js +1 -0
- package/lib/esm/models/listQueryParams.js +1 -0
- package/lib/esm/models/redirectUri.js +1 -0
- package/lib/esm/models/response.js +1 -0
- package/lib/esm/models/webhooks.js +15 -0
- package/lib/esm/nylas.js +31 -0
- package/lib/esm/package.json +3 -0
- package/lib/esm/resources/applications.js +26 -0
- package/lib/esm/resources/auth.js +149 -0
- package/lib/esm/resources/calendars.js +74 -0
- package/lib/esm/resources/events.js +65 -0
- package/lib/esm/resources/grants.js +61 -0
- package/lib/esm/resources/redirectUris.js +60 -0
- package/lib/esm/resources/resource.js +107 -0
- package/lib/esm/resources/webhooks.js +94 -0
- package/lib/esm/utils.js +53 -0
- package/lib/esm/version.js +2 -0
- package/lib/types/apiClient.d.ts +65 -0
- package/lib/types/config.d.ts +50 -0
- package/lib/types/models/applicationDetails.d.ts +93 -0
- package/lib/types/models/auth.d.ts +196 -0
- package/lib/types/models/availability.d.ts +159 -0
- package/lib/types/models/calendars.d.ts +121 -0
- package/lib/types/models/error.d.ts +104 -0
- package/lib/types/models/events.d.ts +494 -0
- package/lib/types/models/grants.d.ts +134 -0
- package/lib/types/models/listQueryParams.d.ts +4 -0
- package/lib/types/models/redirectUri.d.ts +71 -0
- package/lib/types/models/response.d.ts +40 -0
- package/lib/types/models/webhooks.d.ts +45 -0
- package/lib/types/nylas.d.ts +44 -0
- package/lib/types/resources/applications.d.ts +26 -0
- package/lib/types/resources/auth.d.ts +66 -0
- package/lib/types/resources/calendars.d.ts +97 -0
- package/lib/types/resources/events.d.ts +87 -0
- package/lib/types/resources/grants.d.ts +63 -0
- package/lib/types/resources/redirectUris.d.ts +63 -0
- package/lib/types/resources/resource.d.ts +55 -0
- package/lib/types/resources/webhooks.d.ts +79 -0
- package/lib/types/utils.d.ts +22 -0
- package/lib/types/version.d.ts +1 -0
- package/package.json +33 -42
- package/lib/config.d.ts +0 -70
- package/lib/config.js +0 -68
- package/lib/models/access-token.d.ts +0 -18
- package/lib/models/access-token.js +0 -56
- package/lib/models/account.d.ts +0 -27
- package/lib/models/account.js +0 -73
- package/lib/models/application-details.d.ts +0 -14
- package/lib/models/application-details.js +0 -47
- package/lib/models/attributes.d.ts +0 -151
- package/lib/models/attributes.js +0 -382
- package/lib/models/calendar-availability.d.ts +0 -76
- package/lib/models/calendar-availability.js +0 -121
- package/lib/models/calendar-restful-model-collection.d.ts +0 -17
- package/lib/models/calendar-restful-model-collection.js +0 -181
- package/lib/models/calendar.d.ts +0 -31
- package/lib/models/calendar.js +0 -93
- package/lib/models/component-restful-model-collection.d.ts +0 -9
- package/lib/models/component-restful-model-collection.js +0 -34
- package/lib/models/component.d.ts +0 -37
- package/lib/models/component.js +0 -91
- package/lib/models/connect.d.ts +0 -73
- package/lib/models/connect.js +0 -193
- package/lib/models/contact-restful-model-collection.d.ts +0 -9
- package/lib/models/contact-restful-model-collection.js +0 -60
- package/lib/models/contact.d.ts +0 -129
- package/lib/models/contact.js +0 -289
- package/lib/models/delta-collection.d.ts +0 -17
- package/lib/models/delta-collection.js +0 -139
- package/lib/models/delta-stream.d.ts +0 -32
- package/lib/models/delta-stream.js +0 -250
- package/lib/models/delta.d.ts +0 -28
- package/lib/models/delta.js +0 -88
- package/lib/models/deltas.d.ts +0 -17
- package/lib/models/deltas.js +0 -49
- package/lib/models/draft.d.ts +0 -27
- package/lib/models/draft.js +0 -156
- package/lib/models/email-participant.d.ts +0 -13
- package/lib/models/email-participant.js +0 -46
- package/lib/models/event-conferencing.d.ts +0 -34
- package/lib/models/event-conferencing.js +0 -71
- package/lib/models/event-notification.d.ts +0 -27
- package/lib/models/event-notification.js +0 -62
- package/lib/models/event-participant.d.ts +0 -19
- package/lib/models/event-participant.js +0 -56
- package/lib/models/event.d.ts +0 -96
- package/lib/models/event.js +0 -297
- package/lib/models/file.d.ts +0 -29
- package/lib/models/file.js +0 -136
- package/lib/models/folder.d.ts +0 -21
- package/lib/models/folder.js +0 -69
- package/lib/models/free-busy.d.ts +0 -58
- package/lib/models/free-busy.js +0 -132
- package/lib/models/job-status-restful-model-collection.d.ts +0 -9
- package/lib/models/job-status-restful-model-collection.js +0 -38
- package/lib/models/job-status.d.ts +0 -24
- package/lib/models/job-status.js +0 -68
- package/lib/models/management-account.d.ts +0 -63
- package/lib/models/management-account.js +0 -187
- package/lib/models/management-model-collection.d.ts +0 -10
- package/lib/models/management-model-collection.js +0 -39
- package/lib/models/management-model.d.ts +0 -6
- package/lib/models/management-model.js +0 -29
- package/lib/models/message-restful-model-collection.d.ts +0 -26
- package/lib/models/message-restful-model-collection.js +0 -80
- package/lib/models/message.d.ts +0 -57
- package/lib/models/message.js +0 -173
- package/lib/models/model-collection.d.ts +0 -25
- package/lib/models/model-collection.js +0 -201
- package/lib/models/model.d.ts +0 -12
- package/lib/models/model.js +0 -64
- package/lib/models/neural-categorizer.d.ts +0 -28
- package/lib/models/neural-categorizer.js +0 -139
- package/lib/models/neural-clean-conversation.d.ts +0 -16
- package/lib/models/neural-clean-conversation.js +0 -114
- package/lib/models/neural-ocr.d.ts +0 -14
- package/lib/models/neural-ocr.js +0 -50
- package/lib/models/neural-sentiment-analysis.d.ts +0 -20
- package/lib/models/neural-sentiment-analysis.js +0 -56
- package/lib/models/neural-signature-contact.d.ts +0 -43
- package/lib/models/neural-signature-contact.js +0 -142
- package/lib/models/neural-signature-extraction.d.ts +0 -17
- package/lib/models/neural-signature-extraction.js +0 -54
- package/lib/models/neural.d.ts +0 -36
- package/lib/models/neural.js +0 -163
- package/lib/models/nylas-api-error.d.ts +0 -26
- package/lib/models/nylas-api-error.js +0 -61
- package/lib/models/outbox-job-status.d.ts +0 -20
- package/lib/models/outbox-job-status.js +0 -64
- package/lib/models/outbox-message.d.ts +0 -16
- package/lib/models/outbox-message.js +0 -54
- package/lib/models/outbox.d.ts +0 -35
- package/lib/models/outbox.js +0 -158
- package/lib/models/resource.d.ts +0 -22
- package/lib/models/resource.js +0 -66
- package/lib/models/restful-model-collection.d.ts +0 -15
- package/lib/models/restful-model-collection.js +0 -169
- package/lib/models/restful-model-instance.d.ts +0 -9
- package/lib/models/restful-model-instance.js +0 -37
- package/lib/models/restful-model.d.ts +0 -36
- package/lib/models/restful-model.js +0 -146
- package/lib/models/scheduler-booking-request.d.ts +0 -64
- package/lib/models/scheduler-booking-request.js +0 -148
- package/lib/models/scheduler-restful-model-collection.d.ts +0 -26
- package/lib/models/scheduler-restful-model-collection.js +0 -133
- package/lib/models/scheduler-time-slot.d.ts +0 -20
- package/lib/models/scheduler-time-slot.js +0 -53
- package/lib/models/scheduler.d.ts +0 -226
- package/lib/models/scheduler.js +0 -446
- package/lib/models/thread.d.ts +0 -49
- package/lib/models/thread.js +0 -127
- package/lib/models/webhook-notification.d.ts +0 -108
- package/lib/models/webhook-notification.js +0 -239
- package/lib/models/webhook.d.ts +0 -50
- package/lib/models/webhook.js +0 -101
- package/lib/models/when.d.ts +0 -23
- package/lib/models/when.js +0 -65
- package/lib/nylas-connection.d.ts +0 -71
- package/lib/nylas-connection.js +0 -258
- package/lib/nylas.d.ts +0 -57
- package/lib/nylas.js +0 -210
- package/lib/server-bindings/express-binding.d.ts +0 -18
- package/lib/server-bindings/express-binding.js +0 -163
- package/lib/server-bindings/server-binding.d.ts +0 -65
- package/lib/server-bindings/server-binding.js +0 -87
- package/lib/services/routes.d.ts +0 -26
- package/lib/services/routes.js +0 -95
- package/lib/services/tunnel.d.ts +0 -29
- package/lib/services/tunnel.js +0 -112
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attributes';
|
|
2
|
-
import NylasConnection from '../nylas-connection';
|
|
3
|
-
import Model from './model';
|
|
4
|
-
export declare type SaveCallback = (error: Error | null, result?: RestfulModel) => void;
|
|
5
|
-
interface RestfulModelJSON {
|
|
6
|
-
id: string;
|
|
7
|
-
object: string;
|
|
8
|
-
accountId: string;
|
|
9
|
-
[key: string]: any;
|
|
10
|
-
}
|
|
11
|
-
declare type requestOptions = {
|
|
12
|
-
body: Record<string, unknown>;
|
|
13
|
-
qs: Record<string, unknown>;
|
|
14
|
-
};
|
|
15
|
-
export default class RestfulModel extends Model {
|
|
16
|
-
static endpointName: string;
|
|
17
|
-
static collectionName: string;
|
|
18
|
-
accountId?: string;
|
|
19
|
-
connection: NylasConnection;
|
|
20
|
-
id?: string;
|
|
21
|
-
object?: string;
|
|
22
|
-
baseUrl?: string;
|
|
23
|
-
static attributes: Record<string, Attribute>;
|
|
24
|
-
constructor(connection: NylasConnection, props?: Partial<RestfulModelJSON>);
|
|
25
|
-
static propsFromJSON(json: Partial<RestfulModelJSON> | undefined, parent: unknown): Partial<RestfulModelJSON>;
|
|
26
|
-
isEqual(other: RestfulModel): boolean;
|
|
27
|
-
fromJSON(json?: Partial<RestfulModelJSON>): this;
|
|
28
|
-
pathPrefix(): string;
|
|
29
|
-
saveEndpoint(): string;
|
|
30
|
-
deleteRequestQueryString(_params: Record<string, unknown>): Record<string, unknown>;
|
|
31
|
-
deleteRequestBody(_params: Record<string, unknown>): Record<string, unknown>;
|
|
32
|
-
deleteRequestOptions(params: Record<string, unknown>): requestOptions;
|
|
33
|
-
protected save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
|
|
34
|
-
protected get(params?: Record<string, any>, callback?: (error: Error | null, result?: any) => void, pathSuffix?: string): Promise<any>;
|
|
35
|
-
}
|
|
36
|
-
export {};
|
|
@@ -1,146 +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 model_1 = __importDefault(require("./model"));
|
|
21
|
-
var RestfulModel = /** @class */ (function (_super) {
|
|
22
|
-
__extends(RestfulModel, _super);
|
|
23
|
-
function RestfulModel(connection, props) {
|
|
24
|
-
var _this = _super.call(this) || this;
|
|
25
|
-
_this.connection = connection;
|
|
26
|
-
if (!_this.connection) {
|
|
27
|
-
throw new Error('Connection object not provided');
|
|
28
|
-
}
|
|
29
|
-
_this.id = (props === null || props === void 0 ? void 0 : props.id) ? props.id : undefined;
|
|
30
|
-
_this.accountId = (props === null || props === void 0 ? void 0 : props.accountId) ? props.accountId : undefined;
|
|
31
|
-
_this.object = (props === null || props === void 0 ? void 0 : props.object) ? props.object : undefined;
|
|
32
|
-
return _this;
|
|
33
|
-
}
|
|
34
|
-
RestfulModel.propsFromJSON = function (json, parent) {
|
|
35
|
-
if (json === void 0) { json = {}; }
|
|
36
|
-
return _super.propsFromJSON.call(this, json, parent);
|
|
37
|
-
};
|
|
38
|
-
RestfulModel.prototype.isEqual = function (other) {
|
|
39
|
-
return ((other ? other.id : undefined) === this.id &&
|
|
40
|
-
(other ? other.constructor : undefined) === this.constructor);
|
|
41
|
-
};
|
|
42
|
-
RestfulModel.prototype.fromJSON = function (json) {
|
|
43
|
-
if (json === void 0) { json = {}; }
|
|
44
|
-
return _super.prototype.fromJSON.call(this, json);
|
|
45
|
-
};
|
|
46
|
-
// Subclasses should override this method.
|
|
47
|
-
RestfulModel.prototype.pathPrefix = function () {
|
|
48
|
-
return '';
|
|
49
|
-
};
|
|
50
|
-
RestfulModel.prototype.saveEndpoint = function () {
|
|
51
|
-
var collectionName = this.constructor.collectionName;
|
|
52
|
-
return this.pathPrefix() + "/" + collectionName;
|
|
53
|
-
};
|
|
54
|
-
// deleteRequestQueryString is used by delete(). Subclasses should override this method.
|
|
55
|
-
RestfulModel.prototype.deleteRequestQueryString = function (_params) {
|
|
56
|
-
return {};
|
|
57
|
-
};
|
|
58
|
-
// deleteRequestBody is used by delete(). Subclasses should override this method.
|
|
59
|
-
RestfulModel.prototype.deleteRequestBody = function (_params) {
|
|
60
|
-
return {};
|
|
61
|
-
};
|
|
62
|
-
// deleteRequestOptions is used by delete(). Subclasses should override this method.
|
|
63
|
-
RestfulModel.prototype.deleteRequestOptions = function (params) {
|
|
64
|
-
return {
|
|
65
|
-
body: this.deleteRequestBody(params),
|
|
66
|
-
qs: this.deleteRequestQueryString(params),
|
|
67
|
-
};
|
|
68
|
-
};
|
|
69
|
-
// Not every model needs to have a save function, but those who
|
|
70
|
-
// do shouldn't have to reimplement the same boilerplate.
|
|
71
|
-
// They should instead define a save() function which calls _save.
|
|
72
|
-
RestfulModel.prototype.save = function (params, callback) {
|
|
73
|
-
var _this = this;
|
|
74
|
-
if (params === void 0) { params = {}; }
|
|
75
|
-
if (typeof params === 'function') {
|
|
76
|
-
callback = params;
|
|
77
|
-
params = {};
|
|
78
|
-
}
|
|
79
|
-
return this.connection
|
|
80
|
-
.request({
|
|
81
|
-
method: this.id ? 'PUT' : 'POST',
|
|
82
|
-
body: this.saveRequestBody(),
|
|
83
|
-
qs: params,
|
|
84
|
-
path: this.id
|
|
85
|
-
? this.saveEndpoint() + "/" + this.id
|
|
86
|
-
: "" + this.saveEndpoint(),
|
|
87
|
-
baseUrl: this.baseUrl,
|
|
88
|
-
})
|
|
89
|
-
.then(function (json) {
|
|
90
|
-
var newModel = _this.fromJSON(json);
|
|
91
|
-
if (callback) {
|
|
92
|
-
callback(null, _this);
|
|
93
|
-
}
|
|
94
|
-
return Promise.resolve(newModel);
|
|
95
|
-
})
|
|
96
|
-
.catch(function (err) {
|
|
97
|
-
if (callback) {
|
|
98
|
-
callback(err);
|
|
99
|
-
}
|
|
100
|
-
return Promise.reject(err);
|
|
101
|
-
});
|
|
102
|
-
};
|
|
103
|
-
RestfulModel.prototype.get = function (params, callback, pathSuffix) {
|
|
104
|
-
if (params === void 0) { params = {}; }
|
|
105
|
-
if (pathSuffix === void 0) { pathSuffix = ''; }
|
|
106
|
-
var collectionName = this.constructor.collectionName;
|
|
107
|
-
return this.connection
|
|
108
|
-
.request({
|
|
109
|
-
method: 'GET',
|
|
110
|
-
path: "/" + collectionName + "/" + this.id + pathSuffix,
|
|
111
|
-
qs: params,
|
|
112
|
-
baseUrl: this.baseUrl,
|
|
113
|
-
})
|
|
114
|
-
.then(function (response) {
|
|
115
|
-
if (callback) {
|
|
116
|
-
callback(null, response);
|
|
117
|
-
}
|
|
118
|
-
return Promise.resolve(response);
|
|
119
|
-
})
|
|
120
|
-
.catch(function (err) {
|
|
121
|
-
if (callback) {
|
|
122
|
-
callback(err);
|
|
123
|
-
}
|
|
124
|
-
return Promise.reject(err);
|
|
125
|
-
});
|
|
126
|
-
};
|
|
127
|
-
RestfulModel.endpointName = ''; // overrridden in subclasses
|
|
128
|
-
RestfulModel.collectionName = ''; // overrridden in subclasses
|
|
129
|
-
RestfulModel.attributes = {
|
|
130
|
-
id: attributes_1.default.String({
|
|
131
|
-
modelKey: 'id',
|
|
132
|
-
readOnly: true,
|
|
133
|
-
}),
|
|
134
|
-
object: attributes_1.default.String({
|
|
135
|
-
modelKey: 'object',
|
|
136
|
-
readOnly: true,
|
|
137
|
-
}),
|
|
138
|
-
accountId: attributes_1.default.String({
|
|
139
|
-
modelKey: 'accountId',
|
|
140
|
-
jsonKey: 'account_id',
|
|
141
|
-
readOnly: true,
|
|
142
|
-
}),
|
|
143
|
-
};
|
|
144
|
-
return RestfulModel;
|
|
145
|
-
}(model_1.default));
|
|
146
|
-
exports.default = RestfulModel;
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attributes';
|
|
2
|
-
import SchedulerTimeSlot from './scheduler-time-slot';
|
|
3
|
-
import Model from './model';
|
|
4
|
-
export declare type SchedulerBookingConfirmationProperties = {
|
|
5
|
-
id?: string;
|
|
6
|
-
accountId?: string;
|
|
7
|
-
additionalFieldValues?: object;
|
|
8
|
-
calendarEventId?: string;
|
|
9
|
-
calendarId?: string;
|
|
10
|
-
editHash?: string;
|
|
11
|
-
startTime?: Date;
|
|
12
|
-
endTime?: Date;
|
|
13
|
-
isConfirmed?: boolean;
|
|
14
|
-
location?: string;
|
|
15
|
-
recipientEmail?: string;
|
|
16
|
-
recipientLocale?: string;
|
|
17
|
-
recipientName?: string;
|
|
18
|
-
recipientTz?: string;
|
|
19
|
-
title?: string;
|
|
20
|
-
};
|
|
21
|
-
export declare class SchedulerBookingConfirmation extends Model implements SchedulerBookingConfirmationProperties {
|
|
22
|
-
id?: string;
|
|
23
|
-
accountId?: string;
|
|
24
|
-
additionalFieldValues?: object;
|
|
25
|
-
calendarEventId?: string;
|
|
26
|
-
calendarId?: string;
|
|
27
|
-
editHash?: string;
|
|
28
|
-
startTime?: Date;
|
|
29
|
-
endTime?: Date;
|
|
30
|
-
isConfirmed?: boolean;
|
|
31
|
-
location?: string;
|
|
32
|
-
recipientEmail?: string;
|
|
33
|
-
recipientLocale?: string;
|
|
34
|
-
recipientName?: string;
|
|
35
|
-
recipientTz?: string;
|
|
36
|
-
title?: string;
|
|
37
|
-
static attributes: Record<string, Attribute>;
|
|
38
|
-
constructor(props?: SchedulerBookingConfirmationProperties);
|
|
39
|
-
}
|
|
40
|
-
export declare type SchedulerBookingRequestProperties = {
|
|
41
|
-
additionalEmails?: string[];
|
|
42
|
-
additionalValues?: object;
|
|
43
|
-
email?: string;
|
|
44
|
-
locale?: string;
|
|
45
|
-
name?: string;
|
|
46
|
-
pageHostname?: string;
|
|
47
|
-
replacesBookingHash?: string;
|
|
48
|
-
slot?: SchedulerTimeSlot;
|
|
49
|
-
timezone?: string;
|
|
50
|
-
};
|
|
51
|
-
export default class SchedulerBookingRequest extends Model implements SchedulerBookingRequestProperties {
|
|
52
|
-
additionalEmails?: string[];
|
|
53
|
-
additionalValues?: object;
|
|
54
|
-
email?: string;
|
|
55
|
-
locale?: string;
|
|
56
|
-
name?: string;
|
|
57
|
-
pageHostname?: string;
|
|
58
|
-
replacesBookingHash?: string;
|
|
59
|
-
slot?: SchedulerTimeSlot;
|
|
60
|
-
timezone?: string;
|
|
61
|
-
static attributes: Record<string, Attribute>;
|
|
62
|
-
constructor(props?: SchedulerBookingRequestProperties);
|
|
63
|
-
toJSON(enforceReadOnly?: boolean): Record<string, any>;
|
|
64
|
-
}
|
|
@@ -1,148 +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 scheduler_time_slot_1 = __importDefault(require("./scheduler-time-slot"));
|
|
21
|
-
var model_1 = __importDefault(require("./model"));
|
|
22
|
-
var SchedulerBookingConfirmation = /** @class */ (function (_super) {
|
|
23
|
-
__extends(SchedulerBookingConfirmation, _super);
|
|
24
|
-
function SchedulerBookingConfirmation(props) {
|
|
25
|
-
var _this = _super.call(this) || this;
|
|
26
|
-
_this.initAttributes(props);
|
|
27
|
-
return _this;
|
|
28
|
-
}
|
|
29
|
-
SchedulerBookingConfirmation.attributes = {
|
|
30
|
-
id: attributes_1.default.Number({
|
|
31
|
-
modelKey: 'id',
|
|
32
|
-
}),
|
|
33
|
-
accountId: attributes_1.default.String({
|
|
34
|
-
modelKey: 'accountId',
|
|
35
|
-
jsonKey: 'account_id',
|
|
36
|
-
}),
|
|
37
|
-
additionalFieldValues: attributes_1.default.Object({
|
|
38
|
-
modelKey: 'additionalFieldValues',
|
|
39
|
-
jsonKey: 'additional_field_values',
|
|
40
|
-
}),
|
|
41
|
-
calendarEventId: attributes_1.default.String({
|
|
42
|
-
modelKey: 'calendarEventId',
|
|
43
|
-
jsonKey: 'calendar_event_id',
|
|
44
|
-
}),
|
|
45
|
-
calendarId: attributes_1.default.String({
|
|
46
|
-
modelKey: 'calendarId',
|
|
47
|
-
jsonKey: 'calendar_id',
|
|
48
|
-
}),
|
|
49
|
-
editHash: attributes_1.default.String({
|
|
50
|
-
modelKey: 'editHash',
|
|
51
|
-
jsonKey: 'edit_hash',
|
|
52
|
-
}),
|
|
53
|
-
startTime: attributes_1.default.DateTime({
|
|
54
|
-
modelKey: 'startTime',
|
|
55
|
-
jsonKey: 'start_time',
|
|
56
|
-
}),
|
|
57
|
-
endTime: attributes_1.default.DateTime({
|
|
58
|
-
modelKey: 'endTime',
|
|
59
|
-
jsonKey: 'end_time',
|
|
60
|
-
}),
|
|
61
|
-
isConfirmed: attributes_1.default.Boolean({
|
|
62
|
-
modelKey: 'isConfirmed',
|
|
63
|
-
jsonKey: 'is_confirmed',
|
|
64
|
-
}),
|
|
65
|
-
location: attributes_1.default.String({
|
|
66
|
-
modelKey: 'location',
|
|
67
|
-
}),
|
|
68
|
-
recipientEmail: attributes_1.default.String({
|
|
69
|
-
modelKey: 'recipientEmail',
|
|
70
|
-
jsonKey: 'recipient_email',
|
|
71
|
-
}),
|
|
72
|
-
recipientLocale: attributes_1.default.String({
|
|
73
|
-
modelKey: 'recipientLocale',
|
|
74
|
-
jsonKey: 'recipient_locale',
|
|
75
|
-
}),
|
|
76
|
-
recipientName: attributes_1.default.String({
|
|
77
|
-
modelKey: 'recipientName',
|
|
78
|
-
jsonKey: 'recipient_name',
|
|
79
|
-
}),
|
|
80
|
-
recipientTz: attributes_1.default.String({
|
|
81
|
-
modelKey: 'recipientTz',
|
|
82
|
-
jsonKey: 'recipient_tz',
|
|
83
|
-
}),
|
|
84
|
-
title: attributes_1.default.String({
|
|
85
|
-
modelKey: 'title',
|
|
86
|
-
}),
|
|
87
|
-
};
|
|
88
|
-
return SchedulerBookingConfirmation;
|
|
89
|
-
}(model_1.default));
|
|
90
|
-
exports.SchedulerBookingConfirmation = SchedulerBookingConfirmation;
|
|
91
|
-
var SchedulerBookingRequest = /** @class */ (function (_super) {
|
|
92
|
-
__extends(SchedulerBookingRequest, _super);
|
|
93
|
-
function SchedulerBookingRequest(props) {
|
|
94
|
-
var _this = _super.call(this) || this;
|
|
95
|
-
_this.initAttributes(props);
|
|
96
|
-
return _this;
|
|
97
|
-
}
|
|
98
|
-
/*
|
|
99
|
-
* The booking endpoint requires additional_values and additional_emails
|
|
100
|
-
to exist regardless if they are empty or not
|
|
101
|
-
*/
|
|
102
|
-
SchedulerBookingRequest.prototype.toJSON = function (enforceReadOnly) {
|
|
103
|
-
var json = _super.prototype.toJSON.call(this, enforceReadOnly);
|
|
104
|
-
if (!this.additionalEmails) {
|
|
105
|
-
json['additional_emails'] = [];
|
|
106
|
-
}
|
|
107
|
-
if (!this.additionalValues) {
|
|
108
|
-
json['additional_values'] = {};
|
|
109
|
-
}
|
|
110
|
-
return json;
|
|
111
|
-
};
|
|
112
|
-
SchedulerBookingRequest.attributes = {
|
|
113
|
-
additionalEmails: attributes_1.default.StringList({
|
|
114
|
-
modelKey: 'additionalEmails',
|
|
115
|
-
jsonKey: 'additional_emails',
|
|
116
|
-
}),
|
|
117
|
-
additionalValues: attributes_1.default.Object({
|
|
118
|
-
modelKey: 'additionalValues',
|
|
119
|
-
jsonKey: 'additional_values',
|
|
120
|
-
}),
|
|
121
|
-
email: attributes_1.default.String({
|
|
122
|
-
modelKey: 'email',
|
|
123
|
-
}),
|
|
124
|
-
locale: attributes_1.default.String({
|
|
125
|
-
modelKey: 'locale',
|
|
126
|
-
}),
|
|
127
|
-
name: attributes_1.default.String({
|
|
128
|
-
modelKey: 'name',
|
|
129
|
-
}),
|
|
130
|
-
pageHostname: attributes_1.default.String({
|
|
131
|
-
modelKey: 'pageHostname',
|
|
132
|
-
jsonKey: 'page_hostname',
|
|
133
|
-
}),
|
|
134
|
-
replacesBookingHash: attributes_1.default.String({
|
|
135
|
-
modelKey: 'replacesBookingHash',
|
|
136
|
-
jsonKey: 'replaces_booking_hash',
|
|
137
|
-
}),
|
|
138
|
-
slot: attributes_1.default.Object({
|
|
139
|
-
modelKey: 'slot',
|
|
140
|
-
itemClass: scheduler_time_slot_1.default,
|
|
141
|
-
}),
|
|
142
|
-
timezone: attributes_1.default.String({
|
|
143
|
-
modelKey: 'timezone',
|
|
144
|
-
}),
|
|
145
|
-
};
|
|
146
|
-
return SchedulerBookingRequest;
|
|
147
|
-
}(model_1.default));
|
|
148
|
-
exports.default = SchedulerBookingRequest;
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import RestfulModelCollection from './restful-model-collection';
|
|
2
|
-
import NylasConnection from '../nylas-connection';
|
|
3
|
-
import Scheduler from './scheduler';
|
|
4
|
-
import SchedulerTimeSlot from './scheduler-time-slot';
|
|
5
|
-
import SchedulerBookingRequest, { SchedulerBookingConfirmation } from './scheduler-booking-request';
|
|
6
|
-
export declare type ProviderAvailability = {
|
|
7
|
-
busy: [{
|
|
8
|
-
end: number;
|
|
9
|
-
start: number;
|
|
10
|
-
}];
|
|
11
|
-
email: string;
|
|
12
|
-
name: string;
|
|
13
|
-
};
|
|
14
|
-
export default class SchedulerRestfulModelCollection extends RestfulModelCollection<Scheduler> {
|
|
15
|
-
connection: NylasConnection;
|
|
16
|
-
modelClass: typeof Scheduler;
|
|
17
|
-
baseUrl: string;
|
|
18
|
-
constructor(connection: NylasConnection);
|
|
19
|
-
getGoogleAvailability(): Promise<ProviderAvailability>;
|
|
20
|
-
getOffice365Availability(): Promise<ProviderAvailability>;
|
|
21
|
-
getPageBySlug(slug: string): Promise<Scheduler>;
|
|
22
|
-
getAvailableTimeSlots(slug: string): Promise<SchedulerTimeSlot[]>;
|
|
23
|
-
bookTimeSlot(slug: string, bookingRequest: SchedulerBookingRequest): Promise<SchedulerBookingConfirmation>;
|
|
24
|
-
cancelBooking(slug: string, editHash: string, reason: string): Record<string, any>;
|
|
25
|
-
confirmBooking(slug: string, editHash: string): Promise<SchedulerBookingConfirmation>;
|
|
26
|
-
}
|
|
@@ -1,133 +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 restful_model_collection_1 = __importDefault(require("./restful-model-collection"));
|
|
20
|
-
var scheduler_1 = __importDefault(require("./scheduler"));
|
|
21
|
-
var scheduler_time_slot_1 = __importDefault(require("./scheduler-time-slot"));
|
|
22
|
-
var scheduler_booking_request_1 = require("./scheduler-booking-request");
|
|
23
|
-
var SchedulerRestfulModelCollection = /** @class */ (function (_super) {
|
|
24
|
-
__extends(SchedulerRestfulModelCollection, _super);
|
|
25
|
-
function SchedulerRestfulModelCollection(connection) {
|
|
26
|
-
var _this = _super.call(this, scheduler_1.default, connection) || this;
|
|
27
|
-
_this.baseUrl = 'https://api.schedule.nylas.com';
|
|
28
|
-
_this.connection = connection;
|
|
29
|
-
_this.modelClass = scheduler_1.default;
|
|
30
|
-
return _this;
|
|
31
|
-
}
|
|
32
|
-
SchedulerRestfulModelCollection.prototype.getGoogleAvailability = function () {
|
|
33
|
-
return this.connection.request({
|
|
34
|
-
method: 'GET',
|
|
35
|
-
path: '/schedule/availability/google',
|
|
36
|
-
headers: {
|
|
37
|
-
'Content-Type': 'application/json',
|
|
38
|
-
},
|
|
39
|
-
baseUrl: this.baseUrl,
|
|
40
|
-
});
|
|
41
|
-
};
|
|
42
|
-
SchedulerRestfulModelCollection.prototype.getOffice365Availability = function () {
|
|
43
|
-
return this.connection.request({
|
|
44
|
-
method: 'GET',
|
|
45
|
-
path: '/schedule/availability/o365',
|
|
46
|
-
headers: {
|
|
47
|
-
'Content-Type': 'application/json',
|
|
48
|
-
},
|
|
49
|
-
baseUrl: this.baseUrl,
|
|
50
|
-
});
|
|
51
|
-
};
|
|
52
|
-
SchedulerRestfulModelCollection.prototype.getPageBySlug = function (slug) {
|
|
53
|
-
var _this = this;
|
|
54
|
-
return this.connection
|
|
55
|
-
.request({
|
|
56
|
-
method: 'GET',
|
|
57
|
-
path: "/schedule/" + slug + "/info",
|
|
58
|
-
headers: {
|
|
59
|
-
'Content-Type': 'application/json',
|
|
60
|
-
},
|
|
61
|
-
baseUrl: this.baseUrl,
|
|
62
|
-
})
|
|
63
|
-
.then(function (json) {
|
|
64
|
-
return Promise.resolve(new scheduler_1.default(_this.connection).fromJSON(json));
|
|
65
|
-
});
|
|
66
|
-
};
|
|
67
|
-
SchedulerRestfulModelCollection.prototype.getAvailableTimeSlots = function (slug) {
|
|
68
|
-
return this.connection
|
|
69
|
-
.request({
|
|
70
|
-
method: 'GET',
|
|
71
|
-
path: "/schedule/" + slug + "/timeslots",
|
|
72
|
-
headers: {
|
|
73
|
-
'Content-Type': 'application/json',
|
|
74
|
-
},
|
|
75
|
-
baseUrl: this.baseUrl,
|
|
76
|
-
})
|
|
77
|
-
.then(function (json) {
|
|
78
|
-
var timeslots = json.map(function (timeslot) {
|
|
79
|
-
return new scheduler_time_slot_1.default().fromJSON(timeslot);
|
|
80
|
-
});
|
|
81
|
-
return Promise.resolve(timeslots);
|
|
82
|
-
});
|
|
83
|
-
};
|
|
84
|
-
SchedulerRestfulModelCollection.prototype.bookTimeSlot = function (slug, bookingRequest) {
|
|
85
|
-
return this.connection
|
|
86
|
-
.request({
|
|
87
|
-
method: 'POST',
|
|
88
|
-
path: "/schedule/" + slug + "/timeslots",
|
|
89
|
-
headers: {
|
|
90
|
-
'Content-Type': 'application/json',
|
|
91
|
-
},
|
|
92
|
-
body: bookingRequest.toJSON(),
|
|
93
|
-
baseUrl: this.baseUrl,
|
|
94
|
-
})
|
|
95
|
-
.then(function (json) {
|
|
96
|
-
return Promise.resolve(new scheduler_booking_request_1.SchedulerBookingConfirmation().fromJSON(json));
|
|
97
|
-
});
|
|
98
|
-
};
|
|
99
|
-
SchedulerRestfulModelCollection.prototype.cancelBooking = function (slug, editHash, reason) {
|
|
100
|
-
return this.connection
|
|
101
|
-
.request({
|
|
102
|
-
method: 'POST',
|
|
103
|
-
path: "/schedule/" + slug + "/" + editHash + "/cancel",
|
|
104
|
-
headers: {
|
|
105
|
-
'Content-Type': 'application/json',
|
|
106
|
-
},
|
|
107
|
-
body: {
|
|
108
|
-
reason: reason,
|
|
109
|
-
},
|
|
110
|
-
baseUrl: this.baseUrl,
|
|
111
|
-
})
|
|
112
|
-
.then(function (json) {
|
|
113
|
-
return Promise.resolve(json);
|
|
114
|
-
});
|
|
115
|
-
};
|
|
116
|
-
SchedulerRestfulModelCollection.prototype.confirmBooking = function (slug, editHash) {
|
|
117
|
-
return this.connection
|
|
118
|
-
.request({
|
|
119
|
-
method: 'POST',
|
|
120
|
-
path: "/schedule/" + slug + "/" + editHash + "/confirm",
|
|
121
|
-
headers: {
|
|
122
|
-
'Content-Type': 'application/json',
|
|
123
|
-
},
|
|
124
|
-
body: {},
|
|
125
|
-
baseUrl: this.baseUrl,
|
|
126
|
-
})
|
|
127
|
-
.then(function (json) {
|
|
128
|
-
return Promise.resolve(new scheduler_booking_request_1.SchedulerBookingConfirmation().fromJSON(json));
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
return SchedulerRestfulModelCollection;
|
|
132
|
-
}(restful_model_collection_1.default));
|
|
133
|
-
exports.default = SchedulerRestfulModelCollection;
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { Attribute } from './attributes';
|
|
2
|
-
import Model from './model';
|
|
3
|
-
export declare type SchedulerTimeSlotProperties = {
|
|
4
|
-
accountId?: string;
|
|
5
|
-
calendarId?: string;
|
|
6
|
-
hostName?: string;
|
|
7
|
-
emails?: string[];
|
|
8
|
-
start?: Date;
|
|
9
|
-
end?: Date;
|
|
10
|
-
};
|
|
11
|
-
export default class SchedulerTimeSlot extends Model implements SchedulerTimeSlotProperties {
|
|
12
|
-
accountId?: string;
|
|
13
|
-
calendarId?: string;
|
|
14
|
-
hostName?: string;
|
|
15
|
-
emails?: string[];
|
|
16
|
-
start?: Date;
|
|
17
|
-
end?: Date;
|
|
18
|
-
static attributes: Record<string, Attribute>;
|
|
19
|
-
constructor(props?: SchedulerTimeSlotProperties);
|
|
20
|
-
}
|
|
@@ -1,53 +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 model_1 = __importDefault(require("./model"));
|
|
21
|
-
var SchedulerTimeSlot = /** @class */ (function (_super) {
|
|
22
|
-
__extends(SchedulerTimeSlot, _super);
|
|
23
|
-
function SchedulerTimeSlot(props) {
|
|
24
|
-
var _this = _super.call(this) || this;
|
|
25
|
-
_this.initAttributes(props);
|
|
26
|
-
return _this;
|
|
27
|
-
}
|
|
28
|
-
SchedulerTimeSlot.attributes = {
|
|
29
|
-
accountId: attributes_1.default.String({
|
|
30
|
-
modelKey: 'accountId',
|
|
31
|
-
jsonKey: 'account_id',
|
|
32
|
-
}),
|
|
33
|
-
calendarId: attributes_1.default.String({
|
|
34
|
-
modelKey: 'calendarId',
|
|
35
|
-
jsonKey: 'calendar_id',
|
|
36
|
-
}),
|
|
37
|
-
hostName: attributes_1.default.String({
|
|
38
|
-
modelKey: 'hostName',
|
|
39
|
-
jsonKey: 'host_name',
|
|
40
|
-
}),
|
|
41
|
-
emails: attributes_1.default.StringList({
|
|
42
|
-
modelKey: 'emails',
|
|
43
|
-
}),
|
|
44
|
-
start: attributes_1.default.DateTime({
|
|
45
|
-
modelKey: 'start',
|
|
46
|
-
}),
|
|
47
|
-
end: attributes_1.default.DateTime({
|
|
48
|
-
modelKey: 'end',
|
|
49
|
-
}),
|
|
50
|
-
};
|
|
51
|
-
return SchedulerTimeSlot;
|
|
52
|
-
}(model_1.default));
|
|
53
|
-
exports.default = SchedulerTimeSlot;
|