Skip to content

Commit 99623ab

Browse files
Added /accounts, /account-categories, /account-category-types, /periods
1 parent 1eedbc7 commit 99623ab

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

tempoapiclient/client.py

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,39 @@ def _list(self, url, **params):
7171
if "next" not in metadata or metadata.get("count", 0) < metadata.get("limit", 0):
7272
break
7373

74+
def get_accounts(self):
75+
"""
76+
Retrieve existing accounts.
77+
"""
78+
return { x["key"]: x for x in self._list("/accounts") }
79+
80+
81+
82+
def get_account_categories(self):
83+
"""
84+
Retrieve existing account categories.
85+
"""
86+
return { x["key"]: x for x in self._list("/account-categories") }
87+
88+
89+
def get_account_category_types(self):
90+
"""
91+
Retrieve all periods for a given date range
92+
"""
93+
return list(self._list("/account-category-types"))
94+
95+
96+
def get_periods(self, date_from, date_to):
97+
"""
98+
Retrieve periods.
99+
"""
100+
params = {
101+
"from": self._resolve_date(date_from).isoformat(),
102+
"to": self._resolve_date(date_to).isoformat()
103+
}
104+
105+
return list(self._list("/periods", **params) )
106+
74107

75108
def get_work_attributes(self):
76109
"""

0 commit comments

Comments
 (0)