diff --git a/pyproject.toml b/pyproject.toml index 7dd543a..d79fd73 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,8 +39,8 @@ required-version = ">=0.12.0,<0.13.0" [tool.uv.build-backend] module-root = "" -source-exclude = ["**/*_test.py"] -wheel-exclude = ["**/*_test.py"] +source-exclude = ["**/*_test.py", "**/__pycache__"] +wheel-exclude = ["**/*_test.py", "**/__pycache__"] [tool.black] target-version = ["py311"] diff --git a/seam/pagination.py b/seam/pagination.py index a6cd346..ee1ca9e 100644 --- a/seam/pagination.py +++ b/seam/pagination.py @@ -1,16 +1,8 @@ from typing import Any, Dict, List, Optional +from .resources.pagination import Pagination -class Pagination: - def __init__( - self, - has_next_page: bool, - next_page_cursor: str | None, - next_page_url: str | None, - ): - self.has_next_page = has_next_page - self.next_page_cursor = next_page_cursor - self.next_page_url = next_page_url +__all__ = ["PaginatedList", "Pagination"] class PaginatedList(List[Any]): diff --git a/test/paginator_test.py b/test/paginator_test.py index 65af163..da8a444 100644 --- a/test/paginator_test.py +++ b/test/paginator_test.py @@ -82,3 +82,16 @@ def test_paginator_flatten(seam: Seam): assert len(collected_accounts) > 1 assert len(collected_accounts) == len(all_connected_accounts) + + +def test_paginator_returns_the_generated_pagination_resource(seam: Seam): + from seam.pagination import Pagination + from seam.resources import Pagination as ResourcePagination + + assert Pagination is ResourcePagination + + paginator = seam.create_paginator(seam.connected_accounts.list, {"limit": 2}) + _, pagination = paginator.first_page() + + assert isinstance(pagination, ResourcePagination) + assert pagination.has_next_page is True