Skip to content

Commit

Permalink
move PaginatedTeams to types folder
Browse files Browse the repository at this point in the history
  • Loading branch information
kraktus committed Aug 14, 2023
1 parent d2c495a commit 0a3349a
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 20 deletions.
3 changes: 2 additions & 1 deletion berserk/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@


from .clients import Client
from .types import Team, OpeningStatistic
from .types import Team, OpeningStatistic, PaginatedTeams
from .session import TokenSession
from .session import Requestor
from .enums import PerfType
Expand All @@ -32,6 +32,7 @@
"Client",
"TokenSession",
"Team",
"PaginatedTeams",
"OpeningStatistic",
"Requestor",
"PerfType",
Expand Down
19 changes: 1 addition & 18 deletions berserk/clients/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,11 @@
from typing import Iterator, Any, cast, List, Dict

from .. import models
from ..types import Team
from ..types import Team, PaginatedTeams
from ..formats import NDJSON, JSON_LIST
from .base import BaseClient


class PaginatedTeams(TypedDict):
# The current page
currentPage: int
# The maximum number of teams per page
maxPerPage: int
# The teams on the current page
currentPageResults: List[Team]
# The total number of teams
nbResults: int
# The previous page
previousPage: int | None
# The next page
nextPage: int | None
# The total number of pages
nbPages: int


class Teams(BaseClient):
def get_members(self, team_id: str) -> Iterator[Dict[str, Any]]:
"""Get members of a team.
Expand Down
3 changes: 2 additions & 1 deletion berserk/types/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from __future__ import annotations

from .team import Team
from .team import Team, PaginatedTeams
from .opening_explorer import (
OpeningStatistic,
OpeningExplorerVariant,
Expand All @@ -10,6 +10,7 @@

__all__ = [
"Team",
"PaginatedTeams",
"OpeningStatistic",
"OpeningExplorerVariant",
"Speed",
Expand Down
17 changes: 17 additions & 0 deletions berserk/types/team.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,20 @@ class LightUser(TypedDict):
title: NotRequired[Title]
# The patron of the user
patron: NotRequired[bool]


class PaginatedTeams(TypedDict):
# The current page
currentPage: int
# The maximum number of teams per page
maxPerPage: int
# The teams on the current page
currentPageResults: List[Team]
# The total number of teams
nbResults: int
# The previous page
previousPage: int | None
# The next page
nextPage: int | None
# The total number of pages
nbPages: int

0 comments on commit 0a3349a

Please sign in to comment.