1717
1818import gitlab
1919from gitlab import base
20+ from gitlab import cli
2021from gitlab import exceptions as exc
2122
2223
@@ -296,6 +297,8 @@ def delete(self, **kwargs):
296297
297298
298299class AccessRequestMixin (object ):
300+ @cli .register_custom_action (('ProjectAccessRequest' , 'GroupAccessRequest' ),
301+ tuple (), ('access_level' , ))
299302 @exc .on_http_error (exc .GitlabUpdateError )
300303 def approve (self , access_level = gitlab .DEVELOPER_ACCESS , ** kwargs ):
301304 """Approve an access request.
@@ -317,6 +320,8 @@ def approve(self, access_level=gitlab.DEVELOPER_ACCESS, **kwargs):
317320
318321
319322class SubscribableMixin (object ):
323+ @cli .register_custom_action (('ProjectIssue' , 'ProjectMergeRequest' ,
324+ 'ProjectLabel' ))
320325 @exc .on_http_error (exc .GitlabSubscribeError )
321326 def subscribe (self , ** kwargs ):
322327 """Subscribe to the object notifications.
@@ -332,6 +337,8 @@ def subscribe(self, **kwargs):
332337 server_data = self .manager .gitlab .http_post (path , ** kwargs )
333338 self ._update_attrs (server_data )
334339
340+ @cli .register_custom_action (('ProjectIssue' , 'ProjectMergeRequest' ,
341+ 'ProjectLabel' ))
335342 @exc .on_http_error (exc .GitlabUnsubscribeError )
336343 def unsubscribe (self , ** kwargs ):
337344 """Unsubscribe from the object notifications.
@@ -349,6 +356,7 @@ def unsubscribe(self, **kwargs):
349356
350357
351358class TodoMixin (object ):
359+ @cli .register_custom_action (('ProjectIssue' , 'ProjectMergeRequest' ))
352360 @exc .on_http_error (exc .GitlabHttpError )
353361 def todo (self , ** kwargs ):
354362 """Create a todo associated to the object.
@@ -365,6 +373,7 @@ def todo(self, **kwargs):
365373
366374
367375class TimeTrackingMixin (object ):
376+ @cli .register_custom_action (('ProjectIssue' , 'ProjectMergeRequest' ))
368377 @exc .on_http_error (exc .GitlabTimeTrackingError )
369378 def time_stats (self , ** kwargs ):
370379 """Get time stats for the object.
@@ -379,6 +388,8 @@ def time_stats(self, **kwargs):
379388 path = '%s/%s/time_stats' % (self .manager .path , self .get_id ())
380389 return self .manager .gitlab .http_get (path , ** kwargs )
381390
391+ @cli .register_custom_action (('ProjectIssue' , 'ProjectMergeRequest' ),
392+ ('duration' , ))
382393 @exc .on_http_error (exc .GitlabTimeTrackingError )
383394 def time_estimate (self , duration , ** kwargs ):
384395 """Set an estimated time of work for the object.
@@ -395,6 +406,7 @@ def time_estimate(self, duration, **kwargs):
395406 data = {'duration' : duration }
396407 return self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
397408
409+ @cli .register_custom_action (('ProjectIssue' , 'ProjectMergeRequest' ))
398410 @exc .on_http_error (exc .GitlabTimeTrackingError )
399411 def reset_time_estimate (self , ** kwargs ):
400412 """Resets estimated time for the object to 0 seconds.
@@ -409,6 +421,8 @@ def reset_time_estimate(self, **kwargs):
409421 path = '%s/%s/rest_time_estimate' % (self .manager .path , self .get_id ())
410422 return self .manager .gitlab .http_post (path , ** kwargs )
411423
424+ @cli .register_custom_action (('ProjectIssue' , 'ProjectMergeRequest' ),
425+ ('duration' , ))
412426 @exc .on_http_error (exc .GitlabTimeTrackingError )
413427 def add_spent_time (self , duration , ** kwargs ):
414428 """Add time spent working on the object.
@@ -425,6 +439,7 @@ def add_spent_time(self, duration, **kwargs):
425439 data = {'duration' : duration }
426440 return self .manager .gitlab .http_post (path , post_data = data , ** kwargs )
427441
442+ @cli .register_custom_action (('ProjectIssue' , 'ProjectMergeRequest' ))
428443 @exc .on_http_error (exc .GitlabTimeTrackingError )
429444 def reset_spent_time (self , ** kwargs ):
430445 """Resets the time spent working on the object.
0 commit comments