diff options
-rw-r--r-- | gitlab/mixins.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py index b79c29e..0d22b78 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -525,7 +525,7 @@ class SaveMixin(_RestObjectBase): return updated_data - def save(self, **kwargs: Any) -> None: + def save(self, **kwargs: Any) -> Optional[Dict[str, Any]]: """Save the changes made to the object to the server. The object is updated to match what the server returns. @@ -533,6 +533,9 @@ class SaveMixin(_RestObjectBase): Args: **kwargs: Extra options to send to the server (e.g. sudo) + Returns: + The new object data (*not* a RESTObject) + Raise: GitlabAuthenticationError: If authentication is not correct GitlabUpdateError: If the server cannot perform the request @@ -540,15 +543,15 @@ class SaveMixin(_RestObjectBase): updated_data = self._get_updated_data() # Nothing to update. Server fails if sent an empty dict. if not updated_data: - return + return None # call the manager obj_id = self.encoded_id if TYPE_CHECKING: assert isinstance(self.manager, UpdateMixin) server_data = self.manager.update(obj_id, updated_data, **kwargs) - if server_data is not None: - self._update_attrs(server_data) + self._update_attrs(server_data) + return server_data class ObjectDeleteMixin(_RestObjectBase): |