ical-generator 4.0.0-develop.2 → 4.1.0-develop.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2140 @@
1
+ import { ServerResponse } from 'http';
2
+
3
+ interface ICalAttendeeData {
4
+ name?: string | null;
5
+ email?: string | null;
6
+ mailto?: string | null;
7
+ sentBy?: string | null;
8
+ status?: ICalAttendeeStatus | null;
9
+ role?: ICalAttendeeRole;
10
+ rsvp?: boolean | null;
11
+ type?: ICalAttendeeType | null;
12
+ delegatedTo?: ICalAttendee | ICalAttendeeData | string | null;
13
+ delegatedFrom?: ICalAttendee | ICalAttendeeData | string | null;
14
+ delegatesTo?: ICalAttendee | ICalAttendeeData | string | null;
15
+ delegatesFrom?: ICalAttendee | ICalAttendeeData | string | null;
16
+ x?: {
17
+ key: string;
18
+ value: string;
19
+ }[] | [string, string][] | Record<string, string>;
20
+ }
21
+ interface ICalAttendeeJSONData {
22
+ name: string | null;
23
+ email: string | null;
24
+ mailto: string | null;
25
+ sentBy: string | null;
26
+ status: ICalAttendeeStatus | null;
27
+ role: ICalAttendeeRole;
28
+ rsvp: boolean | null;
29
+ type: ICalAttendeeType | null;
30
+ delegatedTo: string | null;
31
+ delegatedFrom: string | null;
32
+ x: {
33
+ key: string;
34
+ value: string;
35
+ }[];
36
+ }
37
+ declare enum ICalAttendeeRole {
38
+ CHAIR = "CHAIR",
39
+ REQ = "REQ-PARTICIPANT",
40
+ OPT = "OPT-PARTICIPANT",
41
+ NON = "NON-PARTICIPANT"
42
+ }
43
+ declare enum ICalAttendeeStatus {
44
+ ACCEPTED = "ACCEPTED",
45
+ TENTATIVE = "TENTATIVE",
46
+ DECLINED = "DECLINED",
47
+ DELEGATED = "DELEGATED",
48
+ NEEDSACTION = "NEEDS-ACTION"
49
+ }
50
+ declare enum ICalAttendeeType {
51
+ INDIVIDUAL = "INDIVIDUAL",
52
+ GROUP = "GROUP",
53
+ RESOURCE = "RESOURCE",
54
+ ROOM = "ROOM",
55
+ UNKNOWN = "UNKNOWN"
56
+ }
57
+ /**
58
+ * Usually you get an `ICalAttendee` object like this:
59
+ *
60
+ * ```javascript
61
+ * import ical from 'ical-generator';
62
+ * const calendar = ical();
63
+ * const event = calendar.createEvent();
64
+ * const attendee = event.createAttendee();
65
+ * ```
66
+ *
67
+ * You can also use the [[`ICalAttendee`]] object directly:
68
+ *
69
+ * ```javascript
70
+ * import ical, {ICalAttendee} from 'ical-generator';
71
+ * const attendee = new ICalAttendee();
72
+ * event.attendees([attendee]);
73
+ * ```
74
+ */
75
+ declare class ICalAttendee {
76
+ private readonly data;
77
+ private readonly event;
78
+ /**
79
+ * Constructor of [[`ICalAttendee`]]. The event reference is
80
+ * required to query the calendar's timezone when required.
81
+ *
82
+ * @param data Attendee Data
83
+ * @param calendar Reference to ICalEvent object
84
+ */
85
+ constructor(data: ICalAttendeeData, event: ICalEvent);
86
+ /**
87
+ * Get the attendee's name
88
+ * @since 0.2.0
89
+ */
90
+ name(): string | null;
91
+ /**
92
+ * Set the attendee's name
93
+ * @since 0.2.0
94
+ */
95
+ name(name: string | null): this;
96
+ /**
97
+ * Get the attendee's email address
98
+ * @since 0.2.0
99
+ */
100
+ email(): string | null;
101
+ /**
102
+ * Set the attendee's email address
103
+ * @since 0.2.0
104
+ */
105
+ email(email: string | null): this;
106
+ /**
107
+ * Get the attendee's email address
108
+ * @since 1.3.0
109
+ */
110
+ mailto(): string | null;
111
+ /**
112
+ * Set the attendee's email address
113
+ * @since 1.3.0
114
+ */
115
+ mailto(mailto: string | null): this;
116
+ /**
117
+ * Get the acting user's email adress
118
+ * @since 3.3.0
119
+ */
120
+ sentBy(): string | null;
121
+ /**
122
+ * Set the acting user's email adress
123
+ * @since 3.3.0
124
+ */
125
+ sentBy(email: string | null): this;
126
+ /**
127
+ * Get attendee's role
128
+ * @since 0.2.0
129
+ */
130
+ role(): ICalAttendeeRole;
131
+ /**
132
+ * Set the attendee's role, defaults to `REQ` / `REQ-PARTICIPANT`.
133
+ * Checkout [[`ICalAttendeeRole`]] for available roles.
134
+ *
135
+ * @since 0.2.0
136
+ */
137
+ role(role: ICalAttendeeRole): this;
138
+ /**
139
+ * Get attendee's RSVP expectation
140
+ * @since 0.2.1
141
+ */
142
+ rsvp(): boolean | null;
143
+ /**
144
+ * Set the attendee's RSVP expectation
145
+ * @since 0.2.1
146
+ */
147
+ rsvp(rsvp: boolean | null): this;
148
+ /**
149
+ * Get attendee's status
150
+ * @since 0.2.0
151
+ */
152
+ status(): ICalAttendeeStatus | null;
153
+ /**
154
+ * Set the attendee's status. See [[`ICalAttendeeStatus`]]
155
+ * for available status options.
156
+ *
157
+ * @since 0.2.0
158
+ */
159
+ status(status: ICalAttendeeStatus | null): this;
160
+ /**
161
+ * Get attendee's type (a.k.a. CUTYPE)
162
+ * @since 0.2.3
163
+ */
164
+ type(): ICalAttendeeType;
165
+ /**
166
+ * Set attendee's type (a.k.a. CUTYPE).
167
+ * See [[`ICalAttendeeType`]] for available status options.
168
+ *
169
+ * @since 0.2.3
170
+ */
171
+ type(type: ICalAttendeeType | null): this;
172
+ /**
173
+ * Get the attendee's delegated-to value.
174
+ * @since 0.2.0
175
+ */
176
+ delegatedTo(): ICalAttendee | null;
177
+ /**
178
+ * Set the attendee's delegated-to field.
179
+ *
180
+ * Creates a new Attendee if the passed object is not already a
181
+ * [[`ICalAttendee`]] object. Will set the `delegatedTo` and
182
+ * `delegatedFrom` attributes.
183
+ *
184
+ * Will also set the `status` to `DELEGATED`, if attribute is set.
185
+ *
186
+ * ```javascript
187
+ * const cal = ical();
188
+ * const event = cal.createEvent();
189
+ * const attendee = cal.createAttendee();
190
+ *
191
+ * attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
192
+ ```
193
+ *
194
+ * @since 0.2.0
195
+ */
196
+ delegatedTo(delegatedTo: ICalAttendee | ICalAttendeeData | string | null): this;
197
+ /**
198
+ * Get the attendee's delegated-from field
199
+ * @since 0.2.0
200
+ */
201
+ delegatedFrom(): ICalAttendee | null;
202
+ /**
203
+ * Set the attendee's delegated-from field
204
+ *
205
+ * Creates a new Attendee if the passed object is not already a
206
+ * [[`ICalAttendee`]] object. Will set the `delegatedTo` and
207
+ * `delegatedFrom` attributes.
208
+ *
209
+ * @param delegatedFrom
210
+ */
211
+ delegatedFrom(delegatedFrom: ICalAttendee | ICalAttendeeData | string | null): this;
212
+ /**
213
+ * Create a new attendee this attendee delegates to and returns
214
+ * this new attendee. Creates a new attendee if the passed object
215
+ * is not already an [[`ICalAttendee`]].
216
+ *
217
+ * ```javascript
218
+ * const cal = ical();
219
+ * const event = cal.createEvent();
220
+ * const attendee = cal.createAttendee();
221
+ *
222
+ * attendee.delegatesTo({email: 'foo@bar.com', name: 'Foo'});
223
+ * ```
224
+ *
225
+ * @since 0.2.0
226
+ */
227
+ delegatesTo(options: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
228
+ /**
229
+ * Create a new attendee this attendee delegates from and returns
230
+ * this new attendee. Creates a new attendee if the passed object
231
+ * is not already an [[`ICalAttendee`]].
232
+ *
233
+ * ```javascript
234
+ * const cal = ical();
235
+ * const event = cal.createEvent();
236
+ * const attendee = cal.createAttendee();
237
+ *
238
+ * attendee.delegatesFrom({email: 'foo@bar.com', name: 'Foo'});
239
+ * ```
240
+ *
241
+ * @since 0.2.0
242
+ */
243
+ delegatesFrom(options: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
244
+ /**
245
+ * Set X-* attributes. Woun't filter double attributes,
246
+ * which are also added by another method (e.g. status),
247
+ * so these attributes may be inserted twice.
248
+ *
249
+ * ```javascript
250
+ * attendee.x([
251
+ * {
252
+ * key: "X-MY-CUSTOM-ATTR",
253
+ * value: "1337!"
254
+ * }
255
+ * ]);
256
+ *
257
+ * attendee.x([
258
+ * ["X-MY-CUSTOM-ATTR", "1337!"]
259
+ * ]);
260
+ *
261
+ * attendee.x({
262
+ * "X-MY-CUSTOM-ATTR": "1337!"
263
+ * });
264
+ * ```
265
+ *
266
+ * @since 1.9.0
267
+ */
268
+ x(keyOrArray: {
269
+ key: string;
270
+ value: string;
271
+ }[] | [string, string][] | Record<string, string>): this;
272
+ /**
273
+ * Set a X-* attribute. Woun't filter double attributes,
274
+ * which are also added by another method (e.g. status),
275
+ * so these attributes may be inserted twice.
276
+ *
277
+ * ```javascript
278
+ * attendee.x("X-MY-CUSTOM-ATTR", "1337!");
279
+ * ```
280
+ *
281
+ * @since 1.9.0
282
+ */
283
+ x(keyOrArray: string, value: string): this;
284
+ /**
285
+ * Get all custom X-* attributes.
286
+ * @since 1.9.0
287
+ */
288
+ x(): {
289
+ key: string;
290
+ value: string;
291
+ }[];
292
+ /**
293
+ * Return a shallow copy of the attendee's options for JSON stringification.
294
+ * Can be used for persistence.
295
+ *
296
+ * @since 0.2.4
297
+ */
298
+ toJSON(): ICalAttendeeJSONData;
299
+ /**
300
+ * Return generated attendee as a string.
301
+ *
302
+ * ```javascript
303
+ * console.log(attendee.toString()); // → ATTENDEE;ROLE=…
304
+ * ```
305
+ */
306
+ toString(): string;
307
+ }
308
+
309
+ /**
310
+ * ical-generator supports [native Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date),
311
+ * [moment.js](https://momentjs.com/) (and [moment-timezone](https://momentjs.com/timezone/), [Day.js](https://day.js.org/en/) and
312
+ * [Luxon](https://moment.github.io/luxon/)'s [DateTime](https://moment.github.io/luxon/docs/class/src/datetime.js~DateTime.html)
313
+ * objects. You can also pass a string which is then passed to javascript's Date internally.
314
+ */
315
+ type ICalDateTimeValue = Date | ICalMomentStub | ICalMomentTimezoneStub | ICalLuxonDateTimeStub | ICalDayJsStub | string;
316
+ interface ICalRepeatingOptions {
317
+ freq: ICalEventRepeatingFreq;
318
+ count?: number;
319
+ interval?: number;
320
+ until?: ICalDateTimeValue;
321
+ byDay?: ICalWeekday[] | ICalWeekday;
322
+ byMonth?: number[] | number;
323
+ byMonthDay?: number[] | number;
324
+ bySetPos?: number[] | number;
325
+ exclude?: ICalDateTimeValue[] | ICalDateTimeValue;
326
+ startOfWeek?: ICalWeekday;
327
+ }
328
+ interface ICalLocation {
329
+ title: string;
330
+ address?: string;
331
+ radius?: number;
332
+ geo?: ICalGeo;
333
+ }
334
+ interface ICalGeo {
335
+ lat: number;
336
+ lon: number;
337
+ }
338
+ interface ICalOrganizer {
339
+ name: string;
340
+ email?: string;
341
+ mailto?: string;
342
+ sentBy?: string;
343
+ }
344
+ interface ICalDescription {
345
+ plain: string;
346
+ html?: string;
347
+ }
348
+ interface ICalTimezone {
349
+ name: string | null;
350
+ generator?: (timezone: string) => string | null;
351
+ }
352
+ interface ICalMomentStub {
353
+ format(format?: string): string;
354
+ clone(): ICalMomentStub;
355
+ utc(): ICalMomentStub;
356
+ toDate(): Date;
357
+ isValid(): boolean;
358
+ toJSON(): string;
359
+ }
360
+ interface ICalMomentTimezoneStub extends ICalMomentStub {
361
+ clone(): ICalMomentTimezoneStub;
362
+ utc(): ICalMomentTimezoneStub;
363
+ tz(): string | undefined;
364
+ tz(timezone: string): ICalMomentTimezoneStub;
365
+ }
366
+ interface ICalMomentDurationStub {
367
+ asSeconds(): number;
368
+ }
369
+ interface ICalLuxonDateTimeStub {
370
+ setZone(zone?: string): ICalLuxonDateTimeStub;
371
+ toFormat(fmt: string): string;
372
+ toJSDate(): Date;
373
+ get isValid(): boolean;
374
+ toJSON(): string;
375
+ }
376
+ interface ICalDayJsStub {
377
+ tz(zone?: string): ICalDayJsStub;
378
+ utc(): ICalDayJsStub;
379
+ format(format?: string): string;
380
+ toDate(): Date;
381
+ isValid(): boolean;
382
+ toJSON(): string;
383
+ }
384
+ interface ICalRRuleStub {
385
+ between(after: Date, before: Date, inc?: boolean, iterator?: (d: Date, len: number) => boolean): Date[];
386
+ toString(): string;
387
+ }
388
+ declare enum ICalEventRepeatingFreq {
389
+ SECONDLY = "SECONDLY",
390
+ MINUTELY = "MINUTELY",
391
+ HOURLY = "HOURLY",
392
+ DAILY = "DAILY",
393
+ WEEKLY = "WEEKLY",
394
+ MONTHLY = "MONTHLY",
395
+ YEARLY = "YEARLY"
396
+ }
397
+ declare enum ICalWeekday {
398
+ SU = "SU",
399
+ MO = "MO",
400
+ TU = "TU",
401
+ WE = "WE",
402
+ TH = "TH",
403
+ FR = "FR",
404
+ SA = "SA"
405
+ }
406
+
407
+ declare enum ICalAlarmType {
408
+ display = "display",
409
+ audio = "audio"
410
+ }
411
+ declare const ICalAlarmRelatesTo: {
412
+ readonly end: "END";
413
+ readonly start: "START";
414
+ };
415
+ type ICalAlarmRelatesTo = typeof ICalAlarmRelatesTo[keyof typeof ICalAlarmRelatesTo];
416
+ type ICalAlarmTypeValue = keyof ICalAlarmType;
417
+ interface ICalAttachment {
418
+ uri: string;
419
+ mime: string | null;
420
+ }
421
+ interface ICalAlarmData {
422
+ type?: ICalAlarmType | null;
423
+ trigger?: number | ICalDateTimeValue | null;
424
+ relatesTo?: ICalAlarmRelatesTo | null;
425
+ triggerBefore?: number | ICalDateTimeValue | null;
426
+ triggerAfter?: number | ICalDateTimeValue | null;
427
+ repeat?: number | null;
428
+ interval?: number | null;
429
+ attach?: string | ICalAttachment | null;
430
+ description?: string | null;
431
+ x?: {
432
+ key: string;
433
+ value: string;
434
+ }[] | [string, string][] | Record<string, string>;
435
+ }
436
+ interface ICalAlarmJSONData {
437
+ type: ICalAlarmType | null;
438
+ trigger: string | number | null;
439
+ relatesTo: ICalAlarmRelatesTo | null;
440
+ repeat: number | null;
441
+ interval: number | null;
442
+ attach: ICalAttachment | null;
443
+ description: string | null;
444
+ x: {
445
+ key: string;
446
+ value: string;
447
+ }[];
448
+ }
449
+ /**
450
+ * Usually you get an `ICalAlarm` object like this:
451
+ *
452
+ * ```javascript
453
+ * import ical from 'ical-generator';
454
+ * const calendar = ical();
455
+ * const event = calendar.createEvent();
456
+ * const alarm = event.createAlarm();
457
+ * ```
458
+ *
459
+ * You can also use the [[`ICalAlarm`]] object directly:
460
+ *
461
+ * ```javascript
462
+ * import ical, {ICalAlarm} from 'ical-generator';
463
+ * const alarm = new ICalAlarm();
464
+ * event.alarms([alarm]);
465
+ * ```
466
+ */
467
+ declare class ICalAlarm {
468
+ private readonly data;
469
+ private readonly event;
470
+ /**
471
+ * Constructor of [[`ICalAttendee`]]. The event reference is required
472
+ * to query the calendar's timezone and summary when required.
473
+ *
474
+ * @param data Alarm Data
475
+ * @param calendar Reference to ICalEvent object
476
+ */
477
+ constructor(data: ICalAlarmData, event: ICalEvent);
478
+ /**
479
+ * Get the alarm type
480
+ * @since 0.2.1
481
+ */
482
+ type(type: ICalAlarmType | null): this;
483
+ /**
484
+ * Set the alarm type. See [[`ICalAlarmType`]]
485
+ * for available status options.
486
+ * @since 0.2.1
487
+ */
488
+ type(): ICalAlarmType | null;
489
+ /**
490
+ * Get the trigger time for the alarm. Can either
491
+ * be a date and time value ([[`ICalDateTimeValue`]]) or
492
+ * a number, which will represent the seconds between
493
+ * alarm and event start. The number is negative, if the
494
+ * alarm is triggered after the event started.
495
+ *
496
+ * @since 0.2.1
497
+ */
498
+ trigger(): number | ICalDateTimeValue | null;
499
+ /**
500
+ * Use this method to set the alarm time.
501
+ *
502
+ * ```javascript
503
+ * const cal = ical();
504
+ * const event = cal.createEvent();
505
+ * const alarm = cal.createAlarm();
506
+ *
507
+ * alarm.trigger(600); // -> 10 minutes before event starts
508
+ * alarm.trigger(new Date()); // -> now
509
+ * ```
510
+ *
511
+ * You can use any supported date object, see
512
+ * [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
513
+ * for details about supported values and timezone handling.
514
+ *
515
+ * @since 0.2.1
516
+ */
517
+ trigger(trigger: number | ICalDateTimeValue | Date | null): this;
518
+ /**
519
+ * Get to which time alarm trigger relates to.
520
+ * Can be either `START` or `END`. If the value is
521
+ * `START` the alarm is triggerd relative to the event start time.
522
+ * If the value is `END` the alarm is triggerd relative to the event end time
523
+ *
524
+ * @since 4.0.1
525
+ */
526
+ relatesTo(): ICalAlarmRelatesTo | null;
527
+ /**
528
+ * Use this method to set to which time alarm trigger relates to.
529
+ * Works only if trigger is a `number`
530
+ *
531
+ * ```javascript
532
+ * const cal = ical();
533
+ * const event = cal.createEvent();
534
+ * const alarm = cal.createAlarm();
535
+ *
536
+ * alarm.trigger(600); // -> 10 minutes before event starts
537
+ *
538
+ * alarm.relatesTo('START'); // -> 10 minutes before event starts
539
+ * alarm.relatesTo('END'); // -> 10 minutes before event ends
540
+ *
541
+ * alarm.trigger(-600); // -> 10 minutes after event starts
542
+ *
543
+ * alarm.relatesTo('START'); // -> 10 minutes after event starts
544
+ * alarm.relatesTo('END'); // -> 10 minutes after event ends
545
+ * ```
546
+ * @since 4.0.1
547
+ */
548
+ relatesTo(relatesTo: ICalAlarmRelatesTo | null): this;
549
+ /**
550
+ * Get the trigger time for the alarm. Can either
551
+ * be a date and time value ([[`ICalDateTimeValue`]]) or
552
+ * a number, which will represent the seconds between
553
+ * alarm and event start. The number is negative, if the
554
+ * alarm is triggered before the event started.
555
+ *
556
+ * @since 0.2.1
557
+ */
558
+ triggerAfter(): number | ICalDateTimeValue | null;
559
+ /**
560
+ * Use this method to set the alarm time. Unlike `trigger`, this time
561
+ * the alarm takes place after the event has started.
562
+ *
563
+ * ```javascript
564
+ * const cal = ical();
565
+ * const event = cal.createEvent();
566
+ * const alarm = cal.createAlarm();
567
+ *
568
+ * alarm.trigger(600); // -> 10 minutes after event starts
569
+ * ```
570
+ *
571
+ * You can use any supported date object, see
572
+ * [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
573
+ * for details about supported values and timezone handling.
574
+ *
575
+ * @since 0.2.1
576
+ */
577
+ triggerAfter(trigger: number | ICalDateTimeValue | null): this;
578
+ /**
579
+ * Get the trigger time for the alarm. Can either
580
+ * be a date and time value ([[`ICalDateTimeValue`]]) or
581
+ * a number, which will represent the seconds between
582
+ * alarm and event start. The number is negative, if the
583
+ * alarm is triggered after the event started.
584
+ *
585
+ * @since 0.2.1
586
+ * @alias trigger
587
+ */
588
+ triggerBefore(trigger: number | ICalDateTimeValue | null): this;
589
+ /**
590
+ * Use this method to set the alarm time.
591
+ *
592
+ * ```javascript
593
+ * const cal = ical();
594
+ * const event = cal.createEvent();
595
+ * const alarm = cal.createAlarm();
596
+ *
597
+ * alarm.trigger(600); // -> 10 minutes before event starts
598
+ * alarm.trigger(new Date()); // -> now
599
+ * ```
600
+ *
601
+ * You can use any supported date object, see
602
+ * [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
603
+ * for details about supported values and timezone handling.
604
+ *
605
+ * @since 0.2.1
606
+ * @alias trigger
607
+ */
608
+ triggerBefore(): number | ICalDateTimeValue | null;
609
+ /**
610
+ * Get Alarm Repetitions
611
+ * @since 0.2.1
612
+ */
613
+ repeat(): number | null;
614
+ /**
615
+ * Set Alarm Repetitions. Use this to repeat the alarm.
616
+ *
617
+ * ```javascript
618
+ * const cal = ical();
619
+ * const event = cal.createEvent();
620
+ *
621
+ * // repeat the alarm 4 times every 5 minutes…
622
+ * cal.createAlarm({
623
+ * repeat: 4,
624
+ * interval: 300
625
+ * });
626
+ * ```
627
+ *
628
+ * @since 0.2.1
629
+ */
630
+ repeat(repeat: number | null): this;
631
+ /**
632
+ * Get Repeat Interval
633
+ * @since 0.2.1
634
+ */
635
+ interval(interval: number | null): this;
636
+ /**
637
+ * Set Repeat Interval
638
+ *
639
+ * ```javascript
640
+ * const cal = ical();
641
+ * const event = cal.createEvent();
642
+ *
643
+ * // repeat the alarm 4 times every 5 minutes…
644
+ * cal.createAlarm({
645
+ * repeat: 4,
646
+ * interval: 300
647
+ * });
648
+ * ```
649
+ *
650
+ * @since 0.2.1
651
+ */
652
+ interval(): number | null;
653
+ /**
654
+ * Get Attachment
655
+ * @since 0.2.1
656
+ */
657
+ attach(): {
658
+ uri: string;
659
+ mime: string | null;
660
+ } | null;
661
+ /**
662
+ * Set Alarm attachment. Used to set the alarm sound
663
+ * if alarm type is audio. Defaults to "Basso".
664
+ *
665
+ * ```javascript
666
+ * const cal = ical();
667
+ * const event = cal.createEvent();
668
+ *
669
+ * event.createAlarm({
670
+ * attach: 'https://example.com/notification.aud'
671
+ * });
672
+ *
673
+ * // OR
674
+ *
675
+ * event.createAlarm({
676
+ * attach: {
677
+ * uri: 'https://example.com/notification.aud',
678
+ * mime: 'audio/basic'
679
+ * }
680
+ * });
681
+ * ```
682
+ *
683
+ * @since 0.2.1
684
+ */
685
+ attach(attachment: {
686
+ uri: string;
687
+ mime?: string | null;
688
+ } | string | null): this;
689
+ /**
690
+ * Get the alarm description. Used to set the alarm message
691
+ * if alarm type is display. Defaults to the event's summary.
692
+ *
693
+ * @since 0.2.1
694
+ */
695
+ description(): string | null;
696
+ /**
697
+ * Set the alarm description. Used to set the alarm message
698
+ * if alarm type is display. Defaults to the event's summary.
699
+ *
700
+ * @since 0.2.1
701
+ */
702
+ description(description: string | null): this;
703
+ /**
704
+ * Set X-* attributes. Woun't filter double attributes,
705
+ * which are also added by another method (e.g. type),
706
+ * so these attributes may be inserted twice.
707
+ *
708
+ * ```javascript
709
+ * alarm.x([
710
+ * {
711
+ * key: "X-MY-CUSTOM-ATTR",
712
+ * value: "1337!"
713
+ * }
714
+ * ]);
715
+ *
716
+ * alarm.x([
717
+ * ["X-MY-CUSTOM-ATTR", "1337!"]
718
+ * ]);
719
+ *
720
+ * alarm.x({
721
+ * "X-MY-CUSTOM-ATTR": "1337!"
722
+ * });
723
+ * ```
724
+ *
725
+ * @since 1.9.0
726
+ */
727
+ x(keyOrArray: {
728
+ key: string;
729
+ value: string;
730
+ }[] | [string, string][] | Record<string, string>): this;
731
+ /**
732
+ * Set a X-* attribute. Woun't filter double attributes,
733
+ * which are also added by another method (e.g. type),
734
+ * so these attributes may be inserted twice.
735
+ *
736
+ * ```javascript
737
+ * alarm.x("X-MY-CUSTOM-ATTR", "1337!");
738
+ * ```
739
+ *
740
+ * @since 1.9.0
741
+ */
742
+ x(keyOrArray: string, value: string): this;
743
+ /**
744
+ * Get all custom X-* attributes.
745
+ * @since 1.9.0
746
+ */
747
+ x(): {
748
+ key: string;
749
+ value: string;
750
+ }[];
751
+ /**
752
+ * Return a shallow copy of the alarm's options for JSON stringification.
753
+ * Third party objects like moment.js values are stringified as well. Can
754
+ * be used for persistence.
755
+ *
756
+ * @since 0.2.4
757
+ */
758
+ toJSON(): ICalAlarmJSONData;
759
+ /**
760
+ * Return generated event as a string.
761
+ *
762
+ * ```javascript
763
+ * const alarm = event.createAlarm();
764
+ * console.log(alarm.toString()); // → BEGIN:VALARM…
765
+ * ```
766
+ */
767
+ toString(): string;
768
+ }
769
+
770
+ interface ICalCategoryData {
771
+ name?: string | null;
772
+ }
773
+ interface ICalCategoryInternalData {
774
+ name: string | null;
775
+ }
776
+ /**
777
+ * Usually you get an `ICalCategory` object like this:
778
+ *
779
+ * ```javascript
780
+ * import ical from 'ical-generator';
781
+ * const calendar = ical();
782
+ * const event = calendar.createEvent();
783
+ * const category = event.createCategory();
784
+ * ```
785
+ *
786
+ * You can also use the [[`ICalCategory`]] object directly:
787
+ *
788
+ * ```javascript
789
+ * import ical, {ICalCategory} from 'ical-generator';
790
+ * const category = new ICalCategory();
791
+ * event.categories([category]);
792
+ * ```
793
+ */
794
+ declare class ICalCategory {
795
+ private readonly data;
796
+ /**
797
+ * Constructor of [[`ICalCategory`]].
798
+ * @param data Category Data
799
+ */
800
+ constructor(data: ICalCategoryData);
801
+ /**
802
+ * Get the category name
803
+ * @since 0.3.0
804
+ */
805
+ name(): string | null;
806
+ /**
807
+ * Set the category name
808
+ * @since 0.3.0
809
+ */
810
+ name(name: string | null): this;
811
+ /**
812
+ * Return a shallow copy of the category's options for JSON stringification.
813
+ * Can be used for persistence.
814
+ *
815
+ * @since 0.2.4
816
+ */
817
+ toJSON(): ICalCategoryInternalData;
818
+ /**
819
+ * Return generated category name as a string.
820
+ *
821
+ * ```javascript
822
+ * console.log(category.toString());
823
+ * ```
824
+ */
825
+ toString(): string;
826
+ }
827
+
828
+ declare enum ICalEventStatus {
829
+ CONFIRMED = "CONFIRMED",
830
+ TENTATIVE = "TENTATIVE",
831
+ CANCELLED = "CANCELLED"
832
+ }
833
+ declare enum ICalEventBusyStatus {
834
+ FREE = "FREE",
835
+ TENTATIVE = "TENTATIVE",
836
+ BUSY = "BUSY",
837
+ OOF = "OOF"
838
+ }
839
+ declare enum ICalEventTransparency {
840
+ TRANSPARENT = "TRANSPARENT",
841
+ OPAQUE = "OPAQUE"
842
+ }
843
+ declare enum ICalEventClass {
844
+ PUBLIC = "PUBLIC",
845
+ PRIVATE = "PRIVATE",
846
+ CONFIDENTIAL = "CONFIDENTIAL"
847
+ }
848
+ interface ICalEventData {
849
+ id?: string | number | null;
850
+ sequence?: number;
851
+ start?: ICalDateTimeValue | null;
852
+ end?: ICalDateTimeValue | null;
853
+ recurrenceId?: ICalDateTimeValue | null;
854
+ timezone?: string | null;
855
+ stamp?: ICalDateTimeValue;
856
+ allDay?: boolean;
857
+ floating?: boolean;
858
+ repeating?: ICalRepeatingOptions | ICalRRuleStub | string | null;
859
+ summary?: string;
860
+ location?: ICalLocation | string | null;
861
+ description?: ICalDescription | string | null;
862
+ organizer?: ICalOrganizer | string | null;
863
+ attendees?: ICalAttendee[] | ICalAttendeeData[];
864
+ alarms?: ICalAlarm[] | ICalAlarmData[];
865
+ categories?: ICalCategory[] | ICalCategoryData[];
866
+ status?: ICalEventStatus | null;
867
+ busystatus?: ICalEventBusyStatus | null;
868
+ priority?: number | null;
869
+ url?: string | null;
870
+ attachments?: string[];
871
+ transparency?: ICalEventTransparency | null;
872
+ created?: ICalDateTimeValue | null;
873
+ lastModified?: ICalDateTimeValue | null;
874
+ class?: ICalEventClass | null;
875
+ x?: {
876
+ key: string;
877
+ value: string;
878
+ }[] | [string, string][] | Record<string, string>;
879
+ }
880
+ interface ICalEventJSONData {
881
+ id: string;
882
+ sequence: number;
883
+ start: string | null;
884
+ end: string | null;
885
+ recurrenceId: string | null;
886
+ timezone: string | null;
887
+ stamp: string;
888
+ allDay: boolean;
889
+ floating: boolean;
890
+ repeating: ICalEventInternalRepeatingData | string | null;
891
+ summary: string;
892
+ location: ICalLocation | null;
893
+ description: ICalDescription | null;
894
+ organizer: ICalOrganizer | null;
895
+ attendees: ICalAttendee[];
896
+ alarms: ICalAlarm[];
897
+ categories: ICalCategory[];
898
+ status: ICalEventStatus | null;
899
+ busystatus: ICalEventBusyStatus | null;
900
+ priority?: number | null;
901
+ url: string | null;
902
+ attachments: string[];
903
+ transparency: ICalEventTransparency | null;
904
+ created: string | null;
905
+ lastModified: string | null;
906
+ x: {
907
+ key: string;
908
+ value: string;
909
+ }[];
910
+ }
911
+ interface ICalEventInternalRepeatingData {
912
+ freq: ICalEventRepeatingFreq;
913
+ count?: number;
914
+ interval?: number;
915
+ until?: ICalDateTimeValue;
916
+ byDay?: ICalWeekday[];
917
+ byMonth?: number[];
918
+ byMonthDay?: number[];
919
+ bySetPos?: number[];
920
+ exclude?: ICalDateTimeValue[];
921
+ startOfWeek?: ICalWeekday;
922
+ }
923
+ /**
924
+ * Usually you get an `ICalCalendar` object like this:
925
+ * ```javascript
926
+ * import ical from 'ical-generator';
927
+ * const calendar = ical();
928
+ * const event = calendar.createEvent();
929
+ * ```
930
+ */
931
+ declare class ICalEvent {
932
+ private readonly data;
933
+ private readonly calendar;
934
+ /**
935
+ * Constructor of [[`ICalEvent`]. The calendar reference is
936
+ * required to query the calendar's timezone when required.
937
+ *
938
+ * @param data Calendar Event Data
939
+ * @param calendar Reference to ICalCalendar object
940
+ */
941
+ constructor(data: ICalEventData, calendar: ICalCalendar);
942
+ /**
943
+ * Get the event's ID
944
+ * @since 0.2.0
945
+ */
946
+ id(): string;
947
+ /**
948
+ * Use this method to set the event's ID.
949
+ * If not set, a UUID will be generated randomly.
950
+ *
951
+ * @param id Event ID you want to set
952
+ */
953
+ id(id: string | number): this;
954
+ /**
955
+ * Get the event's ID
956
+ * @since 0.2.0
957
+ * @alias id
958
+ */
959
+ uid(): string;
960
+ /**
961
+ * Use this method to set the event's ID.
962
+ * If not set, a UUID will be generated randomly.
963
+ *
964
+ * @param id Event ID you want to set
965
+ * @alias id
966
+ */
967
+ uid(id: string | number): this;
968
+ /**
969
+ * Get the event's SEQUENCE number. Use this method to get the event's
970
+ * revision sequence number of the calendar component within a sequence of revisions.
971
+ *
972
+ * @since 0.2.6
973
+ */
974
+ sequence(): number;
975
+ /**
976
+ * Set the event's SEQUENCE number. For a new event, this should be zero.
977
+ * Each time the organizer makes a significant revision, the sequence
978
+ * number should be incremented.
979
+ *
980
+ * @param sequence Sequence number or null to unset it
981
+ */
982
+ sequence(sequence: number): this;
983
+ /**
984
+ * Get the event start time which is currently
985
+ * set. Can be any supported date object.
986
+ *
987
+ * @since 0.2.0
988
+ */
989
+ start(): ICalDateTimeValue | null;
990
+ /**
991
+ * Set the appointment date of beginning, which is required for all events.
992
+ * You can use any supported date object, see
993
+ * [Readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
994
+ * for details about supported values and timezone handling.
995
+ *
996
+ * @since 0.2.0
997
+ */
998
+ start(start: ICalDateTimeValue): this;
999
+ /**
1000
+ * Get the event end time which is currently
1001
+ * set. Can be any supported date object.
1002
+ *
1003
+ * @since 0.2.0
1004
+ */
1005
+ end(): ICalDateTimeValue | null;
1006
+ /**
1007
+ * Set the appointment date of end. You can use any supported date object, see
1008
+ * [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
1009
+ * for details about supported values and timezone handling.
1010
+ *
1011
+ * @since 0.2.0
1012
+ */
1013
+ end(end: ICalDateTimeValue | null): this;
1014
+ /**
1015
+ * Get the event's recurrence id
1016
+ * @since 0.2.0
1017
+ */
1018
+ recurrenceId(): ICalDateTimeValue | null;
1019
+ /**
1020
+ * Set the event's recurrence id. You can use any supported date object, see
1021
+ * [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
1022
+ * for details about supported values and timezone handling.
1023
+ *
1024
+ * @since 0.2.0
1025
+ */
1026
+ recurrenceId(recurrenceId: ICalDateTimeValue | null): this;
1027
+ /**
1028
+ * Get the event's timezone.
1029
+ * @since 0.2.6
1030
+ */
1031
+ timezone(): string | null;
1032
+ /**
1033
+ * Sets the time zone to be used for this event. If a time zone has been
1034
+ * defined in both the event and the calendar, the time zone of the event
1035
+ * is used.
1036
+ *
1037
+ * Please note that if the time zone is set, ical-generator assumes
1038
+ * that all times are already in the correct time zone. Alternatively,
1039
+ * a `moment-timezone` or a Luxon object can be passed with `setZone`,
1040
+ * ical-generator will then set the time zone itself.
1041
+ *
1042
+ * This and the 'floating' flag (see below) are mutually exclusive, and setting a timezone will unset the
1043
+ * 'floating' flag. If neither 'timezone' nor 'floating' are set, the date will be output with in UTC format
1044
+ * (see [date-time form #2 in section 3.3.5 of RFC 554](https://tools.ietf.org/html/rfc5545#section-3.3.5)).
1045
+ *
1046
+ * See [Readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones) for details about
1047
+ * supported values and timezone handling.
1048
+ *
1049
+ * ```javascript
1050
+ * event.timezone('America/New_York');
1051
+ * ```
1052
+ *
1053
+ * @see https://github.com/sebbo2002/ical-generator#-date-time--timezones
1054
+ * @since 0.2.6
1055
+ */
1056
+ timezone(timezone: string | null): this;
1057
+ /**
1058
+ * Get the event's timestamp
1059
+ * @since 0.2.0
1060
+ */
1061
+ stamp(): ICalDateTimeValue;
1062
+ /**
1063
+ * Set the appointment date of creation. Defaults to the current time and date (`new Date()`). You can use
1064
+ * any supported date object, see [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
1065
+ * for details about supported values and timezone handling.
1066
+ *
1067
+ * @since 0.2.0
1068
+ */
1069
+ stamp(stamp: ICalDateTimeValue): this;
1070
+ /**
1071
+ * Get the event's timestamp
1072
+ * @since 0.2.0
1073
+ * @alias stamp
1074
+ */
1075
+ timestamp(): ICalDateTimeValue;
1076
+ /**
1077
+ * Set the appointment date of creation. Defaults to the current time and date (`new Date()`). You can use
1078
+ * any supported date object, see [readme](https://github.com/sebbo2002/ical-generator#-date-time--timezones)
1079
+ * for details about supported values and timezone handling.
1080
+ *
1081
+ * @since 0.2.0
1082
+ * @alias stamp
1083
+ */
1084
+ timestamp(stamp: ICalDateTimeValue): this;
1085
+ /**
1086
+ * Get the event's allDay flag
1087
+ * @since 0.2.0
1088
+ */
1089
+ allDay(): boolean;
1090
+ /**
1091
+ * Set the event's allDay flag.
1092
+ *
1093
+ * ```javascript
1094
+ * event.allDay(true); // → appointment is for the whole day
1095
+ * ```
1096
+ *
1097
+ * @since 0.2.0
1098
+ */
1099
+ allDay(allDay: boolean): this;
1100
+ /**
1101
+ * Get the event's floating flag.
1102
+ * @since 0.2.0
1103
+ */
1104
+ floating(): boolean;
1105
+ floating(floating: boolean): this;
1106
+ /**
1107
+ * Get the event's repeating options
1108
+ * @since 0.2.0
1109
+ */
1110
+ repeating(): ICalEventInternalRepeatingData | ICalRRuleStub | string | null;
1111
+ /**
1112
+ * Set the event's repeating options by passing an [[`ICalRepeatingOptions`]] object.
1113
+ *
1114
+ * ```javascript
1115
+ * event.repeating({
1116
+ * freq: 'MONTHLY', // required
1117
+ * count: 5,
1118
+ * interval: 2,
1119
+ * until: new Date('Jan 01 2014 00:00:00 UTC'),
1120
+ * byDay: ['su', 'mo'], // repeat only sunday and monday
1121
+ * byMonth: [1, 2], // repeat only in january and february,
1122
+ * byMonthDay: [1, 15], // repeat only on the 1st and 15th
1123
+ * bySetPos: 3, // repeat every 3rd sunday (will take the first element of the byDay array)
1124
+ * exclude: [new Date('Dec 25 2013 00:00:00 UTC')], // exclude these dates
1125
+ * excludeTimezone: 'Europe/Berlin', // timezone of exclude
1126
+ * wkst: 'SU' // Start the week on Sunday, default is Monday
1127
+ * });
1128
+ * ```
1129
+ *
1130
+ * @since 0.2.0
1131
+ */
1132
+ repeating(repeating: ICalRepeatingOptions | null): this;
1133
+ /**
1134
+ * Set the event's repeating options by passing an [RRule object](https://github.com/jakubroztocil/rrule).
1135
+ * @since 2.0.0-develop.5
1136
+ */
1137
+ repeating(repeating: ICalRRuleStub | null): this;
1138
+ /**
1139
+ * Set the events repeating options by passing a string which is inserted in the ical file.
1140
+ * @since 2.0.0-develop.5
1141
+ */
1142
+ repeating(repeating: string | null): this;
1143
+ /**
1144
+ * @internal
1145
+ */
1146
+ repeating(repeating: ICalRepeatingOptions | ICalRRuleStub | string | null): this;
1147
+ /**
1148
+ * Get the event's summary
1149
+ * @since 0.2.0
1150
+ */
1151
+ summary(): string;
1152
+ /**
1153
+ * Set the event's summary.
1154
+ * Defaults to an empty string if nothing is set.
1155
+ *
1156
+ * @since 0.2.0
1157
+ */
1158
+ summary(summary: string): this;
1159
+ /**
1160
+ * Get the event's location
1161
+ * @since 0.2.0
1162
+ */
1163
+ location(): ICalLocation | null;
1164
+ /**
1165
+ * Set the event's location by passing a string (minimum) or
1166
+ * an [[`ICalLocation`]] object which will also fill the iCal
1167
+ * `GEO` attribute and Apple's `X-APPLE-STRUCTURED-LOCATION`.
1168
+ *
1169
+ * ```javascript
1170
+ * event.location({
1171
+ * title: 'Apple Store Kurfürstendamm',
1172
+ * address: 'Kurfürstendamm 26, 10719 Berlin, Deutschland',
1173
+ * radius: 141.1751386318387,
1174
+ * geo: {
1175
+ * lat: 52.503630,
1176
+ * lon: 13.328650
1177
+ * }
1178
+ * });
1179
+ * ```
1180
+ *
1181
+ * @since 0.2.0
1182
+ */
1183
+ location(location: ICalLocation | string | null): this;
1184
+ /**
1185
+ * Get the event's description as an [[`ICalDescription`]] object.
1186
+ * @since 0.2.0
1187
+ */
1188
+ description(): ICalDescription | null;
1189
+ /**
1190
+ * Set the events description by passing a plaintext string or
1191
+ * an object containing both a plaintext and a html description.
1192
+ * Only a few calendar apps support html descriptions and like in
1193
+ * emails, supported HTML tags and styling is limited.
1194
+ *
1195
+ * ```javascript
1196
+ * event.description({
1197
+ * plain: 'Hello World!';
1198
+ * html: '<p>Hello World!</p>';
1199
+ * });
1200
+ * ```
1201
+ *
1202
+ * @since 0.2.0
1203
+ */
1204
+ description(description: ICalDescription | string | null): this;
1205
+ /**
1206
+ * Get the event's organizer
1207
+ * @since 0.2.0
1208
+ */
1209
+ organizer(): ICalOrganizer | null;
1210
+ /**
1211
+ * Set the event's organizer
1212
+ *
1213
+ * ```javascript
1214
+ * event.organizer({
1215
+ * name: 'Organizer\'s Name',
1216
+ * email: 'organizer@example.com'
1217
+ * });
1218
+ *
1219
+ * // OR
1220
+ *
1221
+ * event.organizer('Organizer\'s Name <organizer@example.com>');
1222
+ * ```
1223
+ *
1224
+ * You can also add an explicit `mailto` email address or or the sentBy address.
1225
+ *
1226
+ * ```javascript
1227
+ * event.organizer({
1228
+ * name: 'Organizer\'s Name',
1229
+ * email: 'organizer@example.com',
1230
+ * mailto: 'explicit@mailto.com',
1231
+ * sentBy: 'substitute@example.com'
1232
+ * })
1233
+ * ```
1234
+ *
1235
+ * @since 0.2.0
1236
+ */
1237
+ organizer(organizer: ICalOrganizer | string | null): this;
1238
+ /**
1239
+ * Creates a new [[`ICalAttendee`]] and returns it. Use options to prefill
1240
+ * the attendee's attributes. Calling this method without options will create
1241
+ * an empty attendee.
1242
+ *
1243
+ * ```javascript
1244
+ * const cal = ical();
1245
+ * const event = cal.createEvent();
1246
+ * const attendee = event.createAttendee({email: 'hui@example.com', name: 'Hui'});
1247
+ *
1248
+ * // add another attendee
1249
+ * event.createAttendee('Buh <buh@example.net>');
1250
+ * ```
1251
+ *
1252
+ * As with the organizer, you can also add an explicit `mailto` address.
1253
+ *
1254
+ * ```javascript
1255
+ * event.createAttendee({email: 'hui@example.com', name: 'Hui', mailto: 'another@mailto.com'});
1256
+ *
1257
+ * // overwrite an attendee's mailto address
1258
+ * attendee.mailto('another@mailto.net');
1259
+ * ```
1260
+ *
1261
+ * @since 0.2.0
1262
+ */
1263
+ createAttendee(data?: ICalAttendee | ICalAttendeeData | string): ICalAttendee;
1264
+ /**
1265
+ * Get all attendees
1266
+ * @since 0.2.0
1267
+ */
1268
+ attendees(): ICalAttendee[];
1269
+ /**
1270
+ * Add multiple attendees to your event
1271
+ *
1272
+ * ```javascript
1273
+ * const event = ical().createEvent();
1274
+ *
1275
+ * cal.attendees([
1276
+ * {email: 'a@example.com', name: 'Person A'},
1277
+ * {email: 'b@example.com', name: 'Person B'}
1278
+ * ]);
1279
+ *
1280
+ * cal.attendees(); // --> [ICalAttendee, ICalAttendee]
1281
+ * ```
1282
+ *
1283
+ * @since 0.2.0
1284
+ */
1285
+ attendees(attendees: (ICalAttendee | ICalAttendeeData | string)[]): this;
1286
+ /**
1287
+ * Creates a new [[`ICalAlarm`]] and returns it. Use options to prefill
1288
+ * the alarm's attributes. Calling this method without options will create
1289
+ * an empty alarm.
1290
+ *
1291
+ * ```javascript
1292
+ * const cal = ical();
1293
+ * const event = cal.createEvent();
1294
+ * const alarm = event.createAlarm({type: ICalAlarmType.display, trigger: 300});
1295
+ *
1296
+ * // add another alarm
1297
+ * event.createAlarm({
1298
+ * type: ICalAlarmType.audio,
1299
+ * trigger: 300, // 5min before event
1300
+ * });
1301
+ * ```
1302
+ *
1303
+ * @since 0.2.1
1304
+ */
1305
+ createAlarm(data?: ICalAlarm | ICalAlarmData): ICalAlarm;
1306
+ /**
1307
+ * Get all alarms
1308
+ * @since 0.2.0
1309
+ */
1310
+ alarms(): ICalAlarm[];
1311
+ /**
1312
+ * Add one or multiple alarms
1313
+ *
1314
+ * ```javascript
1315
+ * const event = ical().createEvent();
1316
+ *
1317
+ * cal.alarms([
1318
+ * {type: ICalAlarmType.display, trigger: 600},
1319
+ * {type: ICalAlarmType.audio, trigger: 300}
1320
+ * ]);
1321
+ *
1322
+ * cal.alarms(); // --> [ICalAlarm, ICalAlarm]
1323
+ ```
1324
+ *
1325
+ * @since 0.2.0
1326
+ */
1327
+ alarms(alarms: ICalAlarm[] | ICalAlarmData[]): this;
1328
+ /**
1329
+ * Creates a new [[`ICalCategory`]] and returns it. Use options to prefill the categories' attributes.
1330
+ * Calling this method without options will create an empty category.
1331
+ *
1332
+ * ```javascript
1333
+ * const cal = ical();
1334
+ * const event = cal.createEvent();
1335
+ * const category = event.createCategory({name: 'APPOINTMENT'});
1336
+ *
1337
+ * // add another alarm
1338
+ * event.createCategory({
1339
+ * name: 'MEETING'
1340
+ * });
1341
+ * ```
1342
+ *
1343
+ * @since 0.3.0
1344
+ */
1345
+ createCategory(data?: ICalCategory | ICalCategoryData): ICalCategory;
1346
+ /**
1347
+ * Get all categories
1348
+ * @since 0.3.0
1349
+ */
1350
+ categories(): ICalCategory[];
1351
+ /**
1352
+ * Add categories to the event or return all selected categories.
1353
+ *
1354
+ * ```javascript
1355
+ * const event = ical().createEvent();
1356
+ *
1357
+ * cal.categories([
1358
+ * {name: 'APPOINTMENT'},
1359
+ * {name: 'MEETING'}
1360
+ * ]);
1361
+ *
1362
+ * cal.categories(); // --> [ICalCategory, ICalCategory]
1363
+ * ```
1364
+ *
1365
+ * @since 0.3.0
1366
+ */
1367
+ categories(categories: (ICalCategory | ICalCategoryData)[]): this;
1368
+ /**
1369
+ * Get the event's status
1370
+ * @since 0.2.0
1371
+ */
1372
+ status(): ICalEventStatus | null;
1373
+ /**
1374
+ * Set the event's status
1375
+ *
1376
+ * ```javascript
1377
+ * import ical, {ICalEventStatus} from 'ical-generator';
1378
+ * event.status(ICalEventStatus.CONFIRMED);
1379
+ * ```
1380
+ *
1381
+ * @since 0.2.0
1382
+ */
1383
+ status(status: ICalEventStatus | null): this;
1384
+ /**
1385
+ * Get the event's busy status
1386
+ * @since 1.0.2
1387
+ */
1388
+ busystatus(): ICalEventBusyStatus | null;
1389
+ /**
1390
+ * Set the event's busy status. Will add the
1391
+ * [`X-MICROSOFT-CDO-BUSYSTATUS`](https://docs.microsoft.com/en-us/openspecs/exchange_server_protocols/ms-oxcical/cd68eae7-ed65-4dd3-8ea7-ad585c76c736)
1392
+ * attribute to your event.
1393
+ *
1394
+ * ```javascript
1395
+ * import ical, {ICalEventBusyStatus} from 'ical-generator';
1396
+ * event.busystatus(ICalEventStatus.BUSY);
1397
+ * ```
1398
+ *
1399
+ * @since 1.0.2
1400
+ */
1401
+ busystatus(busystatus: ICalEventBusyStatus | null): this;
1402
+ /**
1403
+ * Get the event's priority. A value of 1 represents
1404
+ * the highest priority, 9 the lowest. 0 specifies an undefined
1405
+ * priority.
1406
+ *
1407
+ * @since v2.0.0-develop.7
1408
+ */
1409
+ priority(): number | null;
1410
+ /**
1411
+ * Set the event's priority. A value of 1 represents
1412
+ * the highest priority, 9 the lowest. 0 specifies an undefined
1413
+ * priority.
1414
+ *
1415
+ * @since v2.0.0-develop.7
1416
+ */
1417
+ priority(priority: number | null): this;
1418
+ /**
1419
+ * Get the event's URL
1420
+ * @since 0.2.0
1421
+ */
1422
+ url(): string | null;
1423
+ /**
1424
+ * Set the event's URL
1425
+ * @since 0.2.0
1426
+ */
1427
+ url(url: string | null): this;
1428
+ /**
1429
+ * Adds an attachment to the event by adding the file URL to the calendar.
1430
+ *
1431
+ * `ical-generator` only supports external attachments. File attachments that
1432
+ * are directly included in the file are not supported, because otherwise the
1433
+ * calendar file could easily become unfavourably large.
1434
+ *
1435
+ * ```javascript
1436
+ * const cal = ical();
1437
+ * const event = cal.createEvent();
1438
+ * event.createAttachment('https://files.sebbo.net/calendar/attachments/foo');
1439
+ * ```
1440
+ *
1441
+ * @since 3.2.0-develop.1
1442
+ */
1443
+ createAttachment(url: string): this;
1444
+ /**
1445
+ * Get all attachment urls
1446
+ * @since 3.2.0-develop.1
1447
+ */
1448
+ attachments(): string[];
1449
+ /**
1450
+ * Add one or multiple alarms
1451
+ *
1452
+ * ```javascript
1453
+ * const event = ical().createEvent();
1454
+ *
1455
+ * cal.attachments([
1456
+ * 'https://files.sebbo.net/calendar/attachments/foo',
1457
+ * 'https://files.sebbo.net/calendar/attachments/bar'
1458
+ * ]);
1459
+ *
1460
+ * cal.attachments(); // --> [string, string]
1461
+ ```
1462
+ *
1463
+ * 3.2.0-develop.1
1464
+ */
1465
+ attachments(attachments: string[]): this;
1466
+ /**
1467
+ * Get the event's transparency
1468
+ * @since 1.7.3
1469
+ */
1470
+ transparency(): ICalEventTransparency | null;
1471
+ /**
1472
+ * Set the event's transparency
1473
+ *
1474
+ * Set the field to `OPAQUE` if the person or resource is no longer
1475
+ * available due to this event. If the calendar entry has no influence
1476
+ * on availability, you can set the field to `TRANSPARENT`. This value
1477
+ * is mostly used to find out if a person has time on a certain date or
1478
+ * not (see `TRANSP` in iCal specification).
1479
+ *
1480
+ * ```javascript
1481
+ * import ical, {ICalEventTransparency} from 'ical-generator';
1482
+ * event.transparency(ICalEventTransparency.OPAQUE);
1483
+ * ```
1484
+ *
1485
+ * @since 1.7.3
1486
+ */
1487
+ transparency(transparency: ICalEventTransparency | null): this;
1488
+ /**
1489
+ * Get the event's creation date
1490
+ * @since 0.3.0
1491
+ */
1492
+ created(): ICalDateTimeValue | null;
1493
+ /**
1494
+ * Set the event's creation date
1495
+ * @since 0.3.0
1496
+ */
1497
+ created(created: ICalDateTimeValue | null): this;
1498
+ /**
1499
+ * Get the event's last modification date
1500
+ * @since 0.3.0
1501
+ */
1502
+ lastModified(): ICalDateTimeValue | null;
1503
+ /**
1504
+ * Set the event's last modification date
1505
+ * @since 0.3.0
1506
+ */
1507
+ lastModified(lastModified: ICalDateTimeValue | null): this;
1508
+ /**
1509
+ * Get the event's class
1510
+ * @since 2.0.0
1511
+ */
1512
+ class(): ICalEventClass | null;
1513
+ /**
1514
+ * Set the event's class
1515
+ *
1516
+ * ```javascript
1517
+ * import ical, { ICalEventClass } from 'ical-generator';
1518
+ * event.class(ICalEventClass.PRIVATE);
1519
+ * ```
1520
+ *
1521
+ * @since 2.0.0
1522
+ */
1523
+ class(class_: ICalEventClass | null): this;
1524
+ /**
1525
+ * Set X-* attributes. Woun't filter double attributes,
1526
+ * which are also added by another method (e.g. summary),
1527
+ * so these attributes may be inserted twice.
1528
+ *
1529
+ * ```javascript
1530
+ * event.x([
1531
+ * {
1532
+ * key: "X-MY-CUSTOM-ATTR",
1533
+ * value: "1337!"
1534
+ * }
1535
+ * ]);
1536
+ *
1537
+ * event.x([
1538
+ * ["X-MY-CUSTOM-ATTR", "1337!"]
1539
+ * ]);
1540
+ *
1541
+ * event.x({
1542
+ * "X-MY-CUSTOM-ATTR": "1337!"
1543
+ * });
1544
+ * ```
1545
+ *
1546
+ * @since 1.9.0
1547
+ */
1548
+ x(keyOrArray: {
1549
+ key: string;
1550
+ value: string;
1551
+ }[] | [string, string][] | Record<string, string>): this;
1552
+ /**
1553
+ * Set a X-* attribute. Woun't filter double attributes,
1554
+ * which are also added by another method (e.g. summary),
1555
+ * so these attributes may be inserted twice.
1556
+ *
1557
+ * ```javascript
1558
+ * event.x("X-MY-CUSTOM-ATTR", "1337!");
1559
+ * ```
1560
+ *
1561
+ * @since 1.9.0
1562
+ */
1563
+ x(keyOrArray: string, value: string): this;
1564
+ /**
1565
+ * Get all custom X-* attributes.
1566
+ * @since 1.9.0
1567
+ */
1568
+ x(): {
1569
+ key: string;
1570
+ value: string;
1571
+ }[];
1572
+ /**
1573
+ * Return a shallow copy of the events's options for JSON stringification.
1574
+ * Third party objects like moment.js values or RRule objects are stringified
1575
+ * as well. Can be used for persistence.
1576
+ *
1577
+ * ```javascript
1578
+ * const event = ical().createEvent();
1579
+ * const json = JSON.stringify(event);
1580
+ *
1581
+ * // later: restore event data
1582
+ * const calendar = ical().createEvent(JSON.parse(json));
1583
+ * ```
1584
+ *
1585
+ * @since 0.2.4
1586
+ */
1587
+ toJSON(): ICalEventJSONData;
1588
+ /**
1589
+ * Return generated event as a string.
1590
+ *
1591
+ * ```javascript
1592
+ * const event = ical().createEvent();
1593
+ * console.log(event.toString()); // → BEGIN:VEVENT…
1594
+ * ```
1595
+ */
1596
+ toString(): string;
1597
+ }
1598
+
1599
+ interface ICalCalendarData {
1600
+ prodId?: ICalCalendarProdIdData | string;
1601
+ method?: ICalCalendarMethod | null;
1602
+ name?: string | null;
1603
+ description?: string | null;
1604
+ timezone?: ICalTimezone | string | null;
1605
+ source?: string | null;
1606
+ url?: string | null;
1607
+ scale?: string | null;
1608
+ ttl?: number | ICalMomentDurationStub | null;
1609
+ events?: (ICalEvent | ICalEventData)[];
1610
+ x?: {
1611
+ key: string;
1612
+ value: string;
1613
+ }[] | [string, string][] | Record<string, string>;
1614
+ }
1615
+ interface ICalCalendarJSONData {
1616
+ prodId: string;
1617
+ method: ICalCalendarMethod | null;
1618
+ name: string | null;
1619
+ description: string | null;
1620
+ timezone: string | null;
1621
+ source: string | null;
1622
+ url: string | null;
1623
+ scale: string | null;
1624
+ ttl: number | null;
1625
+ events: ICalEventJSONData[];
1626
+ x: {
1627
+ key: string;
1628
+ value: string;
1629
+ }[];
1630
+ }
1631
+ interface ICalCalendarProdIdData {
1632
+ company: string;
1633
+ product: string;
1634
+ language?: string;
1635
+ }
1636
+ declare enum ICalCalendarMethod {
1637
+ PUBLISH = "PUBLISH",
1638
+ REQUEST = "REQUEST",
1639
+ REPLY = "REPLY",
1640
+ ADD = "ADD",
1641
+ CANCEL = "CANCEL",
1642
+ REFRESH = "REFRESH",
1643
+ COUNTER = "COUNTER",
1644
+ DECLINECOUNTER = "DECLINECOUNTER"
1645
+ }
1646
+ /**
1647
+ * Usually you get an `ICalCalendar` object like this:
1648
+ * ```javascript
1649
+ * import ical from 'ical-generator';
1650
+ * const calendar = ical();
1651
+ * ```
1652
+ *
1653
+ * But you can also use the constructor directly like this:
1654
+ * ```javascript
1655
+ * import {ICalCalendar} from 'ical-generator';
1656
+ * const calendar = new ICalCalendar();
1657
+ * ```
1658
+ */
1659
+ declare class ICalCalendar {
1660
+ private readonly data;
1661
+ /**
1662
+ * You can pass options to setup your calendar or use setters to do this.
1663
+ *
1664
+ * ```javascript
1665
+ * * import ical from 'ical-generator';
1666
+ *
1667
+ * // or use require:
1668
+ * // const { default: ical } = require('ical-generator');
1669
+ *
1670
+ *
1671
+ * const cal = ical({name: 'my first iCal'});
1672
+ *
1673
+ * // is the same as
1674
+ *
1675
+ * const cal = ical().name('my first iCal');
1676
+ *
1677
+ * // is the same as
1678
+ *
1679
+ * const cal = ical();
1680
+ * cal.name('sebbo.net');
1681
+ * ```
1682
+ *
1683
+ * @param data Calendar data
1684
+ */
1685
+ constructor(data?: ICalCalendarData);
1686
+ /**
1687
+ * Get your feed's prodid. Will always return a string.
1688
+ * @since 0.2.0
1689
+ */
1690
+ prodId(): string;
1691
+ /**
1692
+ * Set your feed's prodid. `prodid` can be either a
1693
+ * string like `//sebbo.net//ical-generator//EN` or a
1694
+ * valid [[`ICalCalendarProdIdData`]] object. `language`
1695
+ * is optional and defaults to `EN`.
1696
+ *
1697
+ * ```javascript
1698
+ * cal.prodId({
1699
+ * company: 'My Company',
1700
+ * product: 'My Product',
1701
+ * language: 'EN' // optional, defaults to EN
1702
+ * });
1703
+ * ```
1704
+ *
1705
+ * @since 0.2.0
1706
+ */
1707
+ prodId(prodId: ICalCalendarProdIdData | string): this;
1708
+ /**
1709
+ * Get the feed method attribute.
1710
+ * See [[`ICalCalendarMethod`]] for possible results.
1711
+ *
1712
+ * @since 0.2.8
1713
+ */
1714
+ method(): ICalCalendarMethod | null;
1715
+ /**
1716
+ * Set the feed method attribute.
1717
+ * See [[`ICalCalendarMethod`]] for available options.
1718
+ *
1719
+ * #### Typescript Example
1720
+ * ```typescript
1721
+ * import {ICalCalendarMethod} from 'ical-generator';
1722
+ * calendar.method(ICalCalendarMethod.PUBLISH);
1723
+ * ```
1724
+ *
1725
+ * @since 0.2.8
1726
+ */
1727
+ method(method: ICalCalendarMethod | null): this;
1728
+ /**
1729
+ * Get your feed's name
1730
+ * @since 0.2.0
1731
+ */
1732
+ name(): string | null;
1733
+ /**
1734
+ * Set your feed's name. Is used to fill `NAME`
1735
+ * and `X-WR-CALNAME` in your iCal file.
1736
+ *
1737
+ * @since 0.2.0
1738
+ */
1739
+ name(name: string | null): this;
1740
+ /**
1741
+ * Get your feed's description
1742
+ * @since 0.2.7
1743
+ */
1744
+ description(): string | null;
1745
+ /**
1746
+ * Set your feed's description
1747
+ * @since 0.2.7
1748
+ */
1749
+ description(description: string | null): this;
1750
+ /**
1751
+ * Get the current calendar timezone
1752
+ * @since 0.2.0
1753
+ */
1754
+ timezone(): string | null;
1755
+ /**
1756
+ * Use this method to set your feed's timezone. Is used
1757
+ * to fill `TIMEZONE-ID` and `X-WR-TIMEZONE` in your iCal export.
1758
+ * Please not that all date values are treaded differently, if
1759
+ * a timezone was set. See [[`formatDate`]] for details. If no
1760
+ * time zone is specified, all information is output as UTC.
1761
+ *
1762
+ * ```javascript
1763
+ * cal.timezone('America/New_York');
1764
+ * ```
1765
+ *
1766
+ * @see https://github.com/sebbo2002/ical-generator#-date-time--timezones
1767
+ * @since 0.2.0
1768
+ */
1769
+ timezone(timezone: string | null): this;
1770
+ /**
1771
+ * Sets the time zone to be used in this calendar file for all times of all
1772
+ * events. Please note that if the time zone is set, ical-generator assumes
1773
+ * that all times are already in the correct time zone. Alternatively, a
1774
+ * `moment-timezone` or a Luxon object can be passed with `setZone`,
1775
+ * ical-generator will then set the time zone itself.
1776
+ *
1777
+ * For the best support of time zones, a VTimezone entry in the calendar is
1778
+ * recommended, which informs the client about the corresponding time zones
1779
+ * (daylight saving time, deviation from UTC, etc.). `ical-generator` itself
1780
+ * does not have a time zone database, so an external generator is needed here.
1781
+ *
1782
+ * A VTimezone generator is a function that takes a time zone as a string and
1783
+ * returns a VTimezone component according to the ical standard. For example,
1784
+ * ical-timezones can be used for this:
1785
+ *
1786
+ * ```typescript
1787
+ * import ical from 'ical-generator';
1788
+ * import {getVtimezoneComponent} from '@touch4it/ical-timezones';
1789
+ *
1790
+ * const cal = new ICalCalendar();
1791
+ * cal.timezone({
1792
+ * name: 'FOO',
1793
+ * generator: getVtimezoneComponent
1794
+ * });
1795
+ * cal.createEvent({
1796
+ * start: new Date(),
1797
+ * timezone: 'Europe/London'
1798
+ * });
1799
+ * ```
1800
+ *
1801
+ * @see https://github.com/sebbo2002/ical-generator#-date-time--timezones
1802
+ * @since 2.0.0
1803
+ */
1804
+ timezone(timezone: ICalTimezone | string | null): this;
1805
+ /**
1806
+ * Get current value of the `SOURCE` attribute.
1807
+ * @since 2.2.0-develop.1
1808
+ */
1809
+ source(): string | null;
1810
+ /**
1811
+ * Use this method to set your feed's `SOURCE` attribute.
1812
+ * This tells the client where to refresh your feed.
1813
+ *
1814
+ * ```javascript
1815
+ * cal.source('http://example.com/my/original_source.ical');
1816
+ * ```
1817
+ *
1818
+ * @since 2.2.0-develop.1
1819
+ */
1820
+ source(source: string | null): this;
1821
+ /**
1822
+ * Get your feed's URL
1823
+ * @since 0.2.5
1824
+ */
1825
+ url(): string | null;
1826
+ /**
1827
+ * Set your feed's URL
1828
+ *
1829
+ * ```javascript
1830
+ * calendar.url('http://example.com/my/feed.ical');
1831
+ * ```
1832
+ *
1833
+ * @since 0.2.5
1834
+ */
1835
+ url(url: string | null): this;
1836
+ /**
1837
+ * Get current value of the `CALSCALE` attribute. It will
1838
+ * return `null` if no value was set. The iCal standard
1839
+ * specifies this as `GREGORIAN` if no value is present.
1840
+ *
1841
+ * @since 1.8.0
1842
+ */
1843
+ scale(): string | null;
1844
+ /**
1845
+ * Use this method to set your feed's `CALSCALE` attribute. There is no
1846
+ * default value for this property and it will not appear in your iCal
1847
+ * file unless set. The iCal standard specifies this as `GREGORIAN` if
1848
+ * no value is present.
1849
+ *
1850
+ * ```javascript
1851
+ * cal.scale('gregorian');
1852
+ * ```
1853
+ *
1854
+ * @since 1.8.0
1855
+ */
1856
+ scale(scale: string | null): this;
1857
+ /**
1858
+ * Get the current ttl duration in seconds
1859
+ * @since 0.2.5
1860
+ */
1861
+ ttl(): number | null;
1862
+ /**
1863
+ * Use this method to set your feed's time to live
1864
+ * (in seconds). Is used to fill `REFRESH-INTERVAL` and
1865
+ * `X-PUBLISHED-TTL` in your iCal.
1866
+ *
1867
+ * ```javascript
1868
+ * const cal = ical().ttl(60 * 60 * 24); // 1 day
1869
+ * ```
1870
+ *
1871
+ * You can also pass a moment.js duration object. Zero, null
1872
+ * or negative numbers will reset the `ttl` attribute.
1873
+ *
1874
+ * @since 0.2.5
1875
+ */
1876
+ ttl(ttl: number | ICalMomentDurationStub | null): this;
1877
+ /**
1878
+ * Creates a new [[`ICalEvent`]] and returns it. Use options to prefill the event's attributes.
1879
+ * Calling this method without options will create an empty event.
1880
+ *
1881
+ * ```javascript
1882
+ * import ical from 'ical-generator';
1883
+ *
1884
+ * // or use require:
1885
+ * // const { default: ical } = require('ical-generator');
1886
+ *
1887
+ * const cal = ical();
1888
+ * const event = cal.createEvent({summary: 'My Event'});
1889
+ *
1890
+ * // overwrite event summary
1891
+ * event.summary('Your Event');
1892
+ * ```
1893
+ *
1894
+ * @since 0.2.0
1895
+ */
1896
+ createEvent(data: ICalEvent | ICalEventData): ICalEvent;
1897
+ /**
1898
+ * Returns all events of this calendar.
1899
+ *
1900
+ * ```javascript
1901
+ * const cal = ical();
1902
+ *
1903
+ * cal.events([
1904
+ * {
1905
+ * start: new Date(),
1906
+ * end: new Date(new Date().getTime() + 3600000),
1907
+ * summary: 'Example Event',
1908
+ * description: 'It works ;)',
1909
+ * url: 'http://sebbo.net/'
1910
+ * }
1911
+ * ]);
1912
+ *
1913
+ * cal.events(); // --> [ICalEvent]
1914
+ * ```
1915
+ *
1916
+ * @since 0.2.0
1917
+ */
1918
+ events(): ICalEvent[];
1919
+ /**
1920
+ * Add multiple events to your calendar.
1921
+ *
1922
+ * ```javascript
1923
+ * const cal = ical();
1924
+ *
1925
+ * cal.events([
1926
+ * {
1927
+ * start: new Date(),
1928
+ * end: new Date(new Date().getTime() + 3600000),
1929
+ * summary: 'Example Event',
1930
+ * description: 'It works ;)',
1931
+ * url: 'http://sebbo.net/'
1932
+ * }
1933
+ * ]);
1934
+ *
1935
+ * cal.events(); // --> [ICalEvent]
1936
+ * ```
1937
+ *
1938
+ * @since 0.2.0
1939
+ */
1940
+ events(events: (ICalEvent | ICalEventData)[]): this;
1941
+ /**
1942
+ * Remove all events from the calendar without
1943
+ * touching any other data like name or prodId.
1944
+ *
1945
+ * @since 2.0.0-develop.1
1946
+ */
1947
+ clear(): this;
1948
+ /**
1949
+ * Save ical file using [`fs/promises`](https://nodejs.org/api/fs.html#fs_fspromises_writefile_file_data_options).
1950
+ * Only works in node.js environments.
1951
+ *
1952
+ * ```javascript
1953
+ * await calendar.save('./calendar.ical');
1954
+ * ```
1955
+ */
1956
+ save(path: string): Promise<void>;
1957
+ /**
1958
+ * Save ical file with [`fs.writeFile`](http://nodejs.org/api/fs.html#fs_fs_writefile_filename_data_options_callback).
1959
+ * Only works in node.js environments.
1960
+ *
1961
+ * ```javascript
1962
+ * calendar.save('./calendar.ical', err => {
1963
+ * console.log(err);
1964
+ * });
1965
+ * ```
1966
+ */
1967
+ save(path: string, cb?: (err: NodeJS.ErrnoException | null) => void): this;
1968
+ /**
1969
+ * Save Calendar to disk synchronously using
1970
+ * [fs.writeFileSync](http://nodejs.org/api/fs.html#fs_fs_writefilesync_filename_data_options).
1971
+ * Only works in node.js environments.
1972
+ *
1973
+ * ```javascript
1974
+ * calendar.saveSync('./calendar.ical');
1975
+ * ```
1976
+ */
1977
+ saveSync(path: string): this;
1978
+ /**
1979
+ * Send calendar to the user when using HTTP using the passed `ServerResponse` object.
1980
+ * Use second parameter `filename` to change the filename, which defaults to `'calendar.ics'`.
1981
+ *
1982
+ * @param response HTTP Response object which is used to send the calendar
1983
+ * @param [filename = 'calendar.ics'] Filename of the calendar file
1984
+ */
1985
+ serve(response: ServerResponse, filename?: string): this;
1986
+ /**
1987
+ * Generates a blob to use for downloads or to generate a download URL.
1988
+ * Only supported in browsers supporting the Blob API.
1989
+ *
1990
+ * @since 1.9.0
1991
+ */
1992
+ toBlob(): Blob;
1993
+ /**
1994
+ * Returns a URL to download the ical file. Uses the Blob object internally,
1995
+ * so it's only supported in browsers supporting the Blob API.
1996
+ *
1997
+ * @since 1.9.0
1998
+ */
1999
+ toURL(): string;
2000
+ /**
2001
+ * Set X-* attributes. Woun't filter double attributes,
2002
+ * which are also added by another method (e.g. busystatus),
2003
+ * so these attributes may be inserted twice.
2004
+ *
2005
+ * ```javascript
2006
+ * calendar.x([
2007
+ * {
2008
+ * key: "X-MY-CUSTOM-ATTR",
2009
+ * value: "1337!"
2010
+ * }
2011
+ * ]);
2012
+ *
2013
+ * calendar.x([
2014
+ * ["X-MY-CUSTOM-ATTR", "1337!"]
2015
+ * ]);
2016
+ *
2017
+ * calendar.x({
2018
+ * "X-MY-CUSTOM-ATTR": "1337!"
2019
+ * });
2020
+ * ```
2021
+ *
2022
+ * @since 1.9.0
2023
+ */
2024
+ x(keyOrArray: {
2025
+ key: string;
2026
+ value: string;
2027
+ }[] | [string, string][] | Record<string, string>): this;
2028
+ /**
2029
+ * Set a X-* attribute. Woun't filter double attributes,
2030
+ * which are also added by another method (e.g. busystatus),
2031
+ * so these attributes may be inserted twice.
2032
+ *
2033
+ * ```javascript
2034
+ * calendar.x("X-MY-CUSTOM-ATTR", "1337!");
2035
+ * ```
2036
+ *
2037
+ * @since 1.9.0
2038
+ */
2039
+ x(keyOrArray: string, value: string): this;
2040
+ /**
2041
+ * Get all custom X-* attributes.
2042
+ * @since 1.9.0
2043
+ */
2044
+ x(): {
2045
+ key: string;
2046
+ value: string;
2047
+ }[];
2048
+ /**
2049
+ * Return a shallow copy of the calendar's options for JSON stringification.
2050
+ * Third party objects like moment.js values or RRule objects are stringified
2051
+ * as well. Can be used for persistence.
2052
+ *
2053
+ * ```javascript
2054
+ * const cal = ical();
2055
+ * const json = JSON.stringify(cal);
2056
+ *
2057
+ * // later: restore calendar data
2058
+ * cal = ical(JSON.parse(json));
2059
+ * ```
2060
+ *
2061
+ * @since 0.2.4
2062
+ */
2063
+ toJSON(): ICalCalendarJSONData;
2064
+ /**
2065
+ * Get the number of events added to your calendar
2066
+ */
2067
+ length(): number;
2068
+ /**
2069
+ * Return generated calendar as a string.
2070
+ *
2071
+ * ```javascript
2072
+ * const cal = ical();
2073
+ * console.log(cal.toString()); // → BEGIN:VCALENDAR…
2074
+ * ```
2075
+ */
2076
+ toString(): string;
2077
+ }
2078
+
2079
+ /**
2080
+ * Converts a valid date/time object supported by this library to a string.
2081
+ */
2082
+ declare function formatDate(timezone: string | null, d: ICalDateTimeValue, dateonly?: boolean, floating?: boolean): string;
2083
+ /**
2084
+ * Converts a valid date/time object supported by this library to a string.
2085
+ * For information about this format, see RFC 5545, section 3.3.5
2086
+ * https://tools.ietf.org/html/rfc5545#section-3.3.5
2087
+ */
2088
+ declare function formatDateTZ(timezone: string | null, property: string, date: ICalDateTimeValue | Date | string, eventData?: {
2089
+ floating?: boolean | null;
2090
+ timezone?: string | null;
2091
+ }): string;
2092
+ /**
2093
+ * Escapes special characters in the given string
2094
+ */
2095
+ declare function escape(str: string | unknown, inQuotes: boolean): string;
2096
+ /**
2097
+ * Trim line length of given string
2098
+ */
2099
+ declare function foldLines(input: string): string;
2100
+
2101
+ /**
2102
+ * ical-generator entrypoint
2103
+ */
2104
+
2105
+ /**
2106
+ * Create a new, empty calendar and returns it.
2107
+ *
2108
+ * ```javascript
2109
+ * import ical from 'ical-generator';
2110
+ *
2111
+ * // or use require:
2112
+ * // const { default: ical } = require('ical-generator');
2113
+ *
2114
+ * const cal = ical();
2115
+ * ```
2116
+ *
2117
+ * You can pass options to setup your calendar or use setters to do this.
2118
+ *
2119
+ * ```javascript
2120
+ * import ical from 'ical-generator';
2121
+ *
2122
+ * // or use require:
2123
+ * // const { default: ical } = require('ical-generator');
2124
+ * const cal = ical({domain: 'sebbo.net'});
2125
+ *
2126
+ * // is the same as
2127
+ *
2128
+ * const cal = ical().domain('sebbo.net');
2129
+ *
2130
+ * // is the same as
2131
+ *
2132
+ * const cal = ical();
2133
+ * cal.domain('sebbo.net');
2134
+ * ```
2135
+ *
2136
+ * @param data Calendar data
2137
+ */
2138
+ declare function ical(data?: ICalCalendarData): ICalCalendar;
2139
+
2140
+ export { ICalAlarm, ICalAlarmData, ICalAlarmJSONData, ICalAlarmType, ICalAlarmTypeValue, ICalAttachment, ICalAttendee, ICalAttendeeData, ICalAttendeeJSONData, ICalAttendeeRole, ICalAttendeeStatus, ICalAttendeeType, ICalCalendar, ICalCalendarData, ICalCalendarJSONData, ICalCalendarMethod, ICalCalendarProdIdData, ICalCategory, ICalCategoryData, ICalDateTimeValue, ICalDayJsStub, ICalDescription, ICalEvent, ICalEventBusyStatus, ICalEventClass, ICalEventData, ICalEventJSONData, ICalEventRepeatingFreq, ICalEventStatus, ICalEventTransparency, ICalGeo, ICalLocation, ICalLuxonDateTimeStub, ICalMomentDurationStub, ICalMomentStub, ICalMomentTimezoneStub, ICalOrganizer, ICalRRuleStub, ICalRepeatingOptions, ICalTimezone, ICalWeekday, ical as default, escape, foldLines, formatDate, formatDateTZ };