Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove users.register in favor of users.create #1770

Merged
merged 3 commits into from
Jan 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 0 additions & 17 deletions js/sdk/src/v3/clients/users.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,23 +54,6 @@ export class UsersClient {
});
}

/**
* Register a new user.
* @param email User's email address
* @param password User's password
* @returns WrappedUserResponse
* @deprecated Use `client.users.create` instead.
*/
@feature("users.register")
async register(options: {
email: string;
password: string;
}): Promise<WrappedUserResponse> {
return this.client.makeRequest("POST", "users/register", {
data: options,
});
}

/**
* Send a verification email to a user.
* @param email User's email address
Expand Down
2 changes: 1 addition & 1 deletion llms.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3133,7 +3133,7 @@ from r2r import R2RClient
client = R2RClient("http://localhost:7272") # Replace with your R2R deployment URL

# Register a new user
user_result = client.users.register("[email protected]", "password123")
user_result = client.users.create("[email protected]", "password123")
print(user_result)
# {'results': {'email': '[email protected]', 'id': 'bf417057-f104-4e75-8579-c74d26fcbed3', ...}}

Expand Down
22 changes: 0 additions & 22 deletions py/sdk/v3/users.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from __future__ import annotations # for Python 3.10+

from typing import Any, Optional
from uuid import UUID

Expand Down Expand Up @@ -59,26 +57,6 @@ async def create(
version="v3",
)

# @deprecated("Use client.users.create() instead")
async def register(self, email: str, password: str) -> WrappedUserResponse:
"""
Register a new user.

Args:
email (str): User's email address
password (str): User's password

Returns:
UserResponse: New user information
"""
data: dict[str, Any] = {"email": email, "password": password}
return await self.client._make_request(
"POST",
"users/register",
json=data,
version="v3",
)

async def send_verification_email(
self, email: str
) -> WrappedGenericMessageResponse:
Expand Down
2 changes: 1 addition & 1 deletion py/tests/integration/test_chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def search_chunks(self, query: str, limit: int = 5) -> list[dict]:
return response["results"]

async def register_user(self, email: str, password: str) -> None:
await self.client.users.register(email, password)
await self.client.users.create(email, password)

async def login_user(self, email: str, password: str) -> None:
await self.client.users.login(email, password)
Expand Down
8 changes: 4 additions & 4 deletions py/tests/integration/test_documents.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ def test_search_documents(client, test_document):

def test_list_document_chunks(mutable_client, cleanup_documents):
temp_user = f"{uuid.uuid4()}@me.com"
mutable_client.users.register(temp_user, "password")
mutable_client.users.create(temp_user, "password")
mutable_client.users.login(temp_user, "password")

resp = mutable_client.documents.create(
Expand Down Expand Up @@ -251,7 +251,7 @@ def test_get_document_collections_non_superuser(client):
# Create a non-superuser client
non_super_client = R2RClient(client.base_url)
random_string = str(uuid.uuid4())
non_super_client.users.register(f"{random_string}@me.com", "password")
non_super_client.users.create(f"{random_string}@me.com", "password")
non_super_client.users.login(f"{random_string}@me.com", "password")

document_id = str(uuid.uuid4()) # Some doc ID
Expand All @@ -273,7 +273,7 @@ def test_access_document_not_owned(client, cleanup_documents):
# Now try to access with a non-superuser
non_super_client = R2RClient(client.base_url)
random_string = str(uuid.uuid4())
non_super_client.users.register(f"{random_string}@me.com", "password")
non_super_client.users.create(f"{random_string}@me.com", "password")
non_super_client.users.login(f"{random_string}@me.com", "password")

with pytest.raises(R2RException) as exc_info:
Expand All @@ -285,7 +285,7 @@ def test_access_document_not_owned(client, cleanup_documents):

def test_list_documents_with_pagination(mutable_client, cleanup_documents):
temp_user = f"{uuid.uuid4()}@me.com"
mutable_client.users.register(temp_user, "password")
mutable_client.users.create(temp_user, "password")
mutable_client.users.login(temp_user, "password")

for i in range(3):
Expand Down
2 changes: 1 addition & 1 deletion py/tests/integration/test_users.py
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,7 @@ def test_multiple_api_keys(client):
def test_update_user_limits_overrides(client: R2RClient):
# 1) Create user
user_email = f"test_{uuid.uuid4()}@example.com"
client.users.register(user_email, "SomePassword123!")
client.users.create(user_email, "SomePassword123!")
client.users.login(user_email, "SomePassword123!")

# 2) Confirm the default overrides is None
Expand Down
2 changes: 1 addition & 1 deletion py/tests/scaling/loadTester.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def register_login_ingest_user(self, user_email: str, password: str):
"""Register and login a single user with robust error handling."""
# Register user
reg_result = await self.safe_call(
self.client.users.register(user_email, password),
self.client.users.create(user_email, password),
timeout=REGISTER_TIMEOUT,
operation_desc=f"register user {user_email}",
)
Expand Down
2 changes: 1 addition & 1 deletion py/tests/unit/test_chunks.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def search_chunks(self, query: str, limit: int = 5) -> list[dict]:
return response["results"]

async def register_user(self, email: str, password: str) -> None:
await self.client.users.register(email, password)
await self.client.users.create(email, password)

async def login_user(self, email: str, password: str) -> None:
await self.client.users.login(email, password)
Expand Down
Loading