Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#180)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Mar 28, 2024
1 parent e4136eb commit 0ad46e1
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/cloudflare/pagination.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ def next_page_info(self) -> Optional[PageInfo]:


class SyncSinglePage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
items: List[_T]
result: List[_T]

@override
def _get_page_items(self) -> List[_T]:
items = self.items
if not items:
result = self.result
if not result:
return []
return items
return result

@override
def next_page_info(self) -> None:
Expand All @@ -279,20 +279,20 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM
return cls.construct(
None,
**{
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"result": data}),
},
)


class AsyncSinglePage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]):
items: List[_T]
result: List[_T]

@override
def _get_page_items(self) -> List[_T]:
items = self.items
if not items:
result = self.result
if not result:
return []
return items
return result

@override
def next_page_info(self) -> None:
Expand All @@ -307,6 +307,6 @@ def build(cls: Type[_BaseModelT], *, response: Response, data: object) -> _BaseM
return cls.construct(
None,
**{
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"items": data}),
**(cast(Mapping[str, Any], data) if is_mapping(data) else {"result": data}),
},
)

0 comments on commit 0ad46e1

Please sign in to comment.