Module genshin.models.hoyolab.web_event

Classes

class WebEvent (**data: Any)
Expand source code
class WebEvent(APIModel):
    """Hoyolab web event model."""

    id: int
    name: str
    description: str = Aliased("desc")

    start_time: datetime.datetime = Aliased("start")
    end_time: datetime.datetime = Aliased("end")
    create_time: datetime.datetime = Aliased("create_at")

    web_path: str
    app_path: str

    banner: str = Aliased("banner_url")
    status: int

    @property
    def url(self) -> str:
        if "https" in self.web_path:
            return self.web_path
        return f"https://www.hoyolab.com{self.web_path}"

Hoyolab web event model.

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 app_path : str
var banner : str
var create_time : datetime.datetime
var description : str
var end_time : datetime.datetime
var id : int
var model_config : pydantic.config.ConfigDict
var name : str
var start_time : datetime.datetime
var status : int
var web_path : str

Instance variables

prop url : str
Expand source code
@property
def url(self) -> str:
    if "https" in self.web_path:
        return self.web_path
    return f"https://www.hoyolab.com{self.web_path}"