Representation of a Microsoft To-Do Folder. :param parent: parent object :type parent: ToDo :param Connection con: connection to use if no parent specified :param Protocol protocol: protocol to use if no parent specified (kwargs) :param str main_reso
(self, *, parent=None, con=None, **kwargs)
| 462 | task_constructor = Task |
| 463 | |
| 464 | def __init__(self, *, parent=None, con=None, **kwargs): |
| 465 | """Representation of a Microsoft To-Do Folder. |
| 466 | |
| 467 | :param parent: parent object |
| 468 | :type parent: ToDo |
| 469 | :param Connection con: connection to use if no parent specified |
| 470 | :param Protocol protocol: protocol to use if no parent specified |
| 471 | (kwargs) |
| 472 | :param str main_resource: use this resource instead of parent resource |
| 473 | (kwargs) |
| 474 | """ |
| 475 | if parent and con: |
| 476 | raise ValueError("Need a parent or a connection but not both") |
| 477 | self.con = parent.con if parent else con |
| 478 | |
| 479 | # Choose the main_resource passed in kwargs over parent main_resource |
| 480 | main_resource = kwargs.pop("main_resource", None) or ( |
| 481 | getattr(parent, "main_resource", None) if parent else None |
| 482 | ) |
| 483 | |
| 484 | super().__init__( |
| 485 | protocol=parent.protocol if parent else kwargs.get("protocol"), |
| 486 | main_resource=main_resource, |
| 487 | ) |
| 488 | |
| 489 | cloud_data = kwargs.get(self._cloud_data_key, {}) |
| 490 | |
| 491 | self.name = cloud_data.get(self._cc("displayName"), "") |
| 492 | self.folder_id = cloud_data.get(self._cc("id"), None) |
| 493 | self.is_default = False |
| 494 | if cloud_data.get(self._cc("wellknownListName"), "") == "defaultList": |
| 495 | self.is_default = True |
| 496 | |
| 497 | def __str__(self): |
| 498 | """Representation of the Folder via the Graph api as a string.""" |