Module aiogithubapi.objects.repository.traffic
AIOGitHubAPI: Repository Traffic
https://docs.github.com/en/rest/reference/repos#traffic
Expand source code
"""
AIOGitHubAPI: Repository Traffic
https://docs.github.com/en/rest/reference/repos#traffic
"""
from typing import Optional
from aiohttp.hdrs import IF_NONE_MATCH
from ..base import AIOGitHubAPIBaseClient
from ..repos.traffic.clones import AIOGitHubAPIReposTrafficClones
from ..repos.traffic.pageviews import AIOGitHubAPIReposTrafficPageviews
class AIOGitHubAPIRepositoryTraffic(AIOGitHubAPIBaseClient):
"""Repository Release GitHub API implementation."""
@property
def full_name(self) -> None:
return self.attributes.get("full_name")
async def get_views(self, etag: Optional[str] = None):
_endpoint = f"/repos/{self.full_name}/traffic/views"
_headers = {}
if etag:
_headers[IF_NONE_MATCH] = etag
response = await self.client.get(endpoint=_endpoint, headers=_headers)
return AIOGitHubAPIReposTrafficPageviews(response.data)
async def get_clones(self, etag: Optional[str] = None) -> None:
_endpoint = f"/repos/{self.full_name}/traffic/clones"
_headers = {}
if etag:
_headers[IF_NONE_MATCH] = etag
response = await self.client.get(endpoint=_endpoint, headers=_headers)
return AIOGitHubAPIReposTrafficClones(response.data)
Classes
class AIOGitHubAPIRepositoryTraffic (client: AIOGitHubAPIClient, attributes: dict)
-
Repository Release GitHub API implementation.
Initialise.
Expand source code
class AIOGitHubAPIRepositoryTraffic(AIOGitHubAPIBaseClient): """Repository Release GitHub API implementation.""" @property def full_name(self) -> None: return self.attributes.get("full_name") async def get_views(self, etag: Optional[str] = None): _endpoint = f"/repos/{self.full_name}/traffic/views" _headers = {} if etag: _headers[IF_NONE_MATCH] = etag response = await self.client.get(endpoint=_endpoint, headers=_headers) return AIOGitHubAPIReposTrafficPageviews(response.data) async def get_clones(self, etag: Optional[str] = None) -> None: _endpoint = f"/repos/{self.full_name}/traffic/clones" _headers = {} if etag: _headers[IF_NONE_MATCH] = etag response = await self.client.get(endpoint=_endpoint, headers=_headers) return AIOGitHubAPIReposTrafficClones(response.data)
Ancestors
Instance variables
var full_name : None
-
Expand source code
@property def full_name(self) -> None: return self.attributes.get("full_name")
Methods
async def get_clones(self, etag: Optional[str] = None) ‑> None
-
Expand source code
async def get_clones(self, etag: Optional[str] = None) -> None: _endpoint = f"/repos/{self.full_name}/traffic/clones" _headers = {} if etag: _headers[IF_NONE_MATCH] = etag response = await self.client.get(endpoint=_endpoint, headers=_headers) return AIOGitHubAPIReposTrafficClones(response.data)
async def get_views(self, etag: Optional[str] = None)
-
Expand source code
async def get_views(self, etag: Optional[str] = None): _endpoint = f"/repos/{self.full_name}/traffic/views" _headers = {} if etag: _headers[IF_NONE_MATCH] = etag response = await self.client.get(endpoint=_endpoint, headers=_headers) return AIOGitHubAPIReposTrafficPageviews(response.data)