@@ -17,7 +17,14 @@ use http::request::Parts;
1717use http:: StatusCode ;
1818use secrecy:: { ExposeSecret , SecretString } ;
1919
20- /// Handles the `GET /crates/:crate_id/owners` route.
20+ /// List crate owners.
21+ #[ utoipa:: path(
22+ get,
23+ path = "/api/v1/crates/{name}/owners" ,
24+ operation_id = "list_owners" ,
25+ tag = "owners" ,
26+ responses( ( status = 200 , description = "Successful Response" ) ) ,
27+ ) ]
2128pub async fn owners ( state : AppState , Path ( crate_name) : Path < String > ) -> AppResult < ErasedJson > {
2229 let mut conn = state. db_read ( ) . await ?;
2330
@@ -37,7 +44,14 @@ pub async fn owners(state: AppState, Path(crate_name): Path<String>) -> AppResul
3744 Ok ( json ! ( { "users" : owners } ) )
3845}
3946
40- /// Handles the `GET /crates/:crate_id/owner_team` route.
47+ /// List team owners of a crate.
48+ #[ utoipa:: path(
49+ get,
50+ path = "/api/v1/crates/{name}/owner_team" ,
51+ operation_id = "get_team_owners" ,
52+ tag = "owners" ,
53+ responses( ( status = 200 , description = "Successful Response" ) ) ,
54+ ) ]
4155pub async fn owner_team ( state : AppState , Path ( crate_name) : Path < String > ) -> AppResult < ErasedJson > {
4256 let mut conn = state. db_read ( ) . await ?;
4357 let krate: Crate = Crate :: by_name ( & crate_name)
@@ -55,7 +69,14 @@ pub async fn owner_team(state: AppState, Path(crate_name): Path<String>) -> AppR
5569 Ok ( json ! ( { "teams" : owners } ) )
5670}
5771
58- /// Handles the `GET /crates/:crate_id/owner_user` route.
72+ /// List user owners of a crate.
73+ #[ utoipa:: path(
74+ get,
75+ path = "/api/v1/crates/{name}/owner_user" ,
76+ operation_id = "get_user_owners" ,
77+ tag = "owners" ,
78+ responses( ( status = 200 , description = "Successful Response" ) ) ,
79+ ) ]
5980pub async fn owner_user ( state : AppState , Path ( crate_name) : Path < String > ) -> AppResult < ErasedJson > {
6081 let mut conn = state. db_read ( ) . await ?;
6182
@@ -74,7 +95,14 @@ pub async fn owner_user(state: AppState, Path(crate_name): Path<String>) -> AppR
7495 Ok ( json ! ( { "users" : owners } ) )
7596}
7697
77- /// Handles the `PUT /crates/:crate_id/owners` route.
98+ /// Add crate owners.
99+ #[ utoipa:: path(
100+ put,
101+ path = "/api/v1/crates/{name}/owners" ,
102+ operation_id = "add_owners" ,
103+ tag = "owners" ,
104+ responses( ( status = 200 , description = "Successful Response" ) ) ,
105+ ) ]
78106pub async fn add_owners (
79107 app : AppState ,
80108 Path ( crate_name) : Path < String > ,
@@ -84,7 +112,14 @@ pub async fn add_owners(
84112 modify_owners ( app, crate_name, parts, body, true ) . await
85113}
86114
87- /// Handles the `DELETE /crates/:crate_id/owners` route.
115+ /// Remove crate owners.
116+ #[ utoipa:: path(
117+ delete,
118+ path = "/api/v1/crates/{name}/owners" ,
119+ operation_id = "delete_owners" ,
120+ tag = "owners" ,
121+ responses( ( status = 200 , description = "Successful Response" ) ) ,
122+ ) ]
88123pub async fn remove_owners (
89124 app : AppState ,
90125 Path ( crate_name) : Path < String > ,
0 commit comments