Creates a Plan :param str owner: the id of the group that will own the plan :param str title: the title of the new plan. Default set to "Tasks" :return: newly created plan :rtype: Plan
(self, owner, title='Tasks')
| 998 | for plan in data.get('value', [])] |
| 999 | |
| 1000 | def create_plan(self, owner, title='Tasks'): |
| 1001 | """ Creates a Plan |
| 1002 | |
| 1003 | :param str owner: the id of the group that will own the plan |
| 1004 | :param str title: the title of the new plan. Default set to "Tasks" |
| 1005 | :return: newly created plan |
| 1006 | :rtype: Plan |
| 1007 | """ |
| 1008 | if not owner: |
| 1009 | raise RuntimeError('Provide the owner (group_id)') |
| 1010 | |
| 1011 | url = self.build_url( |
| 1012 | self._endpoints.get('create_plan')) |
| 1013 | |
| 1014 | data = {'owner': owner, 'title': title} |
| 1015 | |
| 1016 | response = self.con.post(url, data=data) |
| 1017 | if not response: |
| 1018 | return None |
| 1019 | |
| 1020 | plan = response.json() |
| 1021 | |
| 1022 | return self.plan_constructor(parent=self, |
| 1023 | **{self._cloud_data_key: plan}) |