@@ -1237,6 +1237,17 @@ def move(self, to_project_id, **kwargs):
1237
1237
raise_error_from_response (r , GitlabUpdateError , 201 )
1238
1238
self ._set_from_dict (r .json ())
1239
1239
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
+
1240
1251
1241
1252
class ProjectIssueManager (BaseManager ):
1242
1253
obj_cls = ProjectIssue
@@ -1498,6 +1509,17 @@ def merge(self, merge_commit_message=None,
1498
1509
raise_error_from_response (r , errors )
1499
1510
self ._set_from_dict (r .json ())
1500
1511
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
+
1501
1523
1502
1524
class ProjectMergeRequestManager (BaseManager ):
1503
1525
obj_cls = ProjectMergeRequest
@@ -2154,7 +2176,7 @@ def all(self, scope=None, **kwargs):
2154
2176
2155
2177
Raises:
2156
2178
GitlabConnectionError: If the server cannot be reached.
2157
- GitlabListError; If the resource cannot be found
2179
+ GitlabListError: If the resource cannot be found
2158
2180
"""
2159
2181
url = '/runners/all'
2160
2182
if scope is not None :
@@ -2170,6 +2192,33 @@ class TeamMember(GitlabObject):
2170
2192
shortPrintAttr = 'username'
2171
2193
2172
2194
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
+
2173
2222
class UserProject (GitlabObject ):
2174
2223
_url = '/projects/user/%(user_id)s'
2175
2224
_constructorTypes = {'owner' : 'User' , 'namespace' : 'Group' }
0 commit comments