Articles

class Attachment(...)
static info_from_files(*paths)

returns a list of dicts that can be used for the attachments property 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 FileExistsError if 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:

TimeAccounting

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 True the properties will contain additional information.

Note

if EXPANDED_ATTRIBUTES contains '*' expand will always be True

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
created_by: User
from_: str
id
internal: bool
message_id: str | None
message_id_md5: str | None
origin_by: User | None
parent: Articles
sender: str
subject: str | None
property ticket: Ticket
time_unit: str | None
to: str | None
updated_at: datetime
updated_by: User
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:

Article

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

property client: Client
endpoint: str
url