openzeppelin_relayer/api/routes/docs/
network_docs.rs1use crate::models::{ApiResponse, NetworkResponse, UpdateNetworkRequest};
12
13#[utoipa::path(
19 get,
20 path = "/api/v1/networks",
21 tag = "Networks",
22 operation_id = "listNetworks",
23 security(
24 ("bearer_auth" = [])
25 ),
26 params(
27 ("page" = Option<usize>, Query, description = "Page number for pagination (starts at 1)"),
28 ("per_page" = Option<usize>, Query, description = "Number of items per page (default: 10)")
29 ),
30 responses(
31 (
32 status = 200,
33 description = "Network list retrieved successfully",
34 body = ApiResponse<Vec<NetworkResponse>>
35 ),
36 (
37 status = 400,
38 description = "Bad Request",
39 body = ApiResponse<String>,
40 example = json!({
41 "success": false,
42 "message": "Bad Request",
43 "data": null
44 })
45 ),
46 (
47 status = 401,
48 description = "Unauthorized",
49 body = ApiResponse<String>,
50 example = json!({
51 "success": false,
52 "message": "Unauthorized",
53 "data": null
54 })
55 ),
56 (
57 status = 500,
58 description = "Internal Server Error",
59 body = ApiResponse<String>,
60 example = json!({
61 "success": false,
62 "message": "Internal Server Error",
63 "data": null
64 })
65 )
66 )
67)]
68#[allow(dead_code)]
69fn doc_list_networks() {}
70
71#[utoipa::path(
73 get,
74 path = "/api/v1/networks/{network_id}",
75 tag = "Networks",
76 operation_id = "getNetwork",
77 security(
78 ("bearer_auth" = [])
79 ),
80 params(
81 ("network_id" = String, Path, description = "Network ID (e.g., evm:sepolia, solana:mainnet)")
82 ),
83 responses(
84 (
85 status = 200,
86 description = "Network retrieved successfully",
87 body = ApiResponse<NetworkResponse>
88 ),
89 (
90 status = 400,
91 description = "Bad Request - invalid network type",
92 body = ApiResponse<String>,
93 example = json!({
94 "success": false,
95 "message": "Bad Request",
96 "data": null
97 })
98 ),
99 (
100 status = 401,
101 description = "Unauthorized",
102 body = ApiResponse<String>,
103 example = json!({
104 "success": false,
105 "message": "Unauthorized",
106 "data": null
107 })
108 ),
109 (
110 status = 404,
111 description = "Not Found",
112 body = ApiResponse<String>,
113 example = json!({
114 "success": false,
115 "message": "Network with ID 'evm:sepolia' not found",
116 "data": null
117 })
118 ),
119 (
120 status = 500,
121 description = "Internal Server Error",
122 body = ApiResponse<String>,
123 example = json!({
124 "success": false,
125 "message": "Internal Server Error",
126 "data": null
127 })
128 )
129 )
130)]
131#[allow(dead_code)]
132fn doc_get_network() {}
133
134#[utoipa::path(
137 patch,
138 path = "/api/v1/networks/{network_id}",
139 tag = "Networks",
140 operation_id = "updateNetwork",
141 security(
142 ("bearer_auth" = [])
143 ),
144 params(
145 ("network_id" = String, Path, description = "Network ID (e.g., evm:sepolia, solana:mainnet)")
146 ),
147 request_body = UpdateNetworkRequest,
148 responses(
149 (
150 status = 200,
151 description = "Network updated successfully",
152 body = ApiResponse<NetworkResponse>
153 ),
154 (
155 status = 400,
156 description = "Bad Request - invalid network type or request data",
157 body = ApiResponse<String>,
158 example = json!({
159 "success": false,
160 "message": "Bad Request",
161 "data": null
162 })
163 ),
164 (
165 status = 401,
166 description = "Unauthorized",
167 body = ApiResponse<String>,
168 example = json!({
169 "success": false,
170 "message": "Unauthorized",
171 "data": null
172 })
173 ),
174 (
175 status = 404,
176 description = "Not Found",
177 body = ApiResponse<String>,
178 example = json!({
179 "success": false,
180 "message": "Network with ID 'evm:sepolia' not found",
181 "data": null
182 })
183 ),
184 (
185 status = 500,
186 description = "Internal Server Error",
187 body = ApiResponse<String>,
188 example = json!({
189 "success": false,
190 "message": "Internal Server Error",
191 "data": null
192 })
193 )
194 )
195)]
196#[allow(dead_code)]
197fn doc_update_network() {}