2 from _typeshed import Self
3 from collections.abc import Iterable, Iterator, Mapping
4 from typing import Any, Type, TypeVar, overload
5 from typing_extensions import Literal
6 from urllib.parse import ParseResult, SplitResult
8 from vobject.base import VBase
10 from .davclient import DAVClient
11 from .elements.cdav import CompFilter, ScheduleInboxURL, ScheduleOutboxURL
12 from .lib.url import URL
14 _CC = TypeVar("_CC", bound=CalendarObjectResource)
16 _vCalAddress = Any # actually icalendar.vCalAddress
21 client: DAVClient | None
22 parent: DAVObject | None
24 props: Mapping[Any, Any]
25 extra_init_options: dict[str, Any]
28 client: DAVClient | None = ...,
29 url: str | ParseResult | SplitResult | URL | None = ...,
30 parent: DAVObject | None = ...,
31 name: str | None = ...,
33 props: Mapping[Any, Any] | None = ...,
37 def canonical_url(self) -> str: ...
38 def children(self, type: str | None = ...) -> list[tuple[URL, Any, Any]]: ...
39 def get_property(self, prop, use_cached: bool = ..., **passthrough) -> Any | None: ...
41 self, props: Any | None = ..., depth: int = ..., parse_response_xml: bool = ..., parse_props: bool = ...
43 def set_properties(self: Self, props: Any | None = ...) -> Self: ...
44 def save(self: Self) -> Self: ...
45 def delete(self) -> None: ...
47 class CalendarSet(DAVObject):
48 def calendars(self) -> list[Calendar]: ...
50 self, name: str | None = ..., cal_id: str | None = ..., supported_calendar_component_set: Any | None = ...
52 def calendar(self, name: str | None = ..., cal_id: str | None = ...) -> Calendar: ...
54 class Principal(DAVObject):
55 def __init__(self, client: DAVClient | None = ..., url: str | ParseResult | SplitResult | URL | None = ...) -> None: ...
56 def calendars(self) -> list[Calendar]: ...
58 self, name: str | None = ..., cal_id: str | None = ..., supported_calendar_component_set: Any | None = ...
60 def calendar(self, name: str | None = ..., cal_id: str | None = ...) -> Calendar: ...
61 def get_vcal_address(self) -> _vCalAddress: ...
62 calendar_home_set: CalendarSet # can also be set to anything URL.objectify() accepts
63 def freebusy_request(self, dtstart, dtend, attendees): ...
64 def calendar_user_address_set(self) -> list[str]: ...
65 def schedule_inbox(self) -> ScheduleInbox: ...
66 def schedule_outbox(self) -> ScheduleOutbox: ...
68 class Calendar(DAVObject):
69 def get_supported_components(self) -> list[Any]: ...
70 def save_with_invites(self, ical: str, attendees, **attendeeoptions) -> None: ...
71 def save_event(self, ical: str, no_overwrite: bool = ..., no_create: bool = ...) -> Event: ...
72 def save_todo(self, ical: str, no_overwrite: bool = ..., no_create: bool = ...) -> Todo: ...
73 def save_journal(self, ical: str, no_overwrite: bool = ..., no_create: bool = ...) -> Journal: ...
74 add_event = save_event
76 add_journal = save_journal
77 def calendar_multiget(self, event_urls: Iterable[URL]) -> list[Event]: ...
78 def build_date_search_query(
81 end: datetime.datetime | None = ...,
82 compfilter: Literal["VEVENT"] | None = ...,
83 expand: bool | Literal["maybe"] = ...,
88 start: datetime.datetime,
89 end: datetime.datetime | None = ...,
90 compfilter: Literal["VEVENT"] = ...,
91 expand: bool | Literal["maybe"] = ...,
95 self, start: datetime.datetime, *, compfilter: None, expand: bool | Literal["maybe"] = ...
96 ) -> list[CalendarObjectResource]: ...
99 self, start: datetime.datetime, end: datetime.datetime | None, compfilter: None, expand: bool | Literal["maybe"] = ...
100 ) -> list[CalendarObjectResource]: ...
102 def search(self, xml, comp_class: None = ...) -> list[CalendarObjectResource]: ...
104 def search(self, xml, comp_class: Type[_CC]) -> list[_CC]: ...
105 def freebusy_request(self, start: datetime.datetime, end: datetime.datetime) -> FreeBusy: ...
106 def todos(self, sort_keys: Iterable[str] = ..., include_completed: bool = ..., sort_key: str | None = ...) -> list[Todo]: ...
107 def event_by_url(self, href, data: Any | None = ...) -> Event: ...
108 def object_by_uid(self, uid: str, comp_filter: CompFilter | None = ...) -> Event: ...
109 def todo_by_uid(self, uid: str) -> CalendarObjectResource: ...
110 def event_by_uid(self, uid: str) -> CalendarObjectResource: ...
111 def journal_by_uid(self, uid: str) -> CalendarObjectResource: ...
113 def events(self) -> list[Event]: ...
114 def objects_by_sync_token(
115 self, sync_token: Any | None = ..., load_objects: bool = ...
116 ) -> SynchronizableCalendarObjectCollection: ...
117 objects = objects_by_sync_token
118 def journals(self) -> list[Journal]: ...
120 class ScheduleMailbox(Calendar):
123 client: DAVClient | None = ...,
124 principal: Principal | None = ...,
125 url: str | ParseResult | SplitResult | URL | None = ...,
127 def get_items(self): ...
129 class ScheduleInbox(ScheduleMailbox):
130 findprop = ScheduleInboxURL
132 class ScheduleOutbox(ScheduleMailbox):
133 findprop = ScheduleOutboxURL
135 class SynchronizableCalendarObjectCollection:
136 def __init__(self, calendar, objects, sync_token) -> None: ...
137 def __iter__(self) -> Iterator[Any]: ...
138 def objects_by_url(self): ...
139 def sync(self) -> tuple[Any, Any]: ...
141 class CalendarObjectResource(DAVObject):
144 client: DAVClient | None = ...,
145 url: str | ParseResult | SplitResult | URL | None = ...,
146 data: Any | None = ...,
147 parent: Any | None = ...,
148 id: Any | None = ...,
149 props: Any | None = ...,
151 def add_organizer(self) -> None: ...
152 def add_attendee(self, attendee, no_default_parameters: bool = ..., **parameters) -> None: ...
153 def is_invite_request(self) -> bool: ...
154 def accept_invite(self, calendar: Any | None = ...) -> None: ...
155 def decline_invite(self, calendar: Any | None = ...) -> None: ...
156 def tentatively_accept_invite(self, calendar: Any | None = ...) -> None: ...
157 def copy(self: Self, keep_uid: bool = ..., new_parent: Any | None = ...) -> Self: ...
158 def load(self: Self) -> Self: ...
159 def change_attendee_status(self, attendee: Any | None = ..., **kwargs) -> None: ...
161 self: Self, no_overwrite: bool = ..., no_create: bool = ..., obj_type: Any | None = ..., if_schedule_tag_match: bool = ...
164 vobject_instance: VBase
165 icalendar_instance: Any
168 class Event(CalendarObjectResource): ...
169 class Journal(CalendarObjectResource): ...
171 class FreeBusy(CalendarObjectResource):
172 def __init__(self, parent, data, url: str | ParseResult | SplitResult | URL | None = ..., id: Any | None = ...) -> None: ...
174 class Todo(CalendarObjectResource):
175 def complete(self, completion_timestamp: datetime.datetime | None = ...) -> None: ...