Home / Class/ SyncPage Class — anthropic-sdk-python Architecture

SyncPage Class — anthropic-sdk-python Architecture

Architecture documentation for the SyncPage class in pagination.py from the anthropic-sdk-python codebase.

Entity Profile

Dependency Diagram

graph TD
  cf33a7d5_1f45_ca81_e477_e6c36d6a61f9["SyncPage"]
  b906442a_92b7_2131_d6a5_3712533b82f2["pagination.py"]
  cf33a7d5_1f45_ca81_e477_e6c36d6a61f9 -->|defined in| b906442a_92b7_2131_d6a5_3712533b82f2
  eacabd9b_b605_7a36_8c3d_be914d60933d["_get_page_items()"]
  cf33a7d5_1f45_ca81_e477_e6c36d6a61f9 -->|method| eacabd9b_b605_7a36_8c3d_be914d60933d
  e0640efa_552e_25a7_f98b_c83ba5c838d4["has_next_page()"]
  cf33a7d5_1f45_ca81_e477_e6c36d6a61f9 -->|method| e0640efa_552e_25a7_f98b_c83ba5c838d4
  b409fca7_3885_903a_b084_a4d02f904fee["next_page_info()"]
  cf33a7d5_1f45_ca81_e477_e6c36d6a61f9 -->|method| b409fca7_3885_903a_b084_a4d02f904fee

Relationship Graph

Source Code

src/anthropic/pagination.py lines 13–47

class SyncPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]):
    data: List[_T]
    has_more: Optional[bool] = None
    first_id: Optional[str] = None
    last_id: Optional[str] = None

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

    @override
    def has_next_page(self) -> bool:
        has_more = self.has_more
        if has_more is not None and has_more is False:
            return False

        return super().has_next_page()

    @override
    def next_page_info(self) -> Optional[PageInfo]:
        if self._options.params.get("before_id"):
            first_id = self.first_id
            if not first_id:
                return None

            return PageInfo(params={"before_id": first_id})

        last_id = self.last_id
        if not last_id:
            return None

        return PageInfo(params={"after_id": last_id})

Frequently Asked Questions

What is the SyncPage class?
SyncPage is a class in the anthropic-sdk-python codebase, defined in src/anthropic/pagination.py.
Where is SyncPage defined?
SyncPage is defined in src/anthropic/pagination.py at line 13.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free