Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(api): update via SDK Studio #180

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}),
},
)