From 6be56abd13fdfd2528d0e953f87430644075c050 Mon Sep 17 00:00:00 2001 From: Riley Shaw <30989490+ShineyDev@users.noreply.github.com> Date: Sat, 25 Jan 2025 17:34:38 +0000 Subject: [PATCH] implement Organization.team_count --- github/organization/organization.py | 36 +++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/github/organization/organization.py b/github/organization/organization.py index 1e0006b2..de1f456a 100644 --- a/github/organization/organization.py +++ b/github/organization/organization.py @@ -162,6 +162,7 @@ def _from_data( "is_viewer_following": "viewerIsFollowing", "is_viewer_member": "viewerIsAMember", "mannequin_count": "mannequins{totalCount}", + "team_count": "teams{totalCount}", "twitter_username": "twitterUsername", "updated_at": "updatedAt", } @@ -324,6 +325,19 @@ def mannequin_count( return self._data["mannequins"]["totalCount"] + @property + def team_count( + self: Self, + /, + ) -> int: + """ + The number of teams in the organization. + + :type: :class:`int` + """ + + return self._data["teams"]["totalCount"] + @property def twitter_username( self: Self, @@ -612,6 +626,28 @@ async def fetch_mannequin_count( return await self._fetch_field("mannequins{totalCount}") # type: ignore + async def fetch_team_count( + self: Self, + /, + ) -> int: + """ + |coro| + + Fetches the number of teams in the organization. + + + Raises + ------ + + ~github.core.errors.ClientObjectMissingFieldError + The :attr:`id` attribute is missing. + + + :rtype: :class:`int` + """ + + return await self._fetch_field("teams{totalCount}") # type: ignore + async def fetch_twitter_username( self: Self, /,