Bases: Interactive
User profile data wrapper & validator.
Thanks to BaseModel inheritance, JSON data acquired from github api
endpoint can be automatically dispatched and validated.
Source code in async_py_octocat/_rest/models/_user.py
| class User(Interactive):
"""User profile data wrapper & validator.
Thanks to BaseModel inheritance, JSON data acquired from github api
endpoint can be automatically dispatched and validated.
"""
# public profile information:
login: str
id: int # noqa: A003
node_id: str
avatar_url: str
gravatar_id: str
url: HttpUrl
html_url: HttpUrl
followers_url: HttpUrl
following_url: HttpUrl
gists_url: HttpUrl
starred_url: HttpUrl
subscriptions_url: HttpUrl
organizations_url: HttpUrl
repos_url: HttpUrl
events_url: HttpUrl
received_events_url: HttpUrl
type: str # noqa: A003
site_admin: bool
# fields not available in repository description
name: str = Field(default=None)
company: str = Field(default=None)
blog: str = Field(default=None)
location: str = Field(default=None)
email: str = Field(default=None)
hireable: str = Field(default=None)
bio: str = Field(default=None)
twitter_username: str = Field(default=None)
public_repos: int = Field(default=None)
public_gists: int = Field(default=None)
followers: int = Field(default=None)
following: int = Field(default=None)
created_at: datetime = Field(default=None)
updated_at: datetime = Field(default=None)
# private profile information:
private_gists: Optional[int]
total_private_repos: Optional[int]
owned_private_repos: Optional[int]
disk_usage: Optional[int]
collaborators: Optional[int]
two_factor_authentication: Optional[bool]
plan: Optional[Plan]
async def repo(
self, name_or_url: Union[str, HttpUrl]
) -> _repository.Repository:
"""Request repository details for this user.
Alias: repository()
Parameters
----------
name_or_url : Union[str, HttpUrl]
Repository name or full github link to repository,
Returns
-------
Repository
Repository wrapper object allowing for further interaction
wit Github API.
"""
return await self._fetch_repository(name_or_url)
async def repository(
self, name_or_url: Union[str, HttpUrl]
) -> _repository.Repository:
"""Request repository details for this user.
Alias: repo()
Parameters
----------
name_or_url : Union[str, HttpUrl]
Repository name or full github link to repository,
Returns
-------
Repository
Repository wrapper object allowing for further interaction
wit Github API.
"""
return await self._fetch_repository(name_or_url)
async def _fetch_repository(
self, name_or_url: Union[str, HttpUrl]
) -> _repository.Repository:
# decide whether url string or just name was given
str_guarantee = str(name_or_url)
if is_url(str_guarantee):
repo_name = parse_repo_from(str_guarantee).repo
else:
repo_name = str_guarantee
repo = await self.get_gh_session().get_repo(self.login, repo_name)
return repo
|
repo(name_or_url)
async
Request repository details for this user.
Alias: repository()
Parameters:
Name |
Type |
Description |
Default |
name_or_url |
Union[str, HttpUrl]
|
Repository name or full github link to repository, |
required
|
Returns:
Type |
Description |
Repository
|
Repository wrapper object allowing for further interaction
wit Github API. |
Source code in async_py_octocat/_rest/models/_user.py
| async def repo(
self, name_or_url: Union[str, HttpUrl]
) -> _repository.Repository:
"""Request repository details for this user.
Alias: repository()
Parameters
----------
name_or_url : Union[str, HttpUrl]
Repository name or full github link to repository,
Returns
-------
Repository
Repository wrapper object allowing for further interaction
wit Github API.
"""
return await self._fetch_repository(name_or_url)
|
repository(name_or_url)
async
Request repository details for this user.
Alias: repo()
Parameters:
Name |
Type |
Description |
Default |
name_or_url |
Union[str, HttpUrl]
|
Repository name or full github link to repository, |
required
|
Returns:
Type |
Description |
Repository
|
Repository wrapper object allowing for further interaction
wit Github API. |
Source code in async_py_octocat/_rest/models/_user.py
| async def repository(
self, name_or_url: Union[str, HttpUrl]
) -> _repository.Repository:
"""Request repository details for this user.
Alias: repo()
Parameters
----------
name_or_url : Union[str, HttpUrl]
Repository name or full github link to repository,
Returns
-------
Repository
Repository wrapper object allowing for further interaction
wit Github API.
"""
return await self._fetch_repository(name_or_url)
|