@@ -17,7 +17,14 @@ use http::request::Parts;
17
17
use http:: StatusCode ;
18
18
use secrecy:: { ExposeSecret , SecretString } ;
19
19
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
+ ) ]
21
28
pub async fn owners ( state : AppState , Path ( crate_name) : Path < String > ) -> AppResult < ErasedJson > {
22
29
let mut conn = state. db_read ( ) . await ?;
23
30
@@ -37,7 +44,14 @@ pub async fn owners(state: AppState, Path(crate_name): Path<String>) -> AppResul
37
44
Ok ( json ! ( { "users" : owners } ) )
38
45
}
39
46
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
+ ) ]
41
55
pub async fn owner_team ( state : AppState , Path ( crate_name) : Path < String > ) -> AppResult < ErasedJson > {
42
56
let mut conn = state. db_read ( ) . await ?;
43
57
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
55
69
Ok ( json ! ( { "teams" : owners } ) )
56
70
}
57
71
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
+ ) ]
59
80
pub async fn owner_user ( state : AppState , Path ( crate_name) : Path < String > ) -> AppResult < ErasedJson > {
60
81
let mut conn = state. db_read ( ) . await ?;
61
82
@@ -74,7 +95,14 @@ pub async fn owner_user(state: AppState, Path(crate_name): Path<String>) -> AppR
74
95
Ok ( json ! ( { "users" : owners } ) )
75
96
}
76
97
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
+ ) ]
78
106
pub async fn add_owners (
79
107
app : AppState ,
80
108
Path ( crate_name) : Path < String > ,
@@ -84,7 +112,14 @@ pub async fn add_owners(
84
112
modify_owners ( app, crate_name, parts, body, true ) . await
85
113
}
86
114
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
+ ) ]
88
123
pub async fn remove_owners (
89
124
app : AppState ,
90
125
Path ( crate_name) : Path < String > ,
0 commit comments