Articles
- class Attachment(...)
- static info_from_files(*paths)
returns a list of dicts that can be used for the
attachmentsproperty when creating articles- Parameters:
paths (PathType) – one or multiple paths of the attachment files
- download(path='.', raise_if_exists=False)
Downloads the attachment file to the filesystem.
- Raises:
FileExistsError- Parameters:
path (PathType) – optional download location (directory or full file path)
raise_if_exists – raises
FileExistsErrorif destination file exists
- Returns:
the path of the downloaded attachment file
- Return type:
Path
- iter_bytes(chunk_size=8192)
Iterates over the attachment binary content.
- Parameters:
chunk_size – maximum chunk size in bytes
- iter_text(chunk_size=8192)
Iterates over the decoded attachment text content.
- Parameters:
chunk_size – maximum chunk size in bytes
- read_bytes()
Return the attachment content as bytes.
- read_text()
Return the attachment content as string.
- view()
returns a mapping view of the objects internal properties as returned by the REST API.
- filename: str
- id: int
- preferences: Dict[str, Any]
- property size: int
attachment size in bytes
- store_file_id: int
- url: str
attachment content url
- class Article(...)
- create_or_update_time_accounting(time_unit, type=None)
Create accounted time for ticket article. If time accounting already exists, it will be updated.
- Parameters:
time_unit (str | float) – accounted time units
type (None | str | int | TimeAccountingType) – accounting type
- Return type:
- last_request_age_s()
- Returns:
time in seconds since the last request
- Return type:
float | None
- reload(expand=False)
Update the object properties by requesting the current data from the server.
- Parameters:
expand – if
Truethe properties will contain additional information.
Note
if
EXPANDED_ATTRIBUTEScontains'*'expand will always beTrue
- view()
returns a mapping view of the objects internal properties as returned by the REST API.
- EXPANDED_ATTRIBUTES = ()
- property attachments: List[Attachment]
A list of the articles attachments.
- body: str
- cc: str | None
- content_type: str
- created_at: datetime
- from_: str
- id
- internal: bool
- message_id: str | None
- message_id_md5: str | None
- sender: str
- subject: str | None
- time_unit: str | None
- to: str | None
- updated_at: datetime
- url
the API endpoint URL
- class Articles(...)
- by_ticket(tid)
- create(ticket_id, body, files=None, **kwargs)
Create a new ticket article.
- Parameters:
ticket_id (int) – the ticket id where the article will be appended
body (str) – article text
files (OptionalFiles) – file attachments
kwargs – additional article parameters
- Returns:
the newly created article
- Return type:
- DEFAULT_CACHE_SIZE = -1
controls the LRU cache behaviour
LRU disabled, cache unbounded (-1)
disable caching (0)
limited LRU caching (>0)
- cache
resource LRU cache
- endpoint: str
- url