mirror of
https://github.com/BerriAI/litellm.git
synced 2025-04-26 03:04:13 +00:00
style(internal_user_endpoints.py): add response model to /user/list
endpoint
make sure we maintain consistent response spec
This commit is contained in:
parent
4a50cf10fb
commit
57b887478a
3 changed files with 23 additions and 1 deletions
File diff suppressed because one or more lines are too long
|
@ -43,6 +43,9 @@ from litellm.types.proxy.management_endpoints.common_daily_activity import (
|
||||||
SpendAnalyticsPaginatedResponse,
|
SpendAnalyticsPaginatedResponse,
|
||||||
SpendMetrics,
|
SpendMetrics,
|
||||||
)
|
)
|
||||||
|
from litellm.types.proxy.management_endpoints.internal_user_endpoints import (
|
||||||
|
UserListResponse,
|
||||||
|
)
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
@ -903,11 +906,13 @@ async def get_user_key_counts(
|
||||||
"/user/get_users",
|
"/user/get_users",
|
||||||
tags=["Internal User management"],
|
tags=["Internal User management"],
|
||||||
dependencies=[Depends(user_api_key_auth)],
|
dependencies=[Depends(user_api_key_auth)],
|
||||||
|
response_model=UserListResponse,
|
||||||
)
|
)
|
||||||
@router.get(
|
@router.get(
|
||||||
"/user/list",
|
"/user/list",
|
||||||
tags=["Internal User management"],
|
tags=["Internal User management"],
|
||||||
dependencies=[Depends(user_api_key_auth)],
|
dependencies=[Depends(user_api_key_auth)],
|
||||||
|
response_model=UserListResponse,
|
||||||
)
|
)
|
||||||
async def get_users(
|
async def get_users(
|
||||||
role: Optional[str] = fastapi.Query(
|
role: Optional[str] = fastapi.Query(
|
||||||
|
|
|
@ -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
|
Loading…
Add table
Add a link
Reference in a new issue