Skip to content

Commit f16c140

Browse files
committed
chore(release): version 1.5.1
chore(cliff): hide navigation in changelog
2 parents 06bdaad + bacab09 commit f16c140

19 files changed

+159
-93
lines changed

cliff.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
[changelog]
99
# template for the changelog header
1010
header = """
11+
---
12+
hide:
13+
- navigation
14+
---
15+
1116
# Changelog\n
1217
All notable changes to this project will be documented in this file.\n
1318
"""

docs/CHANGELOG.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
---
22
hide:
3-
- navigation
3+
- navigation
44
---
55

66
# Changelog
77

88
All notable changes to this project will be documented in this file.
99

10+
## [1.5.1] - 2024-11-26
11+
12+
### 🐛 Bug Fixes
13+
14+
- *(models)* From_kwargs not incorporating organization id
15+
16+
### 📚 Documentation
17+
18+
- *(endpoints)* Correct and improve docstrings
19+
- *(cache, config)* Remove unnecessary type on return value in docstrings
20+
1021
## [1.5.0] - 2024-11-25
1122

1223
### 🚀 Features

docs/api-guide/organization.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
> [!NOTE]
2-
> Organization endpoint doesn't require a workspace id.
3-
41
::: toggl_api.OrganizationEndpoint
2+
options:
3+
show_source: true

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "toggl-api-wrapper"
3-
version = "1.5.0"
3+
version = "1.5.1"
44
description = "Simple Toggl API wrapper for non-premium features."
55
authors = ["David Kasakaitis <[email protected]>"]
66
license = "MIT"

toggl_api/client.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,12 @@ class ClientEndpoint(TogglCachedEndpoint[TogglClient]):
6363
6464
[Official Documentation](https://engineering.toggl.com/docs/api/clients)
6565
66+
Examples:
67+
>>> wid = 123213324
68+
>>> client_endpoint = ClientEndpoint(wid, BasicAuth(...), SqliteCache(...))
69+
>>> client_endpoint.get(214125562)
70+
TogglClient(214125562, "Simplicidentata", workspace=123213324)
71+
6672
Params:
6773
workspace_id: The workspace the clients belong to.
6874
auth: Authentication for the client.
@@ -109,7 +115,7 @@ def add(self, body: ClientBody) -> TogglClient | None:
109115
NamingError: If no name was set as its required.
110116
111117
Returns:
112-
TogglClient: Newly created client with specified parameters.
118+
Newly created client with specified parameters.
113119
"""
114120

115121
if body.name is None:
@@ -134,7 +140,7 @@ def get(self, client_id: int | TogglClient, *, refresh: bool = False) -> TogglCl
134140
is not found in cache. Defaults to False.
135141
136142
Returns:
137-
TogglClient | None: If the client was found.
143+
A TogglClient if the client was found else None.
138144
"""
139145
if isinstance(client_id, TogglClient):
140146
client_id = client_id.id
@@ -167,7 +173,7 @@ def edit(self, client: TogglClient | int, body: ClientBody) -> TogglClient | Non
167173
body: New parameters to use. Ignore client status.
168174
169175
Returns:
170-
TogglClient | None: Newly edited client or None if not found.
176+
Newly edited client or None if not found.
171177
"""
172178
if body.status:
173179
log.warning("Client status not supported by edit endpoint")
@@ -188,6 +194,10 @@ def delete(self, client: TogglClient | int) -> None:
188194
This endpoint always hit the external API in order to keep clients consistent.
189195
190196
[Official Documentation](https://engineering.toggl.com/docs/api/clients#delete-delete-client)
197+
198+
Raises:
199+
HTTPStatusError: If anything thats not an *ok* or *404* status code
200+
is returned.
191201
"""
192202
client_id = client if isinstance(client, int) else client.id
193203
try:
@@ -228,12 +238,11 @@ def collect(
228238
[Official Documentation](https://engineering.toggl.com/docs/api/clients#get-list-clients)
229239
230240
Args:
231-
body: Status and name to target. Ignores notes. Ignores status if
232-
using cache.
241+
body: Status and name to target. Ignores notes. Ignores status if using cache.
233242
refresh: Whether to refresh cache.
234243
235244
Returns:
236-
list[TogglClient]: A list of clients. Empty if not found.
245+
A list of clients. Empty if not found.
237246
"""
238247
if not refresh:
239248
return self._collect_cache(body)

toggl_api/config.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def generate_authentication() -> BasicAuth:
2929
AuthenticationError: If credentials are not set or invalid.
3030
3131
Returns:
32-
BasicAuth: BasicAuth object that is used with httpx client.
32+
BasicAuth object that is used with Httpx client.
3333
"""
3434
api_token = os.getenv("TOGGL_API_TOKEN")
3535
if api_token is None:
@@ -83,7 +83,7 @@ def use_togglrc(config_path: Optional[Path] = None) -> BasicAuth:
8383
AuthenticationError: If credentials are not set or invalid.
8484
8585
Returns:
86-
BasicAuth: BasicAuth object that is used with httpx client.
86+
BasicAuth object that is used with httpx client.
8787
"""
8888
try:
8989
config = _get_togglrc(config_path)
@@ -138,7 +138,7 @@ def retrieve_workspace_id(default: Optional[int] = None) -> int:
138138
variable or the workspace set is not an integer.
139139
140140
Returns:
141-
int: The id of the workspace.
141+
The id of the workspace.
142142
"""
143143

144144
workspace = os.environ.get("TOGGL_WORKSPACE_ID", default)
@@ -165,7 +165,7 @@ def retrieve_togglrc_workspace_id(config_path: Optional[Path] = None) -> int:
165165
ValueError: If the workspace value is not an integer.
166166
167167
Returns:
168-
int: The id of the workspace.
168+
The id of the workspace.
169169
"""
170170

171171
config = _get_togglrc(config_path)

toggl_api/meta/base_endpoint.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ class property if set to None.
117117
raw (bool): Whether to use the raw data. Defaults to False.
118118
retries (int): For recursive calls if the server fails multiple times.
119119
120+
Raises:
121+
HTTPStatusError: If the request is not a success.
122+
120123
Returns:
121-
Any: Response data or None if request does not return any data.
124+
Response data or None if request does not return any data.
122125
"""
123126
if retries is None:
124127
retries = self.retries

toggl_api/meta/cache/json_cache.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ def delete_entries(self, update: list[T] | T, **kwargs: Any) -> None:
240240
self.delete_entry(entry)
241241
return None
242242

243-
def query(self, *query: TogglQuery, distinct: bool = False) -> list[TogglClass]:
243+
def query(self, *query: TogglQuery, distinct: bool = False) -> list[T]:
244244
"""Query method for filtering Toggl objects from cache.
245245
246246
Filters cached Toggl objects by set of supplied queries.
@@ -254,7 +254,7 @@ def query(self, *query: TogglQuery, distinct: bool = False) -> list[TogglClass]:
254254
with unhashable fields such as lists.
255255
256256
Returns:
257-
list[TogglClass]: A query object with parameters filtered.
257+
A list of models with the query parameters that matched.
258258
"""
259259

260260
log.debug("Querying cache with %s parameters.", len(query), extra={"query": query})

toggl_api/meta/cache/sqlite_cache.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,9 @@ def find_entry(self, query: T | dict[str, Any]) -> T | None:
132132
return search.filter_by(**query).first()
133133

134134
def query(self, *query: TogglQuery, distinct: bool = False) -> Query[T]:
135-
"""Query method for filtering Toggl objects from cache.
135+
"""Query method for filtering models from cache.
136136
137-
Filters cached toggl objects by set of supplied queries.
137+
Filters cached model by set of supplied queries.
138138
139139
Supports queries with various comparisons with the [Comparison][toggl_api.Comparison]
140140
enumeration.
@@ -144,7 +144,7 @@ def query(self, *query: TogglQuery, distinct: bool = False) -> Query[T]:
144144
distinct: Whether to keep equivalent values around.
145145
146146
Returns:
147-
Query[TogglClass]: A SQLAlchemy query object with parameters filtered.
147+
A SQLAlchemy query object with parameters filtered.
148148
"""
149149

150150
search = self.session.query(self.parent.model)

toggl_api/meta/cached_endpoint.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,12 @@ def request( # type: ignore[override]
108108
refresh: Whether to refresh the cache or not. Defaults to False.
109109
raw (bool): Whether to use the raw data. Defaults to False.
110110
111+
Raises:
112+
HTTPStatusError: If the request is not a success.
113+
111114
Returns:
112-
TogglClass | Iterable[TogglClass] | None: Toggl API response data
113-
processed into TogglClass objects.
115+
Toggl API response data processed into TogglClass objects or not
116+
depending on arguments.
114117
"""
115118

116119
data = self.load_cache() if self.model is not None else None
@@ -166,7 +169,7 @@ def query(self, *query: TogglQuery, distinct: bool = False) -> list[T]:
166169
distinct: A boolean that remove duplicate values if present.
167170
168171
Returns:
169-
Iterable: An iterable object depending on the cache used.
172+
A list objects depending on the endpoint.
170173
"""
171174
return list(self.cache.query(*query, distinct=distinct))
172175

0 commit comments

Comments
 (0)