TimeAccountings

class TimeAccountingType(parent, rid, *, info=None)
delete()

Since time_accounting types cannot be deletet via REST API, this method raises an exception.

Raises:

NotImplementedError

update(**kwargs)

Update the type properties.

Parameters:

kwargs – name(str), note(note) or active(bool)

Returns:

a new type instance

Return type:

TimeAccountingType

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 = ()
active
created_at: datetime
created_by: User
id
name
note
parent
updated_at: datetime
updated_by: User
url

the API endpoint URL

class TimeAccountingTypes(...)
create(name, *, note=None, active=True)

Create a new time accounting type.

Parameters:
  • name (str) – the type name

  • note (str | None) – optional note

  • active (bool) – active flag

Returns:

the newly created time accountings type

Return type:

TimeAccountingType

iter(*args, **params)

Iterate through all objects.

With params you can also override the pagination defaults set in Client.pagination

The returned iterable can be used in for loops or fill a Python container like list or tuple.

items = tuple(resource.iter(...))

for item in resource.iter(page=5, page_size=20, expand=True):
    print(item)
Parameters:
  • args – additional endpoint arguments

  • params – additional pagination options like page, page_size, extend

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
class TimeAccounting(...)
update(**kwargs):

Update the time accounting properties. Required permission: admin.time_accounting.

examples:

time_accounting = client.time_accountings(1)

# time_unit can be ``float`` or ``str``
new_instance = time_accounting.update(time_unit=60.0)

# change accounting type: ``str`` or type_id: ``int``
new_instance = time_accounting.update(type="research")

# change accounting type to default
new_instance = time_accounting.update(type_id=None)
Returns:

a new instance of the updated time accounting

Return type:

TimeAccounting

delete()

Delete the resource. Requires the respective permission.

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 = ('type',)
created_at: datetime
created_by: User
id: int
parent: TimeAccountings
property ticket: Ticket
property ticket_article: Article | None
ticket_article_id: int | None
ticket_id: int
time_unit: str
property type: TimeAccountingType | None
updated_at: datetime
updated_by: User
url

the API endpoint URL

class TimeAccountings(...)
create(ticket_id, **kwargs)
iter(*args, **params)

Iterate through all objects.

With params you can also override the pagination defaults set in Client.pagination

The returned iterable can be used in for loops or fill a Python container like list or tuple.

items = tuple(resource.iter(...))

for item in resource.iter(page=5, page_size=20, expand=True):
    print(item)
Parameters:
  • args – additional endpoint arguments

  • params – additional pagination options like page, page_size, extend

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
property types: TimeAccountingTypes

Manages the /time_accounting/types endpoint.

url