openzeppelin_relayer/api/routes/docs/
plugin_docs.rs

1use crate::{
2    models::{ApiResponse, PluginCallRequest},
3    services::plugins::PluginCallResponse,
4};
5
6/// Calls a plugin method.
7#[utoipa::path(
8    post,
9    path = "/api/v1/plugins/{plugin_id}/call",
10    tag = "Plugins",
11    operation_id = "callPlugin",
12    security(
13        ("bearer_auth" = [])
14    ),
15    params(
16        ("plugin_id" = String, Path, description = "The unique identifier of the plugin")
17    ),
18    request_body = PluginCallRequest,
19    responses(
20        (
21            status = 200,
22            description = "Plugin call successful",
23            body = ApiResponse<PluginCallResponse>
24        ),
25        (
26            status = 400,
27            description = "BadRequest",
28            body = ApiResponse<String>,
29            example = json!({
30                "success": false,
31                "message": "Bad Request",
32                "data": null
33            })
34        ),
35        (
36            status = 401,
37            description = "Unauthorized",
38            body = ApiResponse<String>,
39            example = json!({
40                "success": false,
41                "message": "Unauthorized",
42                "data": null
43            })
44        ),
45        (
46            status = 404,
47            description = "Not Found",
48            body = ApiResponse<String>,
49            example = json!({
50                "success": false,
51                "message": "Plugin with ID plugin_id not found",
52                "data": null
53            })
54        ),
55        (
56            status = 429,
57            description = "Too Many Requests",
58            body = ApiResponse<String>,
59            example = json!({
60                "success": false,
61                "message": "Too Many Requests",
62                "data": null
63            })
64        ),
65        (
66            status = 500,
67            description = "Internal server error",
68            body = ApiResponse<String>,
69            example = json!({
70                "success": false,
71                "message": "Internal Server Error",
72                "data": null
73            })
74        ),
75    )
76)]
77#[allow(dead_code)]
78fn doc_call_plugin() {}