File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ use crate :: prelude:: api:: * ;
2+ use crate :: prelude:: types:: * ;
3+ use axum:: Router ;
4+ use axum:: routing:: { delete, get, post} ;
5+ use std:: sync:: Arc ;
6+ use tokio:: sync:: Mutex ;
7+
8+ pub fn create_apikeys_router ( bot_state : Arc < Mutex < BotState > > ) -> Router < Arc < Mutex < BotState > > > {
9+ let apikeys_router = Router :: new ( )
10+ . route ( "/" , post ( create_api_key_handler) )
11+ . route ( "/" , get ( list_api_keys_handler) )
12+ . route ( "/{id}/revoke" , post ( revoke_api_key_handler) )
13+ . route ( "/{id}" , delete ( delete_api_key_handler) )
14+ . layer ( axum:: middleware:: from_fn_with_state (
15+ bot_state,
16+ auth_middleware,
17+ ) ) ;
18+
19+ apikeys_router
20+ }
Original file line number Diff line number Diff line change 1+ pub mod apikeys;
12pub mod auth;
23pub mod bot;
34pub mod externals;
45pub mod panel;
56pub mod user;
67
8+ pub use apikeys:: * ;
79pub use auth:: * ;
810pub use bot:: * ;
911pub use externals:: * ;
You can’t perform that action at this time.
0 commit comments