Skip to content

Commit 30fb295

Browse files
committed
chore(release): version 1.3.0
2 parents 5ad0cf5 + 6808e99 commit 30fb295

39 files changed

+1127
-73
lines changed

.github/workflows/publish.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
env:
4545
TOGGL_WORKSPACE_ID: ${{ secrets.TOGGL_WORKSPACE_ID }}
4646
TOGGL_API_TOKEN: ${{ secrets.TOGGL_API_TOKEN }}
47+
TOGGL_ORGANIZATION_ID: ${{ secrets.TOGGL_ORGANIZATION_ID }}
48+
TOGGL_USER_ID: ${{ secrets.TOGGL_USER_ID }}
4749
GH_ACTION: "ACTION"
4850

4951
steps:

docs/CHANGELOG.md

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,73 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [1.3.0] - 2024-10-31
6+
7+
### 🚀 Features
8+
9+
- *(workspace)* Workspace body dataclass
10+
- *(workspace)* Add workspace endpoint
11+
- *(workspace)* Collect workspaces endpoint
12+
- *(workspace)* Edit workspace endpoint
13+
- *(workspace)* Get time constraints
14+
- *(workspace)* Statistics endpoint
15+
- *(models)* Organization model
16+
- *(schema)* Added organization model
17+
- *(endpoint)* Added organization endpoint
18+
- *(organization)* Add endpoint method
19+
- *(organization)* Get endpoint method
20+
- *(models)* Validate organization name
21+
- *(models)* Validate workspace name
22+
- *(organization)* Edit endpoint method
23+
- *(organization)* Collect endpoint method
24+
- *(organization)* Delete endpoint method
25+
- *(workspace)* Organization id property
26+
- *(utility)* Add org endpoint to cleanup
27+
- Add organization objects to __init__
28+
29+
### 🐛 Bug Fixes
30+
31+
- *(endpoint)* Api status not catching json decode error
32+
- *(body)* Verifying wrong variable
33+
- *(organization)* Make sure edit method stores and returns model
34+
35+
### 🚜 Refactor
36+
37+
- *(workspace)* Use a blank endpoint property
38+
- *(endpoint)* [**breaking**] Remove unnecessary class variables
39+
- *(workspace)* Improve get method error handling
40+
41+
### 🕸 Deprecations
42+
43+
- *(workspace)* Accept organization instead of workspace
44+
- *(workspace)* Turn get method workspace argument optional
45+
46+
### 📚 Documentation
47+
48+
- *(examples)* Improve authentication information
49+
- *(workspace)* Document new workspace features
50+
- *(workspace)* Improve docstrings
51+
- *(api)* Update project structure and mermaid
52+
- *(organization)* Add organization to api reference
53+
- *(workspace)* Add typed dicts to api documentation
54+
- *(config)* Reword deprecation
55+
- *(models)* Improve model documentation
56+
57+
### ⚙️ Miscellaneous Tasks
58+
59+
- *(dev-deps)* Pytest dependency added
60+
- *(actions)* Add new secrets to environment
61+
62+
### 🧪 Testing
63+
64+
- *(conftest)* Organization id fixture
65+
- *(workspace)* Cover new endpoint methods
66+
- *(tags)* Extra delete method validation
67+
- *(user)* Fix test date creation
68+
- *(workspace)* Use org id instead
69+
- *(organization)* Test all functionality
70+
- *(conftest)* User id fixture
71+
572
## [1.2.0] - 2024-10-27
673

774
### 🚀 Features

docs/api-guide/model.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,41 @@
11
# Abstract Classes
22

33
::: toggl_api.models.TogglClass
4+
options:
5+
show_source: true
46

57
::: toggl_api.models.WorkspaceChild
8+
options:
9+
show_source: true
610

711
---
812

913
# Main Models
1014

15+
::: toggl_api.TogglOrganization
16+
options:
17+
show_source: true
18+
members:
19+
- validate_name
20+
1121
::: toggl_api.TogglWorkspace
22+
options:
23+
show_source: true
24+
members:
25+
- validate_name
1226

1327
::: toggl_api.TogglClient
28+
options:
29+
show_source: true
1430

1531
::: toggl_api.TogglProject
32+
options:
33+
show_source: true
1634

1735
::: toggl_api.TogglTracker
36+
options:
37+
show_source: true
1838

1939
::: toggl_api.TogglTag
40+
options:
41+
show_source: true

docs/api-guide/organization.md

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

docs/api-guide/project_structure.txt

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,37 @@ toggl_api
2828
├── utility.py
2929
├── version.py
3030
└── workspace.py
31+
toggl_api
32+
├── client.py
33+
├── config.py
34+
├── __init__.py
35+
├── meta
36+
│   ├── base_endpoint.py
37+
│   ├── body.py
38+
│   ├── cache
39+
│   │   ├── base_cache.py
40+
│   │   ├── __init__.py
41+
│   │   ├── json_cache.py
42+
│   │   └── sqlite_cache.py
43+
│   ├── cached_endpoint.py
44+
│   ├── enums.py
45+
│   └── __init__.py
46+
├── models
47+
│   ├── _decorators.py
48+
│   ├── __init__.py
49+
│   ├── models.py
50+
│   └── schema.py
51+
├── organization.py
52+
├── project.py
53+
├── py.typed
54+
├── reports
55+
│   ├── __init__.py
56+
│   └── reports.py
57+
├── tag.py
58+
├── tracker.py
59+
├── user.py
60+
├── utility.py
61+
├── version.py
62+
└── workspace.py
63+
64+
5 directories, 27 files

docs/api-guide/workspace.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1+
2+
::: toggl_api.WorkspaceBody
3+
options:
4+
show_source: true
5+
16
::: toggl_api.WorkspaceEndpoint
27
options:
38
show_source: true
49
members:
510
- get
11+
- add
12+
- collect
13+
- edit
14+
- tracker_constraints
15+
- statistics
16+
17+
18+
# Types
19+
20+
::: toggl_api.workspace.User
21+
options:
22+
show_source: true
23+
24+
::: toggl_api.workspace.WorkspaceStatistics
25+
options:
26+
show_source: true

docs/static/mermaid/classes.mmd

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ classDiagram
5959
commit(path: Path) None
6060
load(path: Path) None
6161
process_data(data: list[TogglClass]) list[TogglClass]
62+
refresh(path: Path) bool
63+
}
64+
class OrganizationEndpoint {
65+
endpoint
66+
model
67+
add(name: str, workspace_name: str) TogglOrganization
68+
collect() list[TogglOrganization]
69+
delete(organization: TogglOrganization | int) None
70+
edit(organization: TogglOrganization | int, name: str) TogglOrganization
71+
get(organization: TogglOrganization | int) TogglOrganization | None
6272
}
6373
class PaginatedResult {
6474
next_id : Optional[int]
@@ -191,9 +201,6 @@ classDiagram
191201
class TogglEndpoint {
192202
BASE_ENDPOINT : str
193203
HEADERS : Final[dict]
194-
NOT_FOUND : Final[int]
195-
OK_RESPONSE : Final[int]
196-
SERVER_ERROR : Final[int]
197204
endpoint
198205
model
199206
workspace_id : int
@@ -202,6 +209,10 @@ classDiagram
202209
process_models(data: list[dict[str, Any]]) list[TogglClass]
203210
request(parameters: str, headers: Optional[dict], body: Optional[dict], method: RequestMethod) Any
204211
}
212+
class TogglOrganization {
213+
from_kwargs() TogglOrganization
214+
validate_name(name: str) None
215+
}
205216
class TogglProject {
206217
active : bool
207218
client : Optional[int]
@@ -227,7 +238,10 @@ classDiagram
227238
running() bool
228239
}
229240
class TogglWorkspace {
241+
name : str
242+
organization : int
230243
from_kwargs() TogglWorkspace
244+
validate_name(name: str) None
231245
}
232246
class TrackerBody {
233247
created_with : str
@@ -258,6 +272,10 @@ classDiagram
258272
process_bind_param(value: datetime, _) datetime | None
259273
process_result_value(value: Optional[datetime], _) datetime | None
260274
}
275+
class User {
276+
name : str
277+
user_id : int
278+
}
261279
class UserEndpoint {
262280
TRACKER_NOT_RUNNING : Final[int]
263281
endpoint
@@ -266,32 +284,63 @@ classDiagram
266284
collect(since: Optional[int | datetime], before: Optional[date], start_date: Optional[date], end_date: Optional[date]) list[TogglTracker]
267285
current() TogglTracker | None
268286
get(tracker_id: int | TogglTracker) TogglTracker | None
287+
get_details() dict[str, Any]
288+
verify_authentication(auth: BasicAuth) bool
269289
}
270290
class WeeklyReportEndpoint {
271291
endpoint
272292
export_report(body: ReportBody, extension: REPORT_FORMATS) bytes
273293
search_time_entries(body: ReportBody) list[dict[str, Any]]
274294
}
295+
class WorkspaceBody {
296+
admins : list[int]
297+
name : Optional[str]
298+
only_admins_may_create_projects : bool
299+
only_admins_may_create_tags : bool
300+
only_admins_see_billable_rates : bool
301+
only_admins_see_team_dashboard : bool
302+
projects_billable_by_default : bool
303+
projects_enforce_billable : bool
304+
projects_private_by_default : bool
305+
rate_change_mode : Optional[Literal['start-today', 'override-current', 'override-all']]
306+
reports_collapse : bool
307+
rounding : Optional[int]
308+
rounding_minutes : Optional[int]
309+
format(endpoint: str) dict[str, Any]
310+
}
275311
class WorkspaceChild {
276312
workspace : int
277313
from_kwargs() WorkspaceChild
278314
}
279315
class WorkspaceEndpoint {
280316
endpoint
281317
model
318+
organization_id
319+
add(organization_id: int, body: WorkspaceBody) TogglWorkspace
320+
collect(since: Optional[datetime | int]) list[TogglWorkspace]
321+
edit(workspace_id: TogglWorkspace | int, body: WorkspaceBody) TogglWorkspace
282322
get(workspace: Optional[TogglWorkspace | int]) TogglWorkspace | None
323+
statistics(workspace_id: TogglWorkspace | int) WorkspaceStatistics
324+
tracker_constraints(workspace_id: TogglWorkspace | int) dict[str, bool]
325+
}
326+
class WorkspaceStatistics {
327+
admins : list[User]
328+
groups_count : int
329+
members_count : int
283330
}
284331
ClientBody --|> BaseBody
285332
ClientEndpoint --|> TogglCachedEndpoint
286333
JSONCache --|> TogglCache
287334
SqliteCache --|> TogglCache
288335
TogglCachedEndpoint --|> TogglEndpoint
289336
TogglClient --|> WorkspaceChild
337+
TogglOrganization --|> TogglClass
290338
TogglProject --|> WorkspaceChild
291339
TogglTag --|> WorkspaceChild
292340
TogglTracker --|> WorkspaceChild
293341
TogglWorkspace --|> TogglClass
294342
WorkspaceChild --|> TogglClass
343+
OrganizationEndpoint --|> TogglCachedEndpoint
295344
ProjectBody --|> BaseBody
296345
ProjectEndpoint --|> TogglCachedEndpoint
297346
DetailedReportEndpoint --|> ReportEndpoint
@@ -303,6 +352,7 @@ classDiagram
303352
TrackerBody --|> BaseBody
304353
TrackerEndpoint --|> TogglCachedEndpoint
305354
UserEndpoint --|> TogglCachedEndpoint
355+
WorkspaceBody --|> BaseBody
306356
WorkspaceEndpoint --|> TogglCachedEndpoint
307357
Comparison --* TogglQuery : comparison
308358
JSONSession --* JSONCache : session

docs/static/mermaid/packages.mmd

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ classDiagram
3131
}
3232
class schema {
3333
}
34+
class organization {
35+
}
3436
class project {
3537
}
3638
class reports {
@@ -87,6 +89,9 @@ classDiagram
8789
schema --> _decorators
8890
schema --> models
8991
schema --> utility
92+
organization --> meta
93+
organization --> meta
94+
organization --> models
9095
project --> meta
9196
project --> models
9297
project --> utility
@@ -105,6 +110,9 @@ classDiagram
105110
user --> models
106111
user --> utility
107112
workspace --> meta
113+
workspace --> body
114+
workspace --> base_cache
115+
workspace --> enums
108116
workspace --> models
109117
base_cache ..> meta
110118
base_cache ..> models
@@ -113,3 +121,4 @@ classDiagram
113121
sqlite_cache ..> meta
114122
cached_endpoint ..> cache
115123
cached_endpoint ..> base_cache
124+
organization ..> base_cache

docs/user-guide/examples.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ All Tracker, Client, Project & Tag endpoints will have most of these methods:
88

99
---
1010

11-
- With environment variables setup correctly.
11+
> [!INFO]
12+
> With environment variables setup correctly.
1213
1314
### Tracker Example
1415

@@ -33,6 +34,9 @@ All Tracker, Client, Project & Tag endpoints will have most of these methods:
3334

3435
### Project Example
3536

37+
> [!INFO]
38+
> Using an existing togglrc file.
39+
3640
```python
3741
{% include "examples/project_example.py" %}
3842
```

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ nav:
6666
- Endpoint: api-guide/endpoint.md
6767
- Cache: api-guide/cache.md
6868
- Models: api-guide/model.md
69+
- Organization: api-guide/organization.md
6970
- Workspace: api-guide/workspace.md
7071
- Trackers: api-guide/tracker.md
7172
- Projects: api-guide/project.md

0 commit comments

Comments
 (0)