Module genshin.models.hoyolab.accompany

Classes

class AccompanyCharacter (**data: Any)
Expand source code
class AccompanyCharacter(APIModel):
    """Accompany character."""

    info: AccompanyCharacterInfo = Aliased("basic")
    profile: AccompanyCharacterProfile = Aliased("attr_profile")
    attribute_ids: Sequence[int]

Accompany character.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var attribute_ids : Sequence[int]
var infoAccompanyCharacterInfo
var model_config : pydantic.config.ConfigDict
var profileAccompanyCharacterProfile
class AccompanyCharacterAttribute (**data: Any)
Expand source code
class AccompanyCharacterAttribute(APIModel):
    """Accompany character attribute."""

    id: int
    icon: str = Aliased("icon_url")
    corner_icon: str = Aliased("corner_icon_url")

Accompany character attribute.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var corner_icon : str
var icon : str
var id : int
var model_config : pydantic.config.ConfigDict
class AccompanyCharacterGame (**data: Any)
Expand source code
class AccompanyCharacterGame(APIModel):
    """Accompany character game."""

    attributes: Sequence[Sequence[AccompanyCharacterAttribute]] = Aliased("attribute_group_list")
    id: int = Aliased("game_id")
    icon: str = Aliased("game_icon")
    characters: Sequence[AccompanyCharacter] = Aliased("role_list")

    @field_validator("attributes", mode="before")
    def __unnest_attributes(cls, v: list[dict[str, Any]]) -> list[list[dict[str, Any]]]:
        return [group["attribute_list"] for group in v]

    @property
    def game(self) -> types.Game:
        if self.id == 2:
            return types.Game.GENSHIN
        if self.id == 6:
            return types.Game.STARRAIL
        if self.id == 8:
            return types.Game.ZZZ

        raise ValueError(f"Unknown game ID: {self.id}")

Accompany character game.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var attributes : Sequence[Sequence[AccompanyCharacterAttribute]]
var characters : Sequence[AccompanyCharacter]
var icon : str
var id : int
var model_config : pydantic.config.ConfigDict

Instance variables

prop gameGame
Expand source code
@property
def game(self) -> types.Game:
    if self.id == 2:
        return types.Game.GENSHIN
    if self.id == 6:
        return types.Game.STARRAIL
    if self.id == 8:
        return types.Game.ZZZ

    raise ValueError(f"Unknown game ID: {self.id}")
class AccompanyCharacterInfo (**data: Any)
Expand source code
class AccompanyCharacterInfo(APIModel):
    """Accompany character info."""

    role_id: int
    game_id: int
    name: str
    brief_name: str
    topic_id: int
    game_name: str

Accompany character info.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var brief_name : str
var game_id : int
var game_name : str
var model_config : pydantic.config.ConfigDict
var name : str
var role_id : int
var topic_id : int
class AccompanyCharacterProfile (**data: Any)
Expand source code
class AccompanyCharacterProfile(APIModel):
    """Accompany character color and images."""

    card_color: str
    bg_dark_color: str
    bg_light_color: str
    bg_card_color: str

    card_image: str = Aliased("card_img_url")
    video: str = Aliased("full_screen_video_265")
    icon: str = Aliased("icon_url")

Accompany character color and images.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var bg_card_color : str
var bg_dark_color : str
var bg_light_color : str
var card_color : str
var card_image : str
var icon : str
var model_config : pydantic.config.ConfigDict
var video : str
class AccompanyResult (**data: Any)
Expand source code
class AccompanyResult(APIModel):
    """Accompany result."""

    accompany_days: int
    points_increased: int = Aliased("increase_accompany_point")

Accompany result.

Create a new model by parsing and validating input data from keyword arguments.

Raises [ValidationError][pydantic_core.ValidationError] if the input data cannot be validated to form a valid model.

self is explicitly positional-only to allow self as a field name.

Ancestors

Class variables

var accompany_days : int
var model_config : pydantic.config.ConfigDict
var points_increased : int