@@ -1237,6 +1237,17 @@ def move(self, to_project_id, **kwargs):
12371237 raise_error_from_response (r , GitlabUpdateError , 201 )
12381238 self ._set_from_dict (r .json ())
12391239
1240+ def todo (self , ** kwargs ):
1241+ """Create a todo for the issue.
1242+
1243+ Raises:
1244+ GitlabConnectionError: If the server cannot be reached.
1245+ """
1246+ url = ('/projects/%(project_id)s/issues/%(issue_id)s/todo' %
1247+ {'project_id' : self .project_id , 'issue_id' : self .id })
1248+ r = self .gitlab ._raw_post (url , ** kwargs )
1249+ raise_error_from_response (r , GitlabTodoError , [201 , 304 ])
1250+
12401251
12411252class ProjectIssueManager (BaseManager ):
12421253 obj_cls = ProjectIssue
@@ -1498,6 +1509,17 @@ def merge(self, merge_commit_message=None,
14981509 raise_error_from_response (r , errors )
14991510 self ._set_from_dict (r .json ())
15001511
1512+ def todo (self , ** kwargs ):
1513+ """Create a todo for the merge request.
1514+
1515+ Raises:
1516+ GitlabConnectionError: If the server cannot be reached.
1517+ """
1518+ url = ('/projects/%(project_id)s/merge_requests/%(mr_id)s/todo' %
1519+ {'project_id' : self .project_id , 'mr_id' : self .id })
1520+ r = self .gitlab ._raw_post (url , ** kwargs )
1521+ raise_error_from_response (r , GitlabTodoError , [201 , 304 ])
1522+
15011523
15021524class ProjectMergeRequestManager (BaseManager ):
15031525 obj_cls = ProjectMergeRequest
@@ -2154,7 +2176,7 @@ def all(self, scope=None, **kwargs):
21542176
21552177 Raises:
21562178 GitlabConnectionError: If the server cannot be reached.
2157- GitlabListError; If the resource cannot be found
2179+ GitlabListError: If the resource cannot be found
21582180 """
21592181 url = '/runners/all'
21602182 if scope is not None :
@@ -2170,6 +2192,33 @@ class TeamMember(GitlabObject):
21702192 shortPrintAttr = 'username'
21712193
21722194
2195+ class Todo (GitlabObject ):
2196+ _url = '/todos'
2197+ canGet = 'from_list'
2198+ canUpdate = False
2199+ canCreate = False
2200+ optionalListAttrs = ['action' , 'author_id' , 'project_id' , 'state' , 'type' ]
2201+
2202+
2203+ class TodoManager (BaseManager ):
2204+ obj_cls = Todo
2205+
2206+ def delete_all (self , ** kwargs ):
2207+ """Mark all the todos as done.
2208+
2209+ Raises:
2210+ GitlabConnectionError: If the server cannot be reached.
2211+ GitlabDeleteError: If the resource cannot be found
2212+
2213+ Returns:
2214+ The number of todos maked done.
2215+ """
2216+ url = '/todos'
2217+ r = self .gitlab ._raw_delete (url , ** kwargs )
2218+ raise_error_from_response (r , GitlabDeleteError )
2219+ return int (r .text )
2220+
2221+
21732222class UserProject (GitlabObject ):
21742223 _url = '/projects/user/%(user_id)s'
21752224 _constructorTypes = {'owner' : 'User' , 'namespace' : 'Group' }
0 commit comments