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