devhelm 0.1.2__tar.gz → 0.2.0__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.
- {devhelm-0.1.2 → devhelm-0.2.0}/.github/workflows/spec-check.yml +1 -1
- {devhelm-0.1.2 → devhelm-0.2.0}/PKG-INFO +23 -6
- {devhelm-0.1.2 → devhelm-0.2.0}/README.md +22 -5
- devhelm-0.2.0/docs/openapi/monitoring-api.json +33026 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/pyproject.toml +24 -2
- devhelm-0.2.0/scripts/inject_strict_config.py +134 -0
- devhelm-0.2.0/scripts/regen-from.sh +51 -0
- devhelm-0.2.0/scripts/typegen.sh +71 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/src/devhelm/__init__.py +97 -2
- devhelm-0.2.0/src/devhelm/_errors.py +210 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/src/devhelm/_generated.py +2491 -1297
- devhelm-0.2.0/src/devhelm/_http.py +191 -0
- devhelm-0.2.0/src/devhelm/_pagination.py +145 -0
- devhelm-0.2.0/src/devhelm/_validation.py +131 -0
- devhelm-0.2.0/src/devhelm/resources/alert_channels.py +70 -0
- devhelm-0.2.0/src/devhelm/resources/api_keys.py +40 -0
- devhelm-0.2.0/src/devhelm/resources/dependencies.py +51 -0
- devhelm-0.2.0/src/devhelm/resources/deploy_lock.py +49 -0
- devhelm-0.2.0/src/devhelm/resources/environments.py +61 -0
- devhelm-0.2.0/src/devhelm/resources/incidents.py +63 -0
- devhelm-0.2.0/src/devhelm/resources/monitors.py +116 -0
- devhelm-0.2.0/src/devhelm/resources/notification_policies.py +79 -0
- devhelm-0.2.0/src/devhelm/resources/resource_groups.py +93 -0
- devhelm-0.2.0/src/devhelm/resources/secrets.py +45 -0
- devhelm-0.2.0/src/devhelm/resources/status.py +22 -0
- devhelm-0.2.0/src/devhelm/resources/status_pages.py +394 -0
- devhelm-0.2.0/src/devhelm/resources/tags.py +51 -0
- devhelm-0.2.0/src/devhelm/resources/webhooks.py +72 -0
- devhelm-0.2.0/src/devhelm/types.py +348 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/tests/run_sdk.py +136 -43
- {devhelm-0.1.2 → devhelm-0.2.0}/tests/test_client.py +55 -0
- devhelm-0.2.0/tests/test_errors.py +173 -0
- devhelm-0.2.0/tests/test_http.py +172 -0
- devhelm-0.2.0/tests/test_negative_validation.py +2817 -0
- devhelm-0.2.0/tests/test_schemas.py +711 -0
- devhelm-0.2.0/tests/test_spec_parity.py +387 -0
- devhelm-0.2.0/tests/test_typing.py +121 -0
- devhelm-0.2.0/tests/test_validation_helpers.py +85 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/uv.lock +1 -1
- devhelm-0.1.2/docs/openapi/monitoring-api.json +0 -18425
- devhelm-0.1.2/scripts/typegen.sh +0 -31
- devhelm-0.1.2/src/devhelm/_errors.py +0 -62
- devhelm-0.1.2/src/devhelm/_http.py +0 -103
- devhelm-0.1.2/src/devhelm/_pagination.py +0 -74
- devhelm-0.1.2/src/devhelm/resources/alert_channels.py +0 -56
- devhelm-0.1.2/src/devhelm/resources/api_keys.py +0 -35
- devhelm-0.1.2/src/devhelm/resources/dependencies.py +0 -39
- devhelm-0.1.2/src/devhelm/resources/deploy_lock.py +0 -33
- devhelm-0.1.2/src/devhelm/resources/environments.py +0 -50
- devhelm-0.1.2/src/devhelm/resources/incidents.py +0 -44
- devhelm-0.1.2/src/devhelm/resources/monitors.py +0 -91
- devhelm-0.1.2/src/devhelm/resources/notification_policies.py +0 -60
- devhelm-0.1.2/src/devhelm/resources/resource_groups.py +0 -67
- devhelm-0.1.2/src/devhelm/resources/secrets.py +0 -37
- devhelm-0.1.2/src/devhelm/resources/status.py +0 -18
- devhelm-0.1.2/src/devhelm/resources/status_pages.py +0 -268
- devhelm-0.1.2/src/devhelm/resources/tags.py +0 -48
- devhelm-0.1.2/src/devhelm/resources/webhooks.py +0 -56
- devhelm-0.1.2/src/devhelm/types.py +0 -130
- devhelm-0.1.2/tests/test_errors.py +0 -87
- devhelm-0.1.2/tests/test_http.py +0 -74
- {devhelm-0.1.2 → devhelm-0.2.0}/.github/workflows/ci.yml +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/.github/workflows/release.yml +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/.gitignore +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/LICENSE +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/Makefile +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/scripts/release.sh +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/src/devhelm/client.py +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/src/devhelm/py.typed +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/src/devhelm/resources/__init__.py +0 -0
- {devhelm-0.1.2 → devhelm-0.2.0}/tests/__init__.py +0 -0
|
@@ -23,7 +23,7 @@ jobs:
|
|
|
23
23
|
|
|
24
24
|
- name: Download latest OpenAPI spec from monorepo
|
|
25
25
|
run: |
|
|
26
|
-
gh api repos/devhelmhq/mono/contents/docs/openapi/monitoring-api.
|
|
26
|
+
gh api repos/devhelmhq/mono/contents/docs/openapi/monitoring-api.json \
|
|
27
27
|
-H "Accept: application/vnd.github.raw+json" \
|
|
28
28
|
-o docs/openapi/monitoring-api.json
|
|
29
29
|
env:
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: devhelm
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: DevHelm SDK for Python — typed client for monitors, incidents, alerting, and more
|
|
5
5
|
Project-URL: Homepage, https://github.com/devhelmhq/sdk-python
|
|
6
6
|
Project-URL: Repository, https://github.com/devhelmhq/sdk-python.git
|
|
@@ -132,21 +132,38 @@ print(results.has_more)
|
|
|
132
132
|
|
|
133
133
|
## Error Handling
|
|
134
134
|
|
|
135
|
+
The SDK raises three top-level error types (see
|
|
136
|
+
[`040-codegen-policies.md`](https://github.com/devhelmhq/mono/blob/main/cowork/design/040-codegen-policies.md)):
|
|
137
|
+
|
|
138
|
+
- `DevhelmValidationError` — local request/response shape validation failed.
|
|
139
|
+
- `DevhelmApiError` — the API returned a non-2xx status. Subclassed by HTTP
|
|
140
|
+
class for ergonomics: `DevhelmAuthError` (401/403), `DevhelmNotFoundError`
|
|
141
|
+
(404), `DevhelmConflictError` (409), `DevhelmRateLimitError` (429),
|
|
142
|
+
`DevhelmServerError` (5xx).
|
|
143
|
+
- `DevhelmTransportError` — the request never reached a server response
|
|
144
|
+
(connection refused, timeout, TLS failure, etc.).
|
|
145
|
+
|
|
146
|
+
Every `DevhelmApiError` carries:
|
|
147
|
+
|
|
148
|
+
- `status` — the HTTP status code
|
|
149
|
+
- `code` — coarse machine-readable category (e.g. `NOT_FOUND`,
|
|
150
|
+
`RATE_LIMITED`); switch on this, not the human-readable `message`
|
|
151
|
+
- `request_id` — the per-request id from the `X-Request-Id` response header;
|
|
152
|
+
always include this in support tickets
|
|
153
|
+
|
|
135
154
|
```python
|
|
136
|
-
from devhelm import Devhelm,
|
|
155
|
+
from devhelm import Devhelm, DevhelmAuthError, DevhelmError
|
|
137
156
|
|
|
138
157
|
client = Devhelm(token="bad-token", org_id="1", workspace_id="1")
|
|
139
158
|
|
|
140
159
|
try:
|
|
141
160
|
client.monitors.list()
|
|
142
|
-
except
|
|
143
|
-
print(f"Auth failed: {e.message} (HTTP {e.status})")
|
|
161
|
+
except DevhelmAuthError as e:
|
|
162
|
+
print(f"Auth failed: {e.message} (HTTP {e.status}, request_id={e.request_id})")
|
|
144
163
|
except DevhelmError as e:
|
|
145
164
|
print(f"API error [{e.code}]: {e.message}")
|
|
146
165
|
```
|
|
147
166
|
|
|
148
|
-
Error codes: `AUTH`, `NOT_FOUND`, `CONFLICT`, `VALIDATION`, `API`.
|
|
149
|
-
|
|
150
167
|
## Development
|
|
151
168
|
|
|
152
169
|
```bash
|
|
@@ -108,21 +108,38 @@ print(results.has_more)
|
|
|
108
108
|
|
|
109
109
|
## Error Handling
|
|
110
110
|
|
|
111
|
+
The SDK raises three top-level error types (see
|
|
112
|
+
[`040-codegen-policies.md`](https://github.com/devhelmhq/mono/blob/main/cowork/design/040-codegen-policies.md)):
|
|
113
|
+
|
|
114
|
+
- `DevhelmValidationError` — local request/response shape validation failed.
|
|
115
|
+
- `DevhelmApiError` — the API returned a non-2xx status. Subclassed by HTTP
|
|
116
|
+
class for ergonomics: `DevhelmAuthError` (401/403), `DevhelmNotFoundError`
|
|
117
|
+
(404), `DevhelmConflictError` (409), `DevhelmRateLimitError` (429),
|
|
118
|
+
`DevhelmServerError` (5xx).
|
|
119
|
+
- `DevhelmTransportError` — the request never reached a server response
|
|
120
|
+
(connection refused, timeout, TLS failure, etc.).
|
|
121
|
+
|
|
122
|
+
Every `DevhelmApiError` carries:
|
|
123
|
+
|
|
124
|
+
- `status` — the HTTP status code
|
|
125
|
+
- `code` — coarse machine-readable category (e.g. `NOT_FOUND`,
|
|
126
|
+
`RATE_LIMITED`); switch on this, not the human-readable `message`
|
|
127
|
+
- `request_id` — the per-request id from the `X-Request-Id` response header;
|
|
128
|
+
always include this in support tickets
|
|
129
|
+
|
|
111
130
|
```python
|
|
112
|
-
from devhelm import Devhelm,
|
|
131
|
+
from devhelm import Devhelm, DevhelmAuthError, DevhelmError
|
|
113
132
|
|
|
114
133
|
client = Devhelm(token="bad-token", org_id="1", workspace_id="1")
|
|
115
134
|
|
|
116
135
|
try:
|
|
117
136
|
client.monitors.list()
|
|
118
|
-
except
|
|
119
|
-
print(f"Auth failed: {e.message} (HTTP {e.status})")
|
|
137
|
+
except DevhelmAuthError as e:
|
|
138
|
+
print(f"Auth failed: {e.message} (HTTP {e.status}, request_id={e.request_id})")
|
|
120
139
|
except DevhelmError as e:
|
|
121
140
|
print(f"API error [{e.code}]: {e.message}")
|
|
122
141
|
```
|
|
123
142
|
|
|
124
|
-
Error codes: `AUTH`, `NOT_FOUND`, `CONFLICT`, `VALIDATION`, `API`.
|
|
125
|
-
|
|
126
143
|
## Development
|
|
127
144
|
|
|
128
145
|
```bash
|