Remnawave_python-sdk/remnawave_api/controllers/subscription.py
Artem f47cda9378
feat: Add models for subscriptions, users, and system statistics
- Implemented TemplateResponseDto and UpdateTemplateRequestDto for subscription templates.
- Created models for system statistics including CPU, memory, and bandwidth.
- Developed user models for user creation, updates, and responses.
- Added bulk actions for user updates and statistics tracking.
- Introduced tests for authentication, bandwidth statistics, hosts, inbounds, key generation, nodes, subscriptions, and user management.
- Enhanced utility functions for generating random strings, emails, and date ranges for testing.
2025-04-21 20:44:27 +02:00

54 lines
1.8 KiB
Python

from typing import Annotated
from rapid_api_client import Path
from remnawave_api.enums import ClientType
from remnawave_api.models import SubscriptionInfoResponseDto
from remnawave_api.rapid import BaseController, get
class SubscriptionController(BaseController):
@get("/sub/{short_uuid}/info", response_class=SubscriptionInfoResponseDto)
async def get_subscription_info_by_short_uuid(
self,
short_uuid: Annotated[str, Path(description="Short UUID of the user")],
) -> SubscriptionInfoResponseDto:
"""None"""
...
@get("/sub/{short_uuid}", response_class=str)
async def get_subscription(
self,
short_uuid: Annotated[str, Path(description="Short UUID of the user")],
) -> str:
"""None"""
...
@get("/sub/{short_uuid}/{client_type}", response_class=str)
async def get_subscription_by_client_type(
self,
client_type: Annotated[ClientType, Path(description="Client type")],
short_uuid: Annotated[str, Path(description="Short UUID of the user")],
) -> str:
"""None"""
...
@get("/sub/outline/{short_uuid}/{type}/{encoded_tag}", response_class=str)
async def get_subscription_with_type(
self,
short_uuid: Annotated[str, Path(description="Short UUID of the user")],
type: Annotated[
str,
Path(
description="Subscription type (required if encodedTag is provided). Only SS is supported for now."
),
] = "ss",
encoded_tag: Annotated[
str,
Path(
description="Base64 encoded tag for Outline config. This paramter is optional. It is required only when type=ss."
),
] = "VGVzdGVy",
) -> str:
"""None"""
...