-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpkg.generated.mbti
More file actions
757 lines (589 loc) · 30.1 KB
/
Copy pathpkg.generated.mbti
File metadata and controls
757 lines (589 loc) · 30.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
// Generated using `moon info`, DON'T EDIT IT
package "moonbitstack/moonapi"
import {
"moonbitlang/core/json",
"moonbitstack/moonasgi/http",
"moonbitstack/moonasgi/lifespan",
"moonbitstack/moonasgi/spec",
"moonbitstack/mooncred/jwt",
"moonbitstack/moonhttp/mime",
"moonbitstack/moonhttp/sse",
}
// Values
pub const HTTP_100_CONTINUE : Int = 100
pub const HTTP_101_SWITCHING_PROTOCOLS : Int = 101
pub const HTTP_102_PROCESSING : Int = 102
pub const HTTP_103_EARLY_HINTS : Int = 103
pub const HTTP_200_OK : Int = 200
pub const HTTP_201_CREATED : Int = 201
pub const HTTP_202_ACCEPTED : Int = 202
pub const HTTP_203_NON_AUTHORITATIVE_INFORMATION : Int = 203
pub const HTTP_204_NO_CONTENT : Int = 204
pub const HTTP_205_RESET_CONTENT : Int = 205
pub const HTTP_206_PARTIAL_CONTENT : Int = 206
pub const HTTP_207_MULTI_STATUS : Int = 207
pub const HTTP_208_ALREADY_REPORTED : Int = 208
pub const HTTP_226_IM_USED : Int = 226
pub const HTTP_300_MULTIPLE_CHOICES : Int = 300
pub const HTTP_301_MOVED_PERMANENTLY : Int = 301
pub const HTTP_302_FOUND : Int = 302
pub const HTTP_303_SEE_OTHER : Int = 303
pub const HTTP_304_NOT_MODIFIED : Int = 304
pub const HTTP_305_USE_PROXY : Int = 305
pub const HTTP_306_RESERVED : Int = 306
pub const HTTP_307_TEMPORARY_REDIRECT : Int = 307
pub const HTTP_308_PERMANENT_REDIRECT : Int = 308
pub const HTTP_400_BAD_REQUEST : Int = 400
pub const HTTP_401_UNAUTHORIZED : Int = 401
pub const HTTP_402_PAYMENT_REQUIRED : Int = 402
pub const HTTP_403_FORBIDDEN : Int = 403
pub const HTTP_404_NOT_FOUND : Int = 404
pub const HTTP_405_METHOD_NOT_ALLOWED : Int = 405
pub const HTTP_406_NOT_ACCEPTABLE : Int = 406
pub const HTTP_407_PROXY_AUTHENTICATION_REQUIRED : Int = 407
pub const HTTP_408_REQUEST_TIMEOUT : Int = 408
pub const HTTP_409_CONFLICT : Int = 409
pub const HTTP_410_GONE : Int = 410
pub const HTTP_411_LENGTH_REQUIRED : Int = 411
pub const HTTP_412_PRECONDITION_FAILED : Int = 412
pub const HTTP_413_REQUEST_ENTITY_TOO_LARGE : Int = 413
pub const HTTP_414_REQUEST_URI_TOO_LONG : Int = 414
pub const HTTP_415_UNSUPPORTED_MEDIA_TYPE : Int = 415
pub const HTTP_416_REQUESTED_RANGE_NOT_SATISFIABLE : Int = 416
pub const HTTP_417_EXPECTATION_FAILED : Int = 417
pub const HTTP_418_IM_A_TEAPOT : Int = 418
pub const HTTP_421_MISDIRECTED_REQUEST : Int = 421
pub const HTTP_422_UNPROCESSABLE_ENTITY : Int = 422
pub const HTTP_423_LOCKED : Int = 423
pub const HTTP_424_FAILED_DEPENDENCY : Int = 424
pub const HTTP_425_TOO_EARLY : Int = 425
pub const HTTP_426_UPGRADE_REQUIRED : Int = 426
pub const HTTP_428_PRECONDITION_REQUIRED : Int = 428
pub const HTTP_429_TOO_MANY_REQUESTS : Int = 429
pub const HTTP_431_REQUEST_HEADER_FIELDS_TOO_LARGE : Int = 431
pub const HTTP_451_UNAVAILABLE_FOR_LEGAL_REASONS : Int = 451
pub const HTTP_500_INTERNAL_SERVER_ERROR : Int = 500
pub const HTTP_501_NOT_IMPLEMENTED : Int = 501
pub const HTTP_502_BAD_GATEWAY : Int = 502
pub const HTTP_503_SERVICE_UNAVAILABLE : Int = 503
pub const HTTP_504_GATEWAY_TIMEOUT : Int = 504
pub const HTTP_505_HTTP_VERSION_NOT_SUPPORTED : Int = 505
pub const HTTP_506_VARIANT_ALSO_NEGOTIATES : Int = 506
pub const HTTP_507_INSUFFICIENT_STORAGE : Int = 507
pub const HTTP_508_LOOP_DETECTED : Int = 508
pub const HTTP_510_NOT_EXTENDED : Int = 510
pub const HTTP_511_NETWORK_AUTHENTICATION_REQUIRED : Int = 511
pub const WS_1000_NORMAL_CLOSURE : Int = 1000
pub const WS_1001_GOING_AWAY : Int = 1001
pub const WS_1002_PROTOCOL_ERROR : Int = 1002
pub const WS_1003_UNSUPPORTED_DATA : Int = 1003
pub const WS_1005_NO_STATUS_RCVD : Int = 1005
pub const WS_1006_ABNORMAL_CLOSURE : Int = 1006
pub const WS_1007_INVALID_FRAME_PAYLOAD_DATA : Int = 1007
pub const WS_1008_POLICY_VIOLATION : Int = 1008
pub const WS_1009_MESSAGE_TOO_BIG : Int = 1009
pub const WS_1010_MANDATORY_EXT : Int = 1010
pub const WS_1011_INTERNAL_ERROR : Int = 1011
pub const WS_1012_SERVICE_RESTART : Int = 1012
pub const WS_1013_TRY_AGAIN_LATER : Int = 1013
pub const WS_1014_BAD_GATEWAY : Int = 1014
pub const WS_1015_TLS_HANDSHAKE : Int = 1015
pub fn check_constraints(Json, Array[Constraint], Array[String], Array[ValidationError]) -> Unit
pub fn cors(allow_origins? : Array[String], allow_all_origins? : Bool, allow_methods? : Array[String], allow_headers? : Array[String], allow_all_headers? : Bool, allow_credentials? : Bool, expose_headers? : Array[String], max_age? : Int) -> ((@http.Request) -> @http.Response) -> (@http.Request) -> @http.Response
pub fn create_access_token(String, String, Int64, scopes? : Array[String], expires_in_secs? : Int64, extra? : Map[String, Json], wins? : @jwt.Wins, clash? : @jwt.OnClash[Map[String, Json]]) -> String
pub fn delete_cookie(@http.Response, String, path? : String, domain? : String, secure? : Bool, http_only? : Bool, same_site? : SameSite?) -> @http.Response
pub fn demo_app() -> App
pub fn drive_websocket((WebSocket) -> Unit, Array[WsMessage], params? : Map[String, String], subprotocols? : Array[String]) -> Array[@spec.Event]
pub fn file_response(Bytes, filename? : String, media_type? : String, status? : Int, inline? : Bool) -> @http.Response
pub fn filter_response(Schema, Json) -> Result[Json, Array[ValidationError]]
pub fn greet_app(Container[Dep]) -> App
pub fn gzip(min_size? : Int) -> ((@http.Request) -> @http.Response) -> (@http.Request) -> @http.Response
pub fn html(Int, String) -> @http.Response
pub fn http_error(Int, String, headers? : Array[(String, String)]) -> HttpException
pub fn json(Int, Json) -> @http.Response
pub fn json_model(Int, Schema, Json) -> @http.Response
pub fn oauth2_app(() -> Int64, secret? : String) -> App
pub fn parse_basic_auth(String) -> HttpBasicCredentials?
pub let query_limits : @mime.Limits
pub fn redirect(String, status? : Int) -> @http.Response
pub fn redoc_ui(spec_url? : String, title? : String) -> String
pub fn[T : ToSchema] schema_of(T) -> Schema
pub fn set_cookie(@http.Response, String, String, max_age? : Int, expires? : String, path? : String, domain? : String, secure? : Bool, http_only? : Bool, same_site? : SameSite?) -> @http.Response
pub fn sse_response(Array[@sse.Event], status? : Int, headers? : Array[(String, String)], space? : Bool, wins? : @jwt.Wins, clash? : @jwt.OnClash[Array[(String, String)]]) -> @http.StreamingResponse
pub fn swagger_ui(spec_url? : String, title? : String) -> String
pub fn text(Int, String) -> @http.Response
pub fn token_response(String) -> @http.Response
pub fn unprocessable(Array[ValidationError]) -> @http.Response
pub fn validate_schema(Schema, Json, Array[String], Array[ValidationError]) -> Unit
pub fn validation_error_body(Array[ValidationError]) -> Json
pub fn with_constraints(Json, Array[Constraint], OpenApiVersion) -> Json
// Errors
pub(all) suberror HttpException {
HttpException(status~ : Int, detail~ : Json, headers~ : Array[(String, String)])
}
// Types and methods
pub(all) struct Address {
city : String
zip : String
} derive(Eq, ToJson)
pub fn Address::equal(Self, Self) -> Bool
pub fn Address::not_equal(Self, Self) -> Bool
pub fn Address::schema() -> Schema
pub fn Address::to_json(Self) -> Json
pub fn Address::to_schema(Self) -> Schema
pub impl ToSchema for Address
pub(all) struct ApiInfo {
title : String
api_version : String
description : String
terms_of_service : String
contact : Contact?
license : License?
servers : Array[Server]
}
pub fn ApiInfo::new() -> Self
pub struct ApiKey {
loc : ApiKeyIn
name : String
verify : (String) -> Bool
}
pub fn ApiKey::cookie(String, (String) -> Bool) -> Self
pub fn ApiKey::header(String, (String) -> Bool) -> Self
pub fn ApiKey::query(String, (String) -> Bool) -> Self
pub fn ApiKey::read(Self, Context) -> String?
pub fn ApiKey::scheme(Self) -> SecurityScheme
pub(all) enum ApiKeyIn {
KeyHeader
KeyQuery
KeyCookie
} derive(Eq)
pub fn ApiKeyIn::equal(Self, Self) -> Bool
pub fn ApiKeyIn::not_equal(Self, Self) -> Bool
pub struct App {
routes : Array[Route]
ws_routes : Array[WsRoute]
middlewares : Array[((@http.Request) -> @http.Response) -> (@http.Request) -> @http.Response]
exception_handlers : Array[(Context, Error) -> @http.Response?]
security_schemes : Array[DeclaredScheme]
enforcers : Map[String, (Context, SecurityScopes, Int64) -> Result[AuthenticatedUser, @http.Response]]
status_handlers : Map[Int, (Context) -> @http.Response]
mounts : Array[(String, Mount)]
startup_hooks : Array[() -> Unit raise]
shutdown_hooks : Array[() -> Unit raise]
mut info : ApiInfo
mut clock : () -> Int64
mut deps : Deps?
}
pub fn App::add_security_scheme(Self, String, SecurityScheme, description? : String) -> Unit
pub fn App::add_status_handler(Self, Int, (Context) -> @http.Response) -> Unit
pub fn App::delete(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::depends(Self, Deps) -> Unit
pub fn App::describe(Self, title? : String, api_version? : String, description? : String, terms_of_service? : String, contact? : Contact?, license? : License?, servers? : Array[Server]) -> Unit
pub fn App::enable_docs(Self, openapi_url? : String?, docs_url? : String?, redoc_url? : String?, version? : OpenApiVersion) -> Unit
pub fn App::exception_handler(Self, (Context, Error) -> @http.Response?) -> Unit
pub fn App::get(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::handle(Self, @http.Request) -> @http.Response
pub fn App::handle_with_background(Self, @http.Request) -> (@http.Response, BackgroundTasks)
pub fn App::handle_with_stream(Self, @http.Request) -> (@http.StreamingResponse, BackgroundTasks)
pub fn App::include_router(Self, Router, prefix? : String, tags? : Array[String], security? : Array[SecurityRequirement], dependencies? : Array[String], responses? : Array[ResponseSpec], deprecated? : Bool, include_in_schema? : Bool) -> Unit
pub fn App::lifespan_handler(Self) -> @lifespan.LifespanHandler
pub fn App::middleware(Self, ((@http.Request) -> @http.Response) -> (@http.Request) -> @http.Response) -> Unit
pub fn App::mount(Self, String, Self) -> Unit
pub fn App::mount_handler(Self, String, (@http.Request) -> @http.Response) -> Unit
pub fn App::new() -> Self
pub fn App::on_shutdown(Self, () -> Unit raise) -> Unit
pub fn App::on_startup(Self, () -> Unit raise) -> Unit
pub fn App::openapi(Self, version? : OpenApiVersion, title? : String, api_version? : String, description? : String, terms_of_service? : String, contact? : Contact?, license? : License?, servers? : Array[Server]) -> Json
pub fn App::openapi_json(Self, version? : OpenApiVersion) -> String
pub fn App::patch(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::post(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::put(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::route(Self, Method, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::route_bg(Self, Method, String, (Context, BackgroundTasks) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::route_stream(Self, Method, String, (Context) -> @http.StreamingResponse raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::secure_api_key(Self, String, ApiKey, description? : String, auto_error? : Bool) -> Unit
pub fn App::secure_basic(Self, String, BasicAuth, description? : String, auto_error? : Bool) -> Unit
pub fn App::secure_bearer(Self, String, String, bearer_format? : String, description? : String, auto_error? : Bool) -> Unit
pub fn App::secure_digest(Self, String, DigestAuth, description? : String, auto_error? : Bool) -> Unit
pub fn App::secure_oauth2(Self, String, OAuth2PasswordBearer, scopes? : Array[(String, String)], description? : String, auto_error? : Bool) -> Unit
pub fn App::secure_oauth2_code(Self, String, OAuth2CodeBearer, scopes? : Array[(String, String)], description? : String, auto_error? : Bool) -> Unit
pub fn App::secure_openid(Self, String, String, String, description? : String, auto_error? : Bool) -> Unit
pub fn App::set_clock(Self, () -> Int64) -> Unit
pub fn App::stream(Self, String, (Context) -> @http.StreamingResponse raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn App::to_asgi(Self) -> async (@spec.Scope, async () -> @spec.Event, async (@spec.Event) -> Unit) -> Unit
pub fn App::url_for(Self, String, params? : Map[String, String]) -> String?
pub fn App::websocket(Self, String, (WebSocket) -> Unit) -> Unit
pub(all) struct AuthenticatedUser {
subject : String
scopes : Array[String]
claims : Map[String, Json]
}
pub fn AuthenticatedUser::has_scope(Self, String) -> Bool
pub struct BackgroundTasks {
tasks : Array[() -> Unit]
}
pub fn BackgroundTasks::add_task(Self, () -> Unit) -> Unit
pub fn BackgroundTasks::len(Self) -> Int
pub fn BackgroundTasks::new() -> Self
pub fn BackgroundTasks::run(Self) -> Unit
pub struct BasicAuth {
realm : String
verify : (HttpBasicCredentials) -> Bool
}
pub fn BasicAuth::challenge(Self) -> String
pub fn BasicAuth::new((HttpBasicCredentials) -> Bool, realm? : String) -> Self
pub(all) enum Constraint {
Minimum(Double)
Maximum(Double)
ExclusiveMinimum(Double)
ExclusiveMaximum(Double)
MultipleOf(Double)
MinLength(Int)
MaxLength(Int)
Pattern(String)
MinItems(Int)
MaxItems(Int)
} derive(Eq)
pub fn Constraint::equal(Self, Self) -> Bool
pub fn Constraint::not_equal(Self, Self) -> Bool
pub(all) struct Contact {
name : String
url : String
email : String
}
pub(all) struct Container[V] {
providers : Map[String, Provider[V]]
overrides : Map[String, Provider[V]]
}
pub fn[V] Container::clear_override(Self[V], String) -> Unit
pub fn[V] Container::clear_overrides(Self[V]) -> Unit
pub fn[V] Container::erase(Self[V]) -> Deps
pub fn[V] Container::new() -> Self[V]
pub fn[V] Container::open_scope(Self[V]) -> Scope[V]
pub fn[V] Container::override_(Self[V], String, () -> V, teardown? : (V, Error?) -> Unit) -> Self[V]
pub fn[V] Container::provide(Self[V], String, () -> V, teardown? : (V, Error?) -> Unit) -> Self[V]
pub fn[V] Container::provide_using(Self[V], String, (Scope[V]) -> V, teardown? : (V, Error?) -> Unit) -> Self[V]
pub fn[V] Container::run(Self[V], (Scope[V]) -> @http.Response raise) -> @http.Response raise
pub(all) struct Context {
request : @http.Request
params : Map[String, String]
}
pub fn Context::api_key_cookie(Self, String) -> String?
pub fn Context::api_key_header(Self, String) -> String?
pub fn Context::api_key_query(Self, String) -> String?
pub fn Context::bearer_token(Self) -> String?
pub fn[T : @json.FromJson] Context::body(Self) -> T?
pub fn Context::body_json(Self) -> Json?
pub fn[T : @json.FromJson] Context::body_validated(Self, Schema) -> Result[T, Array[ValidationError]]
pub fn Context::cookie(Self, String) -> String?
pub fn Context::digest_credentials(Self) -> String?
pub fn Context::form(Self, limits? : @mime.Limits) -> @mime.Form?
pub fn Context::http_basic(Self) -> HttpBasicCredentials?
pub fn Context::json_field(Self, String) -> Json?
pub fn Context::oauth2_password_form(Self) -> OAuth2PasswordRequestForm?
pub fn Context::param(Self, String) -> String?
pub fn Context::query(Self, String, limits? : @mime.Limits) -> String?
pub fn Context::query_all(Self, String, limits? : @mime.Limits) -> Array[String]
pub(all) struct CorsConfig {
allow_origins : Array[String]
allow_all_origins : Bool
allow_methods : Array[String]
allow_headers : Array[String]
allow_all_headers : Bool
allow_credentials : Bool
expose_headers : Array[String]
max_age : Int
}
type DeclaredScheme
pub(all) enum Dep {
Greeting(String)
} derive(Eq)
pub fn Dep::equal(Self, Self) -> Bool
pub fn Dep::not_equal(Self, Self) -> Bool
pub struct Deps {
open : () -> DepsScope
}
type DepsScope
pub struct DigestAuth {
realm : String
verify : (String) -> Bool
}
pub fn DigestAuth::challenge(Self) -> String
pub fn DigestAuth::new((String) -> Bool, realm? : String) -> Self
pub(all) struct Endpoint {
params : Array[Param]
request_body : Schema?
request_required : Bool
responses : Array[ResponseSpec]
} derive(Eq)
pub fn Endpoint::equal(Self, Self) -> Bool
pub fn Endpoint::new(params? : Array[Param], request_body? : Schema, request_required? : Bool, responses? : Array[ResponseSpec]) -> Self
pub fn Endpoint::not_equal(Self, Self) -> Bool
pub fn Endpoint::validate(Self, Context) -> Array[ValidationError]
pub(all) struct Field {
name : String
schema : Schema
required : Bool
description : String
constraints : Array[Constraint]
default : Json?
} derive(Eq)
pub fn Field::equal(Self, Self) -> Bool
pub fn Field::is_required(Self) -> Bool
pub fn Field::new(String, Schema, required? : Bool, description? : String, constraints? : Array[Constraint], default? : Json) -> Self
pub fn Field::not_equal(Self, Self) -> Bool
pub(all) struct GreetReq {
name : String
} derive(Eq, ToJson, @json.FromJson)
pub fn GreetReq::equal(Self, Self) -> Bool
pub fn GreetReq::from_json(Json, @json.JsonPath) -> Self raise @json.JsonDecodeError
pub fn GreetReq::not_equal(Self, Self) -> Bool
pub fn GreetReq::schema() -> Schema
pub fn GreetReq::to_json(Self) -> Json
pub(all) struct HttpBasicCredentials {
username : String
password : String
}
pub(all) struct License {
name : String
url : String
}
pub(all) enum Method {
Get
Post
Put
Patch
Delete
Head
Options
} derive(Eq)
pub fn Method::equal(Self, Self) -> Bool
pub fn Method::not_equal(Self, Self) -> Bool
type Mount
pub(all) struct NewUser {
name : String
email : String
age : Int
} derive(Eq, ToJson)
pub fn NewUser::equal(Self, Self) -> Bool
pub fn NewUser::not_equal(Self, Self) -> Bool
pub fn NewUser::schema() -> Schema
pub fn NewUser::to_json(Self) -> Json
pub fn NewUser::to_schema(Self) -> Schema
pub impl ToSchema for NewUser
pub struct OAuth2CodeBearer {
authorization_url : String
token_url : String
refresh_url : String
secret : String
}
pub fn OAuth2CodeBearer::new(String, String, String, refresh_url? : String) -> Self
pub fn OAuth2CodeBearer::scheme(Self, scopes? : Array[(String, String)]) -> SecurityScheme
pub(all) struct OAuth2PasswordBearer {
token_url : String
secret : String
}
pub fn OAuth2PasswordBearer::authenticate(Self, Context, Int64, scopes? : Array[String]) -> Result[AuthenticatedUser, @http.Response]
pub fn OAuth2PasswordBearer::new(String, String) -> Self
pub fn OAuth2PasswordBearer::scheme(Self, scopes? : Array[(String, String)]) -> SecurityScheme
pub(all) struct OAuth2PasswordRequestForm {
grant_type : String
username : String
password : String
scopes : Array[String]
client_id : String?
client_secret : String?
} derive(Eq)
pub fn OAuth2PasswordRequestForm::equal(Self, Self) -> Bool
pub fn OAuth2PasswordRequestForm::not_equal(Self, Self) -> Bool
pub(all) struct ObjectSchema {
name : String
fields : Array[Field]
description : String
} derive(Eq)
pub fn ObjectSchema::equal(Self, Self) -> Bool
pub fn ObjectSchema::not_equal(Self, Self) -> Bool
pub(all) enum OpenApiVersion {
Swagger20
OpenApi30
OpenApi31
} derive(Eq)
pub fn OpenApiVersion::equal(Self, Self) -> Bool
pub fn OpenApiVersion::not_equal(Self, Self) -> Bool
pub(all) struct Param {
name : String
loc : ParamLoc
schema : Schema
required : Bool
description : String
constraints : Array[Constraint]
default : Json?
alias_ : String
} derive(Eq)
pub fn Param::equal(Self, Self) -> Bool
pub fn Param::is_required(Self) -> Bool
pub fn Param::key(Self) -> String
pub fn Param::new(String, ParamLoc, schema? : Schema, required? : Bool, description? : String, constraints? : Array[Constraint], default? : Json, alias_? : String) -> Self
pub fn Param::not_equal(Self, Self) -> Bool
pub(all) enum ParamLoc {
InPath
InQuery
InHeader
InCookie
} derive(Eq)
pub fn ParamLoc::equal(Self, Self) -> Bool
pub fn ParamLoc::not_equal(Self, Self) -> Bool
pub(all) struct Provider[V] {
factory : (Scope[V]) -> V
teardown : (V, Error?) -> Unit
}
pub fn[V] Provider::new(() -> V, teardown? : (V, Error?) -> Unit) -> Self[V]
pub fn[V] Provider::scoped((Scope[V]) -> V, teardown? : (V, Error?) -> Unit) -> Self[V]
pub(all) struct ResponseSpec {
status : Int
description : String
body : Schema?
} derive(Eq)
pub fn ResponseSpec::equal(Self, Self) -> Bool
pub fn ResponseSpec::new(Int, description? : String, body? : Schema) -> Self
pub fn ResponseSpec::not_equal(Self, Self) -> Bool
type Route
pub struct Router {
routes : Array[Route]
ws_routes : Array[WsRoute]
}
pub fn Router::delete(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn Router::get(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn Router::new() -> Self
pub fn Router::patch(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn Router::post(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn Router::put(Self, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn Router::route(Self, Method, String, (Context) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn Router::route_bg(Self, Method, String, (Context, BackgroundTasks) -> @http.Response raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn Router::stream(Self, String, (Context) -> @http.StreamingResponse raise, summary? : String, description? : String, tags? : Array[String], deprecated? : Bool, operation_id? : String, status_code? : Int, responses? : Array[ResponseSpec], name? : String, endpoint? : Endpoint, security? : Array[SecurityRequirement], dependencies? : Array[String], include_in_schema? : Bool, validate? : Bool, openapi_extra? : Json) -> Unit
pub fn Router::websocket(Self, String, (WebSocket) -> Unit) -> Unit
pub(all) enum SameSite {
Strict
Lax
Unrestricted
} derive(Eq)
pub fn SameSite::equal(Self, Self) -> Bool
pub fn SameSite::not_equal(Self, Self) -> Bool
pub(all) enum Schema {
SStr
SInt
SFloat
SBool
SNull
SArray(Schema)
SObject(ObjectSchema)
SEnum(Schema, Array[Json])
SNullable(Schema)
SMap(Schema)
SAny
SFormat(Schema, String)
} derive(Eq)
pub fn Schema::array(Self) -> Self
pub fn Schema::binary() -> Self
pub fn Schema::equal(Self, Self) -> Bool
pub fn Schema::format(Self, String) -> Self
pub fn Schema::map(Self) -> Self
pub fn Schema::not_equal(Self, Self) -> Bool
pub fn Schema::nullable(Self) -> Self
pub fn Schema::object(String, Array[Field]) -> Self
pub struct Scope[V] {
container : Container[V]
cache : Map[String, V]
building : Map[String, Bool]
teardowns : Array[(Error?) -> Unit]
}
pub fn[V] Scope::close(Self[V], failure? : Error) -> Unit
pub fn[V] Scope::get(Self[V], String) -> V?
pub(all) struct SecurityRequirement {
scheme : String
scopes : Array[String]
} derive(Eq)
pub fn SecurityRequirement::equal(Self, Self) -> Bool
pub fn SecurityRequirement::new(String, scopes? : Array[String]) -> Self
pub fn SecurityRequirement::not_equal(Self, Self) -> Bool
pub(all) enum SecurityScheme {
OAuth2Password(token_url~ : String, scopes~ : Array[(String, String)])
OAuth2Code(authorization_url~ : String, token_url~ : String, refresh_url~ : String, scopes~ : Array[(String, String)])
HttpBearer(bearer_format~ : String)
ApiKeyHeader(name~ : String)
ApiKeyQuery(name~ : String)
ApiKeyCookie(name~ : String)
HttpBasic
HttpDigest
OpenIdConnect(url~ : String)
}
pub struct SecurityScopes {
scopes : Array[String]
}
pub fn SecurityScopes::challenge(Self) -> String
pub fn SecurityScopes::list(Self) -> Array[String]
pub fn SecurityScopes::new(scopes? : Array[String]) -> Self
pub fn SecurityScopes::scope_str(Self) -> String
pub(all) struct Server {
url : String
description : String
}
pub(all) struct User {
id : Int
name : String
address : Address
tags : Array[String]
} derive(Eq, ToJson)
pub fn User::equal(Self, Self) -> Bool
pub fn User::not_equal(Self, Self) -> Bool
pub fn User::schema() -> Schema
pub fn User::to_json(Self) -> Json
pub fn User::to_schema(Self) -> Schema
pub impl ToSchema for User
pub(all) struct ValidationError {
loc : Array[String]
msg : String
kind : String
}
pub fn ValidationError::missing(Array[String]) -> Self
pub fn ValidationError::type_error(Array[String], String, String) -> Self
pub struct WebSocket {
inbox : Array[WsMessage]
mut cursor : Int
params : Map[String, String]
subprotocols : Array[String]
mut accepted : Bool
mut closed : Bool
outbox : Array[@spec.Event]
}
pub fn WebSocket::accept(Self, subprotocol? : String, headers? : Array[(String, String)]) -> Unit
pub fn WebSocket::close(Self, code? : Int, reason? : String) -> Unit
pub fn WebSocket::offered_subprotocols(Self) -> Array[String]
pub fn WebSocket::param(Self, String) -> String?
pub fn WebSocket::receive(Self) -> WsMessage?
pub fn WebSocket::receive_bytes(Self) -> Bytes?
pub fn WebSocket::receive_text(Self) -> String?
pub fn WebSocket::send_bytes(Self, Bytes) -> Unit
pub fn WebSocket::send_text(Self, String) -> Unit
pub fn WebSocket::sent(Self) -> Array[@spec.Event]
pub(all) enum WsMessage {
WsText(String)
WsBinary(Bytes)
} derive(Eq)
pub fn WsMessage::equal(Self, Self) -> Bool
pub fn WsMessage::not_equal(Self, Self) -> Bool
type WsRoute
// Type aliases
pub type ApiHandler = (Context) -> @http.Response raise
pub type BackgroundHandler = (Context, BackgroundTasks) -> @http.Response raise
pub using @sse {type Event}
pub type ExceptionHandler = (Context, Error) -> @http.Response?
pub using @mime {type Form}
pub using @mime {type Limits}
pub type StreamHandler = (Context) -> @http.StreamingResponse raise
pub using @mime {type Upload}
pub type WsHandler = (WebSocket) -> Unit
// Traits
pub(open) trait ToSchema {
fn to_schema(Self) -> Schema
}