@@ -850,10 +850,10 @@ class ProjectHookManager(BaseManager):
850850
851851
852852class ProjectIssueNote (GitlabObject ):
853- _url = '/projects/%(project_id)s/issues/%(issue_id )s/notes'
853+ _url = '/projects/%(project_id)s/issues/%(issue_iid )s/notes'
854854 _constructorTypes = {'author' : 'User' }
855855 canDelete = False
856- requiredUrlAttrs = ['project_id' , 'issue_id ' ]
856+ requiredUrlAttrs = ['project_id' , 'issue_iid ' ]
857857 requiredCreateAttrs = ['body' ]
858858 optionalCreateAttrs = ['created_at' ]
859859
@@ -875,9 +875,10 @@ class ProjectIssue(GitlabObject):
875875 'milestone_id' , 'labels' , 'created_at' ,
876876 'updated_at' , 'state_event' , 'due_date' ]
877877 shortPrintAttr = 'title'
878+ idAttr = 'iid'
878879 managers = (
879880 ('notes' , 'ProjectIssueNoteManager' ,
880- [('project_id' , 'project_id' ), ('issue_id ' , 'id ' )]),
881+ [('project_id' , 'project_id' ), ('issue_iid ' , 'iid ' )]),
881882 )
882883
883884 def subscribe (self , ** kwargs ):
@@ -887,8 +888,8 @@ def subscribe(self, **kwargs):
887888 GitlabConnectionError: If the server cannot be reached.
888889 GitlabSubscribeError: If the subscription cannot be done
889890 """
890- url = ('/projects/%(project_id)s/issues/%(issue_id )s/subscribe' %
891- {'project_id' : self .project_id , 'issue_id ' : self .id })
891+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/subscribe' %
892+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
892893
893894 r = self .gitlab ._raw_post (url , ** kwargs )
894895 raise_error_from_response (r , GitlabSubscribeError , [201 , 304 ])
@@ -901,8 +902,8 @@ def unsubscribe(self, **kwargs):
901902 GitlabConnectionError: If the server cannot be reached.
902903 GitlabUnsubscribeError: If the unsubscription cannot be done
903904 """
904- url = ('/projects/%(project_id)s/issues/%(issue_id )s/unsubscribe' %
905- {'project_id' : self .project_id , 'issue_id ' : self .id })
905+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/unsubscribe' %
906+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
906907
907908 r = self .gitlab ._raw_post (url , ** kwargs )
908909 raise_error_from_response (r , GitlabUnsubscribeError , [201 , 304 ])
@@ -914,8 +915,8 @@ def move(self, to_project_id, **kwargs):
914915 Raises:
915916 GitlabConnectionError: If the server cannot be reached.
916917 """
917- url = ('/projects/%(project_id)s/issues/%(issue_id )s/move' %
918- {'project_id' : self .project_id , 'issue_id ' : self .id })
918+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/move' %
919+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
919920
920921 data = {'to_project_id' : to_project_id }
921922 data .update (** kwargs )
@@ -929,8 +930,8 @@ def todo(self, **kwargs):
929930 Raises:
930931 GitlabConnectionError: If the server cannot be reached.
931932 """
932- url = ('/projects/%(project_id)s/issues/%(issue_id )s/todo' %
933- {'project_id' : self .project_id , 'issue_id ' : self .id })
933+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/todo' %
934+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
934935 r = self .gitlab ._raw_post (url , ** kwargs )
935936 raise_error_from_response (r , GitlabTodoError , [201 , 304 ])
936937
@@ -940,22 +941,26 @@ def time_stats(self, **kwargs):
940941 Raises:
941942 GitlabConnectionError: If the server cannot be reached.
942943 """
943- url = ('/projects/%(project_id)s/issues/%(issue_id )s/time_stats' %
944- {'project_id' : self .project_id , 'issue_id ' : self .id })
944+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/time_stats' %
945+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
945946 r = self .gitlab ._raw_get (url , ** kwargs )
946947 raise_error_from_response (r , GitlabGetError )
947948 return r .json ()
948949
949- def time_estimate (self , ** kwargs ):
950+ def time_estimate (self , duration , ** kwargs ):
950951 """Set an estimated time of work for the issue.
951952
953+ Args:
954+ duration (str): duration in human format (e.g. 3h30)
955+
952956 Raises:
953957 GitlabConnectionError: If the server cannot be reached.
954958 """
955- url = ('/projects/%(project_id)s/issues/%(issue_id)s/time_estimate' %
956- {'project_id' : self .project_id , 'issue_id' : self .id })
957- r = self .gitlab ._raw_post (url , ** kwargs )
958- raise_error_from_response (r , GitlabTimeTrackingError , 201 )
959+ url = ('/projects/%(project_id)s/issues/%(issue_iid)s/time_estimate' %
960+ {'project_id' : self .project_id , 'issue_iid' : self .iid })
961+ data = {'duration' : duration }
962+ r = self .gitlab ._raw_post (url , data , ** kwargs )
963+ raise_error_from_response (r , GitlabTimeTrackingError , 200 )
959964 return r .json ()
960965
961966 def reset_time_estimate (self , ** kwargs ):
@@ -964,24 +969,28 @@ def reset_time_estimate(self, **kwargs):
964969 Raises:
965970 GitlabConnectionError: If the server cannot be reached.
966971 """
967- url = ('/projects/%(project_id)s/issues/%(issue_id )s/'
972+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/'
968973 'reset_time_estimate' %
969- {'project_id' : self .project_id , 'issue_id ' : self .id })
974+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
970975 r = self .gitlab ._raw_post (url , ** kwargs )
971976 raise_error_from_response (r , GitlabTimeTrackingError , 200 )
972977 return r .json ()
973978
974- def add_spent_time (self , ** kwargs ):
979+ def add_spent_time (self , duration , ** kwargs ):
975980 """Set an estimated time of work for the issue.
976981
982+ Args:
983+ duration (str): duration in human format (e.g. 3h30)
984+
977985 Raises:
978986 GitlabConnectionError: If the server cannot be reached.
979987 """
980- url = ('/projects/%(project_id)s/issues/%(issue_id )s/'
988+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/'
981989 'add_spent_time' %
982- {'project_id' : self .project_id , 'issue_id' : self .id })
983- r = self .gitlab ._raw_post (url , ** kwargs )
984- raise_error_from_response (r , GitlabTimeTrackingError , 200 )
990+ {'project_id' : self .project_id , 'issue_iid' : self .iid })
991+ data = {'duration' : duration }
992+ r = self .gitlab ._raw_post (url , data , ** kwargs )
993+ raise_error_from_response (r , GitlabTimeTrackingError , 201 )
985994 return r .json ()
986995
987996 def reset_spent_time (self , ** kwargs ):
@@ -990,9 +999,9 @@ def reset_spent_time(self, **kwargs):
990999 Raises:
9911000 GitlabConnectionError: If the server cannot be reached.
9921001 """
993- url = ('/projects/%(project_id)s/issues/%(issue_id )s/'
1002+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/'
9941003 'reset_spent_time' %
995- {'project_id' : self .project_id , 'issue_id ' : self .id })
1004+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
9961005 r = self .gitlab ._raw_post (url , ** kwargs )
9971006 raise_error_from_response (r , GitlabTimeTrackingError , 200 )
9981007 return r .json ()
0 commit comments