ical-generator 7.0.0-develop.2 → 7.0.0-develop.3
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/dist/index.cjs +22 -20
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +537 -497
- package/dist/index.d.ts +537 -497
- package/dist/index.js +19 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/alarm.ts +109 -6
- package/src/attendee.ts +12 -11
package/dist/index.d.cts
CHANGED
|
@@ -1,262 +1,449 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
/**
|
|
2
|
+
* ical-generator supports [native Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date),
|
|
3
|
+
* [moment.js](https://momentjs.com/) (and [moment-timezone](https://momentjs.com/timezone/), [Day.js](https://day.js.org/en/) and
|
|
4
|
+
* [Luxon](https://moment.github.io/luxon/)'s [DateTime](https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html)
|
|
5
|
+
* objects. You can also pass a string which is then passed to javascript's Date internally.
|
|
6
|
+
*/
|
|
7
|
+
type ICalDateTimeValue = Date | ICalMomentStub | ICalMomentTimezoneStub | ICalLuxonDateTimeStub | ICalDayJsStub | string;
|
|
8
|
+
interface ICalRepeatingOptions {
|
|
9
|
+
freq: ICalEventRepeatingFreq;
|
|
10
|
+
count?: number;
|
|
11
|
+
interval?: number;
|
|
12
|
+
until?: ICalDateTimeValue;
|
|
13
|
+
byDay?: ICalWeekday[] | ICalWeekday;
|
|
14
|
+
byMonth?: number[] | number;
|
|
15
|
+
byMonthDay?: number[] | number;
|
|
16
|
+
bySetPos?: number[] | number;
|
|
17
|
+
exclude?: ICalDateTimeValue[] | ICalDateTimeValue;
|
|
18
|
+
startOfWeek?: ICalWeekday;
|
|
19
|
+
}
|
|
20
|
+
type ICalLocation = ICalLocationWithTitle | ICalLocationWithoutTitle;
|
|
21
|
+
interface ICalLocationWithTitle {
|
|
22
|
+
title: string;
|
|
23
|
+
address?: string;
|
|
24
|
+
radius?: number;
|
|
25
|
+
geo?: ICalGeo;
|
|
26
|
+
}
|
|
27
|
+
interface ICalLocationWithoutTitle {
|
|
28
|
+
geo: ICalGeo;
|
|
29
|
+
}
|
|
30
|
+
interface ICalGeo {
|
|
31
|
+
lat: number;
|
|
32
|
+
lon: number;
|
|
33
|
+
}
|
|
34
|
+
interface ICalOrganizer {
|
|
35
|
+
name: string;
|
|
36
|
+
email?: string;
|
|
37
|
+
mailto?: string;
|
|
38
|
+
sentBy?: string;
|
|
39
|
+
}
|
|
40
|
+
interface ICalDescription {
|
|
41
|
+
plain: string;
|
|
42
|
+
html?: string;
|
|
43
|
+
}
|
|
44
|
+
interface ICalTimezone {
|
|
45
|
+
name: string | null;
|
|
46
|
+
generator?: (timezone: string) => string | null;
|
|
47
|
+
}
|
|
48
|
+
interface ICalMomentStub {
|
|
49
|
+
format(format?: string): string;
|
|
50
|
+
clone(): ICalMomentStub;
|
|
51
|
+
utc(): ICalMomentStub;
|
|
52
|
+
toDate(): Date;
|
|
53
|
+
isValid(): boolean;
|
|
54
|
+
toJSON(): string;
|
|
55
|
+
}
|
|
56
|
+
interface ICalMomentTimezoneStub extends ICalMomentStub {
|
|
57
|
+
clone(): ICalMomentTimezoneStub;
|
|
58
|
+
utc(): ICalMomentTimezoneStub;
|
|
59
|
+
tz(): string | undefined;
|
|
60
|
+
tz(timezone: string): ICalMomentTimezoneStub;
|
|
61
|
+
}
|
|
62
|
+
interface ICalMomentDurationStub {
|
|
63
|
+
asSeconds(): number;
|
|
64
|
+
}
|
|
65
|
+
interface ICalLuxonDateTimeStub {
|
|
66
|
+
setZone(zone?: string): ICalLuxonDateTimeStub;
|
|
67
|
+
toFormat(fmt: string): string;
|
|
68
|
+
toJSDate(): Date;
|
|
69
|
+
get isValid(): boolean;
|
|
70
|
+
toJSON(): string | null;
|
|
71
|
+
}
|
|
72
|
+
interface ICalDayJsStub {
|
|
73
|
+
tz(zone?: string): ICalDayJsStub;
|
|
74
|
+
utc(): ICalDayJsStub;
|
|
75
|
+
format(format?: string): string;
|
|
76
|
+
toDate(): Date;
|
|
77
|
+
isValid(): boolean;
|
|
78
|
+
toJSON(): string;
|
|
79
|
+
}
|
|
80
|
+
interface ICalRRuleStub {
|
|
81
|
+
between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
|
|
82
|
+
toString(): string;
|
|
83
|
+
}
|
|
84
|
+
declare enum ICalEventRepeatingFreq {
|
|
85
|
+
SECONDLY = "SECONDLY",
|
|
86
|
+
MINUTELY = "MINUTELY",
|
|
87
|
+
HOURLY = "HOURLY",
|
|
88
|
+
DAILY = "DAILY",
|
|
89
|
+
WEEKLY = "WEEKLY",
|
|
90
|
+
MONTHLY = "MONTHLY",
|
|
91
|
+
YEARLY = "YEARLY"
|
|
92
|
+
}
|
|
93
|
+
declare enum ICalWeekday {
|
|
94
|
+
SU = "SU",
|
|
95
|
+
MO = "MO",
|
|
96
|
+
TU = "TU",
|
|
97
|
+
WE = "WE",
|
|
98
|
+
TH = "TH",
|
|
99
|
+
FR = "FR",
|
|
100
|
+
SA = "SA"
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
declare enum ICalAlarmType {
|
|
104
|
+
display = "display",
|
|
105
|
+
audio = "audio",
|
|
106
|
+
email = "email"
|
|
107
|
+
}
|
|
108
|
+
declare const ICalAlarmRelatesTo: {
|
|
109
|
+
readonly end: "END";
|
|
110
|
+
readonly start: "START";
|
|
111
|
+
};
|
|
112
|
+
type ICalAlarmRelatesTo = typeof ICalAlarmRelatesTo[keyof typeof ICalAlarmRelatesTo];
|
|
113
|
+
type ICalAlarmTypeValue = keyof ICalAlarmType;
|
|
114
|
+
interface ICalAttachment {
|
|
115
|
+
uri: string;
|
|
116
|
+
mime: string | null;
|
|
117
|
+
}
|
|
118
|
+
type ICalAlarmData = ICalAlarmBaseData | ICalAlarmTriggerData | ICalAlarmTriggerAfterData | ICalAlarmTriggerBeforeData;
|
|
119
|
+
type ICalAlarmTriggerData = ICalAlarmBaseData & {
|
|
120
|
+
trigger: number | ICalDateTimeValue;
|
|
121
|
+
};
|
|
122
|
+
type ICalAlarmTriggerAfterData = ICalAlarmBaseData & {
|
|
123
|
+
triggerAfter: number | ICalDateTimeValue;
|
|
124
|
+
};
|
|
125
|
+
type ICalAlarmTriggerBeforeData = ICalAlarmBaseData & {
|
|
126
|
+
triggerBefore: number | ICalDateTimeValue;
|
|
127
|
+
};
|
|
128
|
+
interface ICalAlarmBaseData {
|
|
129
|
+
type?: ICalAlarmType;
|
|
130
|
+
relatesTo?: ICalAlarmRelatesTo | null;
|
|
131
|
+
repeat?: ICalAlarmRepeatData | null;
|
|
132
|
+
attach?: string | ICalAttachment | null;
|
|
133
|
+
description?: string | null;
|
|
134
|
+
summary?: string | null;
|
|
135
|
+
attendees?: ICalAttendee[] | ICalAttendeeData[];
|
|
14
136
|
x?: {
|
|
15
137
|
key: string;
|
|
16
138
|
value: string;
|
|
17
139
|
}[] | [string, string][] | Record<string, string>;
|
|
18
140
|
}
|
|
19
|
-
interface
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
141
|
+
interface ICalAlarmRepeatData {
|
|
142
|
+
times: number;
|
|
143
|
+
interval: number;
|
|
144
|
+
}
|
|
145
|
+
interface ICalAlarmJSONData {
|
|
146
|
+
type: ICalAlarmType;
|
|
147
|
+
trigger: string | number;
|
|
148
|
+
relatesTo: ICalAlarmRelatesTo | null;
|
|
149
|
+
repeat: ICalAlarmRepeatData | null;
|
|
150
|
+
interval: number | null;
|
|
151
|
+
attach: ICalAttachment | null;
|
|
152
|
+
description: string | null;
|
|
153
|
+
summary: string | null;
|
|
154
|
+
attendees: ICalAttendee[];
|
|
30
155
|
x: {
|
|
31
156
|
key: string;
|
|
32
157
|
value: string;
|
|
33
158
|
}[];
|
|
34
159
|
}
|
|
35
|
-
declare enum ICalAttendeeRole {
|
|
36
|
-
CHAIR = "CHAIR",
|
|
37
|
-
REQ = "REQ-PARTICIPANT",
|
|
38
|
-
OPT = "OPT-PARTICIPANT",
|
|
39
|
-
NON = "NON-PARTICIPANT"
|
|
40
|
-
}
|
|
41
|
-
declare enum ICalAttendeeStatus {
|
|
42
|
-
ACCEPTED = "ACCEPTED",
|
|
43
|
-
TENTATIVE = "TENTATIVE",
|
|
44
|
-
DECLINED = "DECLINED",
|
|
45
|
-
DELEGATED = "DELEGATED",
|
|
46
|
-
NEEDSACTION = "NEEDS-ACTION"
|
|
47
|
-
}
|
|
48
|
-
declare enum ICalAttendeeType {
|
|
49
|
-
INDIVIDUAL = "INDIVIDUAL",
|
|
50
|
-
GROUP = "GROUP",
|
|
51
|
-
RESOURCE = "RESOURCE",
|
|
52
|
-
ROOM = "ROOM",
|
|
53
|
-
UNKNOWN = "UNKNOWN"
|
|
54
|
-
}
|
|
55
160
|
/**
|
|
56
|
-
* Usually you get an {@link
|
|
161
|
+
* Usually you get an {@link ICalAlarm} object like this:
|
|
57
162
|
*
|
|
58
163
|
* ```javascript
|
|
59
164
|
* import ical from 'ical-generator';
|
|
60
165
|
* const calendar = ical();
|
|
61
166
|
* const event = calendar.createEvent();
|
|
62
|
-
* const
|
|
167
|
+
* const alarm = event.createAlarm();
|
|
63
168
|
* ```
|
|
64
169
|
*
|
|
65
|
-
* You can also use the {@link
|
|
170
|
+
* You can also use the {@link ICalAlarm} object directly:
|
|
66
171
|
*
|
|
67
172
|
* ```javascript
|
|
68
|
-
* import ical, {
|
|
69
|
-
* const
|
|
70
|
-
* event.
|
|
173
|
+
* import ical, {ICalAlarm} from 'ical-generator';
|
|
174
|
+
* const alarm = new ICalAlarm();
|
|
175
|
+
* event.alarms([alarm]);
|
|
71
176
|
* ```
|
|
72
177
|
*/
|
|
73
|
-
declare class
|
|
178
|
+
declare class ICalAlarm {
|
|
74
179
|
private readonly data;
|
|
75
180
|
private readonly event;
|
|
76
181
|
/**
|
|
77
|
-
* Constructor of {@link ICalAttendee}. The event reference is
|
|
78
|
-
*
|
|
182
|
+
* Constructor of {@link ICalAttendee}. The event reference is required
|
|
183
|
+
* to query the calendar's timezone and summary when required.
|
|
79
184
|
*
|
|
80
|
-
* @param data
|
|
185
|
+
* @param data Alarm Data
|
|
81
186
|
* @param event Reference to ICalEvent object
|
|
82
187
|
*/
|
|
83
|
-
constructor(data:
|
|
84
|
-
/**
|
|
85
|
-
* Get the attendee's name
|
|
86
|
-
* @since 0.2.0
|
|
87
|
-
*/
|
|
88
|
-
name(): string | null;
|
|
89
|
-
/**
|
|
90
|
-
* Set the attendee's name
|
|
91
|
-
* @since 0.2.0
|
|
92
|
-
*/
|
|
93
|
-
name(name: string | null): this;
|
|
94
|
-
/**
|
|
95
|
-
* Get the attendee's email address
|
|
96
|
-
* @since 0.2.0
|
|
97
|
-
*/
|
|
98
|
-
email(): string;
|
|
99
|
-
/**
|
|
100
|
-
* Set the attendee's email address
|
|
101
|
-
* @since 0.2.0
|
|
102
|
-
*/
|
|
103
|
-
email(email: string): this;
|
|
188
|
+
constructor(data: ICalAlarmData, event: ICalEvent);
|
|
104
189
|
/**
|
|
105
|
-
* Get the
|
|
106
|
-
* @since
|
|
190
|
+
* Get the alarm type
|
|
191
|
+
* @since 0.2.1
|
|
107
192
|
*/
|
|
108
|
-
|
|
193
|
+
type(type: ICalAlarmType): this;
|
|
109
194
|
/**
|
|
110
|
-
* Set the
|
|
111
|
-
*
|
|
195
|
+
* Set the alarm type. See {@link ICalAlarmType}
|
|
196
|
+
* for available status options.
|
|
197
|
+
* @since 0.2.1
|
|
112
198
|
*/
|
|
113
|
-
|
|
199
|
+
type(): ICalAlarmType;
|
|
114
200
|
/**
|
|
115
|
-
* Get the
|
|
116
|
-
* @
|
|
201
|
+
* Get the trigger time for the alarm. Can either
|
|
202
|
+
* be a date and time value ({@link ICalDateTimeValue}) or
|
|
203
|
+
* a number, which will represent the seconds between
|
|
204
|
+
* alarm and event start. The number is negative, if the
|
|
205
|
+
* alarm is triggered after the event started.
|
|
206
|
+
*
|
|
207
|
+
* @since 0.2.1
|
|
117
208
|
*/
|
|
118
|
-
|
|
209
|
+
trigger(): number | ICalDateTimeValue;
|
|
119
210
|
/**
|
|
120
|
-
*
|
|
121
|
-
*
|
|
211
|
+
* Use this method to set the alarm time.
|
|
212
|
+
*
|
|
213
|
+
* ```javascript
|
|
214
|
+
* const cal = ical();
|
|
215
|
+
* const event = cal.createEvent();
|
|
216
|
+
* const alarm = cal.createAlarm();
|
|
217
|
+
*
|
|
218
|
+
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
219
|
+
* alarm.trigger(new Date()); // -> now
|
|
220
|
+
* ```
|
|
221
|
+
*
|
|
222
|
+
* You can use any supported date object, see
|
|
223
|
+
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
224
|
+
* for details about supported values and timezone handling.
|
|
225
|
+
*
|
|
226
|
+
* @since 0.2.1
|
|
122
227
|
*/
|
|
123
|
-
|
|
228
|
+
trigger(trigger: number | ICalDateTimeValue | Date): this;
|
|
124
229
|
/**
|
|
125
|
-
* Get
|
|
126
|
-
*
|
|
230
|
+
* Get to which time alarm trigger relates to.
|
|
231
|
+
* Can be either `START` or `END`. If the value is
|
|
232
|
+
* `START` the alarm is triggerd relative to the event start time.
|
|
233
|
+
* If the value is `END` the alarm is triggerd relative to the event end time
|
|
234
|
+
*
|
|
235
|
+
* @since 4.0.1
|
|
127
236
|
*/
|
|
128
|
-
|
|
237
|
+
relatesTo(): ICalAlarmRelatesTo | null;
|
|
129
238
|
/**
|
|
130
|
-
*
|
|
131
|
-
*
|
|
239
|
+
* Use this method to set to which time alarm trigger relates to.
|
|
240
|
+
* Works only if trigger is a `number`
|
|
132
241
|
*
|
|
133
|
-
*
|
|
242
|
+
* ```javascript
|
|
243
|
+
* const cal = ical();
|
|
244
|
+
* const event = cal.createEvent();
|
|
245
|
+
* const alarm = cal.createAlarm();
|
|
246
|
+
*
|
|
247
|
+
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
248
|
+
*
|
|
249
|
+
* alarm.relatesTo('START'); // -> 10 minutes before event starts
|
|
250
|
+
* alarm.relatesTo('END'); // -> 10 minutes before event ends
|
|
251
|
+
*
|
|
252
|
+
* alarm.trigger(-600); // -> 10 minutes after event starts
|
|
253
|
+
*
|
|
254
|
+
* alarm.relatesTo('START'); // -> 10 minutes after event starts
|
|
255
|
+
* alarm.relatesTo('END'); // -> 10 minutes after event ends
|
|
256
|
+
* ```
|
|
257
|
+
* @since 4.0.1
|
|
134
258
|
*/
|
|
135
|
-
|
|
259
|
+
relatesTo(relatesTo: ICalAlarmRelatesTo | null): this;
|
|
136
260
|
/**
|
|
137
|
-
* Get
|
|
261
|
+
* Get the trigger time for the alarm. Can either
|
|
262
|
+
* be a date and time value ({@link ICalDateTimeValue}) or
|
|
263
|
+
* a number, which will represent the seconds between
|
|
264
|
+
* alarm and event start. The number is negative, if the
|
|
265
|
+
* alarm is triggered before the event started.
|
|
266
|
+
*
|
|
138
267
|
* @since 0.2.1
|
|
139
268
|
*/
|
|
140
|
-
|
|
269
|
+
triggerAfter(): number | ICalDateTimeValue;
|
|
141
270
|
/**
|
|
142
|
-
*
|
|
271
|
+
* Use this method to set the alarm time. Unlike `trigger`, this time
|
|
272
|
+
* the alarm takes place after the event has started.
|
|
273
|
+
*
|
|
274
|
+
* ```javascript
|
|
275
|
+
* const cal = ical();
|
|
276
|
+
* const event = cal.createEvent();
|
|
277
|
+
* const alarm = cal.createAlarm();
|
|
278
|
+
*
|
|
279
|
+
* alarm.trigger(600); // -> 10 minutes after event starts
|
|
280
|
+
* ```
|
|
281
|
+
*
|
|
282
|
+
* You can use any supported date object, see
|
|
283
|
+
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
284
|
+
* for details about supported values and timezone handling.
|
|
285
|
+
*
|
|
143
286
|
* @since 0.2.1
|
|
144
287
|
*/
|
|
145
|
-
|
|
288
|
+
triggerAfter(trigger: number | ICalDateTimeValue): this;
|
|
146
289
|
/**
|
|
147
|
-
* Get
|
|
148
|
-
* @
|
|
290
|
+
* Get the trigger time for the alarm. Can either
|
|
291
|
+
* be a date and time value ({@link ICalDateTimeValue}) or
|
|
292
|
+
* a number, which will represent the seconds between
|
|
293
|
+
* alarm and event start. The number is negative, if the
|
|
294
|
+
* alarm is triggered after the event started.
|
|
295
|
+
*
|
|
296
|
+
* @since 0.2.1
|
|
297
|
+
* @alias trigger
|
|
149
298
|
*/
|
|
150
|
-
|
|
299
|
+
triggerBefore(trigger: number | ICalDateTimeValue): this;
|
|
151
300
|
/**
|
|
152
|
-
*
|
|
153
|
-
* for available status options.
|
|
301
|
+
* Use this method to set the alarm time.
|
|
154
302
|
*
|
|
155
|
-
*
|
|
303
|
+
* ```javascript
|
|
304
|
+
* const cal = ical();
|
|
305
|
+
* const event = cal.createEvent();
|
|
306
|
+
* const alarm = cal.createAlarm();
|
|
307
|
+
*
|
|
308
|
+
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
309
|
+
* alarm.trigger(new Date()); // -> now
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* You can use any supported date object, see
|
|
313
|
+
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
314
|
+
* for details about supported values and timezone handling.
|
|
315
|
+
*
|
|
316
|
+
* @since 0.2.1
|
|
317
|
+
* @alias trigger
|
|
156
318
|
*/
|
|
157
|
-
|
|
319
|
+
triggerBefore(): number | ICalDateTimeValue;
|
|
158
320
|
/**
|
|
159
|
-
* Get
|
|
160
|
-
* @since 0.2.
|
|
321
|
+
* Get Alarm Repetitions
|
|
322
|
+
* @since 0.2.1
|
|
161
323
|
*/
|
|
162
|
-
|
|
324
|
+
repeat(): ICalAlarmRepeatData | null;
|
|
163
325
|
/**
|
|
164
|
-
* Set
|
|
165
|
-
* See {@link ICalAttendeeType} for available status options.
|
|
326
|
+
* Set Alarm Repetitions. Use this to repeat the alarm.
|
|
166
327
|
*
|
|
167
|
-
*
|
|
328
|
+
* ```javascript
|
|
329
|
+
* const cal = ical();
|
|
330
|
+
* const event = cal.createEvent();
|
|
331
|
+
*
|
|
332
|
+
* // repeat the alarm 4 times every 5 minutes…
|
|
333
|
+
* cal.createAlarm({
|
|
334
|
+
* repeat: {
|
|
335
|
+
* times: 4,
|
|
336
|
+
* interval: 300
|
|
337
|
+
* }
|
|
338
|
+
* });
|
|
339
|
+
* ```
|
|
340
|
+
*
|
|
341
|
+
* @since 0.2.1
|
|
168
342
|
*/
|
|
169
|
-
|
|
343
|
+
repeat(repeat: ICalAlarmRepeatData | null): this;
|
|
170
344
|
/**
|
|
171
|
-
* Get
|
|
172
|
-
* @since 0.2.
|
|
345
|
+
* Get Attachment
|
|
346
|
+
* @since 0.2.1
|
|
173
347
|
*/
|
|
174
|
-
|
|
348
|
+
attach(): {
|
|
349
|
+
uri: string;
|
|
350
|
+
mime: string | null;
|
|
351
|
+
} | null;
|
|
175
352
|
/**
|
|
176
|
-
* Set
|
|
177
|
-
*
|
|
178
|
-
* Creates a new Attendee if the passed object is not already a
|
|
179
|
-
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
180
|
-
* `delegatedFrom` attributes.
|
|
181
|
-
*
|
|
182
|
-
* Will also set the `status` to `DELEGATED`, if attribute is set.
|
|
353
|
+
* Set Alarm attachment. Used to set the alarm sound
|
|
354
|
+
* if alarm type is audio. Defaults to "Basso".
|
|
183
355
|
*
|
|
184
356
|
* ```javascript
|
|
185
357
|
* const cal = ical();
|
|
186
358
|
* const event = cal.createEvent();
|
|
187
|
-
* const attendee = cal.createAttendee();
|
|
188
359
|
*
|
|
189
|
-
*
|
|
190
|
-
|
|
360
|
+
* event.createAlarm({
|
|
361
|
+
* attach: 'https://example.com/notification.aud'
|
|
362
|
+
* });
|
|
191
363
|
*
|
|
192
|
-
*
|
|
364
|
+
* // OR
|
|
365
|
+
*
|
|
366
|
+
* event.createAlarm({
|
|
367
|
+
* attach: {
|
|
368
|
+
* uri: 'https://example.com/notification.aud',
|
|
369
|
+
* mime: 'audio/basic'
|
|
370
|
+
* }
|
|
371
|
+
* });
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* @since 0.2.1
|
|
193
375
|
*/
|
|
194
|
-
|
|
376
|
+
attach(attachment: {
|
|
377
|
+
uri: string;
|
|
378
|
+
mime?: string | null;
|
|
379
|
+
} | string | null): this;
|
|
195
380
|
/**
|
|
196
|
-
* Get the
|
|
197
|
-
*
|
|
381
|
+
* Get the alarm description. Used to set the alarm message
|
|
382
|
+
* if alarm type is `display`. If the alarm type is `email`, it's
|
|
383
|
+
* used to set the email body. Defaults to the event's summary.
|
|
384
|
+
*
|
|
385
|
+
* @since 0.2.1
|
|
198
386
|
*/
|
|
199
|
-
|
|
387
|
+
description(): string | null;
|
|
200
388
|
/**
|
|
201
|
-
* Set the
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
205
|
-
* `delegatedFrom` attributes.
|
|
389
|
+
* Set the alarm description. Used to set the alarm message
|
|
390
|
+
* if alarm type is `display`. If the alarm type is `email`, it's
|
|
391
|
+
* used to set the email body. Defaults to the event's summary.
|
|
206
392
|
*
|
|
207
|
-
* @
|
|
393
|
+
* @since 0.2.1
|
|
208
394
|
*/
|
|
209
|
-
|
|
395
|
+
description(description: string | null): this;
|
|
210
396
|
/**
|
|
211
|
-
*
|
|
212
|
-
*
|
|
213
|
-
* is not already an {@link ICalAttendee}.
|
|
397
|
+
* Get the alarm summary. Used to set the email subject
|
|
398
|
+
* if alarm type is `email`. Defaults to the event's summary.
|
|
214
399
|
*
|
|
215
|
-
*
|
|
216
|
-
* const cal = ical();
|
|
217
|
-
* const event = cal.createEvent();
|
|
218
|
-
* const attendee = cal.createAttendee();
|
|
219
|
-
*
|
|
220
|
-
* attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
|
|
221
|
-
* ```
|
|
222
|
-
*
|
|
223
|
-
* @since 0.2.0
|
|
400
|
+
* @since 7.0.0
|
|
224
401
|
*/
|
|
225
|
-
|
|
402
|
+
summary(): string | null;
|
|
226
403
|
/**
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* is not already an {@link ICalAttendee}.
|
|
404
|
+
* Set the alarm summary. Used to set the email subject
|
|
405
|
+
* if alarm type is display. Defaults to the event's summary.
|
|
230
406
|
*
|
|
231
|
-
*
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
407
|
+
* @since 0.2.1
|
|
408
|
+
*/
|
|
409
|
+
summary(summary: string | null): this;
|
|
410
|
+
/**
|
|
411
|
+
* Creates a new {@link ICalAttendee} and returns it. Use options to prefill
|
|
412
|
+
* the attendee's attributes. Calling this method without options will create
|
|
413
|
+
* an empty attendee.
|
|
235
414
|
*
|
|
236
|
-
*
|
|
237
|
-
|
|
415
|
+
* @since 7.0.0
|
|
416
|
+
*/
|
|
417
|
+
createAttendee(data: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
|
|
418
|
+
/**
|
|
419
|
+
* Get all attendees
|
|
420
|
+
* @since 7.0.0
|
|
421
|
+
*/
|
|
422
|
+
attendees(): ICalAttendee[];
|
|
423
|
+
/**
|
|
424
|
+
* Add multiple attendees to your event
|
|
238
425
|
*
|
|
239
|
-
* @since 0.
|
|
426
|
+
* @since 7.0.0
|
|
240
427
|
*/
|
|
241
|
-
|
|
428
|
+
attendees(attendees: (ICalAttendee | ICalAttendeeData | string)[]): this;
|
|
242
429
|
/**
|
|
243
430
|
* Set X-* attributes. Woun't filter double attributes,
|
|
244
|
-
* which are also added by another method (e.g.
|
|
431
|
+
* which are also added by another method (e.g. type),
|
|
245
432
|
* so these attributes may be inserted twice.
|
|
246
433
|
*
|
|
247
434
|
* ```javascript
|
|
248
|
-
*
|
|
435
|
+
* alarm.x([
|
|
249
436
|
* {
|
|
250
437
|
* key: "X-MY-CUSTOM-ATTR",
|
|
251
438
|
* value: "1337!"
|
|
252
439
|
* }
|
|
253
440
|
* ]);
|
|
254
441
|
*
|
|
255
|
-
*
|
|
442
|
+
* alarm.x([
|
|
256
443
|
* ["X-MY-CUSTOM-ATTR", "1337!"]
|
|
257
444
|
* ]);
|
|
258
445
|
*
|
|
259
|
-
*
|
|
446
|
+
* alarm.x({
|
|
260
447
|
* "X-MY-CUSTOM-ATTR": "1337!"
|
|
261
448
|
* });
|
|
262
449
|
* ```
|
|
@@ -269,11 +456,11 @@ declare class ICalAttendee {
|
|
|
269
456
|
}[] | [string, string][] | Record<string, string>): this;
|
|
270
457
|
/**
|
|
271
458
|
* Set a X-* attribute. Woun't filter double attributes,
|
|
272
|
-
* which are also added by another method (e.g.
|
|
459
|
+
* which are also added by another method (e.g. type),
|
|
273
460
|
* so these attributes may be inserted twice.
|
|
274
461
|
*
|
|
275
462
|
* ```javascript
|
|
276
|
-
*
|
|
463
|
+
* alarm.x("X-MY-CUSTOM-ATTR", "1337!");
|
|
277
464
|
* ```
|
|
278
465
|
*
|
|
279
466
|
* @since 1.9.0
|
|
@@ -288,428 +475,283 @@ declare class ICalAttendee {
|
|
|
288
475
|
value: string;
|
|
289
476
|
}[];
|
|
290
477
|
/**
|
|
291
|
-
* Return a shallow copy of the
|
|
292
|
-
*
|
|
478
|
+
* Return a shallow copy of the alarm's options for JSON stringification.
|
|
479
|
+
* Third party objects like moment.js values are stringified as well. Can
|
|
480
|
+
* be used for persistence.
|
|
293
481
|
*
|
|
294
482
|
* @since 0.2.4
|
|
295
483
|
*/
|
|
296
|
-
toJSON():
|
|
484
|
+
toJSON(): ICalAlarmJSONData;
|
|
297
485
|
/**
|
|
298
|
-
* Return generated
|
|
486
|
+
* Return generated event as a string.
|
|
299
487
|
*
|
|
300
488
|
* ```javascript
|
|
301
|
-
*
|
|
489
|
+
* const alarm = event.createAlarm();
|
|
490
|
+
* console.log(alarm.toString()); // → BEGIN:VALARM…
|
|
302
491
|
* ```
|
|
303
492
|
*/
|
|
304
493
|
toString(): string;
|
|
305
494
|
}
|
|
306
495
|
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
byMonth?: number[] | number;
|
|
321
|
-
byMonthDay?: number[] | number;
|
|
322
|
-
bySetPos?: number[] | number;
|
|
323
|
-
exclude?: ICalDateTimeValue[] | ICalDateTimeValue;
|
|
324
|
-
startOfWeek?: ICalWeekday;
|
|
325
|
-
}
|
|
326
|
-
type ICalLocation = ICalLocationWithTitle | ICalLocationWithoutTitle;
|
|
327
|
-
interface ICalLocationWithTitle {
|
|
328
|
-
title: string;
|
|
329
|
-
address?: string;
|
|
330
|
-
radius?: number;
|
|
331
|
-
geo?: ICalGeo;
|
|
332
|
-
}
|
|
333
|
-
interface ICalLocationWithoutTitle {
|
|
334
|
-
geo: ICalGeo;
|
|
335
|
-
}
|
|
336
|
-
interface ICalGeo {
|
|
337
|
-
lat: number;
|
|
338
|
-
lon: number;
|
|
339
|
-
}
|
|
340
|
-
interface ICalOrganizer {
|
|
341
|
-
name: string;
|
|
342
|
-
email?: string;
|
|
343
|
-
mailto?: string;
|
|
344
|
-
sentBy?: string;
|
|
345
|
-
}
|
|
346
|
-
interface ICalDescription {
|
|
347
|
-
plain: string;
|
|
348
|
-
html?: string;
|
|
349
|
-
}
|
|
350
|
-
interface ICalTimezone {
|
|
351
|
-
name: string | null;
|
|
352
|
-
generator?: (timezone: string) => string | null;
|
|
353
|
-
}
|
|
354
|
-
interface ICalMomentStub {
|
|
355
|
-
format(format?: string): string;
|
|
356
|
-
clone(): ICalMomentStub;
|
|
357
|
-
utc(): ICalMomentStub;
|
|
358
|
-
toDate(): Date;
|
|
359
|
-
isValid(): boolean;
|
|
360
|
-
toJSON(): string;
|
|
361
|
-
}
|
|
362
|
-
interface ICalMomentTimezoneStub extends ICalMomentStub {
|
|
363
|
-
clone(): ICalMomentTimezoneStub;
|
|
364
|
-
utc(): ICalMomentTimezoneStub;
|
|
365
|
-
tz(): string | undefined;
|
|
366
|
-
tz(timezone: string): ICalMomentTimezoneStub;
|
|
367
|
-
}
|
|
368
|
-
interface ICalMomentDurationStub {
|
|
369
|
-
asSeconds(): number;
|
|
370
|
-
}
|
|
371
|
-
interface ICalLuxonDateTimeStub {
|
|
372
|
-
setZone(zone?: string): ICalLuxonDateTimeStub;
|
|
373
|
-
toFormat(fmt: string): string;
|
|
374
|
-
toJSDate(): Date;
|
|
375
|
-
get isValid(): boolean;
|
|
376
|
-
toJSON(): string | null;
|
|
377
|
-
}
|
|
378
|
-
interface ICalDayJsStub {
|
|
379
|
-
tz(zone?: string): ICalDayJsStub;
|
|
380
|
-
utc(): ICalDayJsStub;
|
|
381
|
-
format(format?: string): string;
|
|
382
|
-
toDate(): Date;
|
|
383
|
-
isValid(): boolean;
|
|
384
|
-
toJSON(): string;
|
|
385
|
-
}
|
|
386
|
-
interface ICalRRuleStub {
|
|
387
|
-
between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
|
|
388
|
-
toString(): string;
|
|
389
|
-
}
|
|
390
|
-
declare enum ICalEventRepeatingFreq {
|
|
391
|
-
SECONDLY = "SECONDLY",
|
|
392
|
-
MINUTELY = "MINUTELY",
|
|
393
|
-
HOURLY = "HOURLY",
|
|
394
|
-
DAILY = "DAILY",
|
|
395
|
-
WEEKLY = "WEEKLY",
|
|
396
|
-
MONTHLY = "MONTHLY",
|
|
397
|
-
YEARLY = "YEARLY"
|
|
398
|
-
}
|
|
399
|
-
declare enum ICalWeekday {
|
|
400
|
-
SU = "SU",
|
|
401
|
-
MO = "MO",
|
|
402
|
-
TU = "TU",
|
|
403
|
-
WE = "WE",
|
|
404
|
-
TH = "TH",
|
|
405
|
-
FR = "FR",
|
|
406
|
-
SA = "SA"
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
declare enum ICalAlarmType {
|
|
410
|
-
display = "display",
|
|
411
|
-
audio = "audio"
|
|
412
|
-
}
|
|
413
|
-
declare const ICalAlarmRelatesTo: {
|
|
414
|
-
readonly end: "END";
|
|
415
|
-
readonly start: "START";
|
|
416
|
-
};
|
|
417
|
-
type ICalAlarmRelatesTo = typeof ICalAlarmRelatesTo[keyof typeof ICalAlarmRelatesTo];
|
|
418
|
-
type ICalAlarmTypeValue = keyof ICalAlarmType;
|
|
419
|
-
interface ICalAttachment {
|
|
420
|
-
uri: string;
|
|
421
|
-
mime: string | null;
|
|
422
|
-
}
|
|
423
|
-
type ICalAlarmData = ICalAlarmBaseData | ICalAlarmTriggerData | ICalAlarmTriggerAfterData | ICalAlarmTriggerBeforeData;
|
|
424
|
-
type ICalAlarmTriggerData = ICalAlarmBaseData & {
|
|
425
|
-
trigger: number | ICalDateTimeValue;
|
|
426
|
-
};
|
|
427
|
-
type ICalAlarmTriggerAfterData = ICalAlarmBaseData & {
|
|
428
|
-
triggerAfter: number | ICalDateTimeValue;
|
|
429
|
-
};
|
|
430
|
-
type ICalAlarmTriggerBeforeData = ICalAlarmBaseData & {
|
|
431
|
-
triggerBefore: number | ICalDateTimeValue;
|
|
432
|
-
};
|
|
433
|
-
interface ICalAlarmBaseData {
|
|
434
|
-
type?: ICalAlarmType;
|
|
435
|
-
relatesTo?: ICalAlarmRelatesTo | null;
|
|
436
|
-
repeat?: ICalAlarmRepeatData | null;
|
|
437
|
-
attach?: string | ICalAttachment | null;
|
|
438
|
-
description?: string | null;
|
|
496
|
+
interface ICalAttendeeData {
|
|
497
|
+
name?: string | null;
|
|
498
|
+
email: string;
|
|
499
|
+
mailto?: string | null;
|
|
500
|
+
sentBy?: string | null;
|
|
501
|
+
status?: ICalAttendeeStatus | null;
|
|
502
|
+
role?: ICalAttendeeRole;
|
|
503
|
+
rsvp?: boolean | null;
|
|
504
|
+
type?: ICalAttendeeType | null;
|
|
505
|
+
delegatedTo?: ICalAttendee | ICalAttendeeData | string | null;
|
|
506
|
+
delegatedFrom?: ICalAttendee | ICalAttendeeData | string | null;
|
|
507
|
+
delegatesTo?: ICalAttendee | ICalAttendeeData | string | null;
|
|
508
|
+
delegatesFrom?: ICalAttendee | ICalAttendeeData | string | null;
|
|
439
509
|
x?: {
|
|
440
510
|
key: string;
|
|
441
511
|
value: string;
|
|
442
512
|
}[] | [string, string][] | Record<string, string>;
|
|
443
513
|
}
|
|
444
|
-
interface
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
description: string | null;
|
|
514
|
+
interface ICalAttendeeJSONData {
|
|
515
|
+
name: string | null;
|
|
516
|
+
email: string;
|
|
517
|
+
mailto: string | null;
|
|
518
|
+
sentBy: string | null;
|
|
519
|
+
status: ICalAttendeeStatus | null;
|
|
520
|
+
role: ICalAttendeeRole;
|
|
521
|
+
rsvp: boolean | null;
|
|
522
|
+
type: ICalAttendeeType | null;
|
|
523
|
+
delegatedTo: string | null;
|
|
524
|
+
delegatedFrom: string | null;
|
|
456
525
|
x: {
|
|
457
526
|
key: string;
|
|
458
527
|
value: string;
|
|
459
528
|
}[];
|
|
460
529
|
}
|
|
530
|
+
declare enum ICalAttendeeRole {
|
|
531
|
+
CHAIR = "CHAIR",
|
|
532
|
+
REQ = "REQ-PARTICIPANT",
|
|
533
|
+
OPT = "OPT-PARTICIPANT",
|
|
534
|
+
NON = "NON-PARTICIPANT"
|
|
535
|
+
}
|
|
536
|
+
declare enum ICalAttendeeStatus {
|
|
537
|
+
ACCEPTED = "ACCEPTED",
|
|
538
|
+
TENTATIVE = "TENTATIVE",
|
|
539
|
+
DECLINED = "DECLINED",
|
|
540
|
+
DELEGATED = "DELEGATED",
|
|
541
|
+
NEEDSACTION = "NEEDS-ACTION"
|
|
542
|
+
}
|
|
543
|
+
declare enum ICalAttendeeType {
|
|
544
|
+
INDIVIDUAL = "INDIVIDUAL",
|
|
545
|
+
GROUP = "GROUP",
|
|
546
|
+
RESOURCE = "RESOURCE",
|
|
547
|
+
ROOM = "ROOM",
|
|
548
|
+
UNKNOWN = "UNKNOWN"
|
|
549
|
+
}
|
|
461
550
|
/**
|
|
462
|
-
* Usually you get an {@link
|
|
551
|
+
* Usually you get an {@link ICalAttendee} object like this:
|
|
463
552
|
*
|
|
464
553
|
* ```javascript
|
|
465
554
|
* import ical from 'ical-generator';
|
|
466
555
|
* const calendar = ical();
|
|
467
556
|
* const event = calendar.createEvent();
|
|
468
|
-
* const
|
|
557
|
+
* const attendee = event.createAttendee({ email: 'mail@example.com' });
|
|
469
558
|
* ```
|
|
470
559
|
*
|
|
471
|
-
* You can also use the {@link
|
|
560
|
+
* You can also use the {@link ICalAttendee} object directly:
|
|
472
561
|
*
|
|
473
562
|
* ```javascript
|
|
474
|
-
* import ical, {
|
|
475
|
-
* const
|
|
476
|
-
* event.
|
|
563
|
+
* import ical, {ICalAttendee} from 'ical-generator';
|
|
564
|
+
* const attendee = new ICalAttendee({ email: 'mail@example.com' });
|
|
565
|
+
* event.attendees([attendee]);
|
|
477
566
|
* ```
|
|
478
567
|
*/
|
|
479
|
-
declare class
|
|
568
|
+
declare class ICalAttendee {
|
|
480
569
|
private readonly data;
|
|
481
|
-
private readonly
|
|
570
|
+
private readonly parent;
|
|
571
|
+
/**
|
|
572
|
+
* Constructor of {@link ICalAttendee}. The event reference is
|
|
573
|
+
* required to query the calendar's timezone when required.
|
|
574
|
+
*
|
|
575
|
+
* @param data Attendee Data
|
|
576
|
+
* @param parent Reference to ICalEvent object
|
|
577
|
+
*/
|
|
578
|
+
constructor(data: ICalAttendeeData, parent: ICalEvent | ICalAlarm);
|
|
579
|
+
/**
|
|
580
|
+
* Get the attendee's name
|
|
581
|
+
* @since 0.2.0
|
|
582
|
+
*/
|
|
583
|
+
name(): string | null;
|
|
584
|
+
/**
|
|
585
|
+
* Set the attendee's name
|
|
586
|
+
* @since 0.2.0
|
|
587
|
+
*/
|
|
588
|
+
name(name: string | null): this;
|
|
589
|
+
/**
|
|
590
|
+
* Get the attendee's email address
|
|
591
|
+
* @since 0.2.0
|
|
592
|
+
*/
|
|
593
|
+
email(): string;
|
|
594
|
+
/**
|
|
595
|
+
* Set the attendee's email address
|
|
596
|
+
* @since 0.2.0
|
|
597
|
+
*/
|
|
598
|
+
email(email: string): this;
|
|
599
|
+
/**
|
|
600
|
+
* Get the attendee's email address
|
|
601
|
+
* @since 1.3.0
|
|
602
|
+
*/
|
|
603
|
+
mailto(): string | null;
|
|
604
|
+
/**
|
|
605
|
+
* Set the attendee's email address
|
|
606
|
+
* @since 1.3.0
|
|
607
|
+
*/
|
|
608
|
+
mailto(mailto: string | null): this;
|
|
609
|
+
/**
|
|
610
|
+
* Get the acting user's email adress
|
|
611
|
+
* @since 3.3.0
|
|
612
|
+
*/
|
|
613
|
+
sentBy(): string | null;
|
|
482
614
|
/**
|
|
483
|
-
*
|
|
484
|
-
*
|
|
615
|
+
* Set the acting user's email adress
|
|
616
|
+
* @since 3.3.0
|
|
617
|
+
*/
|
|
618
|
+
sentBy(email: string | null): this;
|
|
619
|
+
/**
|
|
620
|
+
* Get attendee's role
|
|
621
|
+
* @since 0.2.0
|
|
622
|
+
*/
|
|
623
|
+
role(): ICalAttendeeRole;
|
|
624
|
+
/**
|
|
625
|
+
* Set the attendee's role, defaults to `REQ` / `REQ-PARTICIPANT`.
|
|
626
|
+
* Checkout {@link ICalAttendeeRole} for available roles.
|
|
485
627
|
*
|
|
486
|
-
* @
|
|
487
|
-
* @param event Reference to ICalEvent object
|
|
628
|
+
* @since 0.2.0
|
|
488
629
|
*/
|
|
489
|
-
|
|
630
|
+
role(role: ICalAttendeeRole): this;
|
|
490
631
|
/**
|
|
491
|
-
* Get
|
|
632
|
+
* Get attendee's RSVP expectation
|
|
492
633
|
* @since 0.2.1
|
|
493
634
|
*/
|
|
494
|
-
|
|
635
|
+
rsvp(): boolean | null;
|
|
495
636
|
/**
|
|
496
|
-
* Set the
|
|
497
|
-
* for available status options.
|
|
637
|
+
* Set the attendee's RSVP expectation
|
|
498
638
|
* @since 0.2.1
|
|
499
639
|
*/
|
|
500
|
-
|
|
640
|
+
rsvp(rsvp: boolean | null): this;
|
|
501
641
|
/**
|
|
502
|
-
* Get
|
|
503
|
-
*
|
|
504
|
-
* a number, which will represent the seconds between
|
|
505
|
-
* alarm and event start. The number is negative, if the
|
|
506
|
-
* alarm is triggered after the event started.
|
|
507
|
-
*
|
|
508
|
-
* @since 0.2.1
|
|
642
|
+
* Get attendee's status
|
|
643
|
+
* @since 0.2.0
|
|
509
644
|
*/
|
|
510
|
-
|
|
645
|
+
status(): ICalAttendeeStatus | null;
|
|
511
646
|
/**
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
* ```javascript
|
|
515
|
-
* const cal = ical();
|
|
516
|
-
* const event = cal.createEvent();
|
|
517
|
-
* const alarm = cal.createAlarm();
|
|
518
|
-
*
|
|
519
|
-
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
520
|
-
* alarm.trigger(new Date()); // -> now
|
|
521
|
-
* ```
|
|
522
|
-
*
|
|
523
|
-
* You can use any supported date object, see
|
|
524
|
-
* [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
|
|
525
|
-
* for details about supported values and timezone handling.
|
|
647
|
+
* Set the attendee's status. See {@link ICalAttendeeStatus}
|
|
648
|
+
* for available status options.
|
|
526
649
|
*
|
|
527
|
-
* @since 0.2.
|
|
650
|
+
* @since 0.2.0
|
|
528
651
|
*/
|
|
529
|
-
|
|
652
|
+
status(status: ICalAttendeeStatus | null): this;
|
|
530
653
|
/**
|
|
531
|
-
* Get
|
|
532
|
-
*
|
|
533
|
-
* `START` the alarm is triggerd relative to the event start time.
|
|
534
|
-
* If the value is `END` the alarm is triggerd relative to the event end time
|
|
535
|
-
*
|
|
536
|
-
* @since 4.0.1
|
|
654
|
+
* Get attendee's type (a.k.a. CUTYPE)
|
|
655
|
+
* @since 0.2.3
|
|
537
656
|
*/
|
|
538
|
-
|
|
657
|
+
type(): ICalAttendeeType;
|
|
539
658
|
/**
|
|
540
|
-
*
|
|
541
|
-
*
|
|
542
|
-
*
|
|
543
|
-
* ```javascript
|
|
544
|
-
* const cal = ical();
|
|
545
|
-
* const event = cal.createEvent();
|
|
546
|
-
* const alarm = cal.createAlarm();
|
|
547
|
-
*
|
|
548
|
-
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
549
|
-
*
|
|
550
|
-
* alarm.relatesTo('START'); // -> 10 minutes before event starts
|
|
551
|
-
* alarm.relatesTo('END'); // -> 10 minutes before event ends
|
|
552
|
-
*
|
|
553
|
-
* alarm.trigger(-600); // -> 10 minutes after event starts
|
|
659
|
+
* Set attendee's type (a.k.a. CUTYPE).
|
|
660
|
+
* See {@link ICalAttendeeType} for available status options.
|
|
554
661
|
*
|
|
555
|
-
*
|
|
556
|
-
* alarm.relatesTo('END'); // -> 10 minutes after event ends
|
|
557
|
-
* ```
|
|
558
|
-
* @since 4.0.1
|
|
662
|
+
* @since 0.2.3
|
|
559
663
|
*/
|
|
560
|
-
|
|
664
|
+
type(type: ICalAttendeeType | null): this;
|
|
561
665
|
/**
|
|
562
|
-
* Get the
|
|
563
|
-
*
|
|
564
|
-
* a number, which will represent the seconds between
|
|
565
|
-
* alarm and event start. The number is negative, if the
|
|
566
|
-
* alarm is triggered before the event started.
|
|
567
|
-
*
|
|
568
|
-
* @since 0.2.1
|
|
666
|
+
* Get the attendee's delegated-to value.
|
|
667
|
+
* @since 0.2.0
|
|
569
668
|
*/
|
|
570
|
-
|
|
669
|
+
delegatedTo(): ICalAttendee | null;
|
|
571
670
|
/**
|
|
572
|
-
*
|
|
573
|
-
*
|
|
671
|
+
* Set the attendee's delegated-to field.
|
|
672
|
+
*
|
|
673
|
+
* Creates a new Attendee if the passed object is not already a
|
|
674
|
+
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
675
|
+
* `delegatedFrom` attributes.
|
|
676
|
+
*
|
|
677
|
+
* Will also set the `status` to `DELEGATED`, if attribute is set.
|
|
574
678
|
*
|
|
575
679
|
* ```javascript
|
|
576
680
|
* const cal = ical();
|
|
577
681
|
* const event = cal.createEvent();
|
|
578
|
-
* const
|
|
579
|
-
*
|
|
580
|
-
* alarm.trigger(600); // -> 10 minutes after event starts
|
|
581
|
-
* ```
|
|
682
|
+
* const attendee = cal.createAttendee();
|
|
582
683
|
*
|
|
583
|
-
*
|
|
584
|
-
|
|
585
|
-
* for details about supported values and timezone handling.
|
|
684
|
+
* attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
|
|
685
|
+
```
|
|
586
686
|
*
|
|
587
|
-
* @since 0.2.
|
|
687
|
+
* @since 0.2.0
|
|
588
688
|
*/
|
|
589
|
-
|
|
689
|
+
delegatedTo(delegatedTo: ICalAttendee | ICalAttendeeData | string | null): this;
|
|
590
690
|
/**
|
|
591
|
-
* Get the
|
|
592
|
-
*
|
|
593
|
-
* a number, which will represent the seconds between
|
|
594
|
-
* alarm and event start. The number is negative, if the
|
|
595
|
-
* alarm is triggered after the event started.
|
|
596
|
-
*
|
|
597
|
-
* @since 0.2.1
|
|
598
|
-
* @alias trigger
|
|
691
|
+
* Get the attendee's delegated-from field
|
|
692
|
+
* @since 0.2.0
|
|
599
693
|
*/
|
|
600
|
-
|
|
694
|
+
delegatedFrom(): ICalAttendee | null;
|
|
601
695
|
/**
|
|
602
|
-
*
|
|
603
|
-
*
|
|
604
|
-
* ```javascript
|
|
605
|
-
* const cal = ical();
|
|
606
|
-
* const event = cal.createEvent();
|
|
607
|
-
* const alarm = cal.createAlarm();
|
|
608
|
-
*
|
|
609
|
-
* alarm.trigger(600); // -> 10 minutes before event starts
|
|
610
|
-
* alarm.trigger(new Date()); // -> now
|
|
611
|
-
* ```
|
|
696
|
+
* Set the attendee's delegated-from field
|
|
612
697
|
*
|
|
613
|
-
*
|
|
614
|
-
*
|
|
615
|
-
*
|
|
698
|
+
* Creates a new Attendee if the passed object is not already a
|
|
699
|
+
* {@link ICalAttendee} object. Will set the `delegatedTo` and
|
|
700
|
+
* `delegatedFrom` attributes.
|
|
616
701
|
*
|
|
617
|
-
* @
|
|
618
|
-
* @alias trigger
|
|
619
|
-
*/
|
|
620
|
-
triggerBefore(): number | ICalDateTimeValue;
|
|
621
|
-
/**
|
|
622
|
-
* Get Alarm Repetitions
|
|
623
|
-
* @since 0.2.1
|
|
702
|
+
* @param delegatedFrom
|
|
624
703
|
*/
|
|
625
|
-
|
|
704
|
+
delegatedFrom(delegatedFrom: ICalAttendee | ICalAttendeeData | string | null): this;
|
|
626
705
|
/**
|
|
627
|
-
*
|
|
706
|
+
* Create a new attendee this attendee delegates to and returns
|
|
707
|
+
* this new attendee. Creates a new attendee if the passed object
|
|
708
|
+
* is not already an {@link ICalAttendee}.
|
|
628
709
|
*
|
|
629
710
|
* ```javascript
|
|
630
711
|
* const cal = ical();
|
|
631
712
|
* const event = cal.createEvent();
|
|
713
|
+
* const attendee = cal.createAttendee();
|
|
632
714
|
*
|
|
633
|
-
*
|
|
634
|
-
* cal.createAlarm({
|
|
635
|
-
* repeat: {
|
|
636
|
-
* times: 4,
|
|
637
|
-
* interval: 300
|
|
638
|
-
* }
|
|
639
|
-
* });
|
|
715
|
+
* attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
|
|
640
716
|
* ```
|
|
641
717
|
*
|
|
642
|
-
* @since 0.2.
|
|
643
|
-
*/
|
|
644
|
-
repeat(repeat: ICalAlarmRepeatData | null): this;
|
|
645
|
-
/**
|
|
646
|
-
* Get Attachment
|
|
647
|
-
* @since 0.2.1
|
|
718
|
+
* @since 0.2.0
|
|
648
719
|
*/
|
|
649
|
-
|
|
650
|
-
uri: string;
|
|
651
|
-
mime: string | null;
|
|
652
|
-
} | null;
|
|
720
|
+
delegatesTo(options: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
|
|
653
721
|
/**
|
|
654
|
-
*
|
|
655
|
-
*
|
|
722
|
+
* Create a new attendee this attendee delegates from and returns
|
|
723
|
+
* this new attendee. Creates a new attendee if the passed object
|
|
724
|
+
* is not already an {@link ICalAttendee}.
|
|
656
725
|
*
|
|
657
726
|
* ```javascript
|
|
658
727
|
* const cal = ical();
|
|
659
728
|
* const event = cal.createEvent();
|
|
729
|
+
* const attendee = cal.createAttendee();
|
|
660
730
|
*
|
|
661
|
-
*
|
|
662
|
-
* attach: 'https://example.com/notification.aud'
|
|
663
|
-
* });
|
|
664
|
-
*
|
|
665
|
-
* // OR
|
|
666
|
-
*
|
|
667
|
-
* event.createAlarm({
|
|
668
|
-
* attach: {
|
|
669
|
-
* uri: 'https://example.com/notification.aud',
|
|
670
|
-
* mime: 'audio/basic'
|
|
671
|
-
* }
|
|
672
|
-
* });
|
|
731
|
+
* attendee.delegatesFrom({email: 'foo@bar.com', name: 'Foo'});
|
|
673
732
|
* ```
|
|
674
733
|
*
|
|
675
|
-
* @since 0.2.
|
|
676
|
-
*/
|
|
677
|
-
attach(attachment: {
|
|
678
|
-
uri: string;
|
|
679
|
-
mime?: string | null;
|
|
680
|
-
} | string | null): this;
|
|
681
|
-
/**
|
|
682
|
-
* Get the alarm description. Used to set the alarm message
|
|
683
|
-
* if alarm type is display. Defaults to the event's summary.
|
|
684
|
-
*
|
|
685
|
-
* @since 0.2.1
|
|
686
|
-
*/
|
|
687
|
-
description(): string | null;
|
|
688
|
-
/**
|
|
689
|
-
* Set the alarm description. Used to set the alarm message
|
|
690
|
-
* if alarm type is display. Defaults to the event's summary.
|
|
691
|
-
*
|
|
692
|
-
* @since 0.2.1
|
|
734
|
+
* @since 0.2.0
|
|
693
735
|
*/
|
|
694
|
-
|
|
736
|
+
delegatesFrom(options: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
|
|
695
737
|
/**
|
|
696
738
|
* Set X-* attributes. Woun't filter double attributes,
|
|
697
|
-
* which are also added by another method (e.g.
|
|
739
|
+
* which are also added by another method (e.g. status),
|
|
698
740
|
* so these attributes may be inserted twice.
|
|
699
741
|
*
|
|
700
742
|
* ```javascript
|
|
701
|
-
*
|
|
743
|
+
* attendee.x([
|
|
702
744
|
* {
|
|
703
745
|
* key: "X-MY-CUSTOM-ATTR",
|
|
704
746
|
* value: "1337!"
|
|
705
747
|
* }
|
|
706
748
|
* ]);
|
|
707
749
|
*
|
|
708
|
-
*
|
|
750
|
+
* attendee.x([
|
|
709
751
|
* ["X-MY-CUSTOM-ATTR", "1337!"]
|
|
710
752
|
* ]);
|
|
711
753
|
*
|
|
712
|
-
*
|
|
754
|
+
* attendee.x({
|
|
713
755
|
* "X-MY-CUSTOM-ATTR": "1337!"
|
|
714
756
|
* });
|
|
715
757
|
* ```
|
|
@@ -722,11 +764,11 @@ declare class ICalAlarm {
|
|
|
722
764
|
}[] | [string, string][] | Record<string, string>): this;
|
|
723
765
|
/**
|
|
724
766
|
* Set a X-* attribute. Woun't filter double attributes,
|
|
725
|
-
* which are also added by another method (e.g.
|
|
767
|
+
* which are also added by another method (e.g. status),
|
|
726
768
|
* so these attributes may be inserted twice.
|
|
727
769
|
*
|
|
728
770
|
* ```javascript
|
|
729
|
-
*
|
|
771
|
+
* attendee.x("X-MY-CUSTOM-ATTR", "1337!");
|
|
730
772
|
* ```
|
|
731
773
|
*
|
|
732
774
|
* @since 1.9.0
|
|
@@ -741,19 +783,17 @@ declare class ICalAlarm {
|
|
|
741
783
|
value: string;
|
|
742
784
|
}[];
|
|
743
785
|
/**
|
|
744
|
-
* Return a shallow copy of the
|
|
745
|
-
*
|
|
746
|
-
* be used for persistence.
|
|
786
|
+
* Return a shallow copy of the attendee's options for JSON stringification.
|
|
787
|
+
* Can be used for persistence.
|
|
747
788
|
*
|
|
748
789
|
* @since 0.2.4
|
|
749
790
|
*/
|
|
750
|
-
toJSON():
|
|
791
|
+
toJSON(): ICalAttendeeJSONData;
|
|
751
792
|
/**
|
|
752
|
-
* Return generated
|
|
793
|
+
* Return generated attendee as a string.
|
|
753
794
|
*
|
|
754
795
|
* ```javascript
|
|
755
|
-
*
|
|
756
|
-
* console.log(alarm.toString()); // → BEGIN:VALARM…
|
|
796
|
+
* console.log(attendee.toString()); // → ATTENDEE;ROLE=…
|
|
757
797
|
* ```
|
|
758
798
|
*/
|
|
759
799
|
toString(): string;
|