Remnawave_python-sdk/remnawave/controllers/snippets.py
Artem 9e2822774a
feat: Enhance subscription and external squad management
- Updated NodeUsageDto to include node_uuid and changed date to datetime.
- Changed total fields in subscription and subscription request history models from float to int.
- Introduced response rules and conditions for subscription settings, including new models for response modifications.
- Added external squads management with CRUD operations and associated models.
- Implemented passkey management with registration and verification endpoints.
- Enhanced snippets management with full CRUD operations and validation.
- Added OAuth2 provider enum for better authentication handling.
2025-10-28 00:44:15 +01:00

45 lines
No EOL
1.3 KiB
Python

from typing import Annotated
from rapid_api_client.annotations import PydanticBody
from remnawave.models import (
CreateSnippetRequestDto,
CreateSnippetResponseDto,
DeleteSnippetRequestDto,
DeleteSnippetResponseDto,
GetSnippetsResponseDto,
UpdateSnippetRequestDto,
UpdateSnippetResponseDto,
)
from remnawave.rapid import BaseController, delete, get, post, patch
class SnippetsController(BaseController):
@get("/snippets", response_class=GetSnippetsResponseDto)
async def get_snippets(self) -> GetSnippetsResponseDto:
"""Get snippets"""
...
@post("/snippets", response_class=CreateSnippetResponseDto)
async def create_snippet(
self,
body: Annotated[CreateSnippetRequestDto, PydanticBody()],
) -> CreateSnippetResponseDto:
"""Create snippet"""
...
@patch("/snippets", response_class=UpdateSnippetResponseDto)
async def update_snippet(
self,
body: Annotated[UpdateSnippetRequestDto, PydanticBody()],
) -> UpdateSnippetResponseDto:
"""Update snippet"""
...
@delete("/snippets", response_class=DeleteSnippetResponseDto)
async def delete_snippet_by_name(
self,
body: Annotated[DeleteSnippetRequestDto, PydanticBody()],
) -> DeleteSnippetResponseDto:
"""Delete snippet"""
...