Module genshin.models.hoyolab.record
Base hoyolab APIModels.
Classes
class FullHoyolabUser (**data: Any)
-
Full hoyolab user.
Not actually full, but most of the data is useless.
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 allowself
as a field name.Expand source code
class FullHoyolabUser(PartialHoyolabUser): """Full hoyolab user. Not actually full, but most of the data is useless. """ certification: typing.Optional[HoyolabUserCertification] = None level: typing.Optional[HoyolabUserLevel] = None pendant_url: str = Aliased("pendant") bg_url: typing.Optional[str] = None pc_bg_url: typing.Optional[str] = None
Ancestors
- PartialHoyolabUser
- APIModel
- pydantic.main.BaseModel
Class variables
var bg_url : Optional[str]
var certification : Optional[HoyolabUserCertification]
var level : Optional[HoyolabUserLevel]
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var pc_bg_url : Optional[str]
var pendant_url : str
class Gender (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
Gender used on hoyolab.
Expand source code
class Gender(enum.IntEnum): """Gender used on hoyolab.""" unknown = 0 male = 1 female = 2 other = 3
Ancestors
- enum.IntEnum
- builtins.int
- enum.Enum
Class variables
var female
var male
var other
var unknown
class GenshinAccount (**data: Any)
-
Genshin account.
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 allowself
as a field name.Expand source code
class GenshinAccount(APIModel): """Genshin account.""" game_biz: str uid: int = Aliased("game_uid") level: int nickname: str server: str = Aliased("region") server_name: str = Aliased("region_name") @property def game(self) -> types.Game: if "hk4e" in self.game_biz: return types.Game.GENSHIN if "bh3" in self.game_biz: return types.Game.HONKAI if "hkrpg" in self.game_biz: return types.Game.STARRAIL if "nap" in self.game_biz: return types.Game.ZZZ if "nxx" in self.game_biz: return types.Game.TOT try: return types.Game(self.game_biz) except ValueError: return self.game_biz # type: ignore
Ancestors
- APIModel
- pydantic.main.BaseModel
Subclasses
Class variables
var game_biz : str
var level : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var nickname : str
var server : str
var server_name : str
var uid : int
Instance variables
prop game : types.Game
-
Expand source code
@property def game(self) -> types.Game: if "hk4e" in self.game_biz: return types.Game.GENSHIN if "bh3" in self.game_biz: return types.Game.HONKAI if "hkrpg" in self.game_biz: return types.Game.STARRAIL if "nap" in self.game_biz: return types.Game.ZZZ if "nxx" in self.game_biz: return types.Game.TOT try: return types.Game(self.game_biz) except ValueError: return self.game_biz # type: ignore
class HoyolabUserCertification (**data: Any)
-
Hoyolab user certification.
For example artist's type is 2.
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 allowself
as a field name.Expand source code
class HoyolabUserCertification(APIModel): """Hoyolab user certification. For example artist's type is 2. """ icon_url: typing.Optional[str] = None description: typing.Optional[str] = Aliased("desc", default=None) type: int
Ancestors
- APIModel
- pydantic.main.BaseModel
Class variables
var description : Optional[str]
var icon_url : Optional[str]
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var type : int
class HoyolabUserLevel (**data: Any)
-
Hoyolab user level.
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 allowself
as a field name.Expand source code
class HoyolabUserLevel(APIModel): """Hoyolab user level.""" level: int exp: int level_desc: str bg_color: str bg_image: str
Ancestors
- APIModel
- pydantic.main.BaseModel
Class variables
var bg_color : str
var bg_image : str
var exp : int
var level : int
var level_desc : str
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
class PartialHoyolabUser (**data: Any)
-
Partial hoyolab user from a search 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 allowself
as a field name.Expand source code
class PartialHoyolabUser(APIModel): """Partial hoyolab user from a search result.""" hoyolab_id: int = Aliased("uid") nickname: str introduction: str = Aliased("introduce") avatar_id: int = Aliased("avatar") gender: Gender icon: str = Aliased("avatar_url") @pydantic.field_validator("nickname") def __remove_highlight(cls, v: str) -> str: return re.sub(r"<.+?>", "", v)
Ancestors
- APIModel
- pydantic.main.BaseModel
Subclasses
Class variables
var avatar_id : int
var gender : Gender
var hoyolab_id : int
var icon : str
var introduction : str
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var nickname : str
class RecordCard (**data: Any)
-
Hoyolab record card.
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 allowself
as a field name.Expand source code
class RecordCard(GenshinAccount): """Hoyolab record card.""" def __new__(cls, **kwargs: typing.Any) -> RecordCard: """Create the appropriate record card.""" game_id = kwargs.get("game_id", 0) if game_id == 1: cls = HonkaiRecordCard elif game_id == 2: cls = GenshinRecordCard elif game_id == 6: cls = StarRailRecodeCard elif game_id == 8: cls = ZZZRecordCard return super().__new__(cls) # type: ignore game_id: int game_biz: str = "" game_name: str game_logo: str = Aliased("logo") uid: int = Aliased("game_role_id") data: typing.Sequence[RecordCardData] settings: typing.Sequence[RecordCardSetting] = Aliased("data_switches") public: bool = Aliased("is_public") background_image: str has_uid: bool = Aliased("has_role") url: str def as_dict(self) -> dict[str, typing.Any]: """Return data as a dictionary.""" return {d.name: (int(d.value) if d.value.isdigit() else d.value) for d in self.data}
Ancestors
- GenshinAccount
- APIModel
- pydantic.main.BaseModel
Subclasses
- genshin.models.hoyolab.record.GenshinRecordCard
- genshin.models.hoyolab.record.HonkaiRecordCard
- genshin.models.hoyolab.record.StarRailRecodeCard
- genshin.models.hoyolab.record.ZZZRecordCard
Class variables
var background_image : str
var data : Sequence[RecordCardData]
var game_biz : str
var game_id : int
var game_logo : str
var game_name : str
var has_uid : bool
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var public : bool
var settings : Sequence[RecordCardSetting]
var uid : int
var url : str
Methods
def as_dict(self) ‑> dict[str, typing.Any]
-
Return data as a dictionary.
class RecordCardData (**data: Any)
-
Data entry of a record card.
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 allowself
as a field name.Expand source code
class RecordCardData(APIModel): """Data entry of a record card.""" name: str value: str
Ancestors
- APIModel
- pydantic.main.BaseModel
Class variables
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var name : str
var value : str
class RecordCardSetting (**data: Any)
-
Privacy setting of a record card.
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 allowself
as a field name.Expand source code
class RecordCardSetting(APIModel, Unique): """Privacy setting of a record card.""" id: int = Aliased("switch_id") description: str = Aliased("switch_name") public: bool = Aliased("is_public")
Ancestors
Class variables
var description : str
var id : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var public : bool
class RecordCardSettingType (value, names=None, *, module=None, qualname=None, type=None, start=1)
-
Privacy setting of a record card.
Expand source code
class RecordCardSettingType(enum.IntEnum): """Privacy setting of a record card.""" SHOW_CHRONICLE = 1 SHOW_CHARACTER_DETAILS = 2 ENABLE_REAL_TIME_NOTES = 3
Ancestors
- enum.IntEnum
- builtins.int
- enum.Enum
Class variables
var ENABLE_REAL_TIME_NOTES
var SHOW_CHARACTER_DETAILS
var SHOW_CHRONICLE
class UserInfo (**data: Any)
-
Chronicle user 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 allowself
as a field name.Expand source code
class UserInfo(APIModel): """Chronicle user info.""" nickname: str server: str = Aliased("region") level: int icon: str = Aliased("AvatarUrl")
Ancestors
- APIModel
- pydantic.main.BaseModel
Class variables
var icon : str
var level : int
var model_computed_fields
var model_config : pydantic.config.ConfigDict
var model_fields
var nickname : str
var server : str