mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-09 07:56:22 -06:00
Unsubscribe from package when a license is declined (cloud flow)
CURA-6984
This commit is contained in:
parent
0e5654e44b
commit
4e8534b93b
3 changed files with 14 additions and 2 deletions
|
@ -18,3 +18,11 @@ class CloudApiModel:
|
||||||
cloud_api_root=cloud_api_root,
|
cloud_api_root=cloud_api_root,
|
||||||
cloud_api_version=cloud_api_version,
|
cloud_api_version=cloud_api_version,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
## https://api.ultimaker.com/cura-packages/v1/user/packages/{package_id}
|
||||||
|
@classmethod
|
||||||
|
def userPackageUrl(cls, package_id: str) -> str:
|
||||||
|
|
||||||
|
return (CloudApiModel.api_url_user_packages + "/{package_id}").format(
|
||||||
|
package_id=package_id
|
||||||
|
)
|
||||||
|
|
|
@ -16,3 +16,8 @@ class CloudPackageManager:
|
||||||
data=data.encode(),
|
data=data.encode(),
|
||||||
scope=self._scope
|
scope=self._scope
|
||||||
)
|
)
|
||||||
|
|
||||||
|
def unsubscribe(self, package_id: str) -> None:
|
||||||
|
url = CloudApiModel.userPackageUrl(package_id)
|
||||||
|
self._request_manager.delete(url=url, scope=self._scope)
|
||||||
|
|
||||||
|
|
|
@ -83,8 +83,7 @@ class SyncOrchestrator(Extension):
|
||||||
self._cloud_package_manager.subscribe(item["package_id"])
|
self._cloud_package_manager.subscribe(item["package_id"])
|
||||||
has_changes = True
|
has_changes = True
|
||||||
else:
|
else:
|
||||||
# todo unsubscribe declined packages
|
self._cloud_package_manager.unsubscribe(item["package_id"])
|
||||||
pass
|
|
||||||
# delete temp file
|
# delete temp file
|
||||||
os.remove(item["package_path"])
|
os.remove(item["package_path"])
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue