@lovrozagar/honey 0.1.0 → 0.2.0
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.
- package/README.md +1596 -6
- package/dist/accepts.d.ts +6 -0
- package/dist/accepts.d.ts.map +1 -0
- package/dist/body-limit.d.ts +22 -0
- package/dist/body-limit.d.ts.map +1 -0
- package/dist/build/index.d.ts +42 -0
- package/dist/build/index.d.ts.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/client/error.d.ts +14 -0
- package/dist/client/error.d.ts.map +1 -0
- package/dist/client/http.d.ts +88 -0
- package/dist/client/http.d.ts.map +1 -0
- package/dist/client/index.d.ts +22 -0
- package/dist/client/index.d.ts.map +1 -0
- package/dist/client/sdk.d.ts +34 -0
- package/dist/client/sdk.d.ts.map +1 -0
- package/dist/client/sse.d.ts +10 -0
- package/dist/client/sse.d.ts.map +1 -0
- package/dist/client/types.d.ts +124 -0
- package/dist/client/types.d.ts.map +1 -0
- package/dist/client/ws.d.ts +15 -0
- package/dist/client/ws.d.ts.map +1 -0
- package/dist/client-mcp/server.d.ts +10 -0
- package/dist/client-mcp/server.d.ts.map +1 -0
- package/dist/client-mcp/types.d.ts +16 -0
- package/dist/client-mcp/types.d.ts.map +1 -0
- package/dist/cloudflare/realtime.d.ts +30 -0
- package/dist/cloudflare/realtime.d.ts.map +1 -0
- package/dist/codegen-go-cli.d.ts +22 -0
- package/dist/codegen-go-cli.d.ts.map +1 -0
- package/dist/codegen-go.d.ts +29 -0
- package/dist/codegen-go.d.ts.map +1 -0
- package/dist/codegen-hash.d.ts +3 -0
- package/dist/codegen-hash.d.ts.map +1 -0
- package/dist/codegen-ir.d.ts +123 -0
- package/dist/codegen-ir.d.ts.map +1 -0
- package/dist/codegen-loaders.d.ts +12 -0
- package/dist/codegen-loaders.d.ts.map +1 -0
- package/dist/codegen-mcp.d.ts +13 -0
- package/dist/codegen-mcp.d.ts.map +1 -0
- package/dist/codegen-python.d.ts +21 -0
- package/dist/codegen-python.d.ts.map +1 -0
- package/dist/codegen-rust.d.ts +18 -0
- package/dist/codegen-rust.d.ts.map +1 -0
- package/dist/codegen-sanitize.d.ts +3 -0
- package/dist/codegen-sanitize.d.ts.map +1 -0
- package/dist/codegen-schema-naming.d.ts +22 -0
- package/dist/codegen-schema-naming.d.ts.map +1 -0
- package/dist/codegen.d.ts +178 -0
- package/dist/codegen.d.ts.map +1 -0
- package/dist/context.d.ts +56 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/cookie-sign.d.ts +3 -0
- package/dist/cookie-sign.d.ts.map +1 -0
- package/dist/cookie.d.ts +12 -0
- package/dist/cookie.d.ts.map +1 -0
- package/dist/cors.d.ts +13 -0
- package/dist/cors.d.ts.map +1 -0
- package/dist/crypto.d.ts +2 -0
- package/dist/crypto.d.ts.map +1 -0
- package/dist/csrf.d.ts +9 -0
- package/dist/csrf.d.ts.map +1 -0
- package/dist/curl-logger.d.ts +33 -0
- package/dist/curl-logger.d.ts.map +1 -0
- package/dist/detect-runtime.d.ts +16 -0
- package/dist/detect-runtime.d.ts.map +1 -0
- package/dist/error.d.ts +21 -0
- package/dist/error.d.ts.map +1 -0
- package/dist/errors.d.ts +40 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/etag.d.ts +9 -0
- package/dist/etag.d.ts.map +1 -0
- package/dist/feature-load.d.ts +3 -0
- package/dist/feature-load.d.ts.map +1 -0
- package/dist/go-type-emitter.d.ts +33 -0
- package/dist/go-type-emitter.d.ts.map +1 -0
- package/dist/honey-response.d.ts +82 -0
- package/dist/honey-response.d.ts.map +1 -0
- package/dist/i18n-slot.d.ts +7 -0
- package/dist/i18n-slot.d.ts.map +1 -0
- package/dist/i18n.d.ts +26 -0
- package/dist/i18n.d.ts.map +1 -0
- package/dist/index.d.ts +470 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/init.d.ts +7 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/input.d.ts +6 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/ip-restrict.d.ts +12 -0
- package/dist/ip-restrict.d.ts.map +1 -0
- package/dist/logger.d.ts +45 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/meta-spec.d.ts +81 -0
- package/dist/meta-spec.d.ts.map +1 -0
- package/dist/middleware.d.ts +60 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/node-request.d.ts +59 -0
- package/dist/node-request.d.ts.map +1 -0
- package/dist/node.d.ts +13 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/openapi/register.d.ts +3 -0
- package/dist/openapi/register.d.ts.map +1 -0
- package/dist/openapi/scalar.d.ts +12 -0
- package/dist/openapi/scalar.d.ts.map +1 -0
- package/dist/openapi/spec-factory.d.ts +31 -0
- package/dist/openapi/spec-factory.d.ts.map +1 -0
- package/dist/openapi/spec.d.ts +19 -0
- package/dist/openapi/spec.d.ts.map +1 -0
- package/dist/openapi/swagger.d.ts +12 -0
- package/dist/openapi/swagger.d.ts.map +1 -0
- package/dist/plugin.d.ts +167 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/powered-by.d.ts +7 -0
- package/dist/powered-by.d.ts.map +1 -0
- package/dist/pretty-json.d.ts +10 -0
- package/dist/pretty-json.d.ts.map +1 -0
- package/dist/proxy.d.ts +51 -0
- package/dist/proxy.d.ts.map +1 -0
- package/dist/python-type-emitter.d.ts +11 -0
- package/dist/python-type-emitter.d.ts.map +1 -0
- package/dist/realtime/buffer.d.ts +18 -0
- package/dist/realtime/buffer.d.ts.map +1 -0
- package/dist/realtime/bus.d.ts +11 -0
- package/dist/realtime/bus.d.ts.map +1 -0
- package/dist/realtime/longpoll.d.ts +23 -0
- package/dist/realtime/longpoll.d.ts.map +1 -0
- package/dist/realtime/protocol.d.ts +50 -0
- package/dist/realtime/protocol.d.ts.map +1 -0
- package/dist/realtime/route.d.ts +42 -0
- package/dist/realtime/route.d.ts.map +1 -0
- package/dist/realtime/runtime.d.ts +74 -0
- package/dist/realtime/runtime.d.ts.map +1 -0
- package/dist/request-id.d.ts +12 -0
- package/dist/request-id.d.ts.map +1 -0
- package/dist/request-to-curl.d.ts +9 -0
- package/dist/request-to-curl.d.ts.map +1 -0
- package/dist/response.d.ts +57 -0
- package/dist/response.d.ts.map +1 -0
- package/dist/rust-type-emitter.d.ts +32 -0
- package/dist/rust-type-emitter.d.ts.map +1 -0
- package/dist/secure-headers.d.ts +16 -0
- package/dist/secure-headers.d.ts.map +1 -0
- package/dist/serve-register.d.ts +2 -0
- package/dist/serve-register.d.ts.map +1 -0
- package/dist/serve-slot.d.ts +6 -0
- package/dist/serve-slot.d.ts.map +1 -0
- package/dist/serve.d.ts +21 -0
- package/dist/serve.d.ts.map +1 -0
- package/dist/server-timing.d.ts +9 -0
- package/dist/server-timing.d.ts.map +1 -0
- package/dist/static.d.ts +12 -0
- package/dist/static.d.ts.map +1 -0
- package/dist/telemetry/otel.d.ts +59 -0
- package/dist/telemetry/otel.d.ts.map +1 -0
- package/dist/testing.d.ts +24 -0
- package/dist/testing.d.ts.map +1 -0
- package/dist/timeout.d.ts +7 -0
- package/dist/timeout.d.ts.map +1 -0
- package/dist/tree.d.ts +90 -0
- package/dist/tree.d.ts.map +1 -0
- package/dist/ts-type-emitter.d.ts +4 -0
- package/dist/ts-type-emitter.d.ts.map +1 -0
- package/dist/type-emitter.d.ts +8 -0
- package/dist/type-emitter.d.ts.map +1 -0
- package/dist/type-extractor.d.ts +39 -0
- package/dist/type-extractor.d.ts.map +1 -0
- package/dist/types.d.ts +451 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/validation.d.ts +18 -0
- package/dist/validation.d.ts.map +1 -0
- package/dist/ws/bun.d.ts +28 -0
- package/dist/ws/bun.d.ts.map +1 -0
- package/dist/ws/cloudflare.d.ts +55 -0
- package/dist/ws/cloudflare.d.ts.map +1 -0
- package/dist/ws/deno.d.ts +13 -0
- package/dist/ws/deno.d.ts.map +1 -0
- package/dist/ws/node.d.ts +10 -0
- package/dist/ws/node.d.ts.map +1 -0
- package/dist/yaml.d.ts +4 -0
- package/dist/yaml.d.ts.map +1 -0
- package/docs/api-ref/go.md +82 -82
- package/docs/api-ref/python.md +82 -82
- package/docs/api-ref/rust.md +82 -82
- package/docs/api-ref/typescript.md +82 -82
- package/docs/invalidate-spec.md +13 -13
- package/docs/meta-spec.md +513 -0
- package/docs/packaging.md +85 -0
- package/docs/sdk.md +87 -73
- package/package.json +195 -51
- package/src/body-limit.ts +2 -1
- package/src/build/index.ts +2 -9
- package/src/cli.ts +2 -3
- package/src/client/http.ts +204 -223
- package/src/client/index.ts +6 -14
- package/src/client/sdk.ts +24 -17
- package/src/client/types.ts +4 -9
- package/src/client/ws.ts +3 -5
- package/src/client-mcp/server.ts +1 -4
- package/src/cloudflare/realtime.ts +8 -10
- package/src/codegen-go-cli.ts +74 -67
- package/src/codegen-go.ts +71 -51
- package/src/codegen-ir.ts +16 -27
- package/src/codegen-loaders.ts +5 -8
- package/src/codegen-mcp.ts +9 -27
- package/src/codegen-python.ts +47 -27
- package/src/codegen-rust.ts +110 -66
- package/src/codegen-sanitize.ts +1 -7
- package/src/codegen-schema-naming.ts +8 -2
- package/src/codegen.ts +299 -196
- package/src/context.ts +91 -95
- package/src/cookie-sign.ts +5 -13
- package/src/cookie.ts +1 -2
- package/src/cors.ts +4 -6
- package/src/crypto.ts +1 -4
- package/src/csrf.ts +3 -3
- package/src/curl-logger.ts +14 -32
- package/src/detect-runtime.ts +1 -3
- package/src/errors.ts +1 -3
- package/src/etag.ts +3 -4
- package/src/go-type-emitter.ts +45 -40
- package/src/honey-response.ts +1 -3
- package/src/i18n.ts +3 -12
- package/src/index.ts +1168 -1412
- package/src/ip-restrict.ts +2 -1
- package/src/logger.ts +13 -13
- package/src/meta-spec.ts +0 -0
- package/src/middleware.ts +111 -79
- package/src/node-request.ts +2 -1
- package/src/node.ts +9 -10
- package/src/openapi/register.ts +1 -2
- package/src/openapi/scalar.ts +9 -9
- package/src/openapi/spec-factory.ts +2 -2
- package/src/openapi/spec.ts +26 -19
- package/src/openapi/swagger.ts +9 -9
- package/src/plugin.ts +226 -256
- package/src/powered-by.ts +2 -1
- package/src/pretty-json.ts +2 -1
- package/src/proxy.ts +1 -3
- package/src/python-type-emitter.ts +37 -12
- package/src/realtime/route.ts +1 -1
- package/src/realtime/runtime.ts +9 -12
- package/src/request-id.ts +3 -4
- package/src/request-to-curl.ts +1 -4
- package/src/response.ts +150 -199
- package/src/rust-type-emitter.ts +66 -25
- package/src/secure-headers.ts +2 -1
- package/src/serve.ts +3 -12
- package/src/server-timing.ts +2 -1
- package/src/static.ts +3 -4
- package/src/telemetry/otel.ts +1 -6
- package/src/testing.ts +2 -11
- package/src/timeout.ts +2 -1
- package/src/tree.ts +12 -27
- package/src/ts-type-emitter.ts +71 -15
- package/src/type-emitter.ts +226 -237
- package/src/type-extractor.ts +260 -334
- package/src/types.ts +168 -68
- package/src/validation.ts +7 -30
- package/src/ws/bun.ts +2 -9
- package/src/ws/cloudflare.ts +13 -16
- package/src/ws/deno.ts +31 -40
- package/src/ws/node.ts +4 -19
package/docs/api-ref/python.md
CHANGED
|
@@ -7,20 +7,20 @@ run `bun run public/honey/core/scripts/gen-api-ref.ts` to regenerate.
|
|
|
7
7
|
|
|
8
8
|
Every operation's error channel surfaces one of:
|
|
9
9
|
|
|
10
|
-
| Canonical
|
|
11
|
-
|
|
|
12
|
-
| `BadRequest`
|
|
13
|
-
| `Unauthorized`
|
|
14
|
-
| `Forbidden`
|
|
15
|
-
| `NotFound`
|
|
16
|
-
| `Conflict`
|
|
17
|
-
| `UnprocessableEntity` | 422
|
|
18
|
-
| `TooManyRequests`
|
|
19
|
-
| `InternalServerError` | 500
|
|
20
|
-
| `BadGateway`
|
|
21
|
-
| `ServiceUnavailable`
|
|
22
|
-
| `GatewayTimeout`
|
|
23
|
-
| `StatusError`
|
|
10
|
+
| Canonical | Status | Lang symbol | Notes |
|
|
11
|
+
| --------------------- | ------ | --------------------- | ------------------------------------------------------ |
|
|
12
|
+
| `BadRequest` | 400 | `BadRequest` | invalid request payload |
|
|
13
|
+
| `Unauthorized` | 401 | `Unauthorized` | missing/invalid auth; triggers onAuthExpired + 1 retry |
|
|
14
|
+
| `Forbidden` | 403 | `Forbidden` | authenticated but not permitted |
|
|
15
|
+
| `NotFound` | 404 | `NotFound` | resource does not exist |
|
|
16
|
+
| `Conflict` | 409 | `Conflict` | state conflict / unique violation |
|
|
17
|
+
| `UnprocessableEntity` | 422 | `UnprocessableEntity` | schema-valid but semantically rejected |
|
|
18
|
+
| `TooManyRequests` | 429 | `TooManyRequests` | rate-limited; consumer handles backoff via hooks |
|
|
19
|
+
| `InternalServerError` | 500 | `InternalServerError` | server crash |
|
|
20
|
+
| `BadGateway` | 502 | `BadGateway` | upstream failure |
|
|
21
|
+
| `ServiceUnavailable` | 503 | `ServiceUnavailable` | server temporarily unavailable |
|
|
22
|
+
| `GatewayTimeout` | 504 | `GatewayTimeout` | upstream timeout |
|
|
23
|
+
| `StatusError` | * | `StatusError` | fallback for undeclared/other statuses |
|
|
24
24
|
|
|
25
25
|
Operations with declared `responses: { 4xx: { schema } }` parse the response body into the error's typed `data` field.
|
|
26
26
|
|
|
@@ -44,10 +44,10 @@ async def refresh_token(self, body: { refresh_token: str }) -> { access_token: s
|
|
|
44
44
|
|
|
45
45
|
**Responses**
|
|
46
46
|
|
|
47
|
-
| Status | Content-type
|
|
48
|
-
| ------ |
|
|
49
|
-
| `200`
|
|
50
|
-
| `401`
|
|
47
|
+
| Status | Content-type | Type |
|
|
48
|
+
| ------ | ------------------ | ---------------------------------------- |
|
|
49
|
+
| `200` | `application/json` | `{ access_token: str, expires_in: int }` |
|
|
50
|
+
| `401` | `application/json` | `{ status: int, message: str }` |
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
@@ -63,16 +63,16 @@ async def get_declared_error(self, status: str) -> None
|
|
|
63
63
|
|
|
64
64
|
**Path params**
|
|
65
65
|
|
|
66
|
-
| Name
|
|
67
|
-
|
|
|
66
|
+
| Name | Type |
|
|
67
|
+
| -------- | ----- |
|
|
68
68
|
| `status` | `str` |
|
|
69
69
|
|
|
70
70
|
**Responses**
|
|
71
71
|
|
|
72
|
-
| Status
|
|
73
|
-
|
|
|
74
|
-
| `400`
|
|
75
|
-
| `404`
|
|
72
|
+
| Status | Content-type | Type |
|
|
73
|
+
| --------- | ------------------ | ------------------------------- |
|
|
74
|
+
| `400` | `application/json` | `{ status: int, message: str }` |
|
|
75
|
+
| `404` | `application/json` | `{ status: int, message: str }` |
|
|
76
76
|
| `default` | `application/json` | `{ status: int, message: str }` |
|
|
77
77
|
|
|
78
78
|
---
|
|
@@ -89,14 +89,14 @@ async def get_error(self, status: int) -> None
|
|
|
89
89
|
|
|
90
90
|
**Path params**
|
|
91
91
|
|
|
92
|
-
| Name
|
|
93
|
-
|
|
|
92
|
+
| Name | Type |
|
|
93
|
+
| -------- | ----- |
|
|
94
94
|
| `status` | `int` |
|
|
95
95
|
|
|
96
96
|
**Responses**
|
|
97
97
|
|
|
98
|
-
| Status
|
|
99
|
-
|
|
|
98
|
+
| Status | Content-type | Type |
|
|
99
|
+
| --------- | ------------------ | ------------------------------- |
|
|
100
100
|
| `default` | `application/json` | `{ status: int, message: str }` |
|
|
101
101
|
|
|
102
102
|
---
|
|
@@ -113,9 +113,9 @@ async def idempotent_create(self) -> { idempotencyKey: str }
|
|
|
113
113
|
|
|
114
114
|
**Responses**
|
|
115
115
|
|
|
116
|
-
| Status | Content-type
|
|
117
|
-
| ------ |
|
|
118
|
-
| `200`
|
|
116
|
+
| Status | Content-type | Type |
|
|
117
|
+
| ------ | ------------------ | ------------------------- |
|
|
118
|
+
| `200` | `application/json` | `{ idempotencyKey: str }` |
|
|
119
119
|
|
|
120
120
|
**Extensions**
|
|
121
121
|
|
|
@@ -135,15 +135,15 @@ async def connect_realtime(self, reconnect_token: str) -> ResumableConnection
|
|
|
135
135
|
|
|
136
136
|
**Query params**
|
|
137
137
|
|
|
138
|
-
| Name
|
|
139
|
-
|
|
|
138
|
+
| Name | Type |
|
|
139
|
+
| ----------------- | ----- |
|
|
140
140
|
| `reconnect_token` | `str` |
|
|
141
141
|
|
|
142
142
|
**Responses**
|
|
143
143
|
|
|
144
144
|
| Status | Content-type | Type |
|
|
145
145
|
| ------ | ------------ | ---- |
|
|
146
|
-
| `101`
|
|
146
|
+
| `101` | `—` | — |
|
|
147
147
|
|
|
148
148
|
**Extensions**
|
|
149
149
|
|
|
@@ -163,15 +163,15 @@ async def slow(self, ms: int) -> { ok: bool }
|
|
|
163
163
|
|
|
164
164
|
**Query params**
|
|
165
165
|
|
|
166
|
-
| Name | Type
|
|
167
|
-
| ---- |
|
|
166
|
+
| Name | Type |
|
|
167
|
+
| ---- | ----- |
|
|
168
168
|
| `ms` | `int` |
|
|
169
169
|
|
|
170
170
|
**Responses**
|
|
171
171
|
|
|
172
|
-
| Status | Content-type
|
|
173
|
-
| ------ |
|
|
174
|
-
| `200`
|
|
172
|
+
| Status | Content-type | Type |
|
|
173
|
+
| ------ | ------------------ | -------------- |
|
|
174
|
+
| `200` | `application/json` | `{ ok: bool }` |
|
|
175
175
|
|
|
176
176
|
---
|
|
177
177
|
|
|
@@ -187,16 +187,16 @@ async def stream_events(self, last_event_id: str) -> AsyncIterator[{ event: Opti
|
|
|
187
187
|
|
|
188
188
|
**Header params**
|
|
189
189
|
|
|
190
|
-
| Name
|
|
191
|
-
|
|
|
190
|
+
| Name | Type |
|
|
191
|
+
| --------------- | ----- |
|
|
192
192
|
| `Last-Event-ID` | `str` |
|
|
193
193
|
|
|
194
194
|
**Responses**
|
|
195
195
|
|
|
196
|
-
| Status | Content-type
|
|
197
|
-
| ------ |
|
|
198
|
-
| `200`
|
|
199
|
-
| `401`
|
|
196
|
+
| Status | Content-type | Type |
|
|
197
|
+
| ------ | ------------------- | ------------------------------------------------------------------ |
|
|
198
|
+
| `200` | `text/event-stream` | `{ event: Optional[str], data: Optional[str], id: Optional[str] }` |
|
|
199
|
+
| `401` | `application/json` | `{ status: int, message: str }` |
|
|
200
200
|
|
|
201
201
|
**Extensions**
|
|
202
202
|
|
|
@@ -222,10 +222,10 @@ async def upload_blob(self, body: AsyncIterator[bytes]) -> { size: int, hash: st
|
|
|
222
222
|
|
|
223
223
|
**Responses**
|
|
224
224
|
|
|
225
|
-
| Status | Content-type
|
|
226
|
-
| ------ |
|
|
227
|
-
| `200`
|
|
228
|
-
| `401`
|
|
225
|
+
| Status | Content-type | Type |
|
|
226
|
+
| ------ | ------------------ | ------------------------------- |
|
|
227
|
+
| `200` | `application/json` | `{ size: int, hash: str }` |
|
|
228
|
+
| `401` | `application/json` | `{ status: int, message: str }` |
|
|
229
229
|
|
|
230
230
|
---
|
|
231
231
|
|
|
@@ -241,10 +241,10 @@ async def list_users(self) -> { items: List[{ id: str, name: str, email: str }],
|
|
|
241
241
|
|
|
242
242
|
**Responses**
|
|
243
243
|
|
|
244
|
-
| Status | Content-type
|
|
245
|
-
| ------ |
|
|
246
|
-
| `200`
|
|
247
|
-
| `401`
|
|
244
|
+
| Status | Content-type | Type |
|
|
245
|
+
| ------ | ------------------ | ----------------------------------------------------------------- |
|
|
246
|
+
| `200` | `application/json` | `{ items: List[{ id: str, name: str, email: str }], total: int }` |
|
|
247
|
+
| `401` | `application/json` | `{ status: int, message: str }` |
|
|
248
248
|
|
|
249
249
|
---
|
|
250
250
|
|
|
@@ -266,11 +266,11 @@ async def create_user(self, body: { name: str, email: str }) -> { id: str, name:
|
|
|
266
266
|
|
|
267
267
|
**Responses**
|
|
268
268
|
|
|
269
|
-
| Status | Content-type
|
|
270
|
-
| ------ |
|
|
271
|
-
| `201`
|
|
272
|
-
| `401`
|
|
273
|
-
| `422`
|
|
269
|
+
| Status | Content-type | Type |
|
|
270
|
+
| ------ | ------------------ | ------------------------------------ |
|
|
271
|
+
| `201` | `application/json` | `{ id: str, name: str, email: str }` |
|
|
272
|
+
| `401` | `application/json` | `{ status: int, message: str }` |
|
|
273
|
+
| `422` | `application/json` | `{ status: int, message: str }` |
|
|
274
274
|
|
|
275
275
|
**Extensions**
|
|
276
276
|
|
|
@@ -290,17 +290,17 @@ async def delete_user(self, id: str) -> None
|
|
|
290
290
|
|
|
291
291
|
**Path params**
|
|
292
292
|
|
|
293
|
-
| Name | Type
|
|
294
|
-
| ---- |
|
|
293
|
+
| Name | Type |
|
|
294
|
+
| ---- | ----- |
|
|
295
295
|
| `id` | `str` |
|
|
296
296
|
|
|
297
297
|
**Responses**
|
|
298
298
|
|
|
299
|
-
| Status | Content-type
|
|
300
|
-
| ------ |
|
|
301
|
-
| `204`
|
|
302
|
-
| `401`
|
|
303
|
-
| `404`
|
|
299
|
+
| Status | Content-type | Type |
|
|
300
|
+
| ------ | ------------------ | ------------------------------- |
|
|
301
|
+
| `204` | `—` | — |
|
|
302
|
+
| `401` | `application/json` | `{ status: int, message: str }` |
|
|
303
|
+
| `404` | `application/json` | `{ status: int, message: str }` |
|
|
304
304
|
|
|
305
305
|
**Extensions**
|
|
306
306
|
|
|
@@ -320,17 +320,17 @@ async def get_user(self, id: str) -> { id: str, name: str, email: str }
|
|
|
320
320
|
|
|
321
321
|
**Path params**
|
|
322
322
|
|
|
323
|
-
| Name | Type
|
|
324
|
-
| ---- |
|
|
323
|
+
| Name | Type |
|
|
324
|
+
| ---- | ----- |
|
|
325
325
|
| `id` | `str` |
|
|
326
326
|
|
|
327
327
|
**Responses**
|
|
328
328
|
|
|
329
|
-
| Status | Content-type
|
|
330
|
-
| ------ |
|
|
331
|
-
| `200`
|
|
332
|
-
| `401`
|
|
333
|
-
| `404`
|
|
329
|
+
| Status | Content-type | Type |
|
|
330
|
+
| ------ | ------------------ | ------------------------------------ |
|
|
331
|
+
| `200` | `application/json` | `{ id: str, name: str, email: str }` |
|
|
332
|
+
| `401` | `application/json` | `{ status: int, message: str }` |
|
|
333
|
+
| `404` | `application/json` | `{ status: int, message: str }` |
|
|
334
334
|
|
|
335
335
|
---
|
|
336
336
|
|
|
@@ -346,8 +346,8 @@ async def update_user(self, id: str, body: { name: Optional[str], email: Optiona
|
|
|
346
346
|
|
|
347
347
|
**Path params**
|
|
348
348
|
|
|
349
|
-
| Name | Type
|
|
350
|
-
| ---- |
|
|
349
|
+
| Name | Type |
|
|
350
|
+
| ---- | ----- |
|
|
351
351
|
| `id` | `str` |
|
|
352
352
|
|
|
353
353
|
**Request body**
|
|
@@ -358,11 +358,11 @@ async def update_user(self, id: str, body: { name: Optional[str], email: Optiona
|
|
|
358
358
|
|
|
359
359
|
**Responses**
|
|
360
360
|
|
|
361
|
-
| Status | Content-type
|
|
362
|
-
| ------ |
|
|
363
|
-
| `200`
|
|
364
|
-
| `401`
|
|
365
|
-
| `404`
|
|
361
|
+
| Status | Content-type | Type |
|
|
362
|
+
| ------ | ------------------ | ------------------------------------ |
|
|
363
|
+
| `200` | `application/json` | `{ id: str, name: str, email: str }` |
|
|
364
|
+
| `401` | `application/json` | `{ status: int, message: str }` |
|
|
365
|
+
| `404` | `application/json` | `{ status: int, message: str }` |
|
|
366
366
|
|
|
367
367
|
**Extensions**
|
|
368
368
|
|
|
@@ -382,15 +382,15 @@ async def connect_ws(self, token: str) -> ResumableConnection
|
|
|
382
382
|
|
|
383
383
|
**Query params**
|
|
384
384
|
|
|
385
|
-
| Name
|
|
386
|
-
|
|
|
385
|
+
| Name | Type |
|
|
386
|
+
| ------- | ----- |
|
|
387
387
|
| `token` | `str` |
|
|
388
388
|
|
|
389
389
|
**Responses**
|
|
390
390
|
|
|
391
391
|
| Status | Content-type | Type |
|
|
392
392
|
| ------ | ------------ | ---- |
|
|
393
|
-
| `101`
|
|
393
|
+
| `101` | `—` | — |
|
|
394
394
|
|
|
395
395
|
**Extensions**
|
|
396
396
|
|
package/docs/api-ref/rust.md
CHANGED
|
@@ -7,20 +7,20 @@ run `bun run public/honey/core/scripts/gen-api-ref.ts` to regenerate.
|
|
|
7
7
|
|
|
8
8
|
Every operation's error channel surfaces one of:
|
|
9
9
|
|
|
10
|
-
| Canonical
|
|
11
|
-
|
|
|
12
|
-
| `BadRequest`
|
|
13
|
-
| `Unauthorized`
|
|
14
|
-
| `Forbidden`
|
|
15
|
-
| `NotFound`
|
|
16
|
-
| `Conflict`
|
|
17
|
-
| `UnprocessableEntity` | 422
|
|
18
|
-
| `TooManyRequests`
|
|
19
|
-
| `InternalServerError` | 500
|
|
20
|
-
| `BadGateway`
|
|
21
|
-
| `ServiceUnavailable`
|
|
22
|
-
| `GatewayTimeout`
|
|
23
|
-
| `StatusError`
|
|
10
|
+
| Canonical | Status | Lang symbol | Notes |
|
|
11
|
+
| --------------------- | ------ | ---------------------------- | ------------------------------------------------------ |
|
|
12
|
+
| `BadRequest` | 400 | `Error::BadRequest` | invalid request payload |
|
|
13
|
+
| `Unauthorized` | 401 | `Error::Unauthorized` | missing/invalid auth; triggers onAuthExpired + 1 retry |
|
|
14
|
+
| `Forbidden` | 403 | `Error::Forbidden` | authenticated but not permitted |
|
|
15
|
+
| `NotFound` | 404 | `Error::NotFound` | resource does not exist |
|
|
16
|
+
| `Conflict` | 409 | `Error::Conflict` | state conflict / unique violation |
|
|
17
|
+
| `UnprocessableEntity` | 422 | `Error::UnprocessableEntity` | schema-valid but semantically rejected |
|
|
18
|
+
| `TooManyRequests` | 429 | `Error::TooManyRequests` | rate-limited; consumer handles backoff via hooks |
|
|
19
|
+
| `InternalServerError` | 500 | `Error::InternalServerError` | server crash |
|
|
20
|
+
| `BadGateway` | 502 | `Error::BadGateway` | upstream failure |
|
|
21
|
+
| `ServiceUnavailable` | 503 | `Error::ServiceUnavailable` | server temporarily unavailable |
|
|
22
|
+
| `GatewayTimeout` | 504 | `Error::GatewayTimeout` | upstream timeout |
|
|
23
|
+
| `StatusError` | * | `Error::StatusError` | fallback for undeclared/other statuses |
|
|
24
24
|
|
|
25
25
|
Operations with declared `responses: { 4xx: { schema } }` parse the response body into the error's typed `data` field.
|
|
26
26
|
|
|
@@ -44,10 +44,10 @@ pub async fn refresh_token(&self, body: struct { refresh_token: String }) -> Res
|
|
|
44
44
|
|
|
45
45
|
**Responses**
|
|
46
46
|
|
|
47
|
-
| Status | Content-type
|
|
48
|
-
| ------ |
|
|
49
|
-
| `200`
|
|
50
|
-
| `401`
|
|
47
|
+
| Status | Content-type | Type |
|
|
48
|
+
| ------ | ------------------ | -------------------------------------------------- |
|
|
49
|
+
| `200` | `application/json` | `struct { access_token: String, expires_in: i64 }` |
|
|
50
|
+
| `401` | `application/json` | `struct { status: i64, message: String }` |
|
|
51
51
|
|
|
52
52
|
---
|
|
53
53
|
|
|
@@ -63,16 +63,16 @@ pub async fn get_declared_error(&self, status: String) -> Result<(), Error>
|
|
|
63
63
|
|
|
64
64
|
**Path params**
|
|
65
65
|
|
|
66
|
-
| Name
|
|
67
|
-
|
|
|
66
|
+
| Name | Type |
|
|
67
|
+
| -------- | -------- |
|
|
68
68
|
| `status` | `String` |
|
|
69
69
|
|
|
70
70
|
**Responses**
|
|
71
71
|
|
|
72
|
-
| Status
|
|
73
|
-
|
|
|
74
|
-
| `400`
|
|
75
|
-
| `404`
|
|
72
|
+
| Status | Content-type | Type |
|
|
73
|
+
| --------- | ------------------ | ----------------------------------------- |
|
|
74
|
+
| `400` | `application/json` | `struct { status: i64, message: String }` |
|
|
75
|
+
| `404` | `application/json` | `struct { status: i64, message: String }` |
|
|
76
76
|
| `default` | `application/json` | `struct { status: i64, message: String }` |
|
|
77
77
|
|
|
78
78
|
---
|
|
@@ -89,14 +89,14 @@ pub async fn get_error(&self, status: i64) -> Result<(), Error>
|
|
|
89
89
|
|
|
90
90
|
**Path params**
|
|
91
91
|
|
|
92
|
-
| Name
|
|
93
|
-
|
|
|
92
|
+
| Name | Type |
|
|
93
|
+
| -------- | ----- |
|
|
94
94
|
| `status` | `i64` |
|
|
95
95
|
|
|
96
96
|
**Responses**
|
|
97
97
|
|
|
98
|
-
| Status
|
|
99
|
-
|
|
|
98
|
+
| Status | Content-type | Type |
|
|
99
|
+
| --------- | ------------------ | ----------------------------------------- |
|
|
100
100
|
| `default` | `application/json` | `struct { status: i64, message: String }` |
|
|
101
101
|
|
|
102
102
|
---
|
|
@@ -113,9 +113,9 @@ pub async fn idempotent_create(&self) -> Result<struct { idempotency_key: String
|
|
|
113
113
|
|
|
114
114
|
**Responses**
|
|
115
115
|
|
|
116
|
-
| Status | Content-type
|
|
117
|
-
| ------ |
|
|
118
|
-
| `200`
|
|
116
|
+
| Status | Content-type | Type |
|
|
117
|
+
| ------ | ------------------ | ------------------------------------ |
|
|
118
|
+
| `200` | `application/json` | `struct { idempotency_key: String }` |
|
|
119
119
|
|
|
120
120
|
**Extensions**
|
|
121
121
|
|
|
@@ -135,15 +135,15 @@ pub async fn connect_realtime(&self, reconnect_token: String) -> Result<Resumabl
|
|
|
135
135
|
|
|
136
136
|
**Query params**
|
|
137
137
|
|
|
138
|
-
| Name
|
|
139
|
-
|
|
|
138
|
+
| Name | Type |
|
|
139
|
+
| ----------------- | -------- |
|
|
140
140
|
| `reconnect_token` | `String` |
|
|
141
141
|
|
|
142
142
|
**Responses**
|
|
143
143
|
|
|
144
144
|
| Status | Content-type | Type |
|
|
145
145
|
| ------ | ------------ | ---- |
|
|
146
|
-
| `101`
|
|
146
|
+
| `101` | `—` | — |
|
|
147
147
|
|
|
148
148
|
**Extensions**
|
|
149
149
|
|
|
@@ -163,15 +163,15 @@ pub async fn slow(&self, ms: i64) -> Result<struct { ok: bool }, Error>
|
|
|
163
163
|
|
|
164
164
|
**Query params**
|
|
165
165
|
|
|
166
|
-
| Name | Type
|
|
167
|
-
| ---- |
|
|
166
|
+
| Name | Type |
|
|
167
|
+
| ---- | ----- |
|
|
168
168
|
| `ms` | `i64` |
|
|
169
169
|
|
|
170
170
|
**Responses**
|
|
171
171
|
|
|
172
|
-
| Status | Content-type
|
|
173
|
-
| ------ |
|
|
174
|
-
| `200`
|
|
172
|
+
| Status | Content-type | Type |
|
|
173
|
+
| ------ | ------------------ | --------------------- |
|
|
174
|
+
| `200` | `application/json` | `struct { ok: bool }` |
|
|
175
175
|
|
|
176
176
|
---
|
|
177
177
|
|
|
@@ -187,16 +187,16 @@ pub async fn stream_events(&self, last_event_id: String) -> Result<impl Stream<I
|
|
|
187
187
|
|
|
188
188
|
**Header params**
|
|
189
189
|
|
|
190
|
-
| Name
|
|
191
|
-
|
|
|
190
|
+
| Name | Type |
|
|
191
|
+
| --------------- | -------- |
|
|
192
192
|
| `Last-Event-ID` | `String` |
|
|
193
193
|
|
|
194
194
|
**Responses**
|
|
195
195
|
|
|
196
|
-
| Status | Content-type
|
|
197
|
-
| ------ |
|
|
198
|
-
| `200`
|
|
199
|
-
| `401`
|
|
196
|
+
| Status | Content-type | Type |
|
|
197
|
+
| ------ | ------------------- | ---------------------------------------------------------------------------- |
|
|
198
|
+
| `200` | `text/event-stream` | `struct { event: Option<String>, data: Option<String>, id: Option<String> }` |
|
|
199
|
+
| `401` | `application/json` | `struct { status: i64, message: String }` |
|
|
200
200
|
|
|
201
201
|
**Extensions**
|
|
202
202
|
|
|
@@ -222,10 +222,10 @@ pub async fn upload_blob(&self, body: impl Stream<Item = Bytes>) -> Result<struc
|
|
|
222
222
|
|
|
223
223
|
**Responses**
|
|
224
224
|
|
|
225
|
-
| Status | Content-type
|
|
226
|
-
| ------ |
|
|
227
|
-
| `200`
|
|
228
|
-
| `401`
|
|
225
|
+
| Status | Content-type | Type |
|
|
226
|
+
| ------ | ------------------ | ----------------------------------------- |
|
|
227
|
+
| `200` | `application/json` | `struct { size: i64, hash: String }` |
|
|
228
|
+
| `401` | `application/json` | `struct { status: i64, message: String }` |
|
|
229
229
|
|
|
230
230
|
---
|
|
231
231
|
|
|
@@ -241,10 +241,10 @@ pub async fn list_users(&self) -> Result<struct { items: Vec<struct { id: String
|
|
|
241
241
|
|
|
242
242
|
**Responses**
|
|
243
243
|
|
|
244
|
-
| Status | Content-type
|
|
245
|
-
| ------ |
|
|
246
|
-
| `200`
|
|
247
|
-
| `401`
|
|
244
|
+
| Status | Content-type | Type |
|
|
245
|
+
| ------ | ------------------ | --------------------------------------------------------------------------------------- |
|
|
246
|
+
| `200` | `application/json` | `struct { items: Vec<struct { id: String, name: String, email: String }>, total: i64 }` |
|
|
247
|
+
| `401` | `application/json` | `struct { status: i64, message: String }` |
|
|
248
248
|
|
|
249
249
|
---
|
|
250
250
|
|
|
@@ -266,11 +266,11 @@ pub async fn create_user(&self, body: struct { name: String, email: String }) ->
|
|
|
266
266
|
|
|
267
267
|
**Responses**
|
|
268
268
|
|
|
269
|
-
| Status | Content-type
|
|
270
|
-
| ------ |
|
|
271
|
-
| `201`
|
|
272
|
-
| `401`
|
|
273
|
-
| `422`
|
|
269
|
+
| Status | Content-type | Type |
|
|
270
|
+
| ------ | ------------------ | ---------------------------------------------------- |
|
|
271
|
+
| `201` | `application/json` | `struct { id: String, name: String, email: String }` |
|
|
272
|
+
| `401` | `application/json` | `struct { status: i64, message: String }` |
|
|
273
|
+
| `422` | `application/json` | `struct { status: i64, message: String }` |
|
|
274
274
|
|
|
275
275
|
**Extensions**
|
|
276
276
|
|
|
@@ -290,17 +290,17 @@ pub async fn delete_user(&self, id: String) -> Result<(), Error>
|
|
|
290
290
|
|
|
291
291
|
**Path params**
|
|
292
292
|
|
|
293
|
-
| Name | Type
|
|
294
|
-
| ---- |
|
|
293
|
+
| Name | Type |
|
|
294
|
+
| ---- | -------- |
|
|
295
295
|
| `id` | `String` |
|
|
296
296
|
|
|
297
297
|
**Responses**
|
|
298
298
|
|
|
299
|
-
| Status | Content-type
|
|
300
|
-
| ------ |
|
|
301
|
-
| `204`
|
|
302
|
-
| `401`
|
|
303
|
-
| `404`
|
|
299
|
+
| Status | Content-type | Type |
|
|
300
|
+
| ------ | ------------------ | ----------------------------------------- |
|
|
301
|
+
| `204` | `—` | — |
|
|
302
|
+
| `401` | `application/json` | `struct { status: i64, message: String }` |
|
|
303
|
+
| `404` | `application/json` | `struct { status: i64, message: String }` |
|
|
304
304
|
|
|
305
305
|
**Extensions**
|
|
306
306
|
|
|
@@ -320,17 +320,17 @@ pub async fn get_user(&self, id: String) -> Result<struct { id: String, name: St
|
|
|
320
320
|
|
|
321
321
|
**Path params**
|
|
322
322
|
|
|
323
|
-
| Name | Type
|
|
324
|
-
| ---- |
|
|
323
|
+
| Name | Type |
|
|
324
|
+
| ---- | -------- |
|
|
325
325
|
| `id` | `String` |
|
|
326
326
|
|
|
327
327
|
**Responses**
|
|
328
328
|
|
|
329
|
-
| Status | Content-type
|
|
330
|
-
| ------ |
|
|
331
|
-
| `200`
|
|
332
|
-
| `401`
|
|
333
|
-
| `404`
|
|
329
|
+
| Status | Content-type | Type |
|
|
330
|
+
| ------ | ------------------ | ---------------------------------------------------- |
|
|
331
|
+
| `200` | `application/json` | `struct { id: String, name: String, email: String }` |
|
|
332
|
+
| `401` | `application/json` | `struct { status: i64, message: String }` |
|
|
333
|
+
| `404` | `application/json` | `struct { status: i64, message: String }` |
|
|
334
334
|
|
|
335
335
|
---
|
|
336
336
|
|
|
@@ -346,8 +346,8 @@ pub async fn update_user(&self, id: String, body: struct { name: Option<String>,
|
|
|
346
346
|
|
|
347
347
|
**Path params**
|
|
348
348
|
|
|
349
|
-
| Name | Type
|
|
350
|
-
| ---- |
|
|
349
|
+
| Name | Type |
|
|
350
|
+
| ---- | -------- |
|
|
351
351
|
| `id` | `String` |
|
|
352
352
|
|
|
353
353
|
**Request body**
|
|
@@ -358,11 +358,11 @@ pub async fn update_user(&self, id: String, body: struct { name: Option<String>,
|
|
|
358
358
|
|
|
359
359
|
**Responses**
|
|
360
360
|
|
|
361
|
-
| Status | Content-type
|
|
362
|
-
| ------ |
|
|
363
|
-
| `200`
|
|
364
|
-
| `401`
|
|
365
|
-
| `404`
|
|
361
|
+
| Status | Content-type | Type |
|
|
362
|
+
| ------ | ------------------ | ---------------------------------------------------- |
|
|
363
|
+
| `200` | `application/json` | `struct { id: String, name: String, email: String }` |
|
|
364
|
+
| `401` | `application/json` | `struct { status: i64, message: String }` |
|
|
365
|
+
| `404` | `application/json` | `struct { status: i64, message: String }` |
|
|
366
366
|
|
|
367
367
|
**Extensions**
|
|
368
368
|
|
|
@@ -382,15 +382,15 @@ pub async fn connect_ws(&self, token: String) -> Result<ResumableConnection, Err
|
|
|
382
382
|
|
|
383
383
|
**Query params**
|
|
384
384
|
|
|
385
|
-
| Name
|
|
386
|
-
|
|
|
385
|
+
| Name | Type |
|
|
386
|
+
| ------- | -------- |
|
|
387
387
|
| `token` | `String` |
|
|
388
388
|
|
|
389
389
|
**Responses**
|
|
390
390
|
|
|
391
391
|
| Status | Content-type | Type |
|
|
392
392
|
| ------ | ------------ | ---- |
|
|
393
|
-
| `101`
|
|
393
|
+
| `101` | `—` | — |
|
|
394
394
|
|
|
395
395
|
**Extensions**
|
|
396
396
|
|