Remnawave_python-sdk/remnawave/controllers/auth.py
Artem 950a7ffab3
Add Pydantic models for nodes usage history, subscriptions, and user management
- 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.
2025-07-03 12:22:16 +02:00

47 lines
No EOL
1.3 KiB
Python

from typing import Annotated
from rapid_api_client.annotations import PydanticBody
from remnawave.models import (
GetStatusResponseDto,
LoginRequestDto,
LoginResponseDto,
RegisterRequestDto,
RegisterResponseDto,
TelegramCallbackRequestDto,
TelegramCallbackResponseDto,
)
from remnawave.rapid import BaseController, get, post
class AuthController(BaseController):
@post("/auth/login", response_class=LoginResponseDto)
async def login(
self,
body: Annotated[LoginRequestDto, PydanticBody()],
) -> LoginResponseDto:
"""Login"""
...
@post("/auth/register", response_class=RegisterResponseDto)
async def register(
self,
body: Annotated[RegisterRequestDto, PydanticBody()],
) -> RegisterResponseDto:
"""Register"""
...
@get("/auth/status", response_class=GetStatusResponseDto)
async def get_status(
self,
) -> GetStatusResponseDto:
"""Get status"""
...
@post("/auth/oauth2/tg/callback", response_class=TelegramCallbackResponseDto)
async def oauth2_tg_callback(
self,
body: Annotated[TelegramCallbackRequestDto, PydanticBody()],
) -> TelegramCallbackResponseDto:
"""OAuth2 Telegram callback"""
...