Skip to content

models

Module for all models used in the project.

Anime

Bases: BaseModel

Represents a model for all the fields that an anime can contain.

Source code in aniwrap/models/anime.py
@attrs.define(init=False)
class Anime(BaseModel):
    """Represents a model for all the fields that an anime can contain."""

    id: int
    """The id of the anime."""

    title: str
    """The title of the anime."""

    main_picture: PictureModel
    """The urls for medium and large sized pictures of the posters."""

    alternative_titles: TitlesModel
    """The Alternative titles for the anime."""

    start_date: datetime
    """The anime's airing start date. For anime that are not aired, the date might be defaulted to first of the month."""

    synopsis: str
    """The synopsis of the anime."""

    popularity: int
    """The popularity ranking of the anime."""

    nsfw: NSFWLevel
    """The nsfw level of the anime."""

    created_at: datetime
    """The date on which the anime is added on MAL."""

    updated_at: datetime
    """The last updated date of the anime."""

    media_type: AnimeType
    """The type of the anime."""

    status: AnimeStatus
    """The status of the anime."""

    genres: list[CommonModel]
    """The list of genres."""

    source: str
    """The source of the anime."""

    rating: str
    """The rating of the anime (R-rated, PG etc.)."""

    studios: list[CommonModel] | None = attrs.field(default=None)
    """The studios that produced the anime. Defaults to `None` if information is not available."""

    end_date: datetime | None = attrs.field(default=None)
    """The anime's airing end date. Defaults to `None` if the anime is not aired yet."""

    mean: float | None = attrs.field(default=None)
    """The score of the anime on MAL. Defaults to `None` for anime that are not aired yet."""

    rank: int | None = attrs.field(default=None)
    """The rank of the anime on MAL. Defaults to `None` if information is not available."""

    num_list_users: int | None = attrs.field(default=None)
    """The number of users that added the anime to their lists. Defaults to `None` if information is not available."""

    num_scoring_users: int | None = attrs.field(default=None)
    """The number of users that scored the anime. Defaults to `None` if information is not available."""

    num_episodes: int = attrs.field(default=0)
    """The number of episodes in the anime. Defaults to `0` if not aired or no information is available."""

    start_season: Season | None = attrs.field(default=None)
    """The season in which the anime started airing. Defaults to `None` if not aired or information is not available."""

    broadcast: Broadcast | None = attrs.field(default=None)
    """The broadcast day and time details. Defaults to `None` if not aired or information is not available."""

    average_episode_duration: int = attrs.field(default=0)
    """The average episode duration of the anime represented in seconds. Defaults to `0` if not aired or information is not available."""

    pictures: list[OptionalPictureModel] | None = attrs.field(default=None)
    """The list of urls for medium and large sized images related to the anime. Defaults to `None` if information is not available."""

    background: str | None = attrs.field(default=None)
    """Some extra information related to the anime. Defaults to `None` if information is not available."""

    related_anime: list[RelatedMaterialModel] | None = attrs.field(default=None)
    """The other anime that are related to the current anime. Defaults to `None` if information is not available."""

    # related_manga - not implemented

    recommendations: list[RecommendationModel] | None = attrs.field(default=None)
    """The recommended anime by other users.  Defaults to `None` if information is not available."""

    statistics: AnimeStatistics | None = attrs.field(default=None)
    """Represents different statistics related to the anime.  Defaults to `None` if information is not available."""

alternative_titles instance-attribute

alternative_titles: TitlesModel

The Alternative titles for the anime.

average_episode_duration class-attribute instance-attribute

average_episode_duration: int = attrs.field(default=0)

The average episode duration of the anime represented in seconds. Defaults to 0 if not aired or information is not available.

background class-attribute instance-attribute

background: str | None = attrs.field(default=None)

Some extra information related to the anime. Defaults to None if information is not available.

broadcast class-attribute instance-attribute

broadcast: Broadcast | None = attrs.field(default=None)

The broadcast day and time details. Defaults to None if not aired or information is not available.

created_at instance-attribute

created_at: datetime

The date on which the anime is added on MAL.

end_date class-attribute instance-attribute

end_date: datetime | None = attrs.field(default=None)

The anime's airing end date. Defaults to None if the anime is not aired yet.

genres instance-attribute

genres: list[CommonModel]

The list of genres.

id instance-attribute

id: int

The id of the anime.

main_picture instance-attribute

main_picture: PictureModel

The urls for medium and large sized pictures of the posters.

mean class-attribute instance-attribute

mean: float | None = attrs.field(default=None)

The score of the anime on MAL. Defaults to None for anime that are not aired yet.

media_type instance-attribute

media_type: AnimeType

The type of the anime.

nsfw instance-attribute

nsfw: NSFWLevel

The nsfw level of the anime.

num_episodes class-attribute instance-attribute

num_episodes: int = attrs.field(default=0)

The number of episodes in the anime. Defaults to 0 if not aired or no information is available.

num_list_users class-attribute instance-attribute

num_list_users: int | None = attrs.field(default=None)

The number of users that added the anime to their lists. Defaults to None if information is not available.

num_scoring_users class-attribute instance-attribute

num_scoring_users: int | None = attrs.field(default=None)

The number of users that scored the anime. Defaults to None if information is not available.

pictures class-attribute instance-attribute

pictures: list[OptionalPictureModel] | None = attrs.field(
    default=None
)

The list of urls for medium and large sized images related to the anime. Defaults to None if information is not available.

popularity instance-attribute

popularity: int

The popularity ranking of the anime.

rank class-attribute instance-attribute

rank: int | None = attrs.field(default=None)

The rank of the anime on MAL. Defaults to None if information is not available.

rating instance-attribute

rating: str

The rating of the anime (R-rated, PG etc.).

recommendations class-attribute instance-attribute

recommendations: list[
    RecommendationModel
] | None = attrs.field(default=None)

The recommended anime by other users. Defaults to None if information is not available.

related_anime class-attribute instance-attribute

related_anime: list[
    RelatedMaterialModel
] | None = attrs.field(default=None)

The other anime that are related to the current anime. Defaults to None if information is not available.

source instance-attribute

source: str

The source of the anime.

start_date instance-attribute

start_date: datetime

The anime's airing start date. For anime that are not aired, the date might be defaulted to first of the month.

start_season class-attribute instance-attribute

start_season: Season | None = attrs.field(default=None)

The season in which the anime started airing. Defaults to None if not aired or information is not available.

statistics class-attribute instance-attribute

statistics: AnimeStatistics | None = attrs.field(
    default=None
)

Represents different statistics related to the anime. Defaults to None if information is not available.

status instance-attribute

status: AnimeStatus

The status of the anime.

studios class-attribute instance-attribute

studios: list[CommonModel] | None = attrs.field(
    default=None
)

The studios that produced the anime. Defaults to None if information is not available.

synopsis instance-attribute

synopsis: str

The synopsis of the anime.

title instance-attribute

title: str

The title of the anime.

updated_at instance-attribute

updated_at: datetime

The last updated date of the anime.

AnimeList

Bases: BaseModel

Represents the user anime list model.

Source code in aniwrap/models/user.py
@attrs.define
class AnimeList(BaseModel):
    """Represents the user anime list model."""

    anime_data: Anime
    """Represents the anime details."""

    list_status: AnimeListStatus
    """The status details of the anime in the list."""

anime_data instance-attribute

anime_data: Anime

Represents the anime details.

list_status instance-attribute

list_status: AnimeListStatus

The status details of the anime in the list.

AnimeListStatus

Bases: BaseModel

Represents the anime list status model.

Source code in aniwrap/models/user.py
@attrs.define(init=False)
class AnimeListStatus(BaseModel):
    """Represents the anime list status model."""

    status: AnimeWatchStatus
    """The anime watch status in the anime list."""

    updated_at: datetime
    """The last updated time."""

    score: int = 0
    """The score of the anime in the list. Defaults to `0`"""

    num_episodes_watched: int = 0
    """The number of episodes watched. Defaults to `0`"""

    is_rewatching: bool = False
    """Rewatch status. Defaults to `False`"""

    start_date: datetime | None = attrs.field(default=None)
    """The date on which the user started watching the anime."""

    finish_date: datetime | None = attrs.field(default=None)
    """The date on which the user finished watching the anime."""

finish_date class-attribute instance-attribute

finish_date: datetime | None = attrs.field(default=None)

The date on which the user finished watching the anime.

is_rewatching class-attribute instance-attribute

is_rewatching: bool = False

Rewatch status. Defaults to False

num_episodes_watched class-attribute instance-attribute

num_episodes_watched: int = 0

The number of episodes watched. Defaults to 0

score class-attribute instance-attribute

score: int = 0

The score of the anime in the list. Defaults to 0

start_date class-attribute instance-attribute

start_date: datetime | None = attrs.field(default=None)

The date on which the user started watching the anime.

status instance-attribute

status: AnimeWatchStatus

The anime watch status in the anime list.

updated_at instance-attribute

updated_at: datetime

The last updated time.

AnimeListUpdate

Bases: BaseModel

Represents different params present in anime list update.

Source code in aniwrap/models/user.py
@attrs.define(init=False)
class AnimeListUpdate(BaseModel):
    """Represents different params present in anime list update."""

    status: AnimeWatchStatus
    """The anime watch status in the anime list."""

    updated_at: datetime
    """The last updated time."""

    score: int = 0
    """The score of the anime in the list. Defaults to `0`"""

    num_episodes_watched: int = 0
    """The number of episodes watched. Defaults to `0`"""

    is_rewatching: bool = False
    """Rewatch status. Defaults to `False`"""

    priority: ListPriority = ListPriority.Low
    """The anime priority."""

    num_times_rewatched: int = 0
    """The number of times anime is rewatched."""

    rewatch_value: AnimeRewatchValue | None = None

    tags: list[str] | None = None

    comments: str | None = None

is_rewatching class-attribute instance-attribute

is_rewatching: bool = False

Rewatch status. Defaults to False

num_episodes_watched class-attribute instance-attribute

num_episodes_watched: int = 0

The number of episodes watched. Defaults to 0

num_times_rewatched class-attribute instance-attribute

num_times_rewatched: int = 0

The number of times anime is rewatched.

priority class-attribute instance-attribute

priority: ListPriority = ListPriority.Low

The anime priority.

score class-attribute instance-attribute

score: int = 0

The score of the anime in the list. Defaults to 0

status instance-attribute

status: AnimeWatchStatus

The anime watch status in the anime list.

updated_at instance-attribute

updated_at: datetime

The last updated time.

AnimeRanking

Represents all the fields that contain in Anime Ranking result.

Source code in aniwrap/models/anime.py
@attrs.define
class AnimeRanking:
    """Represents all the fields that contain in Anime Ranking result."""

    anime_data: Anime
    """Represents all the anime details."""

    ranking: RankingModel
    """Represents the ranking of the anime in the list."""

anime_data instance-attribute

anime_data: Anime

Represents all the anime details.

ranking instance-attribute

ranking: RankingModel

Represents the ranking of the anime in the list.

AnimeStatistics

Bases: BaseModel

Represents the model for statistics of the anime.

Source code in aniwrap/models/anime.py
@attrs.define
class AnimeStatistics(BaseModel):
    """Represents the model for statistics of the anime."""

    status: AnimeStatisticsStatus | None = attrs.field(default=None)
    """Represnts different statistics of the anime."""

    num_list_users: int | None = attrs.field(default=None)
    """The total number of users that added this anime to their lists."""

num_list_users class-attribute instance-attribute

num_list_users: int | None = attrs.field(default=None)

The total number of users that added this anime to their lists.

status class-attribute instance-attribute

status: AnimeStatisticsStatus | None = attrs.field(
    default=None
)

Represnts different statistics of the anime.

AnimeStatisticsStatus

Bases: BaseModel

Represents the model for anime statistics.

Source code in aniwrap/models/anime.py
@attrs.define
class AnimeStatisticsStatus(BaseModel):
    """Represents the model for anime statistics."""

    watching: str | None = attrs.field(default=None)
    """The number of users that are currently watching the anime."""

    completed: str | None = attrs.field(default=None)
    """The number of users that completed the anime."""

    on_hold: str | None = attrs.field(default=None)
    """The number of users that put the anime on hold."""

    dropped: str | None = attrs.field(default=None)
    """The number of users that dropped the anime."""

    plan_to_watch: str | None = attrs.field(default=None)
    """The number of users that are planning to watch the anime."""

completed class-attribute instance-attribute

completed: str | None = attrs.field(default=None)

The number of users that completed the anime.

dropped class-attribute instance-attribute

dropped: str | None = attrs.field(default=None)

The number of users that dropped the anime.

on_hold class-attribute instance-attribute

on_hold: str | None = attrs.field(default=None)

The number of users that put the anime on hold.

plan_to_watch class-attribute instance-attribute

plan_to_watch: str | None = attrs.field(default=None)

The number of users that are planning to watch the anime.

watching class-attribute instance-attribute

watching: str | None = attrs.field(default=None)

The number of users that are currently watching the anime.

Author

Bases: BaseModel

Represents the author model.

Source code in aniwrap/models/manga.py
@attrs.define
class Author(BaseModel):
    """Represents the author model."""

    node: AuthorName
    """Represents author details."""

    role: str | None = attrs.field(default=None)
    """The role of the author (Story, art etc.)."""

node instance-attribute

node: AuthorName

Represents author details.

role class-attribute instance-attribute

role: str | None = attrs.field(default=None)

The role of the author (Story, art etc.).

AuthorName

Bases: BaseModel

Represents the author name model.

Source code in aniwrap/models/manga.py
@attrs.define
class AuthorName(BaseModel):
    """Represents the author name model."""

    id: int
    """The id related to the author."""

    first_name: str
    """The first name of the author."""

    last_name: str
    """The last name of the author."""

first_name instance-attribute

first_name: str

The first name of the author.

id instance-attribute

id: int

The id related to the author.

last_name instance-attribute

last_name: str

The last name of the author.

BaseModel

The base model from which all the other models inherit from.

Source code in aniwrap/models/base.py
@attrs.define
class BaseModel:
    """The base model from which all the other models inherit from."""

Broadcast

Bases: BaseModel

Represents the model for broadcast details.

Source code in aniwrap/models/anime.py
@attrs.define
class Broadcast(BaseModel):
    """Represents the model for broadcast details."""

    day_of_the_week: str
    """The day on which the anime airs."""

    start_time: time.struct_time
    """The time at which the anime airs."""

day_of_the_week instance-attribute

day_of_the_week: str

The day on which the anime airs.

start_time instance-attribute

start_time: time.struct_time

The time at which the anime airs.

CommonModel

Bases: BaseModel

Represents a common model - contains id and name.

Source code in aniwrap/models/common.py
@attrs.define
class CommonModel(BaseModel):
    """Represents a common model - contains `id` and `name`."""

    id: int
    """The id."""

    name: str
    """The name."""

id instance-attribute

id: int

The id.

name instance-attribute

name: str

The name.

Forum

Bases: BaseModel

Represents all fields a forum can contain.

Source code in aniwrap/models/forum.py
@attrs.define(init=False)
class Forum(BaseModel):
    """Represents all fields a forum can contain."""

    title: str
    """The title of the forum."""

    boards: list[ForumBoard]
    """The list of boards in the forum"""

boards instance-attribute

boards: list[ForumBoard]

The list of boards in the forum

title instance-attribute

title: str

The title of the forum.

ForumBoard

Bases: BaseModel

Represnts a forum board model.

Source code in aniwrap/models/forum.py
@attrs.define(init=False)
class ForumBoard(BaseModel):
    """Represnts a forum board model."""

    id: int
    """The id of the forum board."""

    title: str
    """The title of the forum board."""

    description: str | None = attrs.field(default=None)
    """The description of the board."""

    subboards: list[ForumSubBoard] | None = attrs.field(default=None)
    """The list of sub boards."""

description class-attribute instance-attribute

description: str | None = attrs.field(default=None)

The description of the board.

id instance-attribute

id: int

The id of the forum board.

subboards class-attribute instance-attribute

subboards: list[ForumSubBoard] | None = attrs.field(
    default=None
)

The list of sub boards.

title instance-attribute

title: str

The title of the forum board.

ForumPost

Bases: BaseModel

Represents a forum post model.

Source code in aniwrap/models/forum.py
@attrs.define(init=False)
class ForumPost(BaseModel):
    """Represents a forum post model."""

    id: int
    """The Id of the fourm post."""

    number: int
    """The number(sequence?) of this particular post."""

    created_at: datetime
    """The data on which the post was created."""

    created_by: PostCreator
    """The details of the post's author."""

    body: str
    """The content of the post."""

    signature: str | None = attrs.field(default=None)
    """The signature on the post."""

body instance-attribute

body: str

The content of the post.

created_at instance-attribute

created_at: datetime

The data on which the post was created.

created_by instance-attribute

created_by: PostCreator

The details of the post's author.

id instance-attribute

id: int

The Id of the fourm post.

number instance-attribute

number: int

The number(sequence?) of this particular post.

signature class-attribute instance-attribute

signature: str | None = attrs.field(default=None)

The signature on the post.

ForumSubBoard

Bases: BaseModel

Represents a forum subboard model.

Source code in aniwrap/models/forum.py
@attrs.define
class ForumSubBoard(BaseModel):
    """Represents a forum subboard model."""

    id: int
    """The id of the sub board."""

    title: str
    """The title of the sub board."""

id instance-attribute

id: int

The id of the sub board.

title instance-attribute

title: str

The title of the sub board.

ForumTopic

Bases: BaseModel

Represents all fields a forum topic can contain.

Source code in aniwrap/models/forum.py
@attrs.define(init=False)
class ForumTopic(BaseModel):
    """Represents all fields a forum topic can contain."""

    id: int
    """The id of the topic."""

    title: str
    """The title of the topic."""

    created_at: datetime
    """The date at which the topic was created."""

    number_of_posts: int
    """The total number of posts under the topic."""

    last_post_created_at: datetime
    """The date of the latest post under the topic."""

    is_locked: bool
    """Whether the topic is locked."""

    created_by: CommonModel
    """The details of the user that created the topic."""

    last_post_created_by: CommonModel
    """The details of the user that created the last post under the topic."""

created_at instance-attribute

created_at: datetime

The date at which the topic was created.

created_by instance-attribute

created_by: CommonModel

The details of the user that created the topic.

id instance-attribute

id: int

The id of the topic.

is_locked instance-attribute

is_locked: bool

Whether the topic is locked.

last_post_created_at instance-attribute

last_post_created_at: datetime

The date of the latest post under the topic.

last_post_created_by instance-attribute

last_post_created_by: CommonModel

The details of the user that created the last post under the topic.

number_of_posts instance-attribute

number_of_posts: int

The total number of posts under the topic.

title instance-attribute

title: str

The title of the topic.

ForumTopicDetails

Bases: BaseModel

Represents the forum topic details model.

Source code in aniwrap/models/forum.py
@attrs.define(init=False)
class ForumTopicDetails(BaseModel):
    """Represents the forum topic details model."""

    title: str
    """The title of the forum."""

    posts: list[ForumPost] | None = attrs.field(default=None)
    """The list of posts in the forum."""

posts class-attribute instance-attribute

posts: list[ForumPost] | None = attrs.field(default=None)

The list of posts in the forum.

title instance-attribute

title: str

The title of the forum.

GenerateRoute

Source code in aniwrap/models/route.py
class GenerateRoute:
    __slots__ = ("_route", "_params", "_data")

    def __init__(self, route: Route) -> None:
        self._route = route
        self._params: dict[str, str | int] = {}
        self._data: dict[str, str | int] = {}

    @property
    def route(self) -> Route:
        """The route itself."""
        return self._route

    @property
    def uri(self) -> str:
        """The routes uri endpoint."""
        return self.route.uri

    @uri.setter
    def uri(self, val: str) -> str:
        """Set the uri."""
        self.route.uri = val

    @property
    def method(self) -> str:
        """The routes method, i.e. GET, POST..."""
        return self.route.method

    @property
    def params(self) -> dict[str, str | int]:
        """The query params for the route."""
        return self._params

    @property
    def data(self) -> dict[str, str | int]:
        """The input data that needs to be passed."""
        return self._data

    def with_params(self, params: dict[str, Any]) -> GenerateRoute:
        """Adds additional query params to this generated route."""

        if params:
            self.params.update(params)

        return self

    def with_data(self, data: dict[str, Any]) -> GenerateRoute:
        """Adds input data to the generated route."""

        if data:
            self._data.update(data)

        return self

data property

data: dict[str, str | int]

The input data that needs to be passed.

method property

method: str

The routes method, i.e. GET, POST...

params property

params: dict[str, str | int]

The query params for the route.

route property

route: Route

The route itself.

uri property writable

uri: str

The routes uri endpoint.

with_data

with_data(data: dict[str, Any]) -> GenerateRoute

Adds input data to the generated route.

Source code in aniwrap/models/route.py
def with_data(self, data: dict[str, Any]) -> GenerateRoute:
    """Adds input data to the generated route."""

    if data:
        self._data.update(data)

    return self

with_params

with_params(params: dict[str, Any]) -> GenerateRoute

Adds additional query params to this generated route.

Source code in aniwrap/models/route.py
def with_params(self, params: dict[str, Any]) -> GenerateRoute:
    """Adds additional query params to this generated route."""

    if params:
        self.params.update(params)

    return self

HttpErrorResponse

Bases: BaseModel

Represents HTTP success response.

Source code in aniwrap/models/http.py
@attrs.define
class HttpErrorResponse(BaseModel):
    """Represents HTTP success response."""

    status: int
    """The HTTP status code."""

    message: str
    """The error message."""

message instance-attribute

message: str

The error message.

status instance-attribute

status: int

The HTTP status code.

HttpSuccessResponse

Bases: BaseModel

Represents HTTP success response.

Source code in aniwrap/models/http.py
@attrs.define
class HttpSuccessResponse(BaseModel):
    """Represents HTTP success response."""

    status: int
    """The HTTP status code."""

    message: str
    """The success message."""

    data: Any
    """The API json response."""

data instance-attribute

data: Any

The API json response.

message instance-attribute

message: str

The success message.

status instance-attribute

status: int

The HTTP status code.

Manga

Bases: BaseModel

Represents model for all the fields a manga can contain.

Source code in aniwrap/models/manga.py
@attrs.define(init=False)
class Manga(BaseModel):
    """Represents model for all the fields a manga can contain."""

    id: int
    """The id of the Manga."""

    title: str
    """The title of the Manga."""

    main_picture: PictureModel
    """The urls for medium and large sized images of the posters."""

    alternative_titles: TitlesModel
    """The Alternative titles for the Manga. Contains synonyms, Japanese title and any other English title."""

    start_date: datetime
    """The start date of the Manga publication."""

    popularity: int
    """The popularity of the Manga."""

    nsfw: NSFWLevel
    """The NSFW level."""

    created_at: datetime
    """The date on which the manga was created on MAL."""

    updated_at: datetime
    """The date on which the manga was last updated on MAL."""

    media_type: MangaType
    """The type of the Manga."""

    status: MangaStatus
    """The status of the Manga."""

    genres: list[CommonModel]
    """The list of genres to which the manga belongs to."""

    num_volumes: int
    """The number of volumes of the manga that are currently published."""

    num_chapters: int
    """The total number of the chapters present in the Manga."""

    authors: list[Author]
    """The details of the manga authors."""

    end_date: datetime | None = attrs.field(default=None)
    """The Manga end date."""

    synopsis: str | None = attrs.field(default=None)
    """The synopsis of the Manga."""

    mean: float | None = attrs.field(default=None)
    """The score of the manga on MAL. Defaults to `None` for manga that are not published yet."""

    rank: int | None = attrs.field(default=None)
    """The rank of the Manga."""

    num_list_users: int | None = attrs.field(default=None)
    """The number of users that added the manga to their lists."""

    num_scoring_users: int | None = attrs.field(default=None)
    """The number of users that scored the manga."""

    background: str | None = attrs.field(default=None)
    """Some extra information related to the manga."""

    # related_anime: list[RelatedAnimeType] | None = attrs.field(default=None)
    # """The other anime that are related to the current anime."""

    pictures: list[OptionalPictureModel] | None = attrs.field(default=None)
    """The list of urls for medium and large sized images related to the anime. Defaults to `None` if information is not available."""

    related_manga: list[RelatedMaterialModel] | None = attrs.field(default=None)
    """The other manga that are related to the current manga."""

    recommendations: list[RecommendationModel] | None = attrs.field(default=None)
    """The recommended manga by other users."""

    serialization: Serialization | None = attrs.field(default=None)

alternative_titles instance-attribute

alternative_titles: TitlesModel

The Alternative titles for the Manga. Contains synonyms, Japanese title and any other English title.

authors instance-attribute

authors: list[Author]

The details of the manga authors.

background class-attribute instance-attribute

background: str | None = attrs.field(default=None)

Some extra information related to the manga.

created_at instance-attribute

created_at: datetime

The date on which the manga was created on MAL.

end_date class-attribute instance-attribute

end_date: datetime | None = attrs.field(default=None)

The Manga end date.

genres instance-attribute

genres: list[CommonModel]

The list of genres to which the manga belongs to.

id instance-attribute

id: int

The id of the Manga.

main_picture instance-attribute

main_picture: PictureModel

The urls for medium and large sized images of the posters.

mean class-attribute instance-attribute

mean: float | None = attrs.field(default=None)

The score of the manga on MAL. Defaults to None for manga that are not published yet.

media_type instance-attribute

media_type: MangaType

The type of the Manga.

nsfw instance-attribute

nsfw: NSFWLevel

The NSFW level.

num_chapters instance-attribute

num_chapters: int

The total number of the chapters present in the Manga.

num_list_users class-attribute instance-attribute

num_list_users: int | None = attrs.field(default=None)

The number of users that added the manga to their lists.

num_scoring_users class-attribute instance-attribute

num_scoring_users: int | None = attrs.field(default=None)

The number of users that scored the manga.

num_volumes instance-attribute

num_volumes: int

The number of volumes of the manga that are currently published.

pictures class-attribute instance-attribute

pictures: list[OptionalPictureModel] | None = attrs.field(
    default=None
)

The list of urls for medium and large sized images related to the anime. Defaults to None if information is not available.

popularity instance-attribute

popularity: int

The popularity of the Manga.

rank class-attribute instance-attribute

rank: int | None = attrs.field(default=None)

The rank of the Manga.

recommendations class-attribute instance-attribute

recommendations: list[
    RecommendationModel
] | None = attrs.field(default=None)

The recommended manga by other users.

related_manga class-attribute instance-attribute

related_manga: list[
    RelatedMaterialModel
] | None = attrs.field(default=None)

The other manga that are related to the current manga.

start_date instance-attribute

start_date: datetime

The start date of the Manga publication.

status instance-attribute

status: MangaStatus

The status of the Manga.

synopsis class-attribute instance-attribute

synopsis: str | None = attrs.field(default=None)

The synopsis of the Manga.

title instance-attribute

title: str

The title of the Manga.

updated_at instance-attribute

updated_at: datetime

The date on which the manga was last updated on MAL.

MangaList

Bases: BaseModel

Represents the user manga list model.

Source code in aniwrap/models/user.py
@attrs.define
class MangaList(BaseModel):
    """Represents the user manga list model."""

    manga: Manga
    """Represents the manga details."""

    list_status: MangaListStatus
    """The status details of the manga in the user list."""

list_status instance-attribute

list_status: MangaListStatus

The status details of the manga in the user list.

manga instance-attribute

manga: Manga

Represents the manga details.

MangaListStatus

Bases: BaseModel

Represents the Manga list status model.

Source code in aniwrap/models/user.py
@attrs.define(init=False)
class MangaListStatus(BaseModel):
    """Represents the Manga list status model."""

    status: MangaReadStatus
    """The manga read status in the user list."""

    updated_at: datetime
    """The last updated time."""

    is_rereading: bool = False
    """The rereading status."""

    num_volumes_read: int = 0
    """The number of volumes read in the manga."""

    num_chapters_read: int = 0
    """The number of chapters read in the manga."""

    score: int = 0
    """The score of the manga."""

    start_date: datetime | None = attrs.field(default=None)
    """The date on which the user started reading the manga."""

    finish_date: datetime | None = attrs.field(default=None)
    """The date on which the user finished reading the manga."""

finish_date class-attribute instance-attribute

finish_date: datetime | None = attrs.field(default=None)

The date on which the user finished reading the manga.

is_rereading class-attribute instance-attribute

is_rereading: bool = False

The rereading status.

num_chapters_read class-attribute instance-attribute

num_chapters_read: int = 0

The number of chapters read in the manga.

num_volumes_read class-attribute instance-attribute

num_volumes_read: int = 0

The number of volumes read in the manga.

score class-attribute instance-attribute

score: int = 0

The score of the manga.

start_date class-attribute instance-attribute

start_date: datetime | None = attrs.field(default=None)

The date on which the user started reading the manga.

status instance-attribute

status: MangaReadStatus

The manga read status in the user list.

updated_at instance-attribute

updated_at: datetime

The last updated time.

MangaListUpdate

Bases: BaseModel

Represents different params present in manga list update.

Source code in aniwrap/models/user.py
@attrs.define(init=False)
class MangaListUpdate(BaseModel):
    """Represents different params present in manga list update."""

    status: MangaReadStatus
    """The manga read status in the manga list."""

    updated_at: datetime
    """The last updated time."""

    score: int = 0
    """The score of the manga in the list. Defaults to `0`"""

    num_volumes_read: int = 0
    """The number of volumes read in the manga. Defaults to `0`"""

    num_chapters_read: int = 0
    """The number of chapters read in the manga. Defaults to `0`"""

    priority: ListPriority = ListPriority.Low
    """The manga priority in the list."""

    num_times_reread: int = 0
    """The manga reread times."""

    is_rereading: bool = False

    reread_value: MangaRereadValue | None = None

    tags: list[str] | None = None

    comments: str | None = None

num_chapters_read class-attribute instance-attribute

num_chapters_read: int = 0

The number of chapters read in the manga. Defaults to 0

num_times_reread class-attribute instance-attribute

num_times_reread: int = 0

The manga reread times.

num_volumes_read class-attribute instance-attribute

num_volumes_read: int = 0

The number of volumes read in the manga. Defaults to 0

priority class-attribute instance-attribute

priority: ListPriority = ListPriority.Low

The manga priority in the list.

score class-attribute instance-attribute

score: int = 0

The score of the manga in the list. Defaults to 0

status instance-attribute

status: MangaReadStatus

The manga read status in the manga list.

updated_at instance-attribute

updated_at: datetime

The last updated time.

MangaRanking

Bases: BaseModel

Represents all the fields that contain in Manga Ranking result.

Source code in aniwrap/models/manga.py
@attrs.define
class MangaRanking(BaseModel):
    """Represents all the fields that contain in Manga Ranking result."""

    manga_data: Manga
    """Represents all the manga details."""

    ranking: RankingModel
    """Represents the ranking of the manga in the list."""

manga_data instance-attribute

manga_data: Manga

Represents all the manga details.

ranking instance-attribute

ranking: RankingModel

Represents the ranking of the manga in the list.

OptionalPictureModel

Bases: BaseModel

Represents a model for the picture type fields.

Source code in aniwrap/models/common.py
@attrs.define
class OptionalPictureModel(BaseModel):
    """Represents a model for the picture type fields."""

    medium: str
    """The url for the medium sized picture."""

    large: str
    """The url for the large sized picture"""

large instance-attribute

large: str

The url for the large sized picture

medium instance-attribute

medium: str

The url for the medium sized picture.

PictureModel

Bases: BaseModel

Represents the picture type fields model.

Source code in aniwrap/models/common.py
@attrs.define(init=False)
class PictureModel(BaseModel):
    """Represents the picture type fields model."""

    medium: str
    """The url for the medium sized picture."""

    large: str
    """The url for the large sized picture"""

large instance-attribute

large: str

The url for the large sized picture

medium instance-attribute

medium: str

The url for the medium sized picture.

PostCreator

Bases: BaseModel

Represents post creator model.

Source code in aniwrap/models/forum.py
@attrs.define(init=False)
class PostCreator(BaseModel):
    """Represents post creator model."""

    id: int
    """The Id of the post's author."""

    name: str
    """The name of the post's author."""

    forum_avator: str | None = attrs.field(default=None)
    """The url for the avatar of the post's author."""

forum_avator class-attribute instance-attribute

forum_avator: str | None = attrs.field(default=None)

The url for the avatar of the post's author.

id instance-attribute

id: int

The Id of the post's author.

name instance-attribute

name: str

The name of the post's author.

RankingModel

Bases: BaseModel

Represents the ranking model.

Source code in aniwrap/models/common.py
@attrs.define
class RankingModel(BaseModel):
    """Represents the ranking model."""

    rank: int
    """Represents the rank of the anime in the list."""

rank instance-attribute

rank: int

Represents the rank of the anime in the list.

RecommendationModel

Bases: BaseModel

Represents the recommendation type model.

Source code in aniwrap/models/common.py
@attrs.define
class RecommendationModel(BaseModel):
    """Represents the recommendation type model."""

    node: dict[str, RelatedMaterialNodeModel] | None = attrs.field(default=None)
    """Contains details of the recommended anime/manga."""

    num_recommendations: int | None = attrs.field(default=None)
    """The number of users that recommended this anime/manga."""

node class-attribute instance-attribute

node: dict[
    str, RelatedMaterialNodeModel
] | None = attrs.field(default=None)

Contains details of the recommended anime/manga.

num_recommendations class-attribute instance-attribute

num_recommendations: int | None = attrs.field(default=None)

The number of users that recommended this anime/manga.

RelatedMaterialModel

Bases: BaseModel

Represents related anime/manga model.

Source code in aniwrap/models/common.py
@attrs.define
class RelatedMaterialModel(BaseModel):
    """Represents related anime/manga model."""

    node: RelatedMaterialNodeModel | None = attrs.field(default=None)
    """Contains details of the related anime/manga."""

    relation_type: str | None = attrs.field(default=None)
    """Unformatted representation of the way this anime/manga is related to the parent anime/manga."""

    relation_type_formatted: str | None = attrs.field(default=None)
    """Formatted representation of the way this anime/manga is related to the parent anime/manga."""

node class-attribute instance-attribute

node: RelatedMaterialNodeModel | None = attrs.field(
    default=None
)

Contains details of the related anime/manga.

relation_type class-attribute instance-attribute

relation_type: str | None = attrs.field(default=None)

Unformatted representation of the way this anime/manga is related to the parent anime/manga.

relation_type_formatted class-attribute instance-attribute

relation_type_formatted: str | None = attrs.field(
    default=None
)

Formatted representation of the way this anime/manga is related to the parent anime/manga.

RelatedMaterialNodeModel

Bases: BaseModel

Represents individual node of the related material model.

Source code in aniwrap/models/common.py
@attrs.define
class RelatedMaterialNodeModel(BaseModel):
    """Represents individual node of the related material model."""

    id: int | None = attrs.field(default=None)
    """The id of the related anime/manga."""

    title: str | None = attrs.field(default=None)
    """The title of the related anime/manga."""

    main_picture: OptionalPictureModel | None = attrs.field(default=None)
    """The urls for medium and large sized pictures of the posters of the related anime/manga."""

id class-attribute instance-attribute

id: int | None = attrs.field(default=None)

The id of the related anime/manga.

main_picture class-attribute instance-attribute

main_picture: OptionalPictureModel | None = attrs.field(
    default=None
)

The urls for medium and large sized pictures of the posters of the related anime/manga.

title class-attribute instance-attribute

title: str | None = attrs.field(default=None)

The title of the related anime/manga.

Route

Represents route details.

Source code in aniwrap/models/route.py
@attrs.define
class Route:
    """Represents route details."""

    method: str
    """The type of request."""

    uri: str
    """The request uri."""

    def generate_route(self, *args: str | int) -> GenerateRoute:
        """Generate route.

        Args:
            *args: the arguments to insert.

        Returns:

        """
        generated_route = GenerateRoute(self)

        for arg in args:
            generated_route.uri = generated_route.uri.replace(r"()", str(arg), 1)

        return generated_route

method instance-attribute

method: str

The type of request.

uri instance-attribute

uri: str

The request uri.

generate_route

generate_route(*args: str | int) -> GenerateRoute

Generate route.

Parameters:

Name Type Description Default
*args str | int

the arguments to insert.

()

Returns:

Source code in aniwrap/models/route.py
def generate_route(self, *args: str | int) -> GenerateRoute:
    """Generate route.

    Args:
        *args: the arguments to insert.

    Returns:

    """
    generated_route = GenerateRoute(self)

    for arg in args:
        generated_route.uri = generated_route.uri.replace(r"()", str(arg), 1)

    return generated_route

Season

Bases: BaseModel

Represents the model for anime season details.

Source code in aniwrap/models/anime.py
@attrs.define
class Season(BaseModel):
    """Represents the model for anime season details."""

    year: str
    """The year."""

    season: AnimeSeason
    """The season."""

season instance-attribute

season: AnimeSeason

The season.

year instance-attribute

year: str

The year.

Serialization

Bases: BaseModel

Represents the model for serialization.

Source code in aniwrap/models/manga.py
@attrs.define
class Serialization(BaseModel):
    """Represents the model for serialization."""

    node: CommonModel
    """Contains the id and name of the serialization."""

node instance-attribute

node: CommonModel

Contains the id and name of the serialization.

TitlesModel

Bases: BaseModel

Represents the model for alternative title fields.

Source code in aniwrap/models/common.py
@attrs.define(init=False)
class TitlesModel(BaseModel):
    """Represents the model for alternative title fields."""

    synonyms: list(str)
    """Synonyms of the title of Anime/Manga."""

    en: str
    """The English title of the Anime/Manga"""

    ja: str
    """The Japanese title of the Anime/Manga"""

en instance-attribute

en: str

The English title of the Anime/Manga

ja instance-attribute

ja: str

The Japanese title of the Anime/Manga

synonyms instance-attribute

synonyms: list(str)

Synonyms of the title of Anime/Manga.