Module aiogithubapi.objects.base
AIOGitHubAPI: objects.base
Expand source code
"""AIOGitHubAPI: objects.base"""
from __future__ import annotations
from typing import TYPE_CHECKING
from aiohttp.hdrs import ETAG
from ..common.const import HttpStatusCode
if TYPE_CHECKING:
from ..client import AIOGitHubAPIClient
class AIOGitHubAPIBase:
"""Base class for AIOGitHubAPI."""
def __init__(self, attributes) -> None:
"""Initialize."""
self.attributes = attributes
class AIOGitHubAPIBaseClient(AIOGitHubAPIBase):
"""Base class for AIOGitHubAPI."""
def __init__(self, client: AIOGitHubAPIClient, attributes: dict) -> None:
"""Initialise."""
super().__init__(attributes)
self.client = client
class AIOGitHubAPIResponse:
"""Response object for AIOGitHub."""
def __init__(self) -> None:
"""initialise."""
self.headers: dict = {}
self.data = {}
self.status: HttpStatusCode = HttpStatusCode.OK
def as_dict(self):
"""Return attributes as a dict."""
return {
"headers": self.headers,
"status": self.status,
"data": self.data,
"etag": self.etag,
}
@property
def etag(self):
"""Return the ETag for this response."""
return self.headers.get(ETAG)
Classes
class AIOGitHubAPIBase (attributes)
-
Base class for AIOGitHubAPI.
Initialize.
Expand source code
class AIOGitHubAPIBase: """Base class for AIOGitHubAPI.""" def __init__(self, attributes) -> None: """Initialize.""" self.attributes = attributes
Subclasses
- AIOGitHubAPIClient
- AIOGitHubAPI
- AIOGitHubAPIBaseClient
- AIOGitHubAPIContentBase
- AIOGitHubAPILoginDevice
- AIOGitHubAPILoginOauth
- AIOGitHubAPIOrgsTeam
- Organization
- AIOGitHubAPIRateLimit
- AIOGitHubAPIReposBranch
- Commit
- CommitAuthor
- CommitCommit
- CommitCommitAuthor
- CommitCommitCommitter
- CommitCommitTree
- CommitCommitVerification
- CommitCommitter
- Parents
- Protection
- ProtectionRequiredStatusChecks
- AIOGitHubAPIReposCommit
- Author
- Commit
- CommitAuthor
- CommitCommitter
- CommitTree
- CommitVerification
- Committer
- Files
- Parents
- Stats
- AIOGitHubAPIReposFork
- License
- Owner
- Permissions
- AIOGitHubAPIReposLabel
- AIOGitHubAPIReposTrafficClones
- Clones
- AIOGitHubAPIReposTrafficPageviews
- Views
- AIOGitHubAPIRepositoryCollaborator
- Permissions
- AIOGitHubAPIRepositoryPullrequest
- Assignee
- Assignees
- Base
- BaseRepo
- BaseRepoOwner
- BaseRepoPermissions
- BaseUser
- Head
- HeadRepo
- HeadRepoOwner
- HeadRepoPermissions
- HeadUser
- Labels
- MergedBy
- Milestone
- MilestoneCreator
- RequestedReviewers
- RequestedTeams
- User
- AIOGitHubAPIRepositoryRelease
- AIOGitHubAPIUsersUser
class AIOGitHubAPIBaseClient (client: AIOGitHubAPIClient, attributes: dict)
-
Base class for AIOGitHubAPI.
Initialise.
Expand source code
class AIOGitHubAPIBaseClient(AIOGitHubAPIBase): """Base class for AIOGitHubAPI.""" def __init__(self, client: AIOGitHubAPIClient, attributes: dict) -> None: """Initialise.""" super().__init__(attributes) self.client = client
Ancestors
Subclasses
class AIOGitHubAPIResponse
-
Response object for AIOGitHub.
initialise.
Expand source code
class AIOGitHubAPIResponse: """Response object for AIOGitHub.""" def __init__(self) -> None: """initialise.""" self.headers: dict = {} self.data = {} self.status: HttpStatusCode = HttpStatusCode.OK def as_dict(self): """Return attributes as a dict.""" return { "headers": self.headers, "status": self.status, "data": self.data, "etag": self.etag, } @property def etag(self): """Return the ETag for this response.""" return self.headers.get(ETAG)
Instance variables
var etag
-
Return the ETag for this response.
Expand source code
@property def etag(self): """Return the ETag for this response.""" return self.headers.get(ETAG)
Methods
def as_dict(self)
-
Return attributes as a dict.
Expand source code
def as_dict(self): """Return attributes as a dict.""" return { "headers": self.headers, "status": self.status, "data": self.data, "etag": self.etag, }