ical-generator 10.2.0-develop.3 → 10.2.0-develop.4

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