CloudApiModel.py 1.1 KB

1234567891011121314151617181920212223242526272829
  1. from typing import Union
  2. from cura import ApplicationMetadata
  3. from cura.UltimakerCloud import UltimakerCloudConstants
  4. class CloudApiModel:
  5. sdk_version: Union[str, int] = ApplicationMetadata.CuraSDKVersion
  6. cloud_api_version: str = UltimakerCloudConstants.CuraCloudAPIVersion
  7. cloud_api_root: str = UltimakerCloudConstants.CuraCloudAPIRoot
  8. api_url: str = "{cloud_api_root}/cura-packages/v{cloud_api_version}/cura/v{sdk_version}".format(
  9. cloud_api_root = cloud_api_root,
  10. cloud_api_version = cloud_api_version,
  11. sdk_version = sdk_version
  12. )
  13. # https://api.ultimaker.com/cura-packages/v1/user/packages
  14. api_url_user_packages = "{cloud_api_root}/cura-packages/v{cloud_api_version}/user/packages".format(
  15. cloud_api_root = cloud_api_root,
  16. cloud_api_version = cloud_api_version,
  17. )
  18. @classmethod
  19. def userPackageUrl(cls, package_id: str) -> str:
  20. """https://api.ultimaker.com/cura-packages/v1/user/packages/{package_id}"""
  21. return (CloudApiModel.api_url_user_packages + "/{package_id}").format(
  22. package_id = package_id
  23. )