Skip to content

models

Module for exporting all the models used in the library.

BaseCharacter

Bases: BaseModel

Represents base character model.

Source code in barch\models\character.py
@attrs.define(init=False)
class BaseCharacter(BaseModel):
    """Represents base character model."""

    name: str
    """Name of the character."""

    profile: str
    """Profile description of the character."""

    rarity: Rarity
    """Rarity of the character."""

    base_star: int
    """Base star."""

    position: Position
    """Position of the character."""

    role: Role
    """Role of the character."""

    armor_type: str
    """Armor type of the character."""

    bullet_type: str
    """Bullet type of the character."""

    weapon_type: str
    """Weapon type of the character."""

    squad_type: str
    """Squad type."""

armor_type instance-attribute

armor_type: str

Armor type of the character.

base_star instance-attribute

base_star: int

Base star.

bullet_type instance-attribute

bullet_type: str

Bullet type of the character.

name instance-attribute

name: str

Name of the character.

position instance-attribute

position: Position

Position of the character.

profile instance-attribute

profile: str

Profile description of the character.

rarity instance-attribute

rarity: Rarity

Rarity of the character.

role instance-attribute

role: Role

Role of the character.

squad_type instance-attribute

squad_type: str

Squad type.

weapon_type instance-attribute

weapon_type: str

Weapon type of the character.

Character

Bases: BaseCharacter

Represents character model.

Source code in barch\models\character.py
@attrs.define(init=False)
class Character(BaseCharacter):
    """Represents character model."""

    id: int
    """Id of the character."""

    school: str
    """The school to which the character belongs to."""

    terrain: Terrain
    """The terrain details."""

id instance-attribute

id: int

Id of the character.

school instance-attribute

school: str

The school to which the character belongs to.

terrain instance-attribute

terrain: Terrain

The terrain details.

CharacterDetails

Bases: BaseModel

Represents Character Details model.

Source code in barch\models\character.py
@attrs.define(init=False)
class CharacterDetails(BaseModel):
    """Represents Character Details model."""

    id: int

    is_released: bool

    is_playable: bool

    character: BaseCharacter

    info: CharacterInfo

    image: Image

    stat: Stats

    terrain: Terrain

    skills: Skills

CharacterInfo

Bases: BaseModel

Represents CharacterInfo model.

Source code in barch\models\character.py
@attrs.define(init=False)
class CharacterInfo(BaseModel):
    """Represents CharacterInfo model."""

    age: int
    # TODO: string to int
    """The age of the character."""

    birth_date: str
    """The birth date of the character."""

    height: str
    """The height of the character."""

    artist: str
    """The designer or illustrator of the character."""

    club: str
    """The club to which the character belongs."""

    school: str
    """The school to which the character belongs."""

    school_year: str
    """The school year of the character."""

    voice_actor: str
    """The voice actor of the character."""

age instance-attribute

age: int

The age of the character.

artist instance-attribute

artist: str

The designer or illustrator of the character.

birth_date instance-attribute

birth_date: str

The birth date of the character.

club instance-attribute

club: str

The club to which the character belongs.

height instance-attribute

height: str

The height of the character.

school instance-attribute

school: str

The school to which the character belongs.

school_year instance-attribute

school_year: str

The school year of the character.

voice_actor instance-attribute

voice_actor: str

The voice actor of the character.

Characters

Bases: BaseModel

Represents Characters model.

Source code in barch\models\character.py
@attrs.define
class Characters(BaseModel):
    """Represents Characters model."""

    id: int

    name: str

CommonModel

Bases: BaseModel

Represents a CommonModel model which is used in multiple classes.

Source code in barch\models\character.py
@attrs.define
class CommonModel(BaseModel):
    """Represents a CommonModel model which is used in multiple classes."""

    id: int

    name: str

    description: str

GenerateRoute

Source code in barch\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 barch\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 barch\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 error response.

Source code in barch\models\http.py
@attrs.define()
class HttpErrorResponse(BaseModel):
    """Represents HTTP error response."""

    status: int
    """HTTP error status code."""

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

message instance-attribute

message: str

The error response message.

status instance-attribute

status: int

HTTP error status code.

HttpSuccessResponse

Bases: BaseModel

Represents HTTP sucess response.

Source code in barch\models\http.py
@attrs.define()
class HttpSuccessResponse(BaseModel):
    """Represents HTTP sucess response."""

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

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

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

data instance-attribute

data: Any

The JSON API response.

message instance-attribute

message: str

The success response message.

status instance-attribute

status: int

The HTTP status code.

Image

Bases: BaseModel

Represents image model.

Source code in barch\models\character.py
@attrs.define
class Image(BaseModel):
    """Represents image model."""

    icon: str

    lobby: str

    portrait: str

Raid

Bases: BaseModel

Represents Raid model which contains individual raid details..

Source code in barch\models\raid.py
@attrs.define(init=False)
class Raid(BaseModel):
    """Represents Raid model which contains individual raid details.."""

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

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

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

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

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

Raids

Bases: BaseModel

Represents Raids model.

Source code in barch\models\raid.py
@attrs.define(init=False)
class Raids(BaseModel):
    """Represents Raids model."""

    current: list[Raid] | None = attrs.field(default=None)

    upcoming: list[Raid] | None = attrs.field(default=None)

    ended: list[Raid] | None = attrs.field(default=None)

Route

The route model.

Source code in barch\models\route.py
@attrs.define
class Route:
    """The route model."""

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

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

    def generate_route(self, *args: str | int) -> GenerateRoute:
        """Method to create a route with all the necessary data.

        Args:
            *args: the arguments to insert."""

        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 http method of request.

uri instance-attribute

uri: str

The request uri.

generate_route

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

Method to create a route with all the necessary data.

Parameters:

Name Type Description Default
*args str | int

the arguments to insert.

()
Source code in barch\models\route.py
def generate_route(self, *args: str | int) -> GenerateRoute:
    """Method to create a route with all the necessary data.

    Args:
        *args: the arguments to insert."""

    generated_route = GenerateRoute(self)

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

    return generated_route

Skills

Bases: BaseModel

Represents Skills model.

Source code in barch\models\character.py
@attrs.define(init=False)
class Skills(BaseModel):
    """Represents Skills model."""

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

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

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

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

Stats

Bases: BaseModel

Represents Stats model.

Source code in barch\models\character.py
@attrs.define(init=False)
class Stats(BaseModel):
    """Represents Stats model."""

    id: int

    attack_level1: int

    attack_level100: int

    max_hp_level1: int

    max_hp_level100: int

    defense_level1: int

    defense_level100: int

    heal_power_level1: int

    heal_power_level100: int

    def_penetrate_level1: int

    def_penetrate_level100: int

    ammo_count: int

    ammo_cost: int

    range: int

    move_speed: int

    street_mood: str

    outdoor_mood: str

    indoor_mood: str

Terrain

Bases: BaseModel

Represents Terrain model.

Source code in barch\models\character.py
@attrs.define(init=False)
class Terrain(BaseModel):
    """Represents Terrain model."""

    urban: TerrainDetails

    outdoor: TerrainDetails

    indoor: TerrainDetails

TerrainDetails

Bases: BaseModel

Represents TerrainDetails model.

Source code in barch\models\character.py
@attrs.define
class TerrainDetails(BaseModel):
    """Represents TerrainDetails model."""

    damage_dealt: str

    shield_block_rate: str