2828from pydantic import BaseModel
2929
3030T = TypeVar ("T" , bound = BaseModel )
31+ R = TypeVar ("R" , bound = BaseModel )
3132
3233
33- class HasListMethod (Protocol [T ]):
34- def list (self , * , fqn : str , limit : Optional [int ] = None , ** kwargs : Any ) -> SyncPager [T ]: ...
34+ class HasListMethod (Protocol [T , R ]):
35+ def list (self , * , fqn : str , limit : Optional [int ] = None , ** kwargs : Any ) -> SyncPager [T , R ]: ...
3536
3637
37- class HasAsyncListMethod (Protocol [T ]):
38- async def list (self , * , fqn : str , limit : Optional [int ] = None , ** kwargs ) -> AsyncPager [T ]: ...
38+ class HasAsyncListMethod (Protocol [T , R ]):
39+ async def list (self , * , fqn : str , limit : Optional [int ] = None , ** kwargs ) -> AsyncPager [T , R ]: ...
3940
4041
41- def _get_by_fqn (client : HasListMethod [T ], * , fqn : str , request_options : Optional [RequestOptions ] = None ) -> T :
42+ def _get_by_fqn (client : HasListMethod [T , R ], * , fqn : str , request_options : Optional [RequestOptions ] = None ) -> T :
4243 result = None
4344 for item in client .list (fqn = fqn , limit = 1 , request_options = request_options ):
4445 result = item
@@ -54,7 +55,7 @@ def _get_by_fqn(client: HasListMethod[T], *, fqn: str, request_options: Optional
5455
5556
5657async def _aget_by_fqn (
57- client : HasAsyncListMethod [T ], * , fqn : str , request_options : Optional [RequestOptions ] = None
58+ client : HasAsyncListMethod [T , R ], * , fqn : str , request_options : Optional [RequestOptions ] = None
5859) -> T :
5960 result = None
6061 pager = await client .list (fqn = fqn , limit = 1 , request_options = request_options )
0 commit comments