das-cli 1.0.6__py3-none-any.whl → 1.2.4__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- das/ai/plugins/dasai.py +11 -2
- das/cli.py +130 -6
- das/common/api.py +20 -0
- das/common/config.py +6 -0
- das/managers/digital_objects_manager.py +84 -0
- das/managers/download_manager.py +43 -1
- das/managers/entries_manager.py +37 -1
- das/managers/search_manager.py +17 -2
- das/services/digital_objects.py +142 -0
- das/services/downloads.py +19 -2
- das/services/entries.py +29 -3
- das_cli-1.2.4.dist-info/METADATA +1076 -0
- das_cli-1.2.4.dist-info/RECORD +32 -0
- {das_cli-1.0.6.dist-info → das_cli-1.2.4.dist-info}/WHEEL +1 -1
- das_cli-1.0.6.dist-info/METADATA +0 -408
- das_cli-1.0.6.dist-info/RECORD +0 -30
- {das_cli-1.0.6.dist-info → das_cli-1.2.4.dist-info}/entry_points.txt +0 -0
- {das_cli-1.0.6.dist-info → das_cli-1.2.4.dist-info}/licenses/LICENSE +0 -0
- {das_cli-1.0.6.dist-info → das_cli-1.2.4.dist-info}/top_level.txt +0 -0
das/services/entries.py
CHANGED
|
@@ -52,8 +52,34 @@ class EntriesService():
|
|
|
52
52
|
raise ValueError(f"API returned invalid JSON: {response.get('error')}\nResponse content: {raw_content}")
|
|
53
53
|
else:
|
|
54
54
|
raise ValueError(response.get('error') or "Unknown error occurred")
|
|
55
|
-
|
|
56
|
-
def
|
|
55
|
+
|
|
56
|
+
def delete_by_id(self, id: str) -> bool:
|
|
57
|
+
"""Delete an entry by its id."""
|
|
58
|
+
|
|
59
|
+
token = load_token()
|
|
60
|
+
|
|
61
|
+
if (token is None or token == ""):
|
|
62
|
+
raise ValueError("Authorization token is required")
|
|
63
|
+
|
|
64
|
+
headers = {
|
|
65
|
+
"Authorization": f"Bearer {token}"
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
response_entry = self.get(id=id)
|
|
69
|
+
|
|
70
|
+
if response_entry is None:
|
|
71
|
+
raise ValueError(f"Entry with id {id} not found")
|
|
72
|
+
|
|
73
|
+
url = f"{self.base_url}/Delete?Id={response_entry.get('entry',{}).get('id')}&AttributeId={response_entry.get('attributeId')}"
|
|
74
|
+
|
|
75
|
+
response = delete_data(url, headers=headers)
|
|
76
|
+
|
|
77
|
+
if response.get('success') == True:
|
|
78
|
+
return True
|
|
79
|
+
else:
|
|
80
|
+
raise ValueError(response.get('error'))
|
|
81
|
+
|
|
82
|
+
def delete(self, code: str) -> bool:
|
|
57
83
|
"""Delete an entry by its code."""
|
|
58
84
|
token = load_token()
|
|
59
85
|
|
|
@@ -74,7 +100,7 @@ class EntriesService():
|
|
|
74
100
|
response = delete_data(url, headers=headers)
|
|
75
101
|
|
|
76
102
|
if response.get('success') == True:
|
|
77
|
-
return
|
|
103
|
+
return True
|
|
78
104
|
else:
|
|
79
105
|
raise ValueError(response.get('error'))
|
|
80
106
|
|