Remnawave_python-sdk/remnawave/controllers/hosts.py
Artem 3f0b5af2cf
Refactor tests for HWID, subscriptions, system, and users; add subscription request history functionality
- Restructured HWID tests into classes for better organization and clarity.
- Enhanced subscription tests to cover additional scenarios and improved assertions.
- Introduced new tests for system statistics and monitoring.
- Implemented CRUD operations for user management with comprehensive test coverage.
- Added new controllers and models for handling subscription request history.
- Created tests for subscription request history, including pagination and statistics.
- Improved error handling in tests to skip when exceptions occur.
2025-10-02 01:46:17 +02:00

74 lines
2.1 KiB
Python

from typing import Annotated, List
from rapid_api_client import Path
from rapid_api_client.annotations import PydanticBody
from remnawave.models import (
CreateHostRequestDto,
CreateHostResponseDto,
DeleteHostResponseDto,
GetAllHostsResponseDto,
GetOneHostResponseDto,
ReorderHostRequestDto,
ReorderHostResponseDto,
UpdateHostRequestDto,
UpdateHostResponseDto,
GetAllHostTagsResponseDto,
)
from remnawave.rapid import AttributeBody, BaseController, delete, get, post, patch
class HostsController(BaseController):
@post("/hosts", response_class=CreateHostResponseDto)
async def create_host(
self,
body: Annotated[CreateHostRequestDto, PydanticBody()],
) -> CreateHostResponseDto:
"""Create Host"""
...
@patch("/hosts", response_class=UpdateHostResponseDto)
async def update_host(
self,
body: Annotated[UpdateHostRequestDto, PydanticBody()],
) -> UpdateHostResponseDto:
"""Update Host"""
...
@get("/hosts", response_class=GetAllHostsResponseDto)
async def get_all_hosts(
self,
) -> GetAllHostsResponseDto:
"""Get All Hosts"""
...
@get("/hosts/tags", response_class=GetAllHostTagsResponseDto)
async def get_hosts_tags(
self,
) -> GetAllHostTagsResponseDto:
"""Get Hosts Tags"""
...
@delete("/hosts/{uuid}", response_class=DeleteHostResponseDto)
async def delete_host(
self,
uuid: Annotated[str, Path(description="UUID of the host")],
) -> DeleteHostResponseDto:
"""Delete Host"""
...
@get("/hosts/{uuid}", response_class=GetOneHostResponseDto)
async def get_one_host(
self,
uuid: Annotated[str, Path(description="UUID of the host")],
) -> GetOneHostResponseDto:
"""Get One Host"""
...
@post("/hosts/actions/reorder", response_class=ReorderHostResponseDto)
async def reorder_hosts(
self,
body: Annotated[ReorderHostRequestDto, PydanticBody()],
) -> ReorderHostResponseDto:
"""Reorder Hosts"""
...