@lovrozagar/honey 0.1.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 +51 -0
- package/docs/api-ref/go.md +399 -0
- package/docs/api-ref/python.md +399 -0
- package/docs/api-ref/rust.md +399 -0
- package/docs/api-ref/typescript.md +399 -0
- package/docs/invalidate-spec.md +303 -0
- package/docs/sdk.md +722 -0
- package/package.json +120 -0
- package/src/accepts.ts +78 -0
- package/src/body-limit.ts +100 -0
- package/src/build/index.ts +174 -0
- package/src/cli-go/auth.go +15 -0
- package/src/cli-go/config.go +165 -0
- package/src/cli-go/errors.go +57 -0
- package/src/cli-go/multipart.go +55 -0
- package/src/cli-go/output.go +109 -0
- package/src/cli-go/root.go +30 -0
- package/src/cli-go/stream.go +88 -0
- package/src/cli-go/version.go +5 -0
- package/src/cli.ts +204 -0
- package/src/client/error.ts +27 -0
- package/src/client/http.ts +502 -0
- package/src/client/index.ts +127 -0
- package/src/client/sdk.ts +265 -0
- package/src/client/sse.ts +102 -0
- package/src/client/types.ts +211 -0
- package/src/client/ws.ts +115 -0
- package/src/client-go/errors.go +207 -0
- package/src/client-go/invalidation.go +373 -0
- package/src/client-go/realtime.go +317 -0
- package/src/client-go/result.go +20 -0
- package/src/client-go/runtime.go +413 -0
- package/src/client-go/sse.go +149 -0
- package/src/client-go/transport.go +452 -0
- package/src/client-go/ws.go +104 -0
- package/src/client-mcp/README.md +10 -0
- package/src/client-mcp/server.ts +94 -0
- package/src/client-mcp/types.ts +19 -0
- package/src/client-python/_errors.py +115 -0
- package/src/client-python/_invalidation.py +578 -0
- package/src/client-python/_realtime.py +156 -0
- package/src/client-python/_runtime.py +469 -0
- package/src/client-python/_sse.py +99 -0
- package/src/client-python/_transport.py +335 -0
- package/src/client-python/_ws.py +131 -0
- package/src/client-python/py.typed +0 -0
- package/src/client-rust/errors.rs +200 -0
- package/src/client-rust/invalidation.rs +441 -0
- package/src/client-rust/invalidation_sync.rs +306 -0
- package/src/client-rust/realtime.rs +695 -0
- package/src/client-rust/result.rs +22 -0
- package/src/client-rust/runtime.rs +547 -0
- package/src/client-rust/runtime_sync.rs +452 -0
- package/src/client-rust/sse.rs +167 -0
- package/src/client-rust/ws.rs +143 -0
- package/src/cloudflare/realtime.ts +236 -0
- package/src/codegen-go-cli.ts +1180 -0
- package/src/codegen-go.ts +1010 -0
- package/src/codegen-hash.ts +8 -0
- package/src/codegen-ir.ts +517 -0
- package/src/codegen-loaders.ts +53 -0
- package/src/codegen-mcp.ts +364 -0
- package/src/codegen-python.ts +1028 -0
- package/src/codegen-rust.ts +1652 -0
- package/src/codegen-sanitize.ts +67 -0
- package/src/codegen-schema-naming.ts +146 -0
- package/src/codegen.ts +5015 -0
- package/src/context.ts +210 -0
- package/src/cookie-sign.ts +58 -0
- package/src/cookie.ts +89 -0
- package/src/cors.ts +96 -0
- package/src/crypto.ts +19 -0
- package/src/csrf.ts +54 -0
- package/src/curl-logger.ts +235 -0
- package/src/detect-runtime.ts +19 -0
- package/src/error.ts +52 -0
- package/src/errors.ts +87 -0
- package/src/etag.ts +74 -0
- package/src/feature-load.ts +23 -0
- package/src/go-type-emitter.ts +404 -0
- package/src/honey-response.ts +354 -0
- package/src/i18n-slot.ts +20 -0
- package/src/i18n.ts +234 -0
- package/src/index.ts +3843 -0
- package/src/init.ts +149 -0
- package/src/input.ts +8 -0
- package/src/ip-restrict.ts +192 -0
- package/src/logger.ts +149 -0
- package/src/middleware.ts +199 -0
- package/src/node-request.ts +240 -0
- package/src/node.ts +212 -0
- package/src/openapi/register.ts +19 -0
- package/src/openapi/scalar.ts +33 -0
- package/src/openapi/spec-factory.ts +46 -0
- package/src/openapi/spec.ts +31 -0
- package/src/openapi/swagger.ts +34 -0
- package/src/plugin.ts +771 -0
- package/src/powered-by.ts +17 -0
- package/src/pretty-json.ts +39 -0
- package/src/proxy.ts +155 -0
- package/src/python-type-emitter.ts +144 -0
- package/src/realtime/buffer.ts +101 -0
- package/src/realtime/bus.ts +93 -0
- package/src/realtime/longpoll.ts +148 -0
- package/src/realtime/protocol.ts +128 -0
- package/src/realtime/route.ts +104 -0
- package/src/realtime/runtime.ts +430 -0
- package/src/request-id.ts +23 -0
- package/src/request-to-curl.ts +34 -0
- package/src/response.ts +414 -0
- package/src/rust-type-emitter.ts +412 -0
- package/src/secure-headers.ts +69 -0
- package/src/serve-register.ts +8 -0
- package/src/serve-slot.ts +20 -0
- package/src/serve.ts +141 -0
- package/src/server-timing.ts +66 -0
- package/src/static.ts +60 -0
- package/src/telemetry/otel.ts +139 -0
- package/src/testing.ts +114 -0
- package/src/timeout.ts +36 -0
- package/src/tree.ts +464 -0
- package/src/ts-type-emitter.ts +106 -0
- package/src/type-emitter.ts +524 -0
- package/src/type-extractor.ts +749 -0
- package/src/types.ts +638 -0
- package/src/validation.ts +300 -0
- package/src/ws/bun.ts +89 -0
- package/src/ws/cloudflare.ts +133 -0
- package/src/ws/deno.ts +109 -0
- package/src/ws/node.ts +161 -0
- package/src/yaml.ts +80 -0
|
@@ -0,0 +1,399 @@
|
|
|
1
|
+
# Rust API Reference
|
|
2
|
+
|
|
3
|
+
Generated from OpenAPI via the shared codegen IR. Do not edit by hand —
|
|
4
|
+
run `bun run public/honey/core/scripts/gen-api-ref.ts` to regenerate.
|
|
5
|
+
|
|
6
|
+
## Typed Errors
|
|
7
|
+
|
|
8
|
+
Every operation's error channel surfaces one of:
|
|
9
|
+
|
|
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
|
+
|
|
25
|
+
Operations with declared `responses: { 4xx: { schema } }` parse the response body into the error's typed `data` field.
|
|
26
|
+
|
|
27
|
+
## Operations
|
|
28
|
+
|
|
29
|
+
### refresh_token
|
|
30
|
+
|
|
31
|
+
`POST /auth/refresh`
|
|
32
|
+
|
|
33
|
+
**Signature**
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
pub async fn refresh_token(&self, body: struct { refresh_token: String }) -> Result<struct { access_token: String, expires_in: i64 }, Error>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
**Request body**
|
|
40
|
+
|
|
41
|
+
- Content-type: `application/json`
|
|
42
|
+
- Required: yes
|
|
43
|
+
- Type: `struct { refresh_token: String }`
|
|
44
|
+
|
|
45
|
+
**Responses**
|
|
46
|
+
|
|
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
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### get_declared_error
|
|
55
|
+
|
|
56
|
+
`GET /declared-errors/{status}`
|
|
57
|
+
|
|
58
|
+
**Signature**
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
pub async fn get_declared_error(&self, status: String) -> Result<(), Error>
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
**Path params**
|
|
65
|
+
|
|
66
|
+
| Name | Type |
|
|
67
|
+
| ---- | ---- |
|
|
68
|
+
| `status` | `String` |
|
|
69
|
+
|
|
70
|
+
**Responses**
|
|
71
|
+
|
|
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
|
+
| `default` | `application/json` | `struct { status: i64, message: String }` |
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### get_error
|
|
81
|
+
|
|
82
|
+
`GET /errors/{status}`
|
|
83
|
+
|
|
84
|
+
**Signature**
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
pub async fn get_error(&self, status: i64) -> Result<(), Error>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**Path params**
|
|
91
|
+
|
|
92
|
+
| Name | Type |
|
|
93
|
+
| ---- | ---- |
|
|
94
|
+
| `status` | `i64` |
|
|
95
|
+
|
|
96
|
+
**Responses**
|
|
97
|
+
|
|
98
|
+
| Status | Content-type | Type |
|
|
99
|
+
| ------ | ------------ | ---- |
|
|
100
|
+
| `default` | `application/json` | `struct { status: i64, message: String }` |
|
|
101
|
+
|
|
102
|
+
---
|
|
103
|
+
|
|
104
|
+
### idempotent_create
|
|
105
|
+
|
|
106
|
+
`POST /idempotent-create`
|
|
107
|
+
|
|
108
|
+
**Signature**
|
|
109
|
+
|
|
110
|
+
```
|
|
111
|
+
pub async fn idempotent_create(&self) -> Result<struct { idempotency_key: String }, Error>
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
**Responses**
|
|
115
|
+
|
|
116
|
+
| Status | Content-type | Type |
|
|
117
|
+
| ------ | ------------ | ---- |
|
|
118
|
+
| `200` | `application/json` | `struct { idempotency_key: String }` |
|
|
119
|
+
|
|
120
|
+
**Extensions**
|
|
121
|
+
|
|
122
|
+
- `x-idempotency-key`: yes — auto-sent if omitted
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
### connect_realtime
|
|
127
|
+
|
|
128
|
+
`GET /realtime`
|
|
129
|
+
|
|
130
|
+
**Signature**
|
|
131
|
+
|
|
132
|
+
```
|
|
133
|
+
pub async fn connect_realtime(&self, reconnect_token: String) -> Result<ResumableConnection, Error>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
**Query params**
|
|
137
|
+
|
|
138
|
+
| Name | Type |
|
|
139
|
+
| ---- | ---- |
|
|
140
|
+
| `reconnect_token` | `String` |
|
|
141
|
+
|
|
142
|
+
**Responses**
|
|
143
|
+
|
|
144
|
+
| Status | Content-type | Type |
|
|
145
|
+
| ------ | ------------ | ---- |
|
|
146
|
+
| `101` | `—` | — |
|
|
147
|
+
|
|
148
|
+
**Extensions**
|
|
149
|
+
|
|
150
|
+
- `x-realtime`: yes
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### slow
|
|
155
|
+
|
|
156
|
+
`GET /slow`
|
|
157
|
+
|
|
158
|
+
**Signature**
|
|
159
|
+
|
|
160
|
+
```
|
|
161
|
+
pub async fn slow(&self, ms: i64) -> Result<struct { ok: bool }, Error>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
**Query params**
|
|
165
|
+
|
|
166
|
+
| Name | Type |
|
|
167
|
+
| ---- | ---- |
|
|
168
|
+
| `ms` | `i64` |
|
|
169
|
+
|
|
170
|
+
**Responses**
|
|
171
|
+
|
|
172
|
+
| Status | Content-type | Type |
|
|
173
|
+
| ------ | ------------ | ---- |
|
|
174
|
+
| `200` | `application/json` | `struct { ok: bool }` |
|
|
175
|
+
|
|
176
|
+
---
|
|
177
|
+
|
|
178
|
+
### stream_events
|
|
179
|
+
|
|
180
|
+
`GET /stream`
|
|
181
|
+
|
|
182
|
+
**Signature**
|
|
183
|
+
|
|
184
|
+
```
|
|
185
|
+
pub async fn stream_events(&self, last_event_id: String) -> Result<impl Stream<Item = struct { event: Option<String>, data: Option<String>, id: Option<String> }>, Error>
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
**Header params**
|
|
189
|
+
|
|
190
|
+
| Name | Type |
|
|
191
|
+
| ---- | ---- |
|
|
192
|
+
| `Last-Event-ID` | `String` |
|
|
193
|
+
|
|
194
|
+
**Responses**
|
|
195
|
+
|
|
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
|
+
|
|
201
|
+
**Extensions**
|
|
202
|
+
|
|
203
|
+
- SSE response detected (`text/event-stream`)
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
### upload_blob
|
|
208
|
+
|
|
209
|
+
`POST /upload`
|
|
210
|
+
|
|
211
|
+
**Signature**
|
|
212
|
+
|
|
213
|
+
```
|
|
214
|
+
pub async fn upload_blob(&self, body: impl Stream<Item = Bytes>) -> Result<struct { size: i64, hash: String }, Error>
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
**Request body**
|
|
218
|
+
|
|
219
|
+
- Content-type: `application/octet-stream`
|
|
220
|
+
- Required: yes
|
|
221
|
+
- Type: `impl Stream<Item = Bytes>`
|
|
222
|
+
|
|
223
|
+
**Responses**
|
|
224
|
+
|
|
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
|
+
|
|
230
|
+
---
|
|
231
|
+
|
|
232
|
+
### list_users
|
|
233
|
+
|
|
234
|
+
`GET /users`
|
|
235
|
+
|
|
236
|
+
**Signature**
|
|
237
|
+
|
|
238
|
+
```
|
|
239
|
+
pub async fn list_users(&self) -> Result<struct { items: Vec<struct { id: String, name: String, email: String }>, total: i64 }, Error>
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
**Responses**
|
|
243
|
+
|
|
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
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
### create_user
|
|
252
|
+
|
|
253
|
+
`POST /users`
|
|
254
|
+
|
|
255
|
+
**Signature**
|
|
256
|
+
|
|
257
|
+
```
|
|
258
|
+
pub async fn create_user(&self, body: struct { name: String, email: String }) -> Result<struct { id: String, name: String, email: String }, Error>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
**Request body**
|
|
262
|
+
|
|
263
|
+
- Content-type: `application/json`
|
|
264
|
+
- Required: yes
|
|
265
|
+
- Type: `struct { name: String, email: String }`
|
|
266
|
+
|
|
267
|
+
**Responses**
|
|
268
|
+
|
|
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
|
+
|
|
275
|
+
**Extensions**
|
|
276
|
+
|
|
277
|
+
- `x-invalidate`: `GET /users`
|
|
278
|
+
|
|
279
|
+
---
|
|
280
|
+
|
|
281
|
+
### delete_user
|
|
282
|
+
|
|
283
|
+
`DELETE /users/{id}`
|
|
284
|
+
|
|
285
|
+
**Signature**
|
|
286
|
+
|
|
287
|
+
```
|
|
288
|
+
pub async fn delete_user(&self, id: String) -> Result<(), Error>
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
**Path params**
|
|
292
|
+
|
|
293
|
+
| Name | Type |
|
|
294
|
+
| ---- | ---- |
|
|
295
|
+
| `id` | `String` |
|
|
296
|
+
|
|
297
|
+
**Responses**
|
|
298
|
+
|
|
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
|
+
|
|
305
|
+
**Extensions**
|
|
306
|
+
|
|
307
|
+
- `x-invalidate`: `GET /users`, `GET /users/{id}`
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
### get_user
|
|
312
|
+
|
|
313
|
+
`GET /users/{id}`
|
|
314
|
+
|
|
315
|
+
**Signature**
|
|
316
|
+
|
|
317
|
+
```
|
|
318
|
+
pub async fn get_user(&self, id: String) -> Result<struct { id: String, name: String, email: String }, Error>
|
|
319
|
+
```
|
|
320
|
+
|
|
321
|
+
**Path params**
|
|
322
|
+
|
|
323
|
+
| Name | Type |
|
|
324
|
+
| ---- | ---- |
|
|
325
|
+
| `id` | `String` |
|
|
326
|
+
|
|
327
|
+
**Responses**
|
|
328
|
+
|
|
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
|
+
|
|
335
|
+
---
|
|
336
|
+
|
|
337
|
+
### update_user
|
|
338
|
+
|
|
339
|
+
`PUT /users/{id}`
|
|
340
|
+
|
|
341
|
+
**Signature**
|
|
342
|
+
|
|
343
|
+
```
|
|
344
|
+
pub async fn update_user(&self, id: String, body: struct { name: Option<String>, email: Option<String> }) -> Result<struct { id: String, name: String, email: String }, Error>
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Path params**
|
|
348
|
+
|
|
349
|
+
| Name | Type |
|
|
350
|
+
| ---- | ---- |
|
|
351
|
+
| `id` | `String` |
|
|
352
|
+
|
|
353
|
+
**Request body**
|
|
354
|
+
|
|
355
|
+
- Content-type: `application/json`
|
|
356
|
+
- Required: yes
|
|
357
|
+
- Type: `struct { name: Option<String>, email: Option<String> }`
|
|
358
|
+
|
|
359
|
+
**Responses**
|
|
360
|
+
|
|
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
|
+
|
|
367
|
+
**Extensions**
|
|
368
|
+
|
|
369
|
+
- `x-invalidate`: `GET /users`, `GET /users/{id}`
|
|
370
|
+
|
|
371
|
+
---
|
|
372
|
+
|
|
373
|
+
### connect_ws
|
|
374
|
+
|
|
375
|
+
`GET /ws`
|
|
376
|
+
|
|
377
|
+
**Signature**
|
|
378
|
+
|
|
379
|
+
```
|
|
380
|
+
pub async fn connect_ws(&self, token: String) -> Result<ResumableConnection, Error>
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
**Query params**
|
|
384
|
+
|
|
385
|
+
| Name | Type |
|
|
386
|
+
| ---- | ---- |
|
|
387
|
+
| `token` | `String` |
|
|
388
|
+
|
|
389
|
+
**Responses**
|
|
390
|
+
|
|
391
|
+
| Status | Content-type | Type |
|
|
392
|
+
| ------ | ------------ | ---- |
|
|
393
|
+
| `101` | `—` | — |
|
|
394
|
+
|
|
395
|
+
**Extensions**
|
|
396
|
+
|
|
397
|
+
- `x-websocket`: yes
|
|
398
|
+
|
|
399
|
+
---
|