Skip to content
Open
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down
12 changes: 2 additions & 10 deletions seam/pagination.py
Original file line number Diff line number Diff line change
@@ -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]):
Expand Down
13 changes: 13 additions & 0 deletions test/paginator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Loading