Skip to content

Commit 9989a64

Browse files
committed
Added force= option for deleting assets/versions or rejecting probation.
1 parent ff95025 commit 9989a64

File tree

3 files changed

+19
-6
lines changed

3 files changed

+19
-6
lines changed

src/pygobbler/reject_probation.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from . import _utils as ut
22

33

4-
def reject_probation(project: str, asset: str, version: str, staging: str, url: str):
4+
def reject_probation(project: str, asset: str, version: str, staging: str, url: str, force: bool = False):
55
"""
66
Reject a probational upload of a version of a project's asset.
77
@@ -20,5 +20,9 @@ def reject_probation(project: str, asset: str, version: str, staging: str, url:
2020
2121
url:
2222
URL to the Gobbler REST API.
23+
24+
force:
25+
Whether the version should be forcibly rejected and removed if it contains invalid files.
26+
If this needs to be set to ``True``, users may need to call :py:func:`~gobbler.refresh_usage.refresh_usage`` afterwards to correct project-level usage statistics.
2327
"""
24-
ut.dump_request(staging, url, "reject_probation", { "project": project, "asset": asset, "version": version })
28+
ut.dump_request(staging, url, "reject_probation", { "project": project, "asset": asset, "version": version, "force": force })

src/pygobbler/remove_asset.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from . import _utils as ut
22

33

4-
def remove_asset(project: str, asset: str, staging: str, url: str):
4+
def remove_asset(project: str, asset: str, staging: str, url: str, force: bool = False):
55
"""
66
Remove an asset of a project from the registry.
77
@@ -17,5 +17,9 @@ def remove_asset(project: str, asset: str, staging: str, url: str):
1717
1818
url:
1919
URL to the Gobbler REST API.
20+
21+
force:
22+
Whether the asset should be forcibly removed if it contains invalid files.
23+
If this needs to be set to ``True``, users may need to call :py:func:`~gobbler.refresh_usage.refresh_usage`` afterwards to correct project-level usage statistics.
2024
"""
21-
ut.dump_request(staging, url, "delete_asset", { "project": project, "asset": asset })
25+
ut.dump_request(staging, url, "delete_asset", { "project": project, "asset": asset, "force": force })

src/pygobbler/remove_version.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from . import _utils as ut
22

33

4-
def remove_version(project: str, asset: str, version: str, staging: str, url: str):
4+
def remove_version(project: str, asset: str, version: str, staging: str, url: str, force: bool = False):
55
"""
66
Remove a version of a project asset from the registry.
77
@@ -18,7 +18,12 @@ def remove_version(project: str, asset: str, version: str, staging: str, url: st
1818
staging:
1919
Path to the staging directory.
2020
21+
force:
22+
Whether the version should be forcibly removed if it contains invalid files.
23+
If this needs to be set to ``True``, users may need to call :py:func:`~gobbler.refresh_usage.refresh_usage`` afterwards to correct project-level usage statistics.
24+
Similarly, :py:func:`~gobbler.refresh_latest.refresh_latest` may also need to be called.
25+
2126
url:
2227
URL to the Gobbler REST API.
2328
"""
24-
ut.dump_request(staging, url, "delete_version", { "project": project, "asset": asset, "version": version })
29+
ut.dump_request(staging, url, "delete_version", { "project": project, "asset": asset, "version": version, "force": force })

0 commit comments

Comments
 (0)