Remnawave_python-sdk/remnawave/models/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

58 lines
No EOL
1.3 KiB
Python

from typing import Annotated, Optional
from pydantic import BaseModel, Field, StringConstraints
class AuthTokenResponseData(BaseModel):
access_token: str = Field(alias="accessToken")
class RegisterResponseDto(BaseModel):
access_token: str = Field(alias="accessToken")
class LoginResponseDto(BaseModel):
access_token: str = Field(alias="accessToken")
class TelegramBotInfo(BaseModel):
bot_id: int = Field(alias="botId")
class StatusResponseData(BaseModel):
is_login_allowed: bool = Field(alias="isLoginAllowed")
is_register_allowed: bool = Field(alias="isRegisterAllowed")
tg_auth: Optional[TelegramBotInfo] = Field(None, alias="tgAuth")
class GetStatusResponseDto(StatusResponseData):
pass
class LoginRequestDto(BaseModel):
username: str
password: str
class RegisterRequestDto(BaseModel):
username: str
password: Annotated[str, StringConstraints(min_length=24)]
class TelegramCallbackRequestDto(BaseModel):
id: int
first_name: str
last_name: Optional[str] = None
username: Optional[str] = None
photo_url: Optional[str] = None
auth_date: int
hash: str
class TelegramCallbackResponseDto(AuthTokenResponseData):
pass
# Legacy alias for backward compatibility
StatusResponseDto = GetStatusResponseDto
LoginTelegramRequestDto = TelegramCallbackRequestDto