@@ -850,10 +850,10 @@ class ProjectHookManager(BaseManager):
850
850
851
851
852
852
class ProjectIssueNote (GitlabObject ):
853
- _url = '/projects/%(project_id)s/issues/%(issue_id )s/notes'
853
+ _url = '/projects/%(project_id)s/issues/%(issue_iid )s/notes'
854
854
_constructorTypes = {'author' : 'User' }
855
855
canDelete = False
856
- requiredUrlAttrs = ['project_id' , 'issue_id ' ]
856
+ requiredUrlAttrs = ['project_id' , 'issue_iid ' ]
857
857
requiredCreateAttrs = ['body' ]
858
858
optionalCreateAttrs = ['created_at' ]
859
859
@@ -875,9 +875,10 @@ class ProjectIssue(GitlabObject):
875
875
'milestone_id' , 'labels' , 'created_at' ,
876
876
'updated_at' , 'state_event' , 'due_date' ]
877
877
shortPrintAttr = 'title'
878
+ idAttr = 'iid'
878
879
managers = (
879
880
('notes' , 'ProjectIssueNoteManager' ,
880
- [('project_id' , 'project_id' ), ('issue_id ' , 'id ' )]),
881
+ [('project_id' , 'project_id' ), ('issue_iid ' , 'iid ' )]),
881
882
)
882
883
883
884
def subscribe (self , ** kwargs ):
@@ -887,8 +888,8 @@ def subscribe(self, **kwargs):
887
888
GitlabConnectionError: If the server cannot be reached.
888
889
GitlabSubscribeError: If the subscription cannot be done
889
890
"""
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 })
892
893
893
894
r = self .gitlab ._raw_post (url , ** kwargs )
894
895
raise_error_from_response (r , GitlabSubscribeError , [201 , 304 ])
@@ -901,8 +902,8 @@ def unsubscribe(self, **kwargs):
901
902
GitlabConnectionError: If the server cannot be reached.
902
903
GitlabUnsubscribeError: If the unsubscription cannot be done
903
904
"""
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 })
906
907
907
908
r = self .gitlab ._raw_post (url , ** kwargs )
908
909
raise_error_from_response (r , GitlabUnsubscribeError , [201 , 304 ])
@@ -914,8 +915,8 @@ def move(self, to_project_id, **kwargs):
914
915
Raises:
915
916
GitlabConnectionError: If the server cannot be reached.
916
917
"""
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 })
919
920
920
921
data = {'to_project_id' : to_project_id }
921
922
data .update (** kwargs )
@@ -929,8 +930,8 @@ def todo(self, **kwargs):
929
930
Raises:
930
931
GitlabConnectionError: If the server cannot be reached.
931
932
"""
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 })
934
935
r = self .gitlab ._raw_post (url , ** kwargs )
935
936
raise_error_from_response (r , GitlabTodoError , [201 , 304 ])
936
937
@@ -940,22 +941,26 @@ def time_stats(self, **kwargs):
940
941
Raises:
941
942
GitlabConnectionError: If the server cannot be reached.
942
943
"""
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 })
945
946
r = self .gitlab ._raw_get (url , ** kwargs )
946
947
raise_error_from_response (r , GitlabGetError )
947
948
return r .json ()
948
949
949
- def time_estimate (self , ** kwargs ):
950
+ def time_estimate (self , duration , ** kwargs ):
950
951
"""Set an estimated time of work for the issue.
951
952
953
+ Args:
954
+ duration (str): duration in human format (e.g. 3h30)
955
+
952
956
Raises:
953
957
GitlabConnectionError: If the server cannot be reached.
954
958
"""
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 )
959
964
return r .json ()
960
965
961
966
def reset_time_estimate (self , ** kwargs ):
@@ -964,24 +969,28 @@ def reset_time_estimate(self, **kwargs):
964
969
Raises:
965
970
GitlabConnectionError: If the server cannot be reached.
966
971
"""
967
- url = ('/projects/%(project_id)s/issues/%(issue_id )s/'
972
+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/'
968
973
'reset_time_estimate' %
969
- {'project_id' : self .project_id , 'issue_id ' : self .id })
974
+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
970
975
r = self .gitlab ._raw_post (url , ** kwargs )
971
976
raise_error_from_response (r , GitlabTimeTrackingError , 200 )
972
977
return r .json ()
973
978
974
- def add_spent_time (self , ** kwargs ):
979
+ def add_spent_time (self , duration , ** kwargs ):
975
980
"""Set an estimated time of work for the issue.
976
981
982
+ Args:
983
+ duration (str): duration in human format (e.g. 3h30)
984
+
977
985
Raises:
978
986
GitlabConnectionError: If the server cannot be reached.
979
987
"""
980
- url = ('/projects/%(project_id)s/issues/%(issue_id )s/'
988
+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/'
981
989
'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 )
985
994
return r .json ()
986
995
987
996
def reset_spent_time (self , ** kwargs ):
@@ -990,9 +999,9 @@ def reset_spent_time(self, **kwargs):
990
999
Raises:
991
1000
GitlabConnectionError: If the server cannot be reached.
992
1001
"""
993
- url = ('/projects/%(project_id)s/issues/%(issue_id )s/'
1002
+ url = ('/projects/%(project_id)s/issues/%(issue_iid )s/'
994
1003
'reset_spent_time' %
995
- {'project_id' : self .project_id , 'issue_id ' : self .id })
1004
+ {'project_id' : self .project_id , 'issue_iid ' : self .iid })
996
1005
r = self .gitlab ._raw_post (url , ** kwargs )
997
1006
raise_error_from_response (r , GitlabTimeTrackingError , 200 )
998
1007
return r .json ()
0 commit comments