From 4f9e6b6340eee2493a2e870cba0e8add8532adaa Mon Sep 17 00:00:00 2001 From: "stainless-app[bot]" <142633134+stainless-app[bot]@users.noreply.github.com> Date: Fri, 16 Feb 2024 04:17:04 +0000 Subject: [PATCH] feat: update via SDK Studio (#42) --- src/cloudflare/pagination.py | 60 ------------------------------------ 1 file changed, 60 deletions(-) delete mode 100644 src/cloudflare/pagination.py diff --git a/src/cloudflare/pagination.py b/src/cloudflare/pagination.py deleted file mode 100644 index da48da45e1a..00000000000 --- a/src/cloudflare/pagination.py +++ /dev/null @@ -1,60 +0,0 @@ -# File generated from our OpenAPI spec by Stainless. - -from typing import List, Generic, TypeVar, Optional, cast -from typing_extensions import override - -from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage - -__all__ = ["SyncV4PagePagination", "AsyncV4PagePagination"] - -_T = TypeVar("_T") - - -class SyncV4PagePagination(BaseSyncPage[_T], BasePage[_T], Generic[_T]): - result_info: Optional[object] = None - data: List[_T] - - @override - def _get_page_items(self) -> List[_T]: - data = self.data - if not data: - return [] - return data - - @override - def next_page_info(self) -> Optional[PageInfo]: - current_page = cast("int | None", self._options.params.get("page")) - if current_page is None: - current_page = 1 - - last_page = cast("int | None", self._options.params.get("page")) - if last_page is not None and current_page <= last_page: - # The API didn't return a new page in the last request - return None - - return PageInfo(params={"page": current_page + 1}) - - -class AsyncV4PagePagination(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): - result_info: Optional[object] = None - data: List[_T] - - @override - def _get_page_items(self) -> List[_T]: - data = self.data - if not data: - return [] - return data - - @override - def next_page_info(self) -> Optional[PageInfo]: - current_page = cast("int | None", self._options.params.get("page")) - if current_page is None: - current_page = 1 - - last_page = cast("int | None", self._options.params.get("page")) - if last_page is not None and current_page <= last_page: - # The API didn't return a new page in the last request - return None - - return PageInfo(params={"page": current_page + 1})