|
| 1 | +from typing import Annotated, Optional |
| 2 | + |
| 3 | +from rapid_api_client import Path, PydanticBody, Query |
| 4 | + |
| 5 | + |
| 6 | +from remnawave.models import ( |
| 7 | + CloneNodePluginRequestDto, |
| 8 | + CloneNodePluginResponseDto, |
| 9 | + CreateNodePluginRequestDto, |
| 10 | + CreateNodePluginResponseDto, |
| 11 | + DeleteNodePluginResponseDto, |
| 12 | + GetNodePluginResponseDto, |
| 13 | + GetNodePluginsResponseDto, |
| 14 | + GetTorrentBlockerReportsResponseDto, |
| 15 | + GetTorrentBlockerReportsStatsResponseDto, |
| 16 | + PluginExecutorRequestDto, |
| 17 | + PluginExecutorResponseDto, |
| 18 | + ReorderNodePluginsRequestDto, |
| 19 | + ReorderNodePluginsResponseDto, |
| 20 | + TruncateTorrentBlockerReportsResponseDto, |
| 21 | + UpdateNodePluginRequestDto, |
| 22 | + UpdateNodePluginResponseDto, |
| 23 | +) |
| 24 | +from remnawave.rapid import BaseController, delete, get, patch, post |
| 25 | + |
| 26 | + |
| 27 | +class NodePluginsController(BaseController): |
| 28 | + @get("/node-plugins/torrent-blocker", response_class=GetTorrentBlockerReportsResponseDto) |
| 29 | + async def get_torrent_blocker_reports( |
| 30 | + self, |
| 31 | + size: Annotated[Optional[int], Query(default=None, ge=1, description="Page size")] = None, |
| 32 | + start: Annotated[Optional[int], Query(default=None, ge=0, description="Offset")] = None, |
| 33 | + ) -> GetTorrentBlockerReportsResponseDto: |
| 34 | + """Get Torrent Blocker Reports""" |
| 35 | + ... |
| 36 | + |
| 37 | + @get("/node-plugins/torrent-blocker/stats", response_class=GetTorrentBlockerReportsStatsResponseDto) |
| 38 | + async def get_torrent_blocker_reports_stats( |
| 39 | + self, |
| 40 | + ) -> GetTorrentBlockerReportsStatsResponseDto: |
| 41 | + """Get Torrent Blocker Reports Stats""" |
| 42 | + ... |
| 43 | + |
| 44 | + @delete("/node-plugins/torrent-blocker/truncate", response_class=TruncateTorrentBlockerReportsResponseDto) |
| 45 | + async def truncate_torrent_blocker_reports( |
| 46 | + self, |
| 47 | + ) -> TruncateTorrentBlockerReportsResponseDto: |
| 48 | + """Truncate Torrent Blocker Reports""" |
| 49 | + ... |
| 50 | + |
| 51 | + @get("/node-plugins", response_class=GetNodePluginsResponseDto) |
| 52 | + async def get_all_node_plugins(self) -> GetNodePluginsResponseDto: |
| 53 | + """Get all Node Plugins""" |
| 54 | + ... |
| 55 | + |
| 56 | + @patch("/node-plugins", response_class=UpdateNodePluginResponseDto) |
| 57 | + async def update_node_plugin( |
| 58 | + self, |
| 59 | + body: Annotated[UpdateNodePluginRequestDto, PydanticBody()], |
| 60 | + ) -> UpdateNodePluginResponseDto: |
| 61 | + """Update Node Plugin""" |
| 62 | + ... |
| 63 | + |
| 64 | + @post("/node-plugins", response_class=CreateNodePluginResponseDto) |
| 65 | + async def create_node_plugin( |
| 66 | + self, |
| 67 | + body: Annotated[CreateNodePluginRequestDto, PydanticBody()], |
| 68 | + ) -> CreateNodePluginResponseDto: |
| 69 | + """Create Node Plugin""" |
| 70 | + ... |
| 71 | + |
| 72 | + @get("/node-plugins/{uuid}", response_class=GetNodePluginResponseDto) |
| 73 | + async def get_node_plugin_by_uuid( |
| 74 | + self, |
| 75 | + uuid: Annotated[str, Path(description="Node plugin UUID")], |
| 76 | + ) -> GetNodePluginResponseDto: |
| 77 | + """Get Node Plugin by uuid""" |
| 78 | + ... |
| 79 | + |
| 80 | + @delete("/node-plugins/{uuid}", response_class=DeleteNodePluginResponseDto) |
| 81 | + async def delete_node_plugin( |
| 82 | + self, |
| 83 | + uuid: Annotated[str, Path(description="Node plugin UUID")], |
| 84 | + ) -> DeleteNodePluginResponseDto: |
| 85 | + """Delete Node Plugin""" |
| 86 | + ... |
| 87 | + |
| 88 | + @post("/node-plugins/actions/reorder", response_class=ReorderNodePluginsResponseDto) |
| 89 | + async def reorder_node_plugins( |
| 90 | + self, |
| 91 | + body: Annotated[ReorderNodePluginsRequestDto, PydanticBody()], |
| 92 | + ) -> ReorderNodePluginsResponseDto: |
| 93 | + """Reorder Node Plugins""" |
| 94 | + ... |
| 95 | + |
| 96 | + @post("/node-plugins/actions/clone", response_class=CloneNodePluginResponseDto) |
| 97 | + async def clone_node_plugin( |
| 98 | + self, |
| 99 | + body: Annotated[CloneNodePluginRequestDto, PydanticBody()], |
| 100 | + ) -> CloneNodePluginResponseDto: |
| 101 | + """Clone Node Plugin""" |
| 102 | + ... |
| 103 | + |
| 104 | + @post("/node-plugins/executor", response_class=PluginExecutorResponseDto) |
| 105 | + async def plugin_executor( |
| 106 | + self, |
| 107 | + body: Annotated[PluginExecutorRequestDto, PydanticBody()], |
| 108 | + ) -> PluginExecutorResponseDto: |
| 109 | + """Execute command on node plugins""" |
| 110 | + ... |
0 commit comments