massive update, probably broken
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-pyright / node_modules / pyright / dist / typeshed-fallback / stubs / caldav / caldav / objects.pyi
1 import datetime
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
7
8 from vobject.base import VBase
9
10 from .davclient import DAVClient
11 from .elements.cdav import CompFilter, ScheduleInboxURL, ScheduleOutboxURL
12 from .lib.url import URL
13
14 _CC = TypeVar("_CC", bound=CalendarObjectResource)
15
16 _vCalAddress = Any  # actually icalendar.vCalAddress
17
18 class DAVObject:
19     id: str | None
20     url: URL | None
21     client: DAVClient | None
22     parent: DAVObject | None
23     name: str | None
24     props: Mapping[Any, Any]
25     extra_init_options: dict[str, Any]
26     def __init__(
27         self,
28         client: DAVClient | None = ...,
29         url: str | ParseResult | SplitResult | URL | None = ...,
30         parent: DAVObject | None = ...,
31         name: str | None = ...,
32         id: str | None = ...,
33         props: Mapping[Any, Any] | None = ...,
34         **extra: Any,
35     ) -> None: ...
36     @property
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: ...
40     def get_properties(
41         self, props: Any | None = ..., depth: int = ..., parse_response_xml: bool = ..., parse_props: bool = ...
42     ): ...
43     def set_properties(self: Self, props: Any | None = ...) -> Self: ...
44     def save(self: Self) -> Self: ...
45     def delete(self) -> None: ...
46
47 class CalendarSet(DAVObject):
48     def calendars(self) -> list[Calendar]: ...
49     def make_calendar(
50         self, name: str | None = ..., cal_id: str | None = ..., supported_calendar_component_set: Any | None = ...
51     ) -> Calendar: ...
52     def calendar(self, name: str | None = ..., cal_id: str | None = ...) -> Calendar: ...
53
54 class Principal(DAVObject):
55     def __init__(self, client: DAVClient | None = ..., url: str | ParseResult | SplitResult | URL | None = ...) -> None: ...
56     def calendars(self) -> list[Calendar]: ...
57     def make_calendar(
58         self, name: str | None = ..., cal_id: str | None = ..., supported_calendar_component_set: Any | None = ...
59     ) -> Calendar: ...
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: ...
67
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
75     add_todo = save_todo
76     add_journal = save_journal
77     def calendar_multiget(self, event_urls: Iterable[URL]) -> list[Event]: ...
78     def build_date_search_query(
79         self,
80         start,
81         end: datetime.datetime | None = ...,
82         compfilter: Literal["VEVENT"] | None = ...,
83         expand: bool | Literal["maybe"] = ...,
84     ): ...
85     @overload
86     def date_search(
87         self,
88         start: datetime.datetime,
89         end: datetime.datetime | None = ...,
90         compfilter: Literal["VEVENT"] = ...,
91         expand: bool | Literal["maybe"] = ...,
92     ) -> list[Event]: ...
93     @overload
94     def date_search(
95         self, start: datetime.datetime, *, compfilter: None, expand: bool | Literal["maybe"] = ...
96     ) -> list[CalendarObjectResource]: ...
97     @overload
98     def date_search(
99         self, start: datetime.datetime, end: datetime.datetime | None, compfilter: None, expand: bool | Literal["maybe"] = ...
100     ) -> list[CalendarObjectResource]: ...
101     @overload
102     def search(self, xml, comp_class: None = ...) -> list[CalendarObjectResource]: ...
103     @overload
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: ...
112     event = event_by_uid
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]: ...
119
120 class ScheduleMailbox(Calendar):
121     def __init__(
122         self,
123         client: DAVClient | None = ...,
124         principal: Principal | None = ...,
125         url: str | ParseResult | SplitResult | URL | None = ...,
126     ) -> None: ...
127     def get_items(self): ...
128
129 class ScheduleInbox(ScheduleMailbox):
130     findprop = ScheduleInboxURL
131
132 class ScheduleOutbox(ScheduleMailbox):
133     findprop = ScheduleOutboxURL
134
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]: ...
140
141 class CalendarObjectResource(DAVObject):
142     def __init__(
143         self,
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 = ...,
150     ) -> 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: ...
160     def save(
161         self: Self, no_overwrite: bool = ..., no_create: bool = ..., obj_type: Any | None = ..., if_schedule_tag_match: bool = ...
162     ) -> Self: ...
163     data: Any
164     vobject_instance: VBase
165     icalendar_instance: Any
166     instance: VBase
167
168 class Event(CalendarObjectResource): ...
169 class Journal(CalendarObjectResource): ...
170
171 class FreeBusy(CalendarObjectResource):
172     def __init__(self, parent, data, url: str | ParseResult | SplitResult | URL | None = ..., id: Any | None = ...) -> None: ...
173
174 class Todo(CalendarObjectResource):
175     def complete(self, completion_timestamp: datetime.datetime | None = ...) -> None: ...