mirror of
https://github.com/remnawave/python-sdk.git
synced 2026-05-13 12:16:42 +00:00
feat: обновить версию SDK до 2.1.7, добавить контроллер подписок и новые модели для работы с подписками
This commit is contained in:
parent
f9d9af7f27
commit
5f04c2eca9
8 changed files with 65 additions and 4 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
|
@ -179,4 +179,5 @@ docs/
|
|||
openapi/
|
||||
.DS_Store
|
||||
requirements.txt
|
||||
requirements.in
|
||||
requirements.in
|
||||
test_raw.py
|
||||
|
|
|
|||
|
|
@ -63,7 +63,8 @@ pip install git+https://github.com/remnawave/python-sdk.git@development
|
|||
|
||||
| Contract Version | Remnawave Panel Version |
|
||||
| ---------------- | ----------------------- |
|
||||
| 2.1.4 | >=2.1.4 |
|
||||
| 2.1.7 | >=2.1.7 |
|
||||
| 2.1.4 | >=2.1.4, <2.1.7 |
|
||||
| 2.1.1 | >=2.1.1, <2.1.4 |
|
||||
| 2.0.0 | >=2.0.0,<2.1.0 |
|
||||
| 1.1.3 | >=1.6.12,<2.0.0 |
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
[project]
|
||||
name = "remnawave"
|
||||
version = "2.1.4"
|
||||
description = "A Python SDK for interacting with the Remnawave API v2.1.4."
|
||||
version = "2.1.7"
|
||||
description = "A Python SDK for interacting with the Remnawave API v2.1.7."
|
||||
authors = [
|
||||
{name = "Artem",email = "dev@forestsnet.com"}
|
||||
]
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ from remnawave.controllers import (
|
|||
NodesUsageHistoryController,
|
||||
NodesUserUsageHistoryController,
|
||||
SubscriptionController,
|
||||
SubscriptionsController,
|
||||
SubscriptionsSettingsController,
|
||||
SubscriptionsTemplateController,
|
||||
SystemController,
|
||||
|
|
@ -81,6 +82,7 @@ class RemnawaveSDK:
|
|||
self.nodes_usage_history = NodesUsageHistoryController(self._client)
|
||||
self.nodes_user_usage_history = NodesUserUsageHistoryController(self._client)
|
||||
self.subscription = SubscriptionController(self._client)
|
||||
self.subscriptions = SubscriptionsController(self._client)
|
||||
self.subscriptions_settings = SubscriptionsSettingsController(self._client)
|
||||
self.subscriptions_template = SubscriptionsTemplateController(self._client)
|
||||
self.system = SystemController(self._client)
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ from .keygen import KeygenController
|
|||
from .nodes import NodesController
|
||||
from .nodes_usage_history import NodesUsageHistoryController, NodesUserUsageHistoryController
|
||||
from .subscription import SubscriptionController
|
||||
from .subscriptions_controller import SubscriptionsController
|
||||
from .subscriptions_settings import SubscriptionsSettingsController
|
||||
from .subscriptions_template import SubscriptionsTemplateController
|
||||
from .system import SystemController
|
||||
|
|
@ -39,6 +40,7 @@ __all__ = [
|
|||
"NodesUsageHistoryController",
|
||||
"NodesUserUsageHistoryController",
|
||||
"SubscriptionController",
|
||||
"SubscriptionsController",
|
||||
"SubscriptionsSettingsController",
|
||||
"SubscriptionsTemplateController",
|
||||
"SystemController",
|
||||
|
|
|
|||
46
remnawave/controllers/subscriptions_controller.py
Normal file
46
remnawave/controllers/subscriptions_controller.py
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
from typing import Annotated
|
||||
|
||||
from rapid_api_client import Path, Query
|
||||
|
||||
from remnawave.enums import ClientType
|
||||
from remnawave.rapid import BaseController, get
|
||||
from remnawave.models import GetAllSubscriptionsResponseDto, GetSubscriptionByUsernameResponseDto, GetSubscriptionByShortUUIDResponseDto, GetSubscriptionByUUIDResponseDto
|
||||
|
||||
|
||||
class SubscriptionsController(BaseController):
|
||||
@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/{short_uuid}", response_class=GetSubscriptionByShortUUIDResponseDto)
|
||||
async def get_subscription_by_short_uuid(
|
||||
self,
|
||||
short_uuid: Annotated[str, Path(description="Short UUID of the subscription")],
|
||||
) -> 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"""
|
||||
...
|
||||
|
|
@ -168,6 +168,8 @@ from .subscription import (
|
|||
SubscriptionInfoResponseDto, # Legacy alias
|
||||
UserSubscription,
|
||||
GetRawSubscriptionByShortUuidResponseDto,
|
||||
GetSubscriptionByShortUUIDResponseDto,
|
||||
GetSubscriptionByUUIDResponseDto,
|
||||
)
|
||||
from .subscriptions_settings import (
|
||||
GetSubscriptionSettingsResponseDto,
|
||||
|
|
@ -293,6 +295,8 @@ __all__ = [
|
|||
# Subscription models
|
||||
"GetAllSubscriptionsResponseDto",
|
||||
"GetSubscriptionByUsernameResponseDto",
|
||||
"GetSubscriptionByShortUUIDResponseDto",
|
||||
"GetSubscriptionByUUIDResponseDto",
|
||||
"GetSubscriptionInfoResponseDto",
|
||||
"SubscriptionInfoResponseDto", # Legacy alias
|
||||
"UserSubscription",
|
||||
|
|
|
|||
|
|
@ -127,6 +127,11 @@ class GetSubscriptionByUsernameResponseDto(BaseModel):
|
|||
ss_conf_links: Dict[str, str] = Field(alias="ssConfLinks")
|
||||
subscription_url: str = Field(alias="subscriptionUrl")
|
||||
|
||||
class GetSubscriptionByShortUUIDResponseDto(GetSubscriptionByUsernameResponseDto):
|
||||
pass
|
||||
|
||||
class GetSubscriptionByUUIDResponseDto(GetSubscriptionByUsernameResponseDto):
|
||||
pass
|
||||
|
||||
# Legacy alias for backward compatibility
|
||||
SubscriptionInfoResponseDto = GetSubscriptionInfoResponseDto
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue