11# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22
3- from typing import List , Generic , TypeVar , Optional , cast
3+ from typing import Any , List , Type , Generic , Mapping , TypeVar , Optional , cast
44from typing_extensions import override
55
6+ from httpx import Response
7+
8+ from ._utils import is_mapping
69from ._models import BaseModel , GenericModel
710from ._base_client import BasePage , PageInfo , BaseSyncPage , BaseAsyncPage
811
2427 "AsyncSinglePage" ,
2528]
2629
30+ _BaseModelT = TypeVar ("_BaseModelT" , bound = BaseModel )
31+
2732_T = TypeVar ("_T" )
2833
2934
@@ -269,6 +274,15 @@ def next_page_info(self) -> None:
269274 """
270275 return None
271276
277+ @classmethod
278+ def build (cls : Type [_BaseModelT ], * , response : Response , data : object ) -> _BaseModelT : # noqa: ARG003
279+ return cls .construct (
280+ None ,
281+ ** {
282+ ** (cast (Mapping [str , Any ], data ) if is_mapping (data ) else {"items" : data }),
283+ },
284+ )
285+
272286
273287class AsyncSinglePage (BaseAsyncPage [_T ], BasePage [_T ], Generic [_T ]):
274288 items : List [_T ]
@@ -287,3 +301,12 @@ def next_page_info(self) -> None:
287301 so there will never be a next page.
288302 """
289303 return None
304+
305+ @classmethod
306+ def build (cls : Type [_BaseModelT ], * , response : Response , data : object ) -> _BaseModelT : # noqa: ARG003
307+ return cls .construct (
308+ None ,
309+ ** {
310+ ** (cast (Mapping [str , Any ], data ) if is_mapping (data ) else {"items" : data }),
311+ },
312+ )
0 commit comments