style(internal_user_endpoints.py): add response model to /user/list endpoint

make sure we maintain consistent response spec
This commit is contained in:
Krrish Dholakia 2025-04-21 16:36:41 -07:00
parent 4a50cf10fb
commit 57b887478a
3 changed files with 23 additions and 1 deletions

File diff suppressed because one or more lines are too long

View file

@ -43,6 +43,9 @@ from litellm.types.proxy.management_endpoints.common_daily_activity import (
SpendAnalyticsPaginatedResponse,
SpendMetrics,
)
from litellm.types.proxy.management_endpoints.internal_user_endpoints import (
UserListResponse,
)
router = APIRouter()
@ -903,11 +906,13 @@ async def get_user_key_counts(
"/user/get_users",
tags=["Internal User management"],
dependencies=[Depends(user_api_key_auth)],
response_model=UserListResponse,
)
@router.get(
"/user/list",
tags=["Internal User management"],
dependencies=[Depends(user_api_key_auth)],
response_model=UserListResponse,
)
async def get_users(
role: Optional[str] = fastapi.Query(

View file

@ -0,0 +1,18 @@
from typing import Any, Dict, List, Literal, Optional, Union
from fastapi import HTTPException
from pydantic import BaseModel, EmailStr
from litellm.proxy._types import LiteLLM_UserTableWithKeyCount
class UserListResponse(BaseModel):
"""
Response model for the user list endpoint
"""
users: List[LiteLLM_UserTableWithKeyCount]
total: int
page: int
page_size: int
total_pages: int