Skip to content

Commit 658f725

Browse files
authored
Merge pull request #3 from remnawave:development
Update SDK to version 2.1.7 and add subscription controller
2 parents a863369 + 5f04c2e commit 658f725

File tree

8 files changed

+65
-4
lines changed

8 files changed

+65
-4
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,5 @@ docs/
179179
openapi/
180180
.DS_Store
181181
requirements.txt
182-
requirements.in
182+
requirements.in
183+
test_raw.py

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,8 @@ pip install git+https://github.com/remnawave/python-sdk.git@development
6363

6464
| Contract Version | Remnawave Panel Version |
6565
| ---------------- | ----------------------- |
66-
| 2.1.4 | >=2.1.4 |
66+
| 2.1.7 | >=2.1.7 |
67+
| 2.1.4 | >=2.1.4, <2.1.7 |
6768
| 2.1.1 | >=2.1.1, <2.1.4 |
6869
| 2.0.0 | >=2.0.0,<2.1.0 |
6970
| 1.1.3 | >=1.6.12,<2.0.0 |

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "remnawave"
3-
version = "2.1.4"
4-
description = "A Python SDK for interacting with the Remnawave API v2.1.4."
3+
version = "2.1.7"
4+
description = "A Python SDK for interacting with the Remnawave API v2.1.7."
55
authors = [
66
{name = "Artem",email = "[email protected]"}
77
]

remnawave/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
NodesUsageHistoryController,
2121
NodesUserUsageHistoryController,
2222
SubscriptionController,
23+
SubscriptionsController,
2324
SubscriptionsSettingsController,
2425
SubscriptionsTemplateController,
2526
SystemController,
@@ -81,6 +82,7 @@ def __init__(
8182
self.nodes_usage_history = NodesUsageHistoryController(self._client)
8283
self.nodes_user_usage_history = NodesUserUsageHistoryController(self._client)
8384
self.subscription = SubscriptionController(self._client)
85+
self.subscriptions = SubscriptionsController(self._client)
8486
self.subscriptions_settings = SubscriptionsSettingsController(self._client)
8587
self.subscriptions_template = SubscriptionsTemplateController(self._client)
8688
self.system = SystemController(self._client)

remnawave/controllers/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
from .nodes import NodesController
1414
from .nodes_usage_history import NodesUsageHistoryController, NodesUserUsageHistoryController
1515
from .subscription import SubscriptionController
16+
from .subscriptions_controller import SubscriptionsController
1617
from .subscriptions_settings import SubscriptionsSettingsController
1718
from .subscriptions_template import SubscriptionsTemplateController
1819
from .system import SystemController
@@ -39,6 +40,7 @@
3940
"NodesUsageHistoryController",
4041
"NodesUserUsageHistoryController",
4142
"SubscriptionController",
43+
"SubscriptionsController",
4244
"SubscriptionsSettingsController",
4345
"SubscriptionsTemplateController",
4446
"SystemController",
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
from typing import Annotated
2+
3+
from rapid_api_client import Path, Query
4+
5+
from remnawave.enums import ClientType
6+
from remnawave.rapid import BaseController, get
7+
from remnawave.models import GetAllSubscriptionsResponseDto, GetSubscriptionByUsernameResponseDto, GetSubscriptionByShortUUIDResponseDto, GetSubscriptionByUUIDResponseDto
8+
9+
10+
class SubscriptionsController(BaseController):
11+
@get("/subscriptions", response_class=GetAllSubscriptionsResponseDto)
12+
async def get_all_subscriptions(
13+
self,
14+
start: Annotated[
15+
int, Query(default=0, ge=0, description="Index to start pagination from")
16+
],
17+
size: Annotated[
18+
int, Query(default=25, ge=1, description="Number of users per page")
19+
],
20+
) -> GetAllSubscriptionsResponseDto:
21+
"""None"""
22+
...
23+
24+
@get("/subscriptions/by-username/{username}", response_class=GetSubscriptionByUsernameResponseDto)
25+
async def get_subscription_by_username(
26+
self,
27+
username: Annotated[str, Path(description="Username of the user")],
28+
) -> GetSubscriptionByUsernameResponseDto:
29+
"""None"""
30+
...
31+
32+
@get("/subscriptions/by-short-uuid/{short_uuid}", response_class=GetSubscriptionByShortUUIDResponseDto)
33+
async def get_subscription_by_short_uuid(
34+
self,
35+
short_uuid: Annotated[str, Path(description="Short UUID of the subscription")],
36+
) -> GetSubscriptionByShortUUIDResponseDto:
37+
"""None"""
38+
...
39+
40+
@get("/subscriptions/by-uuid/{uuid}", response_class=GetSubscriptionByUUIDResponseDto)
41+
async def get_subscription_by_uuid(
42+
self,
43+
uuid: Annotated[str, Path(description="UUID of the user")],
44+
) -> GetSubscriptionByUUIDResponseDto:
45+
"""None"""
46+
...

remnawave/models/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@
168168
SubscriptionInfoResponseDto, # Legacy alias
169169
UserSubscription,
170170
GetRawSubscriptionByShortUuidResponseDto,
171+
GetSubscriptionByShortUUIDResponseDto,
172+
GetSubscriptionByUUIDResponseDto,
171173
)
172174
from .subscriptions_settings import (
173175
GetSubscriptionSettingsResponseDto,
@@ -293,6 +295,8 @@
293295
# Subscription models
294296
"GetAllSubscriptionsResponseDto",
295297
"GetSubscriptionByUsernameResponseDto",
298+
"GetSubscriptionByShortUUIDResponseDto",
299+
"GetSubscriptionByUUIDResponseDto",
296300
"GetSubscriptionInfoResponseDto",
297301
"SubscriptionInfoResponseDto", # Legacy alias
298302
"UserSubscription",

remnawave/models/subscription.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,11 @@ class GetSubscriptionByUsernameResponseDto(BaseModel):
127127
ss_conf_links: Dict[str, str] = Field(alias="ssConfLinks")
128128
subscription_url: str = Field(alias="subscriptionUrl")
129129

130+
class GetSubscriptionByShortUUIDResponseDto(GetSubscriptionByUsernameResponseDto):
131+
pass
132+
133+
class GetSubscriptionByUUIDResponseDto(GetSubscriptionByUsernameResponseDto):
134+
pass
130135

131136
# Legacy alias for backward compatibility
132137
SubscriptionInfoResponseDto = GetSubscriptionInfoResponseDto

0 commit comments

Comments
 (0)