DigitalFactoryFeatureBudgetResponse.py 2.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. # Copyright (c) 2021 Ultimaker B.V.
  2. # Cura is released under the terms of the LGPLv3 or higher.
  3. from .BaseModel import BaseModel
  4. from typing import Optional
  5. class DigitalFactoryFeatureBudgetResponse(BaseModel):
  6. """Class representing the capabilities of a user account for Digital Library.
  7. NOTE: For each max_..._projects fields, '-1' means unlimited!
  8. """
  9. def __init__(self,
  10. library_can_use_business_value: Optional[bool] = False,
  11. library_can_use_comments: Optional[bool] = False,
  12. library_can_use_status: Optional[bool] = False,
  13. library_can_use_tags: Optional[bool] = False,
  14. library_can_use_technical_requirements: Optional[bool] = False,
  15. library_max_organization_shared_projects: Optional[int] = None, # -1 means unlimited
  16. library_max_private_projects: Optional[int] = None, # -1 means unlimited
  17. library_max_team_shared_projects: Optional[int] = None, # -1 means unlimited
  18. **kwargs) -> None:
  19. self.library_can_use_business_value = library_can_use_business_value
  20. self.library_can_use_comments = library_can_use_comments
  21. self.library_can_use_status = library_can_use_status
  22. self.library_can_use_tags = library_can_use_tags
  23. self.library_can_use_technical_requirements = library_can_use_technical_requirements
  24. self.library_max_organization_shared_projects = library_max_organization_shared_projects # -1 means unlimited
  25. self.library_max_private_projects = library_max_private_projects # -1 means unlimited
  26. self.library_max_team_shared_projects = library_max_team_shared_projects # -1 means unlimited
  27. super().__init__(**kwargs)
  28. def __repr__(self) -> str:
  29. return "max private: {}, max org: {}, max team: {}".format(
  30. self.library_max_private_projects,
  31. self.library_max_organization_shared_projects,
  32. self.library_max_team_shared_projects)
  33. # Validates the model, raising an exception if the model is invalid.
  34. def validate(self) -> None:
  35. super().validate()
  36. # No validation for now, as the response can be "data: []", which should be interpreted as all False and 0's