| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2adf31d commit e30f39d
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -3,7 +3,7 @@ | |||
| 3 | 3 | https://docs.gitlab.com/ee/api/integrations.html | |
| 4 | 4 | """ | |
| 5 | 5 | ||
| 6 | - from typing import Any, cast, Dict, List, Optional, Union | ||
| 6 | + from typing import Any, cast, List, Union | ||
| 7 | 7 | ||
| 8 | 8 | from gitlab import cli | |
| 9 | 9 | from gitlab.base import RESTManager, RESTObject | |
@@ -23,7 +23,7 @@ | |||
| 23 | 23 | ||
| 24 | 24 | ||
| 25 | 25 | class ProjectService(SaveMixin, ObjectDeleteMixin, RESTObject): | |
| 26 | - pass | ||
| 26 | + _id_attr = "slug" | ||
| 27 | 27 | ||
| 28 | 28 | ||
| 29 | 29 | class ProjectServiceManager(GetMixin, UpdateMixin, DeleteMixin, ListMixin, RESTManager): | |
@@ -264,53 +264,7 @@ class ProjectServiceManager(GetMixin, UpdateMixin, DeleteMixin, ListMixin, RESTM | |||
| 264 | 264 | def get( | |
| 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 | - return obj | ||
| 289 | - | ||
| 290 | - def update( | ||
| 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_data or {} | ||
| 311 | - result = super().update(id, new_data, **kwargs) | ||
| 312 | - self.id = id | ||
| 313 | - return result | ||
| 267 | + return cast(ProjectService, super().get(id=id, lazy=lazy, **kwargs)) | ||
| 314 | 268 | ||
| 315 | 269 | @cli.register_custom_action("ProjectServiceManager") | |
| 316 | 270 | def available(self, **kwargs: Any) -> List[str]: | |
| Back | FazBrowse Home | New Git URL |
0 commit comments