MCPcopy Create free account
hub / github.com/O365/python-o365 / Planner

Class Planner

O365/planner.py:814–1023  ·  view source on GitHub ↗

A microsoft planner class In order to use the API following permissions are required. Delegated (work or school account) - Group.Read.All, Group.ReadWrite.All

Source from the content-addressed store, hash-verified

812
813
814class Planner(ApiComponent):
815 """ A microsoft planner class
816 In order to use the API following permissions are required.
817 Delegated (work or school account) - Group.Read.All, Group.ReadWrite.All
818 """
819
820 _endpoints = {
821 'get_my_tasks': '/me/planner/tasks',
822 'get_plan_by_id': '/planner/plans/{plan_id}',
823 'get_bucket_by_id': '/planner/buckets/{bucket_id}',
824 'get_task_by_id': '/planner/tasks/{task_id}',
825 'list_user_tasks': '/users/{user_id}/planner/tasks',
826 'list_group_plans': '/groups/{group_id}/planner/plans',
827 'create_plan': '/planner/plans',
828 }
829 plan_constructor = Plan
830 bucket_constructor = Bucket
831 task_constructor = Task
832
833 def __init__(self, *, parent=None, con=None, **kwargs):
834 """ A Planner object
835
836 :param parent: parent object
837 :type parent: Account
838 :param Connection con: connection to use if no parent specified
839 :param Protocol protocol: protocol to use if no parent specified
840 (kwargs)
841 :param str main_resource: use this resource instead of parent resource
842 (kwargs)
843 """
844 if parent and con:
845 raise ValueError('Need a parent or a connection but not both')
846 self.con = parent.con if parent else con
847
848 # Choose the main_resource passed in kwargs over the host_name
849 main_resource = kwargs.pop('main_resource',
850 '') # defaults to blank resource
851 super().__init__(
852 protocol=parent.protocol if parent else kwargs.get('protocol'),
853 main_resource=main_resource)
854
855 def __str__(self):
856 return self.__repr__()
857
858 def __repr__(self):
859 return 'Microsoft Planner'
860
861 def get_my_tasks(self, *args):
862 """ Returns a list of open planner tasks assigned to me
863
864 :rtype: tasks
865 """
866
867 url = self.build_url(self._endpoints.get('get_my_tasks'))
868
869 response = self.con.get(url)
870
871 if not response:

Callers 1

plannerMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected