teachworks-sdk 0.2.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- teachworks_sdk-0.2.1/.gitignore +30 -0
- teachworks_sdk-0.2.1/LICENSE +21 -0
- teachworks_sdk-0.2.1/PKG-INFO +151 -0
- teachworks_sdk-0.2.1/README.md +106 -0
- teachworks_sdk-0.2.1/Teachworks API - FT.postman_collection.json +9793 -0
- teachworks_sdk-0.2.1/pyproject.toml +47 -0
- teachworks_sdk-0.2.1/teachworks_sdk/__init__.py +16 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/__init__.py +40 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/availabilities/__init__.py +7 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/availabilities/availabilities.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/availabilities/unavailabilities.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/billing/__init__.py +13 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/billing/cost_premiums.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/billing/credit_note_allocations.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/billing/invoices.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/billing/payment_allocations.py +86 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/billing/payments.py +101 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/employees/__init__.py +3 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/employees/employees.py +176 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/families/__init__.py +9 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/families/customers.py +175 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/families/student_groups.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/families/students.py +189 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/lessons/__init__.py +9 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/lessons/lesson_participants.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/lessons/lessons.py +131 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/lessons/other_events.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/outcomes/__init__.py +9 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/outcomes/repertoires.py +88 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/outcomes/result_groups.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/outcomes/results.py +101 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/service_details/__init__.py +5 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/service_details/locations.py +101 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/service_details/services.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/service_details/subjects.py +73 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/wages/__init__.py +9 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/wages/other_compensation.py +86 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/wages/wage_payments.py +101 -0
- teachworks_sdk-0.2.1/teachworks_sdk/clients/wages/wage_tiers.py +74 -0
- teachworks_sdk-0.2.1/teachworks_sdk/errors.py +75 -0
- teachworks_sdk-0.2.1/teachworks_sdk/logging_utils.py +229 -0
- teachworks_sdk-0.2.1/teachworks_sdk/models/__init__.py +134 -0
- teachworks_sdk-0.2.1/teachworks_sdk/models/base.py +62 -0
- teachworks_sdk-0.2.1/teachworks_sdk/models/list_params.py +732 -0
- teachworks_sdk-0.2.1/teachworks_sdk/models/resolvers.py +270 -0
- teachworks_sdk-0.2.1/teachworks_sdk/models/resources.py +631 -0
- teachworks_sdk-0.2.1/teachworks_sdk/py.typed +0 -0
- teachworks_sdk-0.2.1/teachworks_sdk/session.py +577 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# Distribution / packaging
|
|
7
|
+
build/
|
|
8
|
+
dist/
|
|
9
|
+
*.egg-info/
|
|
10
|
+
*.egg
|
|
11
|
+
|
|
12
|
+
# Virtual environments
|
|
13
|
+
.venv/
|
|
14
|
+
venv/
|
|
15
|
+
ENV/
|
|
16
|
+
|
|
17
|
+
# IDE
|
|
18
|
+
.idea/
|
|
19
|
+
.vscode/
|
|
20
|
+
*.swp
|
|
21
|
+
*.swo
|
|
22
|
+
|
|
23
|
+
# Testing
|
|
24
|
+
.pytest_cache/
|
|
25
|
+
.coverage
|
|
26
|
+
htmlcov/
|
|
27
|
+
|
|
28
|
+
# Local development
|
|
29
|
+
.env
|
|
30
|
+
.env.local
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 Teachworks SDK Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: teachworks-sdk
|
|
3
|
+
Version: 0.2.1
|
|
4
|
+
Summary: Python SDK for the Teachworks API.
|
|
5
|
+
Project-URL: Homepage, https://github.com/north-star-tutors/Teachworks-SDK
|
|
6
|
+
Project-URL: Repository, https://github.com/north-star-tutors/Teachworks-SDK
|
|
7
|
+
Project-URL: Documentation, https://github.com/north-star-tutors/Teachworks-SDK#readme
|
|
8
|
+
Author: Teachworks SDK Contributors
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2024 Teachworks SDK Contributors
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Keywords: api,sdk,teachworks
|
|
32
|
+
Classifier: Development Status :: 3 - Alpha
|
|
33
|
+
Classifier: Intended Audience :: Developers
|
|
34
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
35
|
+
Classifier: Programming Language :: Python :: 3
|
|
36
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
37
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
38
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
39
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
40
|
+
Classifier: Typing :: Typed
|
|
41
|
+
Requires-Python: >=3.9
|
|
42
|
+
Requires-Dist: pydantic>=2.6.0
|
|
43
|
+
Requires-Dist: requests>=2.31.0
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# Teachworks SDK
|
|
47
|
+
|
|
48
|
+
A Python SDK for the [Teachworks API](https://documenter.getpostman.com/view/10096149/SWTABydD). This package provides a typed, validated, and well-organized interface to Teachworks, built around a resilient `TeachworksSession` that manages authentication, rate limits, pagination, and error handling.
|
|
49
|
+
|
|
50
|
+
## Installation
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
pip install teachworks-sdk
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## Quick Start
|
|
57
|
+
|
|
58
|
+
```python
|
|
59
|
+
from teachworks_sdk import TeachworksSession
|
|
60
|
+
|
|
61
|
+
with TeachworksSession(api_key="your-api-key") as session:
|
|
62
|
+
# List all locations
|
|
63
|
+
locations = session.locations.list()
|
|
64
|
+
for location in locations:
|
|
65
|
+
print(location.id, location.name)
|
|
66
|
+
|
|
67
|
+
# Fetch all students across pages
|
|
68
|
+
students = session.students.list(all_pages=True)
|
|
69
|
+
|
|
70
|
+
# Retrieve a single record
|
|
71
|
+
employee = session.employees.retrieve(123)
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Features
|
|
75
|
+
|
|
76
|
+
- **23 API resources** - Customers, students, employees, lessons, invoices, payments, and more
|
|
77
|
+
- **Automatic pagination** - Fetch all pages with `all_pages=True`
|
|
78
|
+
- **Rate limiting** - Built-in request throttling and retry with exponential backoff
|
|
79
|
+
- **Typed responses** - Pydantic models with full type hints
|
|
80
|
+
- **Relationship resolution** - Lazy-load related resources
|
|
81
|
+
- **Session caching** - Identity map prevents duplicate fetches
|
|
82
|
+
- **Comprehensive logging** - DEBUG, INFO, WARNING, and ERROR logging with flexible configuration
|
|
83
|
+
|
|
84
|
+
## Documentation
|
|
85
|
+
|
|
86
|
+
| Document | Description |
|
|
87
|
+
|----------|-------------|
|
|
88
|
+
| [Usage Guide](docs/usage.md) | Configuration, error handling, caching, filtering patterns |
|
|
89
|
+
| [Logging Guide](docs/LOGGING.md) | Comprehensive logging configuration and troubleshooting |
|
|
90
|
+
| [API Reference](docs/api-reference.md) | Complete list of resources and methods |
|
|
91
|
+
| [Types Reference](docs/types.md) | All model types and their properties |
|
|
92
|
+
|
|
93
|
+
## Basic Examples
|
|
94
|
+
|
|
95
|
+
### Error Handling
|
|
96
|
+
|
|
97
|
+
```python
|
|
98
|
+
from teachworks_sdk import TeachworksSession, TeachworksAPIError
|
|
99
|
+
|
|
100
|
+
try:
|
|
101
|
+
location = session.locations.retrieve(999999)
|
|
102
|
+
except TeachworksAPIError as exc:
|
|
103
|
+
print(exc.status_code, exc.message)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
### Typed Filtering
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
from teachworks_sdk import TeachworksSession, Types
|
|
110
|
+
from datetime import date
|
|
111
|
+
|
|
112
|
+
lessons = session.lessons.list(
|
|
113
|
+
query=Types.LessonListParams(
|
|
114
|
+
employee_id=42,
|
|
115
|
+
from_date=date(2024, 1, 1)
|
|
116
|
+
)
|
|
117
|
+
)
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
### Relationship Resolution
|
|
121
|
+
|
|
122
|
+
```python
|
|
123
|
+
participant = session.lesson_participants.retrieve(42)
|
|
124
|
+
student = participant.resolve(session).student()
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Logging
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
import logging
|
|
131
|
+
|
|
132
|
+
# Enable SDK logging with your app's configuration
|
|
133
|
+
logging.basicConfig(level=logging.INFO)
|
|
134
|
+
|
|
135
|
+
# Or enable DEBUG logging for SDK only
|
|
136
|
+
logging.getLogger("teachworks").setLevel(logging.DEBUG)
|
|
137
|
+
|
|
138
|
+
# See the Logging Guide for advanced configuration
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Development
|
|
142
|
+
|
|
143
|
+
```bash
|
|
144
|
+
python -m venv .venv
|
|
145
|
+
source .venv/bin/activate
|
|
146
|
+
pip install -e .
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## License
|
|
150
|
+
|
|
151
|
+
MIT
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Teachworks SDK
|
|
2
|
+
|
|
3
|
+
A Python SDK for the [Teachworks API](https://documenter.getpostman.com/view/10096149/SWTABydD). This package provides a typed, validated, and well-organized interface to Teachworks, built around a resilient `TeachworksSession` that manages authentication, rate limits, pagination, and error handling.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
pip install teachworks-sdk
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Quick Start
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from teachworks_sdk import TeachworksSession
|
|
15
|
+
|
|
16
|
+
with TeachworksSession(api_key="your-api-key") as session:
|
|
17
|
+
# List all locations
|
|
18
|
+
locations = session.locations.list()
|
|
19
|
+
for location in locations:
|
|
20
|
+
print(location.id, location.name)
|
|
21
|
+
|
|
22
|
+
# Fetch all students across pages
|
|
23
|
+
students = session.students.list(all_pages=True)
|
|
24
|
+
|
|
25
|
+
# Retrieve a single record
|
|
26
|
+
employee = session.employees.retrieve(123)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Features
|
|
30
|
+
|
|
31
|
+
- **23 API resources** - Customers, students, employees, lessons, invoices, payments, and more
|
|
32
|
+
- **Automatic pagination** - Fetch all pages with `all_pages=True`
|
|
33
|
+
- **Rate limiting** - Built-in request throttling and retry with exponential backoff
|
|
34
|
+
- **Typed responses** - Pydantic models with full type hints
|
|
35
|
+
- **Relationship resolution** - Lazy-load related resources
|
|
36
|
+
- **Session caching** - Identity map prevents duplicate fetches
|
|
37
|
+
- **Comprehensive logging** - DEBUG, INFO, WARNING, and ERROR logging with flexible configuration
|
|
38
|
+
|
|
39
|
+
## Documentation
|
|
40
|
+
|
|
41
|
+
| Document | Description |
|
|
42
|
+
|----------|-------------|
|
|
43
|
+
| [Usage Guide](docs/usage.md) | Configuration, error handling, caching, filtering patterns |
|
|
44
|
+
| [Logging Guide](docs/LOGGING.md) | Comprehensive logging configuration and troubleshooting |
|
|
45
|
+
| [API Reference](docs/api-reference.md) | Complete list of resources and methods |
|
|
46
|
+
| [Types Reference](docs/types.md) | All model types and their properties |
|
|
47
|
+
|
|
48
|
+
## Basic Examples
|
|
49
|
+
|
|
50
|
+
### Error Handling
|
|
51
|
+
|
|
52
|
+
```python
|
|
53
|
+
from teachworks_sdk import TeachworksSession, TeachworksAPIError
|
|
54
|
+
|
|
55
|
+
try:
|
|
56
|
+
location = session.locations.retrieve(999999)
|
|
57
|
+
except TeachworksAPIError as exc:
|
|
58
|
+
print(exc.status_code, exc.message)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Typed Filtering
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from teachworks_sdk import TeachworksSession, Types
|
|
65
|
+
from datetime import date
|
|
66
|
+
|
|
67
|
+
lessons = session.lessons.list(
|
|
68
|
+
query=Types.LessonListParams(
|
|
69
|
+
employee_id=42,
|
|
70
|
+
from_date=date(2024, 1, 1)
|
|
71
|
+
)
|
|
72
|
+
)
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Relationship Resolution
|
|
76
|
+
|
|
77
|
+
```python
|
|
78
|
+
participant = session.lesson_participants.retrieve(42)
|
|
79
|
+
student = participant.resolve(session).student()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Logging
|
|
83
|
+
|
|
84
|
+
```python
|
|
85
|
+
import logging
|
|
86
|
+
|
|
87
|
+
# Enable SDK logging with your app's configuration
|
|
88
|
+
logging.basicConfig(level=logging.INFO)
|
|
89
|
+
|
|
90
|
+
# Or enable DEBUG logging for SDK only
|
|
91
|
+
logging.getLogger("teachworks").setLevel(logging.DEBUG)
|
|
92
|
+
|
|
93
|
+
# See the Logging Guide for advanced configuration
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Development
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
python -m venv .venv
|
|
100
|
+
source .venv/bin/activate
|
|
101
|
+
pip install -e .
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## License
|
|
105
|
+
|
|
106
|
+
MIT
|