1
- from typing import Any , cast , Dict , Optional , Tuple , TYPE_CHECKING , Union
1
+ from typing import Any , cast , Dict , List , Optional , Tuple , TYPE_CHECKING , Union
2
2
3
- from gitlab import cli
3
+ import requests
4
+
5
+ from gitlab import cli , client
4
6
from gitlab import exceptions as exc
5
7
from gitlab import types
6
8
from gitlab .base import RESTManager , RESTObject
@@ -182,7 +184,9 @@ def reorder(
182
184
183
185
@cli .register_custom_action (cls_names = "ProjectIssue" )
184
186
@exc .on_http_error (exc .GitlabGetError )
185
- def related_merge_requests (self , ** kwargs : Any ) -> Dict [str , Any ]:
187
+ def related_merge_requests (
188
+ self , ** kwargs : Any
189
+ ) -> Union [client .GitlabList , List [Dict [str , Any ]]]:
186
190
"""List merge requests related to the issue.
187
191
188
192
Args:
@@ -196,14 +200,16 @@ def related_merge_requests(self, **kwargs: Any) -> Dict[str, Any]:
196
200
The list of merge requests.
197
201
"""
198
202
path = f"{ self .manager .path } /{ self .encoded_id } /related_merge_requests"
199
- result = self .manager .gitlab .http_get (path , ** kwargs )
203
+ result = self .manager .gitlab .http_list (path , ** kwargs )
200
204
if TYPE_CHECKING :
201
- assert isinstance (result , dict )
205
+ assert not isinstance (result , requests . Response )
202
206
return result
203
207
204
208
@cli .register_custom_action (cls_names = "ProjectIssue" )
205
209
@exc .on_http_error (exc .GitlabGetError )
206
- def closed_by (self , ** kwargs : Any ) -> Dict [str , Any ]:
210
+ def closed_by (
211
+ self , ** kwargs : Any
212
+ ) -> Union [client .GitlabList , List [Dict [str , Any ]]]:
207
213
"""List merge requests that will close the issue when merged.
208
214
209
215
Args:
@@ -217,9 +223,9 @@ def closed_by(self, **kwargs: Any) -> Dict[str, Any]:
217
223
The list of merge requests.
218
224
"""
219
225
path = f"{ self .manager .path } /{ self .encoded_id } /closed_by"
220
- result = self .manager .gitlab .http_get (path , ** kwargs )
226
+ result = self .manager .gitlab .http_list (path , ** kwargs )
221
227
if TYPE_CHECKING :
222
- assert isinstance (result , dict )
228
+ assert not isinstance (result , requests . Response )
223
229
return result
224
230
225
231
0 commit comments