Skip to content

All Components

If you haven't already, first check out Component over at base classes. These are part of the components you can encounter in a iCalendar data file. The others are mentioned in Recurring components and Timezone components.

Simple components

We start out with the components that are relatively straight forward. There is no recurring option here.

VFreeBusy

Bases: Component

This class represents the VFREEBUSY component specified in RFC 5545 in '3.6.4. Free/Busy Component'.

A "VFREEBUSY" calendar component is a grouping of component properties that represents either a request for free or busy time information, a reply to a request for free or busy time information, or a published set of busy time information.

Parameters:

Name Type Description Default
name

The actual name of this component instance. E.g. VEVENT, RRULE, VCUSTOMCOMPONENT.

required
dtstamp Optional[DTStamp]

The DTStamp property. Required and must occur exactly once.

None
uid Optional[UID]

The UID property. Required and must occur exactly once.

None
contact Optional[Contact]

The Contact property. Optional, but may occur at most once.

None
dtstart Optional[DTStart]

The DTStart property. Optional, but may occur at most once.

None
dtend Optional[DTEnd]

The DTEnd property. Optional, but may occur at most once.

None
organizer Optional[Organizer]

The Organizer property. Optional, but may occur at most once.

None
url Optional[URL]

The URL property. Optional, but may occur at most once.

None
attendee Optional[List[Attendee]]

The Attendee property. Optional, but may occur multiple times.

None
comment Optional[List[Comment]]

The Comment property. Optional, but may occur multiple times.

None
freebusy Optional[List[FreeBusyProperty]]

The FreeBusyProperty property. Optional, but may occur multiple times.

None
rstatus Optional[List[RequestStatus]]

The RequestStatus property. Optional, but may occur multiple times.

None
parent Optional[Component]

The Component this item is encapsulated by in the iCalendar data file.

None
Source code in ical_library/ical_components/v_free_busy.py
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
class VFreeBusy(Component):
    """
    This class represents the VFREEBUSY component specified in RFC 5545 in '3.6.4. Free/Busy Component'.

    A "VFREEBUSY" calendar component is a grouping of component properties that represents either a request for free
    or busy time information, a reply to a request for free or busy time information, or a published set of busy time
    information.

    :param name: The actual name of this component instance. E.g. VEVENT, RRULE, VCUSTOMCOMPONENT.
    :param dtstamp: The DTStamp property. Required and must occur exactly once.
    :param uid: The UID property. Required and must occur exactly once.
    :param contact: The Contact property. Optional, but may occur at most once.
    :param dtstart: The DTStart property. Optional, but may occur at most once.
    :param dtend: The DTEnd property. Optional, but may occur at most once.
    :param organizer: The Organizer property. Optional, but may occur at most once.
    :param url: The URL property. Optional, but may occur at most once.
    :param attendee: The Attendee property. Optional, but may occur multiple times.
    :param comment: The Comment property. Optional, but may occur multiple times.
    :param freebusy: The FreeBusyProperty property. Optional, but may occur multiple times.
    :param rstatus: The RequestStatus property. Optional, but may occur multiple times.
    :param parent: The Component this item is encapsulated by in the iCalendar data file.
    """

    def __init__(
        self,
        dtstamp: Optional[DTStamp] = None,
        uid: Optional[UID] = None,
        contact: Optional[Contact] = None,
        dtstart: Optional[DTStart] = None,
        dtend: Optional[DTEnd] = None,
        organizer: Optional[Organizer] = None,
        url: Optional[URL] = None,
        attendee: Optional[List[Attendee]] = None,
        comment: Optional[List[Comment]] = None,
        freebusy: Optional[List[FreeBusyProperty]] = None,
        rstatus: Optional[List[RequestStatus]] = None,
        parent: Optional[Component] = None,
    ):
        super().__init__("VFREEBUSY", parent=parent)

        # Required
        self._dtstamp: Optional[DTStamp] = self.as_parent(dtstamp)
        self._uid: Optional[UID] = self.as_parent(uid)

        # Optional, may only occur once
        self.contact: Optional[Contact] = self.as_parent(contact)
        self.dtstart: Optional[DTStart] = self.as_parent(dtstart)
        self.dtend: Optional[DTEnd] = self.as_parent(dtend)
        self.organizer: Optional[Organizer] = self.as_parent(organizer)
        self.url: Optional[URL] = self.as_parent(url)

        # Optional, may occur more than once
        self.attendee: Optional[List[Attendee]] = self.as_parent(attendee)
        self.comment: Optional[List[Comment]] = self.as_parent(comment)
        self.freebusy: Optional[List[FreeBusyProperty]] = self.as_parent(freebusy)
        self.rstatus: Optional[List[RequestStatus]] = self.as_parent(rstatus)

    def __repr__(self) -> str:
        """Overwrite the repr to create a better representation for the item."""
        return f"VFreeBusy({self.dtstart.value if self.dtstart else ''}, {self.dtend.value if self.dtend else ''})"

    @property
    def dtstamp(self) -> DTStamp:
        """A getter to ensure the required property is set."""
        if self._dtstamp is None:
            raise MissingRequiredProperty(self, "dtstamp")
        return self._dtstamp

    @dtstamp.setter
    def dtstamp(self, value: DTStamp):
        """A setter to set the required property."""
        self._dtstamp = value

    @property
    def uid(self) -> UID:
        """A getter to ensure the required property is set."""
        if self._uid is None:
            raise MissingRequiredProperty(self, "uid")
        return self._uid

    @uid.setter
    def uid(self, value: UID):
        """A setter to set the required property."""
        self._uid = value

    @property
    def timespan(self) -> Optional[TimespanWithParent]:
        start = self.dtstart.datetime_or_date_value if self.dtstart else None
        end = self.dtend.datetime_or_date_value if self.dtend else None
        if start is None:
            return None
        if end is None:
            TimespanWithParent(parent=self, begin=start, end=start)
        return TimespanWithParent(parent=self, begin=start, end=end)

dtstamp: DTStamp property writable

A getter to ensure the required property is set.

uid: UID property writable

A getter to ensure the required property is set.

VAlarm

Bases: Component

This class represents the VAlarm component specified in RFC 5545 in '3.6.6. Alarm Component'.

A "VALARM" calendar component is a grouping of component properties that is a reminder or alarm for an event or a to-do. For example, it may be used to define a reminder for a pending event or an overdue to-do. The "VALARM" calendar component MUST only appear within either a "VEVENT" or "VTODO" calendar component

Parameters:

Name Type Description Default
action Optional[Action]

The Action property. Required and must occur exactly once.

None
trigger Optional[Trigger]

The Trigger property. Required and must occur exactly once.

None
duration Optional[ICALDuration]

The ICALDuration property. Optional, but may occur at most once. If this item is present, repeat may not be present.

None
repeat Optional[Repeat]

The Repeat property. Optional, but may occur at most once. If this item is present, duration may not be present.

None
attach Optional[Attach]

The Attach property. Optional, but may occur at most once.

None
parent Optional[Component]

The Component this item is encapsulated by in the iCalendar data file.

None
Source code in ical_library/ical_components/v_alarm.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
class VAlarm(Component):
    """
    This class represents the VAlarm component specified in RFC 5545 in '3.6.6. Alarm Component'.

    A "VALARM" calendar component is a grouping of component properties that is a reminder or alarm for an event or a
    to-do. For example, it may be used to define a reminder for a pending event or an overdue to-do.
    The "VALARM" calendar component MUST only appear within either a "VEVENT" or "VTODO" calendar component

    :param action: The Action property. Required and must occur exactly once.
    :param trigger: The Trigger property. Required and must occur exactly once.
    :param duration: The ICALDuration property. Optional, but may occur at most once. If this item is
        present, repeat may not be present.
    :param repeat: The Repeat property. Optional, but may occur at most once. If this item is
        present, duration may not be present.
    :param attach: The Attach property. Optional, but may occur at most once.
    :param parent: The Component this item is encapsulated by in the iCalendar data file.
    """

    def __init__(
        self,
        action: Optional[Action] = None,
        trigger: Optional[Trigger] = None,
        duration: Optional[ICALDuration] = None,
        repeat: Optional[Repeat] = None,
        attach: Optional[Attach] = None,
        parent: Optional[Component] = None,
    ):
        super().__init__("VALARM", parent=parent)

        # Required
        self._action: Optional[Action] = self.as_parent(action)
        self._trigger: Optional[Trigger] = self.as_parent(trigger)

        # Both optional and may only occur once. But if one occurs, the other also has to occur.
        self.duration: Optional[ICALDuration] = self.as_parent(duration)
        self.repeat: Optional[Repeat] = self.as_parent(repeat)

        # Optional, may only occur once
        self.attach: Optional[Attach] = self.as_parent(attach)

    def __repr__(self) -> str:
        """Overwrite the repr to create a better representation for the item."""
        return f"VAlarm({self.action.value}: {self.trigger.value})"

    @property
    def action(self) -> Action:
        """A getter to ensure the required property is set."""
        if self._action is None:
            raise MissingRequiredProperty(self, "action")
        return self._action

    @action.setter
    def action(self, value: Action):
        """A setter to set the required property."""
        self._action = value

    @property
    def trigger(self) -> Trigger:
        """Getter that ensures the required property is set."""
        if self._trigger is None:
            raise MissingRequiredProperty(self, "trigger")
        return self._trigger

    @trigger.setter
    def trigger(self, value: Trigger):
        """A setter to set the required property."""
        self._trigger = value

action: Action property writable

A getter to ensure the required property is set.

trigger: Trigger property writable

Getter that ensures the required property is set.