|
3 | 3 | https://docs.gitlab.com/ee/api/integrations.html
|
4 | 4 | """
|
5 | 5 |
|
6 |
| -fromtypingimportAny,cast,Dict,List,Optional,Union |
| 6 | +fromtypingimportAny,cast,List,Union |
7 | 7 |
|
8 | 8 | fromgitlabimportcli
|
9 | 9 | fromgitlab.baseimportRESTManager,RESTObject
|
|
23 | 23 |
|
24 | 24 |
|
25 | 25 | classProjectService(SaveMixin,ObjectDeleteMixin,RESTObject):
|
26 |
| -pass |
| 26 | +_id_attr="slug" |
27 | 27 |
|
28 | 28 |
|
29 | 29 | classProjectServiceManager(GetMixin,UpdateMixin,DeleteMixin,ListMixin,RESTManager):
|
@@ -264,53 +264,7 @@ class ProjectServiceManager(GetMixin, UpdateMixin, DeleteMixin, ListMixin, RESTM
|
264 | 264 | defget(
|
265 | 265 | self,id:Union[str,int],lazy:bool=False,**kwargs:Any
|
266 | 266 | )->ProjectService:
|
267 |
| -"""Retrieve a single object. |
268 |
| -
|
269 |
| - Args: |
270 |
| - id: ID of the object to retrieve |
271 |
| - lazy: If True, don't request the server, but create a |
272 |
| - shallow object giving access to the managers. This is |
273 |
| - useful if you want to avoid useless calls to the API. |
274 |
| - **kwargs: Extra options to send to the server (e.g. sudo) |
275 |
| -
|
276 |
| - Returns: |
277 |
| - The generated RESTObject. |
278 |
| -
|
279 |
| - Raises: |
280 |
| - GitlabAuthenticationError: If authentication is not correct |
281 |
| - GitlabGetError: If the server cannot perform the request |
282 |
| - """ |
283 |
| -obj=cast( |
284 |
| -ProjectService, |
285 |
| -super().get(id,lazy=lazy,**kwargs), |
286 |
| - ) |
287 |
| -obj.id=id |
288 |
| -returnobj |
289 |
| - |
290 |
| -defupdate( |
291 |
| -self, |
292 |
| -id:Optional[Union[str,int]]=None, |
293 |
| -new_data:Optional[Dict[str,Any]]=None, |
294 |
| -**kwargs:Any |
295 |
| - )->Dict[str,Any]: |
296 |
| -"""Update an object on the server. |
297 |
| -
|
298 |
| - Args: |
299 |
| - id: ID of the object to update (can be None if not required) |
300 |
| - new_data: the update data for the object |
301 |
| - **kwargs: Extra options to send to the server (e.g. sudo) |
302 |
| -
|
303 |
| - Returns: |
304 |
| - The new object data (*not* a RESTObject) |
305 |
| -
|
306 |
| - Raises: |
307 |
| - GitlabAuthenticationError: If authentication is not correct |
308 |
| - GitlabUpdateError: If the server cannot perform the request |
309 |
| - """ |
310 |
| -new_data=new_dataor {} |
311 |
| -result=super().update(id,new_data,**kwargs) |
312 |
| -self.id=id |
313 |
| -returnresult |
| 267 | +returncast(ProjectService,super().get(id=id,lazy=lazy,**kwargs)) |
314 | 268 |
|
315 | 269 | @cli.register_custom_action("ProjectServiceManager")
|
316 | 270 | defavailable(self,**kwargs:Any)->List[str]:
|
|