mirror of
https://github.com/RGBCube/GitHubWrapper
synced 2025-05-29 12:15:12 +00:00
45 lines
1.2 KiB
Python
45 lines
1.2 KiB
Python
#== org.py ==#
|
|
|
|
import aiohttp
|
|
|
|
from .objects import APIOBJECT, dt_formatter
|
|
from . import PartialUser
|
|
from .. import http
|
|
|
|
__all__ = (
|
|
'Organization',
|
|
)
|
|
|
|
class Organization(APIOBJECT):
|
|
__slots__ = (
|
|
'login',
|
|
'id',
|
|
'html_url',
|
|
'is_verified',
|
|
'public_repos',
|
|
'public_gists',
|
|
'followers',
|
|
'following',
|
|
'created_at',
|
|
#will add
|
|
)
|
|
|
|
def __init__(self, response: dict, session: aiohttp.ClientSession) -> None:
|
|
super().__init__(response, session)
|
|
tmp = self.__slots__ + APIOBJECT.__slots__
|
|
keys = {key: value for key,value in self._response.items() if key in tmp}
|
|
for key, value in keys.items():
|
|
if key == 'login':
|
|
setattr(self, key, value)
|
|
continue
|
|
if '_at' in key and value is not None:
|
|
setattr(self, key, dt_formatter(value))
|
|
continue
|
|
|
|
else:
|
|
setattr(self, key, value)
|
|
continue
|
|
|
|
def __repr__(self):
|
|
return f'<Organization; login: {self.login}, id: {self.id}, html_url: {self.html_url}, is_verified: {self.is_verified}, public_repos: {self.public_repos}, public_gists: {self.public_gists}, created_at: {self.created_at}>'
|
|
|