contextbase-plugin-microsoft-calendar 0.5.0__py3-none-any.whl

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.
@@ -0,0 +1,515 @@
1
+ from __future__ import annotations
2
+
3
+ from typing import Any
4
+
5
+ from pydantic import AwareDatetime, Field
6
+ from shared_plugins.models import CtxModel, IdStr, NonNegativeInt
7
+
8
+
9
+ class CalendarRow(CtxModel):
10
+ ctx_deleted: bool = Field(default=False, alias="_ctx_deleted")
11
+ id: IdStr
12
+ odata_type: str | None = None
13
+ additional_data: dict[str, Any] = Field(default_factory=dict)
14
+ allowed_online_meeting_providers: list[str] = Field(default_factory=list)
15
+ calendar_group_id: str | None = None
16
+ can_edit: bool | None = None
17
+ can_share: bool | None = None
18
+ can_view_private_items: bool | None = None
19
+ change_key: str | None = None
20
+ color: str | None = None
21
+ default_online_meeting_provider: str | None = None
22
+ group_class_id: str | None = None
23
+ hex_color: str | None = None
24
+ is_default_calendar: bool | None = None
25
+ is_removable: bool | None = None
26
+ is_shared: bool | None = None
27
+ is_shared_with_me: bool | None = None
28
+ is_tallying_responses: bool | None = None
29
+ name: str | None = None
30
+ owner_name: str | None = None
31
+ owner_address: str | None = None
32
+
33
+
34
+ class EventRow(CtxModel):
35
+ """Row in the `events` table.
36
+
37
+ One row per calendarView/delta item, all four Graph event types:
38
+ full-fidelity `singleInstance`/`seriesMaster`/`exception` rows, and
39
+ `occurrence` rows that are sparse by design (their payload lives on the
40
+ series master — only the merge keys, `type`, `series_master_id`,
41
+ `etag`, and the concrete start/end slot are populated).
42
+
43
+ `calendar_id` is pinned from the calendar whose delta produced the row
44
+ (event payloads carry no calendar field); tombstones
45
+ (`ctx_deleted=True`) carry only the merge keys.
46
+ """
47
+
48
+ ctx_deleted: bool = Field(default=False, alias="_ctx_deleted")
49
+ calendar_id: IdStr
50
+ id: IdStr
51
+ type: str | None = None
52
+ odata_type: str | None = None
53
+ etag: str | None = None
54
+ additional_data: dict[str, Any] = Field(default_factory=dict)
55
+ series_master_id: str | None = None
56
+ occurrence_id: str | None = None
57
+ subject: str | None = None
58
+ body: dict[str, Any] | None = None
59
+ body_preview: str | None = None
60
+ categories: list[str] = Field(default_factory=list)
61
+ attendees: list[dict[str, Any]] = Field(default_factory=list)
62
+ organizer_name: str | None = None
63
+ organizer_address: str | None = None
64
+ location: dict[str, Any] | None = None
65
+ locations: list[dict[str, Any]] = Field(default_factory=list)
66
+ start_date_time: AwareDatetime | None = None
67
+ start_time_zone: str | None = None
68
+ end_date_time: AwareDatetime | None = None
69
+ end_time_zone: str | None = None
70
+ original_start_time_zone: str | None = None
71
+ original_end_time_zone: str | None = None
72
+ is_all_day: bool | None = None
73
+ is_cancelled: bool | None = None
74
+ is_draft: bool | None = None
75
+ is_online_meeting: bool | None = None
76
+ is_organizer: bool | None = None
77
+ is_reminder_on: bool | None = None
78
+ has_attachments: bool | None = None
79
+ hide_attendees: bool | None = None
80
+ allow_new_time_proposals: bool | None = None
81
+ response_requested: bool | None = None
82
+ importance: str | None = None
83
+ sensitivity: str | None = None
84
+ show_as: str | None = None
85
+ created_date_time: AwareDatetime | None = None
86
+ last_modified_date_time: AwareDatetime | None = None
87
+ change_key: str | None = None
88
+ i_cal_uid: str | None = None
89
+ i_cal_uid_v2: str | None = None
90
+ uid: str | None = None
91
+ online_meeting: dict[str, Any] | None = None
92
+ online_meeting_provider: str | None = None
93
+ online_meeting_url: str | None = None
94
+ recurrence: dict[str, Any] | None = None
95
+ reminder_minutes_before_start: NonNegativeInt | None = None
96
+ response_status: dict[str, Any] | None = None
97
+ transaction_id: str | None = None
98
+ web_link: str | None = None
99
+
100
+
101
+ CALENDAR_COLUMN_DESCRIPTIONS = {
102
+ "allowed_online_meeting_providers": {
103
+ "description": (
104
+ "Represent the online meeting service providers that can be used to "
105
+ "create online meetings in this calendar. The possible values are: "
106
+ "`unknown`, `skypeForBusiness`, `skypeForConsumer`, `teamsForBusiness`."
107
+ )
108
+ },
109
+ "calendar_group_id": {
110
+ "description": (
111
+ "The calendarGroup in which to create the calendar. If the user has "
112
+ "never explicitly set a group for the calendar, this property is null."
113
+ )
114
+ },
115
+ "can_edit": {
116
+ "description": (
117
+ "`true` if the user can write to the calendar, `false` otherwise. This "
118
+ "property is `true` for the user who created the calendar. This "
119
+ "property is also `true` for a user who has been shared a calendar and "
120
+ "granted write access, through an Outlook client or the corresponding "
121
+ "calendarPermission resource. Read-only."
122
+ )
123
+ },
124
+ "can_share": {
125
+ "description": (
126
+ "`true` if the user has the permission to share the calendar, `false` "
127
+ "otherwise. Only the user who created the calendar can share it. "
128
+ "Read-only."
129
+ )
130
+ },
131
+ "can_view_private_items": {
132
+ "description": (
133
+ "`true` if the user can read calendar items that have been marked "
134
+ "private, `false` otherwise. This property is set through an Outlook "
135
+ "client or the corresponding calendarPermission resource. Read-only."
136
+ )
137
+ },
138
+ "change_key": {
139
+ "description": (
140
+ "Identifies the version of the calendar object. Every time the "
141
+ "calendar is changed, changeKey changes as well. This allows Exchange "
142
+ "to apply changes to the correct version of the object. Read-only."
143
+ )
144
+ },
145
+ "color": {
146
+ "description": (
147
+ "Specifies the color theme to distinguish the calendar from other "
148
+ "calendars in a UI. The property values are: `auto`, `lightBlue`, "
149
+ "`lightGreen`, `lightOrange`, `lightGray`, `lightYellow`, `lightTeal`, "
150
+ "`lightPink`, `lightBrown`, `lightRed`, `maxColor`."
151
+ )
152
+ },
153
+ "default_online_meeting_provider": {
154
+ "description": (
155
+ "The default online meeting provider for meetings sent from this "
156
+ "calendar. The possible values are: `unknown`, `skypeForBusiness`, "
157
+ "`skypeForConsumer`, `teamsForBusiness`."
158
+ )
159
+ },
160
+ "hex_color": {
161
+ "description": (
162
+ "The calendar color, expressed in a hex color code of three "
163
+ "hexadecimal values, each ranging from 00 to FF and representing the "
164
+ "red, green, or blue components of the color in the RGB color space. "
165
+ "If the user has never explicitly set a color for the calendar, this "
166
+ "property is empty."
167
+ )
168
+ },
169
+ "id": {"description": "The calendar's unique identifier. Read-only."},
170
+ "is_default_calendar": {
171
+ "description": (
172
+ "`true` if this is the default calendar where new events are created "
173
+ "by default, `false` otherwise."
174
+ )
175
+ },
176
+ "is_removable": {
177
+ "description": (
178
+ "Indicates whether this user calendar can be deleted from the user mailbox."
179
+ )
180
+ },
181
+ "is_shared": {
182
+ "description": (
183
+ "`true` if the user has shared the calendar with other users, `false` "
184
+ "otherwise. Since only the user who created the calendar can share it, "
185
+ "**isShared** and **isSharedWithMe** cannot be `true` for the same "
186
+ "user. This property is set when sharing is initiated in an Outlook "
187
+ "client, and can be reset when the sharing is cancelled through the "
188
+ "client or the corresponding calendarPermission resource. Read-only."
189
+ )
190
+ },
191
+ "is_shared_with_me": {
192
+ "description": (
193
+ "`true` if the user has been shared this calendar, `false` otherwise. "
194
+ "This property is always `false` for a calendar owner. This property "
195
+ "is set when sharing is initiated in an Outlook client, and can be "
196
+ "reset when the sharing is cancelled through the client or the "
197
+ "corresponding calendarPermission resource. Read-only."
198
+ )
199
+ },
200
+ "is_tallying_responses": {
201
+ "description": (
202
+ "Indicates whether this user calendar supports tracking of meeting "
203
+ "responses. Only meeting invites sent from users' primary calendars "
204
+ "support tracking of meeting responses."
205
+ )
206
+ },
207
+ "name": {"description": "The calendar name."},
208
+ "owner_name": {
209
+ "description": (
210
+ "If set, this represents the user who created or added the calendar. "
211
+ "For a calendar that the user created or added, the **owner** property "
212
+ "is set to the user. For a calendar shared with the user, the "
213
+ "**owner** property is set to the person who shared that calendar with "
214
+ "the user. Read-only."
215
+ )
216
+ },
217
+ "owner_address": {
218
+ "description": (
219
+ "If set, this represents the user who created or added the calendar. "
220
+ "For a calendar that the user created or added, the **owner** property "
221
+ "is set to the user. For a calendar shared with the user, the "
222
+ "**owner** property is set to the person who shared that calendar with "
223
+ "the user. Read-only."
224
+ )
225
+ },
226
+ }
227
+
228
+ EVENT_COLUMN_DESCRIPTIONS = {
229
+ "calendar_id": {
230
+ "description": (
231
+ "ContextLayer: the id of the calendar whose delta produced this row "
232
+ "(event payloads carry no calendar field). Part of the primary key."
233
+ )
234
+ },
235
+ "type": {
236
+ "description": (
237
+ "The event type. The possible values are: `singleInstance`, "
238
+ "`occurrence`, `exception`, `seriesMaster`. Read-only"
239
+ )
240
+ },
241
+ "series_master_id": {
242
+ "description": (
243
+ "The ID for the recurring series master item, if this event is part "
244
+ "of a recurring series."
245
+ )
246
+ },
247
+ "occurrence_id": {
248
+ "description": (
249
+ "An identifier for an occurrence in a recurring event series. Null if "
250
+ "the event isn't part of a recurring series.The format of the property "
251
+ "value is OID.{seriesMasterId-value}.{occurrence-start-date}. The time "
252
+ "zone for {occurrence-start-date} is the recurrenceTimeZone property "
253
+ "defined for the corresponding recurrenceRange.This property can "
254
+ "identify any occurrence in a recurring series, including an "
255
+ "occurrence that has been modified or canceled. You can use this "
256
+ "property to perform all operations supported by occurrences in the "
257
+ "recurring series."
258
+ )
259
+ },
260
+ "id": {
261
+ "description": (
262
+ "Unique identifier for the event. By default, this value changes when "
263
+ "the item is moved from one container (such as a folder or calendar) "
264
+ "to another. To change this behavior, use the `Prefer: "
265
+ 'IdType="ImmutableId"` header. See Get immutable identifiers for '
266
+ "Outlook resources for more information. Case-sensitive and read-only."
267
+ )
268
+ },
269
+ "subject": {"description": "The text of the event's subject line."},
270
+ "body": {
271
+ "description": (
272
+ "The body of the message associated with the event. It can be in HTML "
273
+ "or text format."
274
+ )
275
+ },
276
+ "body_preview": {
277
+ "description": (
278
+ "The preview of the message associated with the event. It is in text "
279
+ "format."
280
+ )
281
+ },
282
+ "categories": {
283
+ "description": (
284
+ "The categories associated with the event. Each category corresponds "
285
+ "to the **displayName** property of an outlookCategory defined for "
286
+ "the user."
287
+ )
288
+ },
289
+ "attendees": {"description": "The collection of attendees for the event."},
290
+ "organizer_name": {"description": "The organizer of the event."},
291
+ "organizer_address": {"description": "The organizer of the event."},
292
+ "location": {"description": "The location of the event."},
293
+ "locations": {
294
+ "description": (
295
+ "The locations where the event is held or attended from. The "
296
+ "**location** and **locations** properties always correspond with "
297
+ "each other. If you update the **location** property, any prior "
298
+ "locations in the **locations** collection would be removed and "
299
+ "replaced by the new **location** value."
300
+ )
301
+ },
302
+ "start_date_time": {
303
+ "description": (
304
+ "The start date, time, and time zone of the event. By default, the "
305
+ "start time is in UTC."
306
+ )
307
+ },
308
+ "start_time_zone": {
309
+ "description": (
310
+ "The start date, time, and time zone of the event. By default, the "
311
+ "start time is in UTC."
312
+ )
313
+ },
314
+ "end_date_time": {
315
+ "description": (
316
+ "The date, time, and time zone that the event ends. By default, the "
317
+ "end time is in UTC."
318
+ )
319
+ },
320
+ "end_time_zone": {
321
+ "description": (
322
+ "The date, time, and time zone that the event ends. By default, the "
323
+ "end time is in UTC."
324
+ )
325
+ },
326
+ "original_start_time_zone": {
327
+ "description": (
328
+ "The start time zone that was set when the event was created. A value "
329
+ "of `tzone://Microsoft/Custom` indicates that a legacy custom time "
330
+ "zone was set in desktop Outlook."
331
+ )
332
+ },
333
+ "original_end_time_zone": {
334
+ "description": (
335
+ "The end time zone that was set when the event was created. A value "
336
+ "of `tzone://Microsoft/Custom` indicates that a legacy custom time "
337
+ "zone was set in desktop Outlook."
338
+ )
339
+ },
340
+ "is_all_day": {
341
+ "description": (
342
+ "Set to true if the event lasts all day. If true, regardless of "
343
+ "whether it's a single-day or multi-day event, start and end time "
344
+ "must be set to midnight and be in the same time zone."
345
+ )
346
+ },
347
+ "is_cancelled": {"description": "Set to true if the event has been canceled."},
348
+ "is_draft": {
349
+ "description": (
350
+ "Set to true if the user has updated the meeting in Outlook but "
351
+ "hasn't sent the updates to attendees. Set to false if all changes "
352
+ "have been sent, or if the event is an appointment without any "
353
+ "attendees."
354
+ )
355
+ },
356
+ "is_online_meeting": {
357
+ "description": (
358
+ "`True` if this event has online meeting information (that is, "
359
+ "**onlineMeeting** points to an onlineMeetingInfo resource), `false` "
360
+ "otherwise. Default is `false` (**onlineMeeting** is `null`). "
361
+ "Optional. After you set **isOnlineMeeting** to `true`, Microsoft "
362
+ "Graph initializes **onlineMeeting**. Outlook then ignores any "
363
+ "further changes to **isOnlineMeeting**, and the meeting remains "
364
+ "available online."
365
+ )
366
+ },
367
+ "is_organizer": {
368
+ "description": (
369
+ "Set to true if the calendar owner (specified by the **owner** "
370
+ "property of the calendar) is the organizer of the event (specified "
371
+ "by the **organizer** property of the **event**). This also applies "
372
+ "if a delegate organized the event on behalf of the owner."
373
+ )
374
+ },
375
+ "is_reminder_on": {
376
+ "description": (
377
+ "Set to true if an alert is set to remind the user of the event."
378
+ )
379
+ },
380
+ "has_attachments": {"description": "Set to true if the event has attachments."},
381
+ "hide_attendees": {
382
+ "description": (
383
+ "When set to `true`, each attendee only sees themselves in the "
384
+ "meeting request and meeting **Tracking** list. Default is false."
385
+ )
386
+ },
387
+ "allow_new_time_proposals": {
388
+ "description": (
389
+ "`true` if the meeting organizer allows invitees to propose a new "
390
+ "time when responding; otherwise `false`. Optional. Default is `true`."
391
+ )
392
+ },
393
+ "response_requested": {
394
+ "description": (
395
+ "Default is true, which represents the organizer would like an "
396
+ "invitee to send a response to the event."
397
+ )
398
+ },
399
+ "importance": {
400
+ "description": (
401
+ "The importance of the event. The possible values are: `low`, "
402
+ "`normal`, `high`."
403
+ )
404
+ },
405
+ "sensitivity": {
406
+ "description": (
407
+ "The possible values are: `normal`, `personal`, `private`, `confidential`."
408
+ )
409
+ },
410
+ "show_as": {
411
+ "description": (
412
+ "The status to show. The possible values are: `free`, `tentative`, "
413
+ "`busy`, `oof`, `workingElsewhere`, `unknown`."
414
+ )
415
+ },
416
+ "created_date_time": {
417
+ "description": (
418
+ "The Timestamp type represents date and time information using ISO "
419
+ "8601 format and is always in UTC time. For example, midnight UTC on "
420
+ "Jan 1, 2014 is `2014-01-01T00:00:00Z`"
421
+ )
422
+ },
423
+ "last_modified_date_time": {
424
+ "description": (
425
+ "The Timestamp type represents date and time information using ISO "
426
+ "8601 format and is always in UTC time. For example, midnight UTC on "
427
+ "Jan 1, 2014 is `2014-01-01T00:00:00Z`"
428
+ )
429
+ },
430
+ "change_key": {
431
+ "description": (
432
+ "Identifies the version of the event object. Every time the event is "
433
+ "changed, ChangeKey changes as well. This allows Exchange to apply "
434
+ "changes to the correct version of the object."
435
+ )
436
+ },
437
+ "i_cal_uid": {
438
+ "description": (
439
+ "A unique identifier for an event across calendars. This ID is "
440
+ "different for each occurrence in a recurring series. Read-only."
441
+ )
442
+ },
443
+ "uid": {
444
+ "description": (
445
+ "A unique identifier for calendar events. For recurring events, the "
446
+ "value is the same for the series master and all of its occurrences "
447
+ "including exceptions."
448
+ )
449
+ },
450
+ "online_meeting": {
451
+ "description": (
452
+ "Details for an attendee to join the meeting online. Default is null. "
453
+ "Read-only. After you set the **isOnlineMeeting** and "
454
+ "**onlineMeetingProvider** properties to enable a meeting online, "
455
+ "Microsoft Graph initializes **onlineMeeting**. When set, the meeting "
456
+ "remains available online, and you can't change the "
457
+ "**isOnlineMeeting**, **onlineMeetingProvider**, and **onlneMeeting** "
458
+ "properties again."
459
+ )
460
+ },
461
+ "online_meeting_provider": {
462
+ "description": (
463
+ "Represents the online meeting service provider. By default, "
464
+ "**onlineMeetingProvider** is `unknown`. The possible values are "
465
+ "`unknown`, `teamsForBusiness`, `skypeForBusiness`, and "
466
+ "`skypeForConsumer`. Optional. After you set "
467
+ "**onlineMeetingProvider**, Microsoft Graph initializes "
468
+ "**onlineMeeting**. Subsequently you can't change "
469
+ "**onlineMeetingProvider** again, and the meeting remains available "
470
+ "online."
471
+ )
472
+ },
473
+ "online_meeting_url": {
474
+ "description": (
475
+ "A URL for an online meeting. The property is set only when an "
476
+ "organizer specifies in Outlook that an event is an online meeting "
477
+ "such as Skype. Read-only.To access the URL to join an online "
478
+ "meeting, use **joinUrl** which is exposed via the **onlineMeeting** "
479
+ "property of the **event**. The **onlineMeetingUrl** property will "
480
+ "be deprecated in the future."
481
+ )
482
+ },
483
+ "recurrence": {"description": "The recurrence pattern for the event."},
484
+ "reminder_minutes_before_start": {
485
+ "description": (
486
+ "The number of minutes before the event start time that the reminder "
487
+ "alert occurs."
488
+ )
489
+ },
490
+ "response_status": {
491
+ "description": (
492
+ "Indicates the type of response sent in response to an event message."
493
+ )
494
+ },
495
+ "transaction_id": {
496
+ "description": (
497
+ "A custom identifier specified by a client app for the server to "
498
+ "avoid redundant POST operations if the client retries to create the "
499
+ "same event. This is useful when low network connectivity causes the "
500
+ "client to time out before receiving a response from the server for "
501
+ "the client's prior create-event request. After you set "
502
+ "**transactionId** when creating an event, you can't change "
503
+ "**transactionId** in a subsequent update. This property is only "
504
+ "returned in a response payload if an app has set it. Optional."
505
+ )
506
+ },
507
+ "web_link": {
508
+ "description": (
509
+ "The URL to open the event in Outlook on the web.Outlook on the web "
510
+ "opens the event in the browser if you're signed in to your mailbox. "
511
+ "Otherwise, Outlook on the web prompts you to sign in.This URL can't "
512
+ "be accessed from within an iFrame."
513
+ )
514
+ },
515
+ }