|
14 | 14 | RequestPayload, |
15 | 15 | ) |
16 | 16 | from faceit.api.pagination import ( |
| 17 | + AsyncPageIterator, |
17 | 18 | MaxItems, |
18 | 19 | MaxItemsType, |
| 20 | + SyncPageIterator, |
19 | 21 | TimestampPaginationConfig, |
20 | 22 | pages, |
21 | 23 | ) |
@@ -236,9 +238,7 @@ def all_bans( |
236 | 238 | def all_bans( |
237 | 239 | self, player_id: PlayerID, max_items: MaxItemsType = MaxItems.SAFE |
238 | 240 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[BanEntry]]: |
239 | | - iterator = self.__class__._sync_page_iterator( |
240 | | - self.bans, player_id, max_items=max_items |
241 | | - ) |
| 241 | + iterator = SyncPageIterator(self.bans, player_id, max_items=max_items) |
242 | 242 | return iterator.collect() |
243 | 243 |
|
244 | 244 | @typing.overload |
@@ -341,8 +341,8 @@ def all_matches_stats( |
341 | 341 | ItemPage[CS2MatchPlayerStats], |
342 | 342 | ItemPage[AbstractMatchPlayerStats], |
343 | 343 | ]: |
344 | | - return self.__class__._sync_page_iterator.gather_from_iterator( |
345 | | - self.__class__._sync_page_iterator.unix( |
| 344 | + return SyncPageIterator.gather_from_iterator( |
| 345 | + SyncPageIterator.unix( |
346 | 346 | self.matches_stats, |
347 | 347 | player_id, |
348 | 348 | game, |
@@ -419,8 +419,8 @@ def all_history( |
419 | 419 | game: GameID, |
420 | 420 | max_items: MaxItemsType = pages(50), |
421 | 421 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[Match]]: |
422 | | - return self.__class__._sync_page_iterator.gather_from_iterator( |
423 | | - self.__class__._sync_page_iterator.unix( |
| 422 | + return SyncPageIterator.gather_from_iterator( |
| 423 | + SyncPageIterator.unix( |
424 | 424 | self.history, |
425 | 425 | player_id, |
426 | 426 | game, |
@@ -481,9 +481,7 @@ def all_hubs( |
481 | 481 | def all_hubs( |
482 | 482 | self, player_id: PlayerID, max_items: MaxItemsType = MaxItems.SAFE |
483 | 483 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[Hub]]: |
484 | | - iterator = self.__class__._sync_page_iterator( |
485 | | - self.hubs, player_id, max_items=max_items |
486 | | - ) |
| 484 | + iterator = SyncPageIterator(self.hubs, player_id, max_items=max_items) |
487 | 485 | return iterator.collect() |
488 | 486 |
|
489 | 487 | @typing.overload |
@@ -566,9 +564,7 @@ def all_teams( |
566 | 564 | def all_teams( |
567 | 565 | self, player_id: PlayerID, max_items: MaxItemsType = MaxItems.SAFE |
568 | 566 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[GeneralTeam]]: |
569 | | - iterator = self.__class__._sync_page_iterator( |
570 | | - self.teams, player_id, max_items=max_items |
571 | | - ) |
| 567 | + iterator = SyncPageIterator(self.teams, player_id, max_items=max_items) |
572 | 568 | return iterator.collect() |
573 | 569 |
|
574 | 570 | @typing.overload |
@@ -623,9 +619,7 @@ def all_tournaments( |
623 | 619 | def all_tournaments( |
624 | 620 | self, player_id: PlayerID, max_items: MaxItemsType = MaxItems.SAFE |
625 | 621 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[Tournament]]: |
626 | | - iterator = self.__class__._sync_page_iterator( |
627 | | - self.tournaments, player_id, max_items=max_items |
628 | | - ) |
| 622 | + iterator = SyncPageIterator(self.tournaments, player_id, max_items=max_items) |
629 | 623 | return iterator.collect() |
630 | 624 |
|
631 | 625 |
|
@@ -723,9 +717,7 @@ async def all_bans( |
723 | 717 | async def all_bans( |
724 | 718 | self, player_id: PlayerID, max_items: MaxItemsType = MaxItems.SAFE |
725 | 719 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[BanEntry]]: |
726 | | - iterator = self.__class__._async_page_iterator( |
727 | | - self.bans, player_id, max_items=max_items |
728 | | - ) |
| 720 | + iterator = AsyncPageIterator(self.bans, player_id, max_items=max_items) |
729 | 721 | return await iterator.collect() |
730 | 722 |
|
731 | 723 | @typing.overload |
@@ -825,8 +817,8 @@ async def all_matches_stats( |
825 | 817 | ItemPage[AbstractMatchPlayerStats], |
826 | 818 | ItemPage[CS2MatchPlayerStats], |
827 | 819 | ]: |
828 | | - return await self.__class__._async_page_iterator.gather_from_iterator( |
829 | | - self.__class__._async_page_iterator.unix( |
| 820 | + return await AsyncPageIterator.gather_from_iterator( |
| 821 | + AsyncPageIterator.unix( |
830 | 822 | self.matches_stats, |
831 | 823 | player_id, |
832 | 824 | game, |
@@ -903,8 +895,8 @@ async def all_history( |
903 | 895 | game: GameID, |
904 | 896 | max_items: MaxItemsType = pages(50), |
905 | 897 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[Match]]: |
906 | | - return await self.__class__._async_page_iterator.gather_from_iterator( |
907 | | - self.__class__._async_page_iterator.unix( |
| 898 | + return await AsyncPageIterator.gather_from_iterator( |
| 899 | + AsyncPageIterator.unix( |
908 | 900 | self.history, |
909 | 901 | player_id, |
910 | 902 | game, |
@@ -965,9 +957,7 @@ async def all_hubs( |
965 | 957 | async def all_hubs( |
966 | 958 | self, player_id: PlayerID, max_items: MaxItemsType = MaxItems.SAFE |
967 | 959 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[Hub]]: |
968 | | - iterator = self.__class__._async_page_iterator( |
969 | | - self.hubs, player_id, max_items=max_items |
970 | | - ) |
| 960 | + iterator = AsyncPageIterator(self.hubs, player_id, max_items=max_items) |
971 | 961 | return await iterator.collect() |
972 | 962 |
|
973 | 963 | @typing.overload |
@@ -1050,9 +1040,7 @@ async def all_teams( |
1050 | 1040 | async def all_teams( |
1051 | 1041 | self, player_id: PlayerID, max_items: MaxItemsType = MaxItems.SAFE |
1052 | 1042 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[GeneralTeam]]: |
1053 | | - iterator = self.__class__._async_page_iterator( |
1054 | | - self.teams, player_id, max_items=max_items |
1055 | | - ) |
| 1043 | + iterator = AsyncPageIterator(self.teams, player_id, max_items=max_items) |
1056 | 1044 | return await iterator.collect() |
1057 | 1045 |
|
1058 | 1046 | @typing.overload |
@@ -1107,7 +1095,5 @@ async def all_tournaments( |
1107 | 1095 | async def all_tournaments( |
1108 | 1096 | self, player_id: PlayerID, max_items: MaxItemsType = MaxItems.SAFE |
1109 | 1097 | ) -> typing.Union[typing.List[RawAPIItem], ItemPage[Tournament]]: |
1110 | | - iterator = self.__class__._async_page_iterator( |
1111 | | - self.tournaments, player_id, max_items=max_items |
1112 | | - ) |
| 1098 | + iterator = AsyncPageIterator(self.tournaments, player_id, max_items=max_items) |
1113 | 1099 | return await iterator.collect() |
0 commit comments