mirror of
https://github.com/remnawave/python-sdk.git
synced 2026-05-13 12:16:42 +00:00
- Added MetadataController for handling user and node metadata. - Implemented models for user and node metadata management. - Created tests for user and node metadata functionalities. - Enhanced authentication settings with passkey and OAuth2 configurations. - Added bulk actions for node updates and responses. - Refactored existing models to accommodate new features and improve structure. - Removed obsolete test_imports.py file. - Updated environment variables for testing. - Improved error handling in subscription tests. - Added new node plugin functionalities including cloning and execution commands.
82 lines
No EOL
3.3 KiB
Python
82 lines
No EOL
3.3 KiB
Python
from typing import Annotated
|
|
|
|
from rapid_api_client import Path, Query
|
|
from rapid_api_client.annotations import PydanticBody
|
|
|
|
from remnawave.models.subscription import GetRawSubscriptionByShortUuidResponseDto
|
|
from remnawave.rapid import BaseController, get
|
|
from remnawave.models import (
|
|
GetAllSubscriptionsResponseDto,
|
|
GetSubscriptionByUsernameResponseDto,
|
|
GetSubscriptionByShortUUIDResponseDto,
|
|
GetSubscriptionByUUIDResponseDto,
|
|
GetSubpageConfigByShortUuidRequestBodyDto,
|
|
GetSubpageConfigByShortUuidResponseDto,
|
|
GetConnectionKeysByUuidResponseDto,
|
|
)
|
|
|
|
|
|
class SubscriptionsController(BaseController):
|
|
# Protected endpoints below
|
|
@get("/subscriptions", response_class=GetAllSubscriptionsResponseDto)
|
|
async def get_all_subscriptions(
|
|
self,
|
|
start: Annotated[
|
|
int, Query(default=0, ge=0, description="Index to start pagination from")
|
|
],
|
|
size: Annotated[
|
|
int, Query(default=25, ge=1, description="Number of users per page")
|
|
],
|
|
) -> GetAllSubscriptionsResponseDto:
|
|
"""None"""
|
|
...
|
|
|
|
@get("/subscriptions/by-username/{username}", response_class=GetSubscriptionByUsernameResponseDto)
|
|
async def get_subscription_by_username(
|
|
self,
|
|
username: Annotated[str, Path(description="Username of the user")],
|
|
) -> GetSubscriptionByUsernameResponseDto:
|
|
"""None"""
|
|
...
|
|
|
|
@get("/subscriptions/by-short-uuid/{shortUuid}", response_class=GetSubscriptionByShortUUIDResponseDto)
|
|
async def get_subscription_by_short_uuid(
|
|
self,
|
|
short_uuid: Annotated[str, Path(description="Short UUID of the subscription", alias="shortUuid")],
|
|
) -> GetSubscriptionByShortUUIDResponseDto:
|
|
"""None"""
|
|
...
|
|
|
|
@get("/subscriptions/by-uuid/{uuid}", response_class=GetSubscriptionByUUIDResponseDto)
|
|
async def get_subscription_by_uuid(
|
|
self,
|
|
uuid: Annotated[str, Path(description="UUID of the user")],
|
|
) -> GetSubscriptionByUUIDResponseDto:
|
|
"""None"""
|
|
...
|
|
|
|
@get("/subscriptions/subpage-config/{shortUuid}", response_class=GetSubpageConfigByShortUuidResponseDto)
|
|
async def get_subpage_config(
|
|
self,
|
|
short_uuid: Annotated[str, Path(description="Short UUID of the subscription", alias="shortUuid")],
|
|
body: Annotated[GetSubpageConfigByShortUuidRequestBodyDto, PydanticBody()],
|
|
) -> GetSubpageConfigByShortUuidResponseDto:
|
|
"""Get subscription page config by short UUID"""
|
|
...
|
|
|
|
@get("/subscriptions/by-short-uuid/{shortUuid}/raw", response_class=GetRawSubscriptionByShortUuidResponseDto)
|
|
async def get_raw_subscription(
|
|
self,
|
|
short_uuid: Annotated[str, Path(description="Short UUID of the user", alias="shortUuid")],
|
|
with_disabled_hosts: Annotated[bool, Query(default=False, alias="withDisabledHosts", description="Include disabled hosts")] = False,
|
|
) -> GetRawSubscriptionByShortUuidResponseDto:
|
|
"""None"""
|
|
...
|
|
|
|
@get("/subscriptions/connection-keys/{uuid}", response_class=GetConnectionKeysByUuidResponseDto)
|
|
async def get_connection_keys_by_uuid(
|
|
self,
|
|
uuid: Annotated[str, Path(description="UUID of the user")],
|
|
) -> GetConnectionKeysByUuidResponseDto:
|
|
"""Get connection keys (base64 format) by uuid"""
|
|
... |