from __future__ import annotations
from typing import Any
from ._base import BaseClient, RequestConfig
class UserService:
def __init__(self, client: BaseClient) -> None:
self._client = client
async def get_profile(self) -> dict[str, Any]:
return await self._client.make_request("GET", "/user/profile")
async def update_profile(self, profile_data: dict[str, Any]) -> dict[str, Any]:
config = RequestConfig(json_data=profile_data)
return await self._client.make_request("PUT", "/user/profile", config=config)
async def get_users(
self,
limit: int = 50,
offset: int = 0,
search: str | None = None,
) -> dict[str, Any]:
params: dict[str, Any] = {"limit": limit, "offset": offset}
if search:
params["search"] = search
config = RequestConfig(params=params)
return await self._client.make_request("GET", "/users", config=config)
async def get_user(self, user_id: str) -> dict[str, Any]:
return await self._client.make_request("GET", f"/users/{user_id}")
async def create_user(self, user_data: dict[str, Any]) -> dict[str, Any]:
config = RequestConfig(json_data=user_data)
return await self._client.make_request("POST", "/users", config=config)
async def update_user(
self,
user_id: str,
user_data: dict[str, Any],
) -> dict[str, Any]:
config = RequestConfig(json_data=user_data)
return await self._client.make_request(
"PUT",
f"/users/{user_id}",
config=config,
)
async def delete_user(self, user_id: str) -> dict[str, Any]:
return await self._client.make_request("DELETE", f"/users/{user_id}")
async def deactivate_user(self, user_id: str) -> dict[str, Any]:
return await self._client.make_request("POST", f"/users/{user_id}/deactivate")
async def activate_user(self, user_id: str) -> dict[str, Any]:
return await self._client.make_request("POST", f"/users/{user_id}/activate")