1
1
import calendar
2
2
import datetime as dt
3
3
import logging
4
- from zoneinfo import ZoneInfo
5
4
6
5
# noinspection PyPep8Naming
7
6
from bs4 import BeautifulSoup as bs
8
7
from dateutil .parser import parse
8
+ from zoneinfo import ZoneInfo
9
9
10
- from .utils import CaseEnum
11
- from .utils import HandleRecipientsMixin
12
- from .utils import AttachableMixin , ImportanceLevel , TrackerSet
13
- from .utils import BaseAttachments , BaseAttachment
14
- from .utils import Pagination , NEXT_LINK_KEYWORD , ApiComponent
15
- from .utils .windows_tz import get_windows_tz
16
10
from .category import Category
11
+ from .utils import (
12
+ NEXT_LINK_KEYWORD ,
13
+ ApiComponent ,
14
+ AttachableMixin ,
15
+ BaseAttachment ,
16
+ BaseAttachments ,
17
+ CaseEnum ,
18
+ HandleRecipientsMixin ,
19
+ ImportanceLevel ,
20
+ Pagination ,
21
+ TrackerSet ,
22
+ )
23
+ from .utils .windows_tz import get_windows_tz
17
24
18
25
log = logging .getLogger (__name__ )
19
26
@@ -541,9 +548,11 @@ def __init__(self, parent, response_status):
541
548
"""
542
549
super ().__init__ (protocol = parent .protocol ,
543
550
main_resource = parent .main_resource )
551
+ #: The status of the response |br| **Type:** str
544
552
self .status = response_status .get (self ._cc ('response' ), 'none' )
545
553
self .status = None if self .status == 'none' else EventResponse .from_value (self .status )
546
554
if self .status :
555
+ #: The time the response was received |br| **Type:** datetime
547
556
self .response_time = response_status .get (self ._cc ('time' ), None )
548
557
if self .response_time == '0001-01-01T00:00:00Z' :
549
558
# consider there's no response time
@@ -853,15 +862,18 @@ def __init__(self, *, parent=None, con=None, **kwargs):
853
862
cc = self ._cc # alias
854
863
# internal to know which properties need to be updated on the server
855
864
self ._track_changes = TrackerSet (casing = cc )
865
+ #: The calendar's unique identifier. |br| **Type:** str
856
866
self .calendar_id = kwargs .get ('calendar_id' , None )
857
867
download_attachments = kwargs .get ('download_attachments' )
858
868
cloud_data = kwargs .get (self ._cloud_data_key , {})
859
869
870
+ #: Unique identifier for the event. |br| **Type:** str
860
871
self .object_id = cloud_data .get (cc ('id' ), None )
861
872
self .__subject = cloud_data .get (cc ('subject' ),
862
873
kwargs .get ('subject' , '' ) or '' )
863
874
body = cloud_data .get (cc ('body' ), {})
864
875
self .__body = body .get (cc ('content' ), '' )
876
+ #: The type of the content. Possible values are text and html. |br| **Type:** bodyType
865
877
self .body_type = body .get (cc ('contentType' ),
866
878
'HTML' ) # default to HTML for new messages
867
879
@@ -886,23 +898,32 @@ def __init__(self, *, parent=None, con=None, **kwargs):
886
898
end_obj = cloud_data .get (cc ('end' ), {})
887
899
self .__end = self ._parse_date_time_time_zone (end_obj , self .__is_all_day )
888
900
901
+ #: Set to true if the event has attachments. |br| **Type:** bool
889
902
self .has_attachments = cloud_data .get (cc ('hasAttachments' ), False )
890
903
self .__attachments = EventAttachments (parent = self , attachments = [])
891
904
if self .has_attachments and download_attachments :
892
905
self .attachments .download_attachments ()
893
906
self .__categories = cloud_data .get (cc ('categories' ), [])
907
+ #: A unique identifier for an event across calendars. This ID is different for each occurrence in a recurring series. |br| **Type:** str
894
908
self .ical_uid = cloud_data .get (cc ('iCalUId' ), None )
895
909
self .__importance = ImportanceLevel .from_value (
896
910
cloud_data .get (cc ('importance' ), 'normal' ) or 'normal' )
911
+ #: Set to true if the event has been cancelled. |br| **Type:** bool
897
912
self .is_cancelled = cloud_data .get (cc ('isCancelled' ), False )
913
+ #: Set to true if the calendar owner (specified by the owner property of the calendar) is the organizer of the event
914
+ #: (specified by the organizer property of the event). It also applies if a delegate organized the event on behalf of the owner.
915
+ #: |br| **Type:** bool
898
916
self .is_organizer = cloud_data .get (cc ('isOrganizer' ), True )
899
917
self .__location = cloud_data .get (cc ('location' ), {})
918
+ #: The locations where the event is held or attended from. |br| **Type:** list
900
919
self .locations = cloud_data .get (cc ('locations' ), []) # TODO
901
920
921
+ #: A URL for an online meeting. |br| **Type:** str
902
922
self .online_meeting_url = cloud_data .get (cc ('onlineMeetingUrl' ), None )
903
923
self .__is_online_meeting = cloud_data .get (cc ('isOnlineMeeting' ), False )
904
924
self .__online_meeting_provider = OnlineMeetingProviderType .from_value (
905
925
cloud_data .get (cc ('onlineMeetingProvider' ), 'teamsForBusiness' ))
926
+ #: Details for an attendee to join the meeting online. The default is null. |br| **Type:** OnlineMeetingInfo
906
927
self .online_meeting = cloud_data .get (cc ('onlineMeeting' ), None )
907
928
if not self .online_meeting_url and self .is_online_meeting :
908
929
self .online_meeting_url = self .online_meeting .get (cc ('joinUrl' ), None ) \
@@ -923,10 +944,12 @@ def __init__(self, *, parent=None, con=None, **kwargs):
923
944
cc ('responseStatus' ), {}))
924
945
self .__sensitivity = EventSensitivity .from_value (
925
946
cloud_data .get (cc ('sensitivity' ), 'normal' ))
947
+ #: The ID for the recurring series master item, if this event is part of a recurring series. |br| **Type:** str
926
948
self .series_master_id = cloud_data .get (cc ('seriesMasterId' ), None )
927
949
self .__show_as = EventShowAs .from_value (cloud_data .get (cc ('showAs' ), 'busy' ))
928
950
self .__event_type = EventType .from_value (cloud_data .get (cc ('type' ), 'singleInstance' ))
929
951
self .__no_forwarding = False
952
+ #: The URL to open the event in Outlook on the web. |br| **Type:** str
930
953
self .web_link = cloud_data .get (cc ('webLink' ), None )
931
954
932
955
def __str__ (self ):
@@ -1359,6 +1382,7 @@ def no_forwarding(self, value):
1359
1382
def get_occurrences (self , start , end , * , limit = None , query = None , order_by = None , batch = None ):
1360
1383
"""
1361
1384
Returns all the occurrences of a seriesMaster event for a specified time range.
1385
+
1362
1386
:type start: datetime
1363
1387
:param start: the start of the time range
1364
1388
:type end: datetime
@@ -1608,7 +1632,7 @@ class Calendar(ApiComponent, HandleRecipientsMixin):
1608
1632
'default_events_view' : '/calendar/calendarView' ,
1609
1633
'get_event' : '/calendars/{id}/events/{ide}' ,
1610
1634
}
1611
- event_constructor = Event
1635
+ event_constructor = Event #: :meta private:
1612
1636
1613
1637
def __init__ (self , * , parent = None , con = None , ** kwargs ):
1614
1638
""" Create a Calendar Representation
@@ -1635,22 +1659,31 @@ def __init__(self, *, parent=None, con=None, **kwargs):
1635
1659
1636
1660
cloud_data = kwargs .get (self ._cloud_data_key , {})
1637
1661
1662
+ #: The calendar name. |br| **Type:** str
1638
1663
self .name = cloud_data .get (self ._cc ('name' ), '' )
1664
+ #: The calendar's unique identifier. |br| **Type:** str
1639
1665
self .calendar_id = cloud_data .get (self ._cc ('id' ), None )
1640
1666
self .__owner = self ._recipient_from_cloud (
1641
1667
cloud_data .get (self ._cc ('owner' ), {}), field = 'owner' )
1642
1668
color = cloud_data .get (self ._cc ('color' ), 'auto' )
1643
1669
try :
1670
+ #: Specifies the color theme to distinguish the calendar from other calendars in a UI. |br| **Type:** calendarColor
1644
1671
self .color = CalendarColor .from_value (color )
1645
1672
except :
1646
1673
self .color = CalendarColor .from_value ('auto' )
1674
+ #: true if the user can write to the calendar, false otherwise. |br| **Type:** bool
1647
1675
self .can_edit = cloud_data .get (self ._cc ('canEdit' ), False )
1676
+ #: true if the user has permission to share the calendar, false otherwise. |br| **Type:** bool
1648
1677
self .can_share = cloud_data .get (self ._cc ('canShare' ), False )
1678
+ #: If true, the user can read calendar items that have been marked private, false otherwise. |br| **Type:** bool
1649
1679
self .can_view_private_items = cloud_data .get (
1650
1680
self ._cc ('canViewPrivateItems' ), False )
1651
1681
1652
1682
# Hex color only returns a value when a custom calandar is set
1653
1683
# Hex color is read-only, cannot be used to set calendar's color
1684
+ #: The calendar color, expressed in a hex color code of three hexadecimal values,
1685
+ #: each ranging from 00 to FF and representing the red, green, or blue components
1686
+ #: of the color in the RGB color space. |br| **Type:** str
1654
1687
self .hex_color = cloud_data .get (self ._cc ('hexColor' ), None )
1655
1688
1656
1689
def __str__ (self ):
@@ -1871,8 +1904,8 @@ class Schedule(ApiComponent):
1871
1904
'get_availability' : '/calendar/getSchedule' ,
1872
1905
}
1873
1906
1874
- calendar_constructor = Calendar
1875
- event_constructor = Event
1907
+ calendar_constructor = Calendar #: :meta private:
1908
+ event_constructor = Event #: :meta private:
1876
1909
1877
1910
def __init__ (self , * , parent = None , con = None , ** kwargs ):
1878
1911
""" Create a wrapper around calendars and events
0 commit comments