|
9 | 9 | from ._base_client import BasePage, PageInfo, BaseSyncPage, BaseAsyncPage |
10 | 10 |
|
11 | 11 | __all__ = [ |
| 12 | + "DomainVerificationsPagePagination", |
| 13 | + "SyncDomainVerificationsPage", |
| 14 | + "AsyncDomainVerificationsPage", |
12 | 15 | "EditorsPagePagination", |
13 | 16 | "SyncEditorsPage", |
14 | 17 | "AsyncEditorsPage", |
|
71 | 74 | _T = TypeVar("_T") |
72 | 75 |
|
73 | 76 |
|
| 77 | +class DomainVerificationsPagePagination(BaseModel): |
| 78 | + next_token: Optional[str] = FieldInfo(alias="nextToken", default=None) |
| 79 | + |
| 80 | + |
| 81 | +class SyncDomainVerificationsPage(BaseSyncPage[_T], BasePage[_T], Generic[_T]): |
| 82 | + domain_verifications: List[_T] = FieldInfo(alias="domainVerifications") |
| 83 | + pagination: Optional[DomainVerificationsPagePagination] = None |
| 84 | + |
| 85 | + @override |
| 86 | + def _get_page_items(self) -> List[_T]: |
| 87 | + domain_verifications = self.domain_verifications |
| 88 | + if not domain_verifications: |
| 89 | + return [] |
| 90 | + return domain_verifications |
| 91 | + |
| 92 | + @override |
| 93 | + def next_page_info(self) -> Optional[PageInfo]: |
| 94 | + next_token = None |
| 95 | + if self.pagination is not None: |
| 96 | + if self.pagination.next_token is not None: |
| 97 | + next_token = self.pagination.next_token |
| 98 | + if not next_token: |
| 99 | + return None |
| 100 | + |
| 101 | + return PageInfo(params={"token": next_token}) |
| 102 | + |
| 103 | + |
| 104 | +class AsyncDomainVerificationsPage(BaseAsyncPage[_T], BasePage[_T], Generic[_T]): |
| 105 | + domain_verifications: List[_T] = FieldInfo(alias="domainVerifications") |
| 106 | + pagination: Optional[DomainVerificationsPagePagination] = None |
| 107 | + |
| 108 | + @override |
| 109 | + def _get_page_items(self) -> List[_T]: |
| 110 | + domain_verifications = self.domain_verifications |
| 111 | + if not domain_verifications: |
| 112 | + return [] |
| 113 | + return domain_verifications |
| 114 | + |
| 115 | + @override |
| 116 | + def next_page_info(self) -> Optional[PageInfo]: |
| 117 | + next_token = None |
| 118 | + if self.pagination is not None: |
| 119 | + if self.pagination.next_token is not None: |
| 120 | + next_token = self.pagination.next_token |
| 121 | + if not next_token: |
| 122 | + return None |
| 123 | + |
| 124 | + return PageInfo(params={"token": next_token}) |
| 125 | + |
| 126 | + |
74 | 127 | class EditorsPagePagination(BaseModel): |
75 | 128 | next_token: Optional[str] = FieldInfo(alias="nextToken", default=None) |
76 | 129 |
|
|
0 commit comments