Skip to content

Commit 4db922b

Browse files
authored
Merge pull request #25 from remnawave/development
Bump to 2.3.0
2 parents 98cbd2b + 6826549 commit 4db922b

21 files changed

+1047
-565
lines changed

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.2.6 | >=2.2.6 |
66+
| 2.3.0 | >=2.3.0 |
67+
| 2.2.6 | ==2.2.6 |
6768
| 2.2.3 | >=2.2.13 |
6869
| 2.1.19 | >=2.1.19, <2.2.0 |
6970
| 2.1.18 | >=2.1.18 |

poetry.lock

Lines changed: 189 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[project]
22
name = "remnawave"
3-
version = "2.2.6"
4-
description = "A Python SDK for interacting with the Remnawave API v2.2.6."
3+
version = "2.3.0"
4+
description = "A Python SDK for interacting with the Remnawave API v2.3.0."
55
authors = [
66
{name = "Artem",email = "[email protected]"}
77
]
@@ -15,6 +15,7 @@ dependencies = [
1515
"pydantic[email]>=2.9.2,<3.0.0",
1616
"pydantic-core>=2.33.1,<2.34.0",
1717
"pydantic>=2.9.2,<3.0.0",
18+
"cryptography (>=46.0.3,<47.0.0)",
1819
]
1920
keywords = ["remnawave", "api", "sdk", "proxy", "httpx", "async", "xray"]
2021
classifiers = [

remnawave/controllers/users.py

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -5,143 +5,169 @@
55

66
from remnawave.models import (
77
CreateUserRequestDto,
8+
CreateUserResponseDto,
89
DeleteUserResponseDto,
9-
EmailUserResponseDto,
10+
GetAllUsersResponseDto,
11+
GetAllTagsResponseDto,
12+
GetUserByIdResponseDto,
13+
GetUserByShortUuidResponseDto,
14+
GetUserByUsernameResponseDto,
15+
GetUserByUuidResponseDto,
1016
GetUserAccessibleNodesResponseDto,
17+
GetUserSubscriptionRequestHistoryResponseDto,
1118
TelegramUserResponseDto,
12-
UpdateUserRequestDto,
13-
UserResponseDto,
14-
UsersResponseDto,
15-
TagsResponseDto,
19+
EmailUserResponseDto,
1620
TagUserResponseDto,
21+
UpdateUserRequestDto,
22+
UpdateUserResponseDto,
1723
RevokeUserRequestDto,
18-
GetSubscriptionRequestsResponseDto
1924
)
2025
from remnawave.rapid import BaseController, delete, get, patch, post
2126

2227

2328
class UsersController(BaseController):
24-
@post("/users", response_class=UserResponseDto)
29+
@post("/users", response_class=CreateUserResponseDto)
2530
async def create_user(
2631
self,
2732
body: Annotated[CreateUserRequestDto, PydanticBody()],
28-
) -> UserResponseDto:
29-
"""Create User"""
33+
) -> CreateUserResponseDto:
34+
"""Create a new user"""
3035
...
3136

32-
@patch("/users", response_class=UserResponseDto)
37+
@patch("/users", response_class=UpdateUserResponseDto)
3338
async def update_user(
3439
self,
3540
body: Annotated[UpdateUserRequestDto, PydanticBody()],
36-
) -> UserResponseDto:
37-
"""Update User"""
41+
) -> UpdateUserResponseDto:
42+
"""Update a user by UUID or username"""
3843
...
3944

40-
@get("/users", response_class=UsersResponseDto)
41-
async def get_all_users_v2(
45+
@get("/users", response_class=GetAllUsersResponseDto)
46+
async def get_all_users(
4247
self,
4348
start: Annotated[
44-
int, Query(default=0, ge=0, description="Index to start pagination from")
45-
],
49+
Optional[int],
50+
Query(default=None, description="Offset for pagination")
51+
] = None,
4652
size: Annotated[
47-
int, Query(default=25, ge=1, description="Number of users per page")
48-
],
49-
) -> UsersResponseDto:
50-
"""
51-
Get users page from the end.
52-
53-
Args:
54-
page (int): Page number from the end (1 = last page).
55-
size (int): Number of users per page.
56-
57-
Returns:
58-
UsersResponseDto
59-
"""
53+
Optional[int],
54+
Query(default=None, description="Page size for pagination")
55+
] = None,
56+
) -> GetAllUsersResponseDto:
57+
"""Get all users"""
6058
...
6159

6260
@delete("/users/{uuid}", response_class=DeleteUserResponseDto)
6361
async def delete_user(
6462
self,
6563
uuid: Annotated[str, Path(description="UUID of the user")],
6664
) -> DeleteUserResponseDto:
67-
"""Delete User"""
65+
"""Delete user"""
6866
...
6967

70-
@post("users/{uuid}/actions/revoke", response_class=UserResponseDto)
68+
@post("/users/{uuid}/actions/revoke", response_class=UpdateUserResponseDto)
7169
async def revoke_user_subscription(
7270
self,
7371
uuid: Annotated[str, Path(description="UUID of the user")],
7472
body: Optional[Annotated[RevokeUserRequestDto, PydanticBody()]] = None,
75-
) -> UserResponseDto:
73+
) -> UpdateUserResponseDto:
7674
"""Revoke User Subscription"""
7775
...
7876

79-
@post("/users/{uuid}/actions/disable", response_class=UserResponseDto)
77+
@post("/users/{uuid}/actions/disable", response_class=UpdateUserResponseDto)
8078
async def disable_user(
8179
self,
8280
uuid: Annotated[str, Path(description="UUID of the user")],
83-
) -> UserResponseDto:
81+
) -> UpdateUserResponseDto:
8482
"""Disable User"""
8583
...
8684

87-
@post("/users/{uuid}/actions/enable", response_class=UserResponseDto)
85+
@post("/users/{uuid}/actions/enable", response_class=UpdateUserResponseDto)
8886
async def enable_user(
8987
self,
9088
uuid: Annotated[str, Path(description="UUID of the user")],
91-
) -> UserResponseDto:
89+
) -> UpdateUserResponseDto:
9290
"""Enable User"""
9391
...
9492

95-
@post("/users/{uuid}/actions/reset-traffic", response_class=UserResponseDto)
93+
@post("/users/{uuid}/actions/reset-traffic", response_class=UpdateUserResponseDto)
9694
async def reset_user_traffic(
9795
self,
9896
uuid: Annotated[str, Path(description="UUID of the user")],
99-
) -> UserResponseDto:
97+
) -> UpdateUserResponseDto:
10098
"""Reset User Traffic"""
10199
...
102100

103-
@get("/users/by-short-uuid/{short_uuid}", response_class=UserResponseDto)
104-
async def get_user_by_short_uuid(
101+
@get("/users/{uuid}", response_class=GetUserByUuidResponseDto)
102+
async def get_user_by_uuid(
105103
self,
106-
short_uuid: Annotated[str, Path(description="Short UUID of the user")],
107-
) -> UserResponseDto:
108-
"""Get User By Short UUID"""
104+
uuid: Annotated[str, Path(description="UUID of the user")],
105+
) -> GetUserByUuidResponseDto:
106+
"""Get user by UUID"""
107+
...
108+
109+
@get("/users/tags", response_class=GetAllTagsResponseDto)
110+
async def get_all_tags(
111+
self,
112+
) -> GetAllTagsResponseDto:
113+
"""Get all existing user tags"""
109114
...
110115

111116
@get(
112-
"/users/by-subscription-uuid/{subscription_uuid}",
113-
response_class=UserResponseDto,
117+
"/users/{uuid}/accessible-nodes",
118+
response_class=GetUserAccessibleNodesResponseDto,
114119
)
115-
async def get_user_by_subscription_uuid(
120+
async def get_user_accessible_nodes(
116121
self,
117-
subscription_uuid: Annotated[str, Path(description="UUID of the subscription")],
118-
) -> UserResponseDto:
119-
"""Get User By Subscription UUID"""
122+
uuid: Annotated[str, Path(description="UUID of the user")],
123+
) -> GetUserAccessibleNodesResponseDto:
124+
"""Get user accessible nodes"""
120125
...
121126

122-
@get("/users/{uuid}", response_class=UserResponseDto)
123-
async def get_user_by_uuid(
127+
@get(
128+
"/users/{uuid}/subscription-request-history",
129+
response_class=GetUserSubscriptionRequestHistoryResponseDto
130+
)
131+
async def get_user_subscription_request_history(
124132
self,
125133
uuid: Annotated[str, Path(description="UUID of the user")],
126-
) -> UserResponseDto:
127-
"""Get User By UUID"""
134+
) -> GetUserSubscriptionRequestHistoryResponseDto:
135+
"""Get user subscription request history, recent 24 records"""
136+
...
137+
138+
# ИСПРАВЛЕНО: убран alias, используется short_uuid
139+
@get("/users/by-short-uuid/{shortUuid}", response_class=GetUserByShortUuidResponseDto)
140+
async def get_user_by_short_uuid(
141+
self,
142+
short_uuid: Annotated[str, Path(description="Short UUID of the user", alias="shortUuid")],
143+
) -> GetUserByShortUuidResponseDto:
144+
"""Get user by Short UUID"""
128145
...
129146

130-
@get("/users/by-username/{username}", response_class=UserResponseDto)
147+
@get("/users/by-username/{username}", response_class=GetUserByUsernameResponseDto)
131148
async def get_user_by_username(
132149
self,
133150
username: Annotated[str, Path(description="Username of the user")],
134-
) -> UserResponseDto:
135-
"""Get User By Username"""
151+
) -> GetUserByUsernameResponseDto:
152+
"""Get user by username"""
153+
...
154+
155+
@get("/users/by-id/{id}", response_class=GetUserByIdResponseDto)
156+
async def get_user_by_id(
157+
self,
158+
id: Annotated[str, Path(description="ID of the user")],
159+
) -> GetUserByIdResponseDto:
160+
"""Get user by ID"""
136161
...
137162

163+
# ИСПРАВЛЕНО: убран alias, используется telegram_id
138164
@get(
139-
"/users/by-telegram-id/{telegram_id}",
165+
"/users/by-telegram-id/{telegramId}",
140166
response_class=TelegramUserResponseDto,
141167
)
142168
async def get_users_by_telegram_id(
143169
self,
144-
telegram_id: Annotated[str, Path(description="Telegram ID of the user")],
170+
telegram_id: Annotated[str, Path(description="Telegram ID of the user", alias="telegramId")],
145171
) -> TelegramUserResponseDto:
146172
"""Get Users By Telegram ID"""
147173
...
@@ -160,30 +186,4 @@ async def get_users_by_tag(
160186
tag: Annotated[str, Path(description="Tag of the user")],
161187
) -> TagUserResponseDto:
162188
"""Get Users By Tag"""
163-
...
164-
165-
@get("/users/tags", response_class=TagsResponseDto)
166-
async def get_all_tags(
167-
self,
168-
) -> TagsResponseDto:
169-
"""Get All Tags"""
170-
...
171-
172-
@get(
173-
"/users/{uuid}/accessible-nodes",
174-
response_class=GetUserAccessibleNodesResponseDto,
175-
)
176-
async def get_user_accessible_nodes(
177-
self,
178-
uuid: Annotated[str, Path(description="UUID of the user")],
179-
) -> GetUserAccessibleNodesResponseDto:
180-
"""Get User Accessible Nodes"""
181-
...
182-
183-
@get("/users/{uuid}/subscription-request-history", response_class=GetSubscriptionRequestsResponseDto)
184-
async def get_subscription_requests(
185-
self,
186-
uuid: Annotated[str, Path(description="UUID of the user")],
187-
) -> GetSubscriptionRequestsResponseDto:
188-
"""Get Subscription Requests History"""
189189
...

0 commit comments

Comments
 (0)