mirror of
https://github.com/remnawave/python-sdk.git
synced 2026-08-31 14:21:05 +00:00
- Implemented models for nodes usage history including NodeInfoDto, GetUserAccessibleNodesResponse, and usage statistics. - Created subscription-related models such as UserSubscription, SubscriptionInfoData, and various response DTOs for subscription information. - Developed models for subscription settings, templates, and system statistics, enhancing the API's capability to manage and retrieve subscription configurations. - Introduced user management models including CreateUserRequestDto, UpdateUserRequestDto, and various response DTOs for user actions. - Added bulk actions for user updates and statistics tracking, improving the efficiency of user management operations. - Established a base controller for handling API requests and responses, along with decorators for HTTP methods to streamline API interactions. - Included utility functions for serialization using orjson for better performance with Pydantic models.
38 lines
No EOL
1.2 KiB
Python
38 lines
No EOL
1.2 KiB
Python
from typing import Annotated
|
|
from uuid import UUID
|
|
|
|
from remnawave.models import (
|
|
CreateUserHwidDeviceResponseDto,
|
|
DeleteUserHwidDeviceResponseDto,
|
|
GetUserHwidDevicesResponseDto,
|
|
CreateHWIDUser,
|
|
HWIDDeleteRequest
|
|
)
|
|
from rapid_api_client import Path, PydanticBody
|
|
from remnawave.rapid import AttributeBody, BaseController, post, get
|
|
|
|
|
|
class HWIDUserController(BaseController):
|
|
@post("/hwid/devices", response_class=CreateUserHwidDeviceResponseDto)
|
|
async def add_hwid_to_users(
|
|
self,
|
|
body: Annotated[CreateHWIDUser, PydanticBody()],
|
|
) -> CreateUserHwidDeviceResponseDto:
|
|
"""Create a user HWID device"""
|
|
...
|
|
|
|
@post("/hwid/devices/delete", response_class=DeleteUserHwidDeviceResponseDto)
|
|
async def delete_hwid_to_user(
|
|
self,
|
|
body: Annotated[HWIDDeleteRequest, PydanticBody()],
|
|
) -> DeleteUserHwidDeviceResponseDto:
|
|
"""Delete a user HWID device"""
|
|
...
|
|
|
|
@get("/hwid/devices/{uuid}", response_class=GetUserHwidDevicesResponseDto)
|
|
async def get_hwid_user(
|
|
self,
|
|
uuid: Annotated[str, Path(description="UUID of the User")],
|
|
) -> GetUserHwidDevicesResponseDto:
|
|
"""Get a user HWID device"""
|
|
... |