mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-05 13:03:59 -06:00
Install and cloud-subscribe a package when after agreeing to the license
CURA-6983
This commit is contained in:
parent
1cf3cd8228
commit
35695e5ab6
5 changed files with 51 additions and 9 deletions
19
plugins/Toolbox/src/CloudSync/CloudPackageManager.py
Normal file
19
plugins/Toolbox/src/CloudSync/CloudPackageManager.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from cura.CuraApplication import CuraApplication
|
||||
from plugins.Toolbox.src.CloudApiModel import CloudApiModel
|
||||
from plugins.Toolbox.src.UltimakerCloudScope import UltimakerCloudScope
|
||||
|
||||
|
||||
## Manages Cloud subscriptions. When a package is added to a user's account, the user is 'subscribed' to that package
|
||||
# Whenever the user logs in on another instance of Cura, these subscriptions can be used to sync the user's plugins
|
||||
class CloudPackageManager:
|
||||
|
||||
def __init__(self, app: CuraApplication):
|
||||
self._request_manager = app.getHttpRequestManager()
|
||||
self._scope = UltimakerCloudScope(app)
|
||||
|
||||
def subscribe(self, package_id: str):
|
||||
data = "{\"data\": {\"package_id\": \"%s\", \"sdk_version\": \"%s\"}}" % (package_id, CloudApiModel.sdk_version)
|
||||
self._request_manager.put(url=CloudApiModel.api_url_user_packages,
|
||||
data=data.encode(),
|
||||
scope=self._scope
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue