Module aiogithubapi.models.release

GitHub release data class.

Expand source code
"""GitHub release data class."""
from __future__ import annotations

from typing import Any, Dict

from .base import GitHubDataModelBase
from .reaction import GitHubReactionModel
from .user import GitHubBaseUserModel


class GitHubReleaseAssetModel(GitHubDataModelBase):
    """Representation of a GitHub release asset."""

    url: str | None = None
    id: int | None = None
    name: str | None = None
    label: str | None = None
    uploader: GitHubBaseUserModel | None = None
    content_type: str | None = None
    state: str | None = None
    size: int | None = None
    download_count: int = None
    created_at: str = None
    updated_at: str = None
    browser_download_url: str = None

    def _generate_uploader(self, data: Dict[str, Any] | None) -> GitHubBaseUserModel:
        """Generate uploader data."""
        return GitHubBaseUserModel(data) if data else None


class GitHubReleaseModel(GitHubDataModelBase):
    """GitHub release data class."""

    url: str | None = None
    assets_url: str | None = None
    upload_url: str | None = None
    html_url: str | None = None
    id: int | None = None
    author: GitHubBaseUserModel | None = None
    tag_name: str | None = None
    target_commitish: str | None = None
    name: str | None = None
    draft: bool | None = None
    prerelease: bool | None = None
    created_at: str | None = None
    published_at: str | None = None
    assets: list[dict] | None = None
    tarball_url: str | None = None
    zipball_url: str | None = None
    body: str | None = None
    reactions: GitHubReactionModel | None = None
    mentions_count: int | None = None

    def _generate_author(self, data: dict) -> GitHubBaseUserModel:
        """Generate author data."""
        return GitHubBaseUserModel(data)

    def _generate_assets(self, data: list[Dict[str, Any]]) -> dict:
        """Generate assets data."""
        return [GitHubReleaseAssetModel(asset) for asset in data or []]

    def _generate_reactions(self, data: dict) -> GitHubReactionModel:
        """Generate reactions data."""
        return GitHubReactionModel(data)

Classes

class GitHubReleaseAssetModel (data: Dict[str, Any])

Representation of a GitHub release asset.

Init.

Expand source code
class GitHubReleaseAssetModel(GitHubDataModelBase):
    """Representation of a GitHub release asset."""

    url: str | None = None
    id: int | None = None
    name: str | None = None
    label: str | None = None
    uploader: GitHubBaseUserModel | None = None
    content_type: str | None = None
    state: str | None = None
    size: int | None = None
    download_count: int = None
    created_at: str = None
    updated_at: str = None
    browser_download_url: str = None

    def _generate_uploader(self, data: Dict[str, Any] | None) -> GitHubBaseUserModel:
        """Generate uploader data."""
        return GitHubBaseUserModel(data) if data else None

Ancestors

Class variables

var browser_download_url : str
var content_type : str | None
var created_at : str
var download_count : int
var id : int | None
var label : str | None
var name : str | None
var size : int | None
var state : str | None
var updated_at : str
var uploader : GitHubBaseUserModel | None
var url : str | None

Inherited members

class GitHubReleaseModel (data: Dict[str, Any])

GitHub release data class.

Init.

Expand source code
class GitHubReleaseModel(GitHubDataModelBase):
    """GitHub release data class."""

    url: str | None = None
    assets_url: str | None = None
    upload_url: str | None = None
    html_url: str | None = None
    id: int | None = None
    author: GitHubBaseUserModel | None = None
    tag_name: str | None = None
    target_commitish: str | None = None
    name: str | None = None
    draft: bool | None = None
    prerelease: bool | None = None
    created_at: str | None = None
    published_at: str | None = None
    assets: list[dict] | None = None
    tarball_url: str | None = None
    zipball_url: str | None = None
    body: str | None = None
    reactions: GitHubReactionModel | None = None
    mentions_count: int | None = None

    def _generate_author(self, data: dict) -> GitHubBaseUserModel:
        """Generate author data."""
        return GitHubBaseUserModel(data)

    def _generate_assets(self, data: list[Dict[str, Any]]) -> dict:
        """Generate assets data."""
        return [GitHubReleaseAssetModel(asset) for asset in data or []]

    def _generate_reactions(self, data: dict) -> GitHubReactionModel:
        """Generate reactions data."""
        return GitHubReactionModel(data)

Ancestors

Class variables

var assets : list[dict] | None
var assets_url : str | None
var author : GitHubBaseUserModel | None
var body : str | None
var created_at : str | None
var draft : bool | None
var html_url : str | None
var id : int | None
var mentions_count : int | None
var name : str | None
var prerelease : bool | None
var published_at : str | None
var reactions : GitHubReactionModel | None
var tag_name : str | None
var tarball_url : str | None
var target_commitish : str | None
var upload_url : str | None
var url : str | None
var zipball_url : str | None

Inherited members