attachment.py
Attachment (CelonisApiObjectChild)
¶
Attachment object to interact with Celonis Studio API.
Source code in celonis_api/studio/attachment.py
class Attachment(CelonisApiObjectChild):
"""Attachment object to interact with Celonis Studio API."""
ATTACHMENT_MODES = ["CREATOR", "VIEWER"]
@staticmethod
def verify_mode(mode: str):
if mode not in Attachment.ATTACHMENT_MODES:
raise PyCelonisValueError(f"Mode needs to be one of {', '.join(Attachment.ATTACHMENT_MODES)}.")
@property
def url(self) -> str:
"""
!!! api "API"
- `/package-manager/api/attachments/{attachment_id}`
"""
return f"{self.celonis.url}/package-manager/api/attachments/{self.id}"
@property
def _parent_class(self):
return BaseNode
@property
def configuration(self) -> typing.Dict:
"""Get/Set the Attachment Configuration.
Returns:
Attachment Configuration.
"""
return json.loads(self.data["configuration"])
@configuration.setter
def configuration(self, value: typing.Union[str, typing.Dict]):
if isinstance(value, str):
self.data["configuration"] = value
else:
self.data["configuration"] = json.dumps(value)