Attachments
- set_attachment_fact(self, file_to_upload, description: str, fact_id: str, html_rendering_hint: str = None) None
Set attachment fact for given asset. Supported for CPD version >=4.6.5.
- Parameters:
file_to_upload (str) – Attachment file path to upload
description (str) – Description about the attachment file
fact_id (str) – Fact id for the attachment
html_rendering_hint (str) – (Optional) html rendering hint. Available options are in
RenderingHints
A way to use me is:
>>> model.set_attachment_fact(file_to_upload="./artifacts/image.png",description=<file description>,fact_id=<custom fact id>) >>> model.set_attachment_fact(file_to_upload="./artifacts/image.png",description=<file description>,fact_id=<custom fact id>,html_rendering_hint=<render hint>)
- get_attachment_definitions(self, type_name: str = None) List
Get all attachment fact definitions for model or model_usecase. Supported for CPD version >=4.6.5
- Returns:
All attachment fact definitions for model or model_usecase
- Return type:
list()
The way to use me is:
>>> client.assets.get_attachment_definitions(type_name=<model or model_usecase>)
- has_attachment(self, fact_id: str = None) bool
Check if attachment/s exist. Supported for CPD version >=4.6.5
- Parameters:
fact_id (str, optional) – Id of attachment fact
- Return type:
bool
The way to use me is :
>>> model.has_attachment() >>> model.has_attachment(fact_id=<fact id>)
- list_attachments(self, filter_by_factid: str = None, format: str = 'dict')
List available attachments facts. Supported for CPD version >=4.6.5
- Parameters:
filter_by_factid (str) – (Optional) Fact id for the attachment to filter by
format (str) – Result output format. Default to dict. Available options are in
FormatType
A way to use me is:
>>> model.list_attachments(format="str") # use this format if using output for `set_custom_fact()` >>> model.list_attachments() # get all attachment facts >>> model.list_attachments(filter_by_factid=<"fact_id_1">) # filter by associated fact_id_1
- remove_attachment(self, fact_id: str)
Remove available attachments facts for given id.Supported for CPD version >=4.6.5
- Parameters:
fact_id (str) – Fact id of the attachment
A way to use me is:
>>> model.remove_attachment(fact_id=<fact id of attachment>)
- remove_all_attachments(self)
Remove all attachments facts for given asset. Supported for CPD version >=4.6.5
A way to use me is:
>>> model.remove_all_attachments()