Remnawave_python-sdk/remnawave/controllers/metadata.py
Artem 0ed1ce92c0
feat: Introduce metadata management for users and nodes
- 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.
2026-03-11 12:35:42 +01:00

50 lines
1.7 KiB
Python

from typing import Annotated
from rapid_api_client import Path
from rapid_api_client.annotations import PydanticBody
from remnawave.models import (
GetNodeMetadataResponseDto,
GetUserMetadataResponseDto,
UpsertNodeMetadataRequestBodyDto,
UpsertNodeMetadataResponseDto,
UpsertUserMetadataRequestBodyDto,
UpsertUserMetadataResponseDto,
)
from remnawave.rapid import BaseController, get, put
class MetadataController(BaseController):
@get("/metadata/user/{uuid}", response_class=GetUserMetadataResponseDto)
async def get_user_metadata(
self,
uuid: Annotated[str, Path(description="User UUID")],
) -> GetUserMetadataResponseDto:
"""Get user metadata"""
...
@put("/metadata/user/{uuid}", response_class=UpsertUserMetadataResponseDto)
async def upsert_user_metadata(
self,
uuid: Annotated[str, Path(description="User UUID")],
body: Annotated[UpsertUserMetadataRequestBodyDto, PydanticBody()],
) -> UpsertUserMetadataResponseDto:
"""Update or create User Metadata"""
...
@get("/metadata/node/{uuid}", response_class=GetNodeMetadataResponseDto)
async def get_node_metadata(
self,
uuid: Annotated[str, Path(description="Node UUID")],
) -> GetNodeMetadataResponseDto:
"""Get node metadata"""
...
@put("/metadata/node/{uuid}", response_class=UpsertNodeMetadataResponseDto)
async def upsert_node_metadata(
self,
uuid: Annotated[str, Path(description="Node UUID")],
body: Annotated[UpsertNodeMetadataRequestBodyDto, PydanticBody()],
) -> UpsertNodeMetadataResponseDto:
"""Update or create Node Metadata"""
...