Coverage for src/lanraragi_api/entity/tankoubon.py: 95%
22 statements
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-22 23:20 +0000
« prev ^ index » next coverage.py v7.16.0, created at 2026-09-22 23:20 +0000
1from pydantic import AliasChoices, BaseModel, Field
3from lanraragi_api.entity.archive import ArchiveMetadata
4from lanraragi_api.entity.base import DictLikeModel
7class TankoubonMetadata(BaseModel):
8 """Metadata of a single Tankoubon.
10 Tankoubon metadata as returned by the list endpoint, with the archive IDs
11 it contains and optional full archive metadata.
13 Attributes:
14 archives: Array of archive IDs contained in this Tankoubon.
15 full_data: Archive metadata of the archives, filled by the full detail
16 endpoint only.
17 tankid: ID of the tankoubon.
18 name: Name of the tankoubon.
19 summary: Summary of the tankoubon.
20 tags: Tags associated with the tankoubon.
21 progress: Reading progress (page number) for this Tankoubon.
22 """
24 archives: list[str] = Field(...)
25 full_data: list[ArchiveMetadata] | None = Field(default=None)
26 tankid: str = Field(..., validation_alias=AliasChoices("tankid", "id"))
27 name: str = Field(...)
28 summary: str | None = Field(default=None)
29 tags: str | None = Field(default=None)
30 progress: int | None = Field(default=None)
32 @property
33 def id(self) -> str:
34 """Return the ID of the tankoubon.
36 This is a backward-compatible alias for the ``tankid`` field.
38 Returns:
39 str: ID of the tankoubon.
40 """
41 return self.tankid
44class TankoubonListResponse(DictLikeModel):
45 """Paginated list of Tankoubons returned by the list endpoint.
47 Attributes:
48 result: Tankoubons of the current page.
49 total: Total count of Tankoubons on the server.
50 filtered: Number of Tankoubons on the current page.
51 """
53 result: list[TankoubonMetadata] = Field(default_factory=list)
54 total: int | None = Field(default=None)
55 filtered: int | None = Field(default=None)
58class TankoubonDetailResponse(DictLikeModel):
59 """Tankoubon returned by the full detail endpoint.
61 Attributes:
62 result: Tankoubon metadata, with ``full_data`` filled in.
63 total: Total amount of archives in this Tankoubon.
64 filtered: Amount of archives in the current page.
65 """
67 result: TankoubonMetadata = Field(...)
68 total: int | None = Field(default=None)
69 filtered: int | None = Field(default=None)