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,226 +0,0 @@
1
- import RestfulModel, { SaveCallback } from './restful-model';
2
- import { Attribute } from './attributes';
3
- import NylasConnection from '../nylas-connection';
4
- import Model from './model';
5
- import Calendar from './calendar';
6
- export declare type SchedulerUploadImageResponse = {
7
- filename: string;
8
- originalFilename: string;
9
- publicUrl: string;
10
- signedUrl: string;
11
- };
12
- export declare type SchedulerAvailableCalendarsProperties = {
13
- id: string;
14
- name: string;
15
- email: string;
16
- calendars: Calendar[];
17
- };
18
- export declare class SchedulerAvailableCalendars extends Model implements SchedulerAvailableCalendarsProperties {
19
- id: string;
20
- name: string;
21
- email: string;
22
- calendars: Calendar[];
23
- static attributes: Record<string, Attribute>;
24
- private _connection?;
25
- constructor(props?: SchedulerAvailableCalendarsProperties);
26
- get connection(): NylasConnection | undefined;
27
- fromJSON(json: Record<string, unknown>, connection?: NylasConnection): this;
28
- }
29
- export declare type SchedulerAppearanceProperties = {
30
- color?: string;
31
- companyName?: string;
32
- logo?: string;
33
- privacyPolicyRedirect?: string;
34
- showAutoschedule?: boolean;
35
- showNylasBranding?: boolean;
36
- showTimezoneOptions?: boolean;
37
- showWeekView?: boolean;
38
- submitText?: string;
39
- thankYouRedirect?: string;
40
- thankYouText?: string;
41
- thankYouTextSecondary?: string;
42
- };
43
- export declare class SchedulerAppearance extends Model implements SchedulerAppearanceProperties {
44
- color?: string;
45
- companyName?: string;
46
- logo?: string;
47
- privacyPolicyRedirect?: string;
48
- showAutoschedule?: boolean;
49
- showNylasBranding?: boolean;
50
- showTimezoneOptions?: boolean;
51
- showWeekView?: boolean;
52
- submitText?: string;
53
- thankYouRedirect?: string;
54
- thankYouText?: string;
55
- thankYouTextSecondary?: string;
56
- static attributes: Record<string, Attribute>;
57
- constructor(props?: SchedulerAppearanceProperties);
58
- }
59
- export declare type SchedulerBookingAdditionalFieldsProperties = {
60
- dropdownOptions?: string[];
61
- label?: string;
62
- multiSelectOptions?: string[];
63
- name?: string;
64
- order?: number;
65
- pattern?: string;
66
- required?: boolean;
67
- type?: string;
68
- };
69
- export declare class SchedulerBookingAdditionalFields extends Model implements SchedulerBookingAdditionalFieldsProperties {
70
- dropdownOptions?: string[];
71
- label?: string;
72
- multiSelectOptions?: string[];
73
- name?: string;
74
- order?: number;
75
- pattern?: string;
76
- required?: boolean;
77
- type?: string;
78
- static attributes: Record<string, Attribute>;
79
- constructor(props?: SchedulerBookingAdditionalFieldsProperties);
80
- }
81
- export declare type SchedulerBookingOpeningHoursProperties = {
82
- accountId?: string;
83
- days?: string[];
84
- end?: string;
85
- start?: string;
86
- };
87
- export declare class SchedulerBookingOpeningHours extends Model implements SchedulerBookingOpeningHoursProperties {
88
- accountId?: string;
89
- days?: string[];
90
- end?: string;
91
- start?: string;
92
- static attributes: Record<string, Attribute>;
93
- constructor(props?: SchedulerBookingOpeningHoursProperties);
94
- }
95
- export declare type SchedulerBookingProperties = {
96
- additionalFields?: SchedulerBookingAdditionalFieldsProperties[];
97
- additionalGuestsHidden?: boolean;
98
- availableDaysInFuture?: number;
99
- calendarInviteToGuests?: boolean;
100
- cancellationPolicy?: string;
101
- confirmationEmailsToGuests?: boolean;
102
- confirmationEmailsToHost?: boolean;
103
- confirmationMethod?: string;
104
- minBookingNotice?: number;
105
- minBuffer?: number;
106
- minCancellationNotice?: number;
107
- intervalMinutes?: number;
108
- nameFieldHidden?: boolean;
109
- openingHours?: SchedulerBookingOpeningHoursProperties[];
110
- schedulingMethod?: string;
111
- };
112
- export declare class SchedulerBooking extends Model implements SchedulerBookingProperties {
113
- additionalFields?: SchedulerBookingAdditionalFields[];
114
- additionalGuestsHidden?: boolean;
115
- availableDaysInFuture?: number;
116
- calendarInviteToGuests?: boolean;
117
- cancellationPolicy?: string;
118
- confirmationEmailsToGuests?: boolean;
119
- confirmationEmailsToHost?: boolean;
120
- confirmationMethod?: string;
121
- minBookingNotice?: number;
122
- minBuffer?: number;
123
- minCancellationNotice?: number;
124
- intervalMinutes?: number;
125
- nameFieldHidden?: boolean;
126
- openingHours?: SchedulerBookingOpeningHours[];
127
- schedulingMethod?: string;
128
- static attributes: Record<string, Attribute>;
129
- constructor(props?: SchedulerBookingProperties);
130
- }
131
- export declare type SchedulerRemindersProperties = {
132
- deliveryMethod?: string;
133
- deliveryRecipient?: string;
134
- emailSubject?: string;
135
- timeBeforeEvent?: number;
136
- webhookUrl?: string;
137
- };
138
- export declare class SchedulerReminders extends Model implements SchedulerRemindersProperties {
139
- deliveryMethod?: string;
140
- deliveryRecipient?: string;
141
- emailSubject?: string;
142
- timeBeforeEvent?: number;
143
- webhookUrl?: string;
144
- static attributes: Record<string, Attribute>;
145
- constructor(props?: SchedulerRemindersProperties);
146
- }
147
- export declare type SchedulerConfigProperties = {
148
- appearance?: SchedulerAppearanceProperties;
149
- booking?: SchedulerBookingProperties;
150
- calendarIds?: {
151
- [accountId: string]: {
152
- availability?: string[];
153
- booking?: string;
154
- };
155
- };
156
- event?: {
157
- duration?: number;
158
- capacity?: number;
159
- location?: string;
160
- title?: string;
161
- };
162
- expireAfter?: {
163
- date?: number;
164
- uses?: number;
165
- };
166
- locale?: string;
167
- localeForGuests?: string;
168
- reminders?: SchedulerRemindersProperties[];
169
- timezone?: string;
170
- };
171
- export declare class SchedulerConfig extends Model implements SchedulerConfigProperties {
172
- appearance?: SchedulerAppearanceProperties;
173
- booking?: SchedulerBookingProperties;
174
- calendarIds?: {
175
- [accountId: string]: {
176
- availability?: string[];
177
- booking?: string;
178
- };
179
- };
180
- event?: {
181
- duration?: number;
182
- capacity?: number;
183
- location?: string;
184
- title?: string;
185
- };
186
- expireAfter?: {
187
- date?: number;
188
- uses?: number;
189
- };
190
- disableEmails?: boolean;
191
- locale?: string;
192
- localeForGuests?: string;
193
- reminders?: SchedulerRemindersProperties[];
194
- timezone?: string;
195
- static attributes: Record<string, Attribute>;
196
- constructor(props?: SchedulerConfigProperties);
197
- }
198
- export declare type SchedulerProperties = {
199
- accessTokens?: string[];
200
- appClientId?: string;
201
- appOrganizationId?: number;
202
- config?: SchedulerConfig;
203
- editToken?: string;
204
- name?: string;
205
- slug?: string;
206
- createdAt?: Date;
207
- modifiedAt?: Date;
208
- };
209
- export default class Scheduler extends RestfulModel implements SchedulerProperties {
210
- accessTokens?: string[];
211
- appClientId?: string;
212
- appOrganizationId?: number;
213
- config?: SchedulerConfig;
214
- editToken?: string;
215
- name?: string;
216
- slug?: string;
217
- createdAt?: Date;
218
- modifiedAt?: Date;
219
- static collectionName: string;
220
- static attributes: Record<string, Attribute>;
221
- constructor(connection: NylasConnection, props?: SchedulerProperties);
222
- save(params?: {} | SaveCallback, callback?: SaveCallback): Promise<this>;
223
- getAvailableCalendars(): Promise<SchedulerAvailableCalendars[]>;
224
- uploadImage(contentType: string, objectName: string): Promise<SchedulerUploadImageResponse>;
225
- private validate;
226
- }
@@ -1,446 +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
- Object.defineProperty(exports, "__esModule", { value: true });
30
- var restful_model_1 = __importDefault(require("./restful-model"));
31
- var attributes_1 = __importDefault(require("./attributes"));
32
- var model_1 = __importDefault(require("./model"));
33
- var calendar_1 = __importDefault(require("./calendar"));
34
- var SchedulerAvailableCalendars = /** @class */ (function (_super) {
35
- __extends(SchedulerAvailableCalendars, _super);
36
- function SchedulerAvailableCalendars(props) {
37
- var _this = _super.call(this) || this;
38
- _this.id = '';
39
- _this.name = '';
40
- _this.email = '';
41
- _this.calendars = [];
42
- _this.initAttributes(props);
43
- return _this;
44
- }
45
- Object.defineProperty(SchedulerAvailableCalendars.prototype, "connection", {
46
- get: function () {
47
- return this._connection;
48
- },
49
- enumerable: true,
50
- configurable: true
51
- });
52
- SchedulerAvailableCalendars.prototype.fromJSON = function (json, connection) {
53
- // Allow a connection object to be passed in to instantiate a Calendar sub object
54
- if (connection) {
55
- this._connection = connection;
56
- }
57
- return _super.prototype.fromJSON.call(this, json);
58
- };
59
- SchedulerAvailableCalendars.attributes = {
60
- calendars: attributes_1.default.Collection({
61
- modelKey: 'calendars',
62
- itemClass: calendar_1.default,
63
- }),
64
- email: attributes_1.default.String({
65
- modelKey: 'email',
66
- }),
67
- id: attributes_1.default.String({
68
- modelKey: 'id',
69
- }),
70
- name: attributes_1.default.String({
71
- modelKey: 'name',
72
- }),
73
- };
74
- return SchedulerAvailableCalendars;
75
- }(model_1.default));
76
- exports.SchedulerAvailableCalendars = SchedulerAvailableCalendars;
77
- var SchedulerAppearance = /** @class */ (function (_super) {
78
- __extends(SchedulerAppearance, _super);
79
- function SchedulerAppearance(props) {
80
- var _this = _super.call(this) || this;
81
- _this.initAttributes(props);
82
- return _this;
83
- }
84
- SchedulerAppearance.attributes = {
85
- color: attributes_1.default.String({
86
- modelKey: 'color',
87
- }),
88
- companyName: attributes_1.default.String({
89
- modelKey: 'companyName',
90
- jsonKey: 'company_name',
91
- }),
92
- logo: attributes_1.default.String({
93
- modelKey: 'logo',
94
- }),
95
- privacyPolicyRedirect: attributes_1.default.String({
96
- modelKey: 'privacyPolicyRedirect',
97
- jsonKey: 'privacy_policy_redirect',
98
- }),
99
- showAutoschedule: attributes_1.default.Boolean({
100
- modelKey: 'showAutoschedule',
101
- jsonKey: 'show_autoschedule',
102
- }),
103
- showNylasBranding: attributes_1.default.Boolean({
104
- modelKey: 'showNylasBranding',
105
- jsonKey: 'show_nylas_branding',
106
- }),
107
- showTimezoneOptions: attributes_1.default.Boolean({
108
- modelKey: 'showTimezoneOptions',
109
- jsonKey: 'show_timezone_options',
110
- }),
111
- showWeekView: attributes_1.default.Boolean({
112
- modelKey: 'showWeekView',
113
- jsonKey: 'show_week_view',
114
- }),
115
- submitText: attributes_1.default.String({
116
- modelKey: 'submitText',
117
- jsonKey: 'submit_text',
118
- }),
119
- thankYouRedirect: attributes_1.default.String({
120
- modelKey: 'thankYouRedirect',
121
- jsonKey: 'thank_you_redirect',
122
- }),
123
- thankYouText: attributes_1.default.String({
124
- modelKey: 'thankYouText',
125
- jsonKey: 'thank_you_text',
126
- }),
127
- thankYouTextSecondary: attributes_1.default.String({
128
- modelKey: 'thankYouTextSecondary',
129
- jsonKey: 'thank_you_text_secondary',
130
- }),
131
- };
132
- return SchedulerAppearance;
133
- }(model_1.default));
134
- exports.SchedulerAppearance = SchedulerAppearance;
135
- var SchedulerBookingAdditionalFields = /** @class */ (function (_super) {
136
- __extends(SchedulerBookingAdditionalFields, _super);
137
- function SchedulerBookingAdditionalFields(props) {
138
- var _this = _super.call(this) || this;
139
- _this.initAttributes(props);
140
- return _this;
141
- }
142
- SchedulerBookingAdditionalFields.attributes = {
143
- dropdownOptions: attributes_1.default.StringList({
144
- modelKey: 'dropdownOptions',
145
- jsonKey: 'dropdown_options',
146
- }),
147
- label: attributes_1.default.String({
148
- modelKey: 'label',
149
- }),
150
- multiSelectOptions: attributes_1.default.StringList({
151
- modelKey: 'multiSelectOptions',
152
- jsonKey: 'multi_select_options',
153
- }),
154
- name: attributes_1.default.String({
155
- modelKey: 'name',
156
- }),
157
- order: attributes_1.default.Number({
158
- modelKey: 'order',
159
- }),
160
- pattern: attributes_1.default.String({
161
- modelKey: 'pattern',
162
- }),
163
- required: attributes_1.default.Boolean({
164
- modelKey: 'required',
165
- }),
166
- type: attributes_1.default.String({
167
- modelKey: 'type',
168
- }),
169
- };
170
- return SchedulerBookingAdditionalFields;
171
- }(model_1.default));
172
- exports.SchedulerBookingAdditionalFields = SchedulerBookingAdditionalFields;
173
- var SchedulerBookingOpeningHours = /** @class */ (function (_super) {
174
- __extends(SchedulerBookingOpeningHours, _super);
175
- function SchedulerBookingOpeningHours(props) {
176
- var _this = _super.call(this) || this;
177
- _this.initAttributes(props);
178
- return _this;
179
- }
180
- SchedulerBookingOpeningHours.attributes = {
181
- accountId: attributes_1.default.String({
182
- modelKey: 'accountId',
183
- jsonKey: 'account_id',
184
- }),
185
- days: attributes_1.default.StringList({
186
- modelKey: 'days',
187
- }),
188
- end: attributes_1.default.String({
189
- modelKey: 'end',
190
- }),
191
- start: attributes_1.default.String({
192
- modelKey: 'start',
193
- }),
194
- };
195
- return SchedulerBookingOpeningHours;
196
- }(model_1.default));
197
- exports.SchedulerBookingOpeningHours = SchedulerBookingOpeningHours;
198
- var SchedulerBooking = /** @class */ (function (_super) {
199
- __extends(SchedulerBooking, _super);
200
- function SchedulerBooking(props) {
201
- var _this = _super.call(this) || this;
202
- _this.initAttributes(props);
203
- return _this;
204
- }
205
- SchedulerBooking.attributes = {
206
- additionalFields: attributes_1.default.Collection({
207
- modelKey: 'additionalFields',
208
- jsonKey: 'additional_fields',
209
- itemClass: SchedulerBookingAdditionalFields,
210
- }),
211
- additionalGuestsHidden: attributes_1.default.Boolean({
212
- modelKey: 'additionalGuestsHidden',
213
- jsonKey: 'additional_guests_hidden',
214
- }),
215
- availableDaysInFuture: attributes_1.default.Number({
216
- modelKey: 'availableDaysInFuture',
217
- jsonKey: 'available_days_in_future',
218
- }),
219
- calendarInviteToGuests: attributes_1.default.Boolean({
220
- modelKey: 'calendarInviteToGuests',
221
- jsonKey: 'calendar_invites_to_guests',
222
- }),
223
- cancellationPolicy: attributes_1.default.String({
224
- modelKey: 'cancellationPolicy',
225
- jsonKey: 'cancellation_policy',
226
- }),
227
- confirmationEmailsToGuests: attributes_1.default.Boolean({
228
- modelKey: 'confirmationEmailsToGuests',
229
- jsonKey: 'confirmation_emails_to_guests',
230
- }),
231
- confirmationEmailsToHost: attributes_1.default.Boolean({
232
- modelKey: 'confirmationEmailsToHost',
233
- jsonKey: 'confirmation_emails_to_host',
234
- }),
235
- confirmationMethod: attributes_1.default.String({
236
- modelKey: 'confirmationMethod',
237
- jsonKey: 'confirmation_method',
238
- }),
239
- minBookingNotice: attributes_1.default.Number({
240
- modelKey: 'minBookingNotice',
241
- jsonKey: 'min_booking_notice',
242
- }),
243
- minBuffer: attributes_1.default.Number({
244
- modelKey: 'minBuffer',
245
- jsonKey: 'min_buffer',
246
- }),
247
- minCancellationNotice: attributes_1.default.Number({
248
- modelKey: 'minCancellationNotice',
249
- jsonKey: 'min_cancellation_notice',
250
- }),
251
- intervalMinutes: attributes_1.default.Number({
252
- modelKey: 'intervalMinutes',
253
- jsonKey: 'interval_minutes',
254
- }),
255
- nameFieldHidden: attributes_1.default.Boolean({
256
- modelKey: 'nameFieldHidden',
257
- jsonKey: 'name_field_hidden',
258
- }),
259
- openingHours: attributes_1.default.Collection({
260
- modelKey: 'openingHours',
261
- jsonKey: 'opening_hours',
262
- itemClass: SchedulerBookingOpeningHours,
263
- }),
264
- schedulingMethod: attributes_1.default.String({
265
- modelKey: 'schedulingMethod',
266
- jsonKey: 'scheduling_method',
267
- }),
268
- };
269
- return SchedulerBooking;
270
- }(model_1.default));
271
- exports.SchedulerBooking = SchedulerBooking;
272
- var SchedulerReminders = /** @class */ (function (_super) {
273
- __extends(SchedulerReminders, _super);
274
- function SchedulerReminders(props) {
275
- var _this = _super.call(this) || this;
276
- _this.initAttributes(props);
277
- return _this;
278
- }
279
- SchedulerReminders.attributes = {
280
- deliveryMethod: attributes_1.default.String({
281
- modelKey: 'deliveryMethod',
282
- jsonKey: 'delivery_method',
283
- }),
284
- deliveryRecipient: attributes_1.default.String({
285
- modelKey: 'deliveryRecipient',
286
- jsonKey: 'delivery_recipient',
287
- }),
288
- emailSubject: attributes_1.default.String({
289
- modelKey: 'emailSubject',
290
- jsonKey: 'email_subject',
291
- }),
292
- timeBeforeEvent: attributes_1.default.Number({
293
- modelKey: 'timeBeforeEvent',
294
- jsonKey: 'time_before_event',
295
- }),
296
- webhookUrl: attributes_1.default.String({
297
- modelKey: 'webhookUrl',
298
- jsonKey: 'webhook_url',
299
- }),
300
- };
301
- return SchedulerReminders;
302
- }(model_1.default));
303
- exports.SchedulerReminders = SchedulerReminders;
304
- var SchedulerConfig = /** @class */ (function (_super) {
305
- __extends(SchedulerConfig, _super);
306
- function SchedulerConfig(props) {
307
- var _this = _super.call(this) || this;
308
- _this.initAttributes(props);
309
- return _this;
310
- }
311
- SchedulerConfig.attributes = {
312
- appearance: attributes_1.default.Object({
313
- modelKey: 'appearance',
314
- itemClass: SchedulerAppearance,
315
- }),
316
- booking: attributes_1.default.Object({
317
- modelKey: 'booking',
318
- itemClass: SchedulerBooking,
319
- }),
320
- calendarIds: attributes_1.default.Object({
321
- modelKey: 'calendarIds',
322
- jsonKey: 'calendar_ids',
323
- }),
324
- event: attributes_1.default.Object({
325
- modelKey: 'event',
326
- }),
327
- expireAfter: attributes_1.default.Object({
328
- modelKey: 'expireAfter',
329
- jsonKey: 'expire_after',
330
- }),
331
- disableEmails: attributes_1.default.Boolean({
332
- modelKey: 'disableEmails',
333
- jsonKey: 'disable_emails',
334
- }),
335
- locale: attributes_1.default.String({
336
- modelKey: 'locale',
337
- }),
338
- localeForGuests: attributes_1.default.String({
339
- modelKey: 'localeForGuests',
340
- jsonKey: 'locale_for_guests',
341
- }),
342
- reminders: attributes_1.default.Collection({
343
- modelKey: 'reminders',
344
- itemClass: SchedulerReminders,
345
- }),
346
- timezone: attributes_1.default.String({
347
- modelKey: 'timezone',
348
- }),
349
- };
350
- return SchedulerConfig;
351
- }(model_1.default));
352
- exports.SchedulerConfig = SchedulerConfig;
353
- var Scheduler = /** @class */ (function (_super) {
354
- __extends(Scheduler, _super);
355
- function Scheduler(connection, props) {
356
- var _this = _super.call(this, connection, props) || this;
357
- _this.initAttributes(props);
358
- _this.baseUrl = 'https://api.schedule.nylas.com';
359
- return _this;
360
- }
361
- Scheduler.prototype.save = function (params, callback) {
362
- if (params === void 0) { params = {}; }
363
- this.validate();
364
- return _super.prototype.save.call(this, params, callback);
365
- };
366
- Scheduler.prototype.getAvailableCalendars = function () {
367
- var _this = this;
368
- if (!this.id) {
369
- throw new Error('Cannot get calendars for a page without an ID.');
370
- }
371
- return this.connection
372
- .request({
373
- method: 'GET',
374
- path: "/manage/pages/" + this.id + "/calendars",
375
- headers: {
376
- 'Content-Type': 'application/json',
377
- },
378
- baseUrl: this.baseUrl,
379
- })
380
- .then(function (json) {
381
- var calendars = json.map(function (cal) {
382
- return new SchedulerAvailableCalendars().fromJSON(cal, _this.connection);
383
- });
384
- return Promise.resolve(calendars);
385
- });
386
- };
387
- Scheduler.prototype.uploadImage = function (contentType, objectName) {
388
- if (!this.id) {
389
- throw new Error('Cannot upload an image to a page without an ID.');
390
- }
391
- return this.connection.request({
392
- method: 'PUT',
393
- path: "/manage/pages/" + this.id + "/upload-image",
394
- headers: {
395
- 'Content-Type': 'application/json',
396
- },
397
- body: {
398
- contentType: contentType,
399
- objectName: objectName,
400
- },
401
- baseUrl: this.baseUrl,
402
- });
403
- };
404
- Scheduler.prototype.validate = function () {
405
- var _a, _b;
406
- var bookingIntervalMinutes = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.booking) === null || _b === void 0 ? void 0 : _b.intervalMinutes;
407
- if (bookingIntervalMinutes !== undefined &&
408
- (bookingIntervalMinutes <= 0 || bookingIntervalMinutes % 5 != 0)) {
409
- throw new Error('SchedulerBooking.intervalMinutes must be a non-zero positive integer, divisible by 5.');
410
- }
411
- };
412
- Scheduler.collectionName = 'manage/pages';
413
- Scheduler.attributes = __assign(__assign({}, restful_model_1.default.attributes), { accessTokens: attributes_1.default.StringList({
414
- modelKey: 'accessTokens',
415
- jsonKey: 'access_tokens',
416
- }), appClientId: attributes_1.default.String({
417
- modelKey: 'appClientId',
418
- jsonKey: 'app_client_id',
419
- readOnly: true,
420
- }), appOrganizationId: attributes_1.default.Number({
421
- modelKey: 'appOrganizationId',
422
- jsonKey: 'app_organization_id',
423
- readOnly: true,
424
- }), config: attributes_1.default.Object({
425
- modelKey: 'config',
426
- itemClass: SchedulerConfig,
427
- }), editToken: attributes_1.default.String({
428
- modelKey: 'editToken',
429
- jsonKey: 'edit_token',
430
- readOnly: true,
431
- }), name: attributes_1.default.String({
432
- modelKey: 'name',
433
- }), slug: attributes_1.default.String({
434
- modelKey: 'slug',
435
- }), createdAt: attributes_1.default.Date({
436
- modelKey: 'createdAt',
437
- jsonKey: 'created_at',
438
- readOnly: true,
439
- }), modifiedAt: attributes_1.default.Date({
440
- modelKey: 'modifiedAt',
441
- jsonKey: 'modified_at',
442
- readOnly: true,
443
- }) });
444
- return Scheduler;
445
- }(restful_model_1.default));
446
- exports.default = Scheduler;