diff options
author | Nejc Habjan <nejc.habjan@siemens.com> | 2022-05-01 20:55:56 +0200 |
---|---|---|
committer | Nejc Habjan <nejc.habjan@siemens.com> | 2022-06-06 10:41:26 +0200 |
commit | 56280040e415b39ca0e9d032a927f0a39e734b9b (patch) | |
tree | c3e1b6d2fb077ef41b1347d49d37636e79d9c1f5 /gitlab/mixins.py | |
parent | 0e3c461a2ad6ade9819db864261a82b357ce5808 (diff) | |
download | gitlab-refactor/decouple-cli-from-custom-args.tar.gz |
refactor: decouple CLI from custom method argumentsrefactor/decouple-cli-from-custom-args
Diffstat (limited to 'gitlab/mixins.py')
-rw-r--r-- | gitlab/mixins.py | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/gitlab/mixins.py b/gitlab/mixins.py index 4dee710..e040192 100644 --- a/gitlab/mixins.py +++ b/gitlab/mixins.py @@ -547,9 +547,8 @@ class AccessRequestMixin(_RestObjectBase): _updated_attrs: Dict[str, Any] manager: base.RESTManager - @cli.register_custom_action( - ("ProjectAccessRequest", "GroupAccessRequest"), (), ("access_level",) - ) + @cli.register_custom_action(("ProjectAccessRequest", "GroupAccessRequest")) + @base.custom_attrs(optional=("access_level",)) @exc.on_http_error(exc.GitlabUpdateError) def approve( self, access_level: int = gitlab.const.DEVELOPER_ACCESS, **kwargs: Any @@ -721,7 +720,8 @@ class TimeTrackingMixin(_RestObjectBase): assert not isinstance(result, requests.Response) return result - @cli.register_custom_action(("ProjectIssue", "ProjectMergeRequest"), ("duration",)) + @cli.register_custom_action(("ProjectIssue", "ProjectMergeRequest")) + @base.custom_attrs(required=("duration",)) @exc.on_http_error(exc.GitlabTimeTrackingError) def time_estimate(self, duration: str, **kwargs: Any) -> Dict[str, Any]: """Set an estimated time of work for the object. @@ -759,7 +759,8 @@ class TimeTrackingMixin(_RestObjectBase): assert not isinstance(result, requests.Response) return result - @cli.register_custom_action(("ProjectIssue", "ProjectMergeRequest"), ("duration",)) + @cli.register_custom_action(("ProjectIssue", "ProjectMergeRequest")) + @base.custom_attrs(required=("duration",)) @exc.on_http_error(exc.GitlabTimeTrackingError) def add_spent_time(self, duration: str, **kwargs: Any) -> Dict[str, Any]: """Add time spent working on the object. @@ -833,9 +834,8 @@ class ParticipantsMixin(_RestObjectBase): class BadgeRenderMixin(_RestManagerBase): - @cli.register_custom_action( - ("GroupBadgeManager", "ProjectBadgeManager"), ("link_url", "image_url") - ) + @cli.register_custom_action(("GroupBadgeManager", "ProjectBadgeManager")) + @base.custom_attrs(required=("link_url", "image_url")) @exc.on_http_error(exc.GitlabRenderError) def render(self, link_url: str, image_url: str, **kwargs: Any) -> Dict[str, Any]: """Preview link_url and image_url after interpolation. |