Skip to content

Commit

Permalink
add ShopCategory enum and update ShopData model to use it
Browse files Browse the repository at this point in the history
  • Loading branch information
staciax committed Dec 29, 2024
1 parent ed0f38d commit 58e5f0b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 3 deletions.
2 changes: 2 additions & 0 deletions valorant/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
RelationType,
RewardType,
SeasonType,
ShopCategory,
WeaponCategory,
)
from .errors import BadRequest, Forbidden, HTTPException, InternalServerError, RateLimited, ValorantError
Expand All @@ -44,6 +45,7 @@
'RelationType',
'RewardType',
'SeasonType',
'ShopCategory',
'ValorantError',
'WeaponCategory',
'models',
Expand Down
11 changes: 11 additions & 0 deletions valorant/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
'RelationType',
'RewardType',
'SeasonType',
'ShopCategory',
'WeaponCategory',
)

Expand Down Expand Up @@ -113,6 +114,16 @@ class SeasonType(str, Enum):
act = 'EAresSeasonType::Act'


class ShopCategory(str, Enum):
armor = 'Armor'
pistols = 'Pistols'
smgs = 'SMGs'
shotguns = 'Shotguns'
heavy_weapons = 'Heavy Weapons'
rifles = 'Rifles'
sniper_rifles = 'Sniper Rifles'


class WeaponCategory(str, Enum):
melee = 'EEquippableCategory::Melee'
sidearm = 'EEquippableCategory::Sidearm'
Expand Down
3 changes: 2 additions & 1 deletion valorant/models/gear.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

from pydantic import Field

from ..enums import ShopCategory
from .base import BaseModel, BaseUUIDModel, LocalizedField

__all__ = (
Expand All @@ -42,7 +43,7 @@ class Detail(BaseModel):

class ShopData(BaseModel):
cost: int
category: str
category: ShopCategory
shop_order_priority: int = Field(alias='shopOrderPriority')
category_text: LocalizedField = Field(alias='categoryText')
grid_position: Any = Field(alias='gridPosition')
Expand Down
4 changes: 2 additions & 2 deletions valorant/models/weapons.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

from pydantic import Field

from ..enums import WeaponCategory
from ..enums import ShopCategory, WeaponCategory
from .base import BaseModel, BaseUUIDModel, LocalizedField

__all__ = (
Expand Down Expand Up @@ -91,7 +91,7 @@ class GridPosition(BaseModel):

class ShopData(BaseModel):
cost: int
category: str
category: ShopCategory
shop_order_priority: int = Field(alias='shopOrderPriority')
category_text: LocalizedField = Field(alias='categoryText')
grid_position: GridPosition | None = Field(alias='gridPosition')
Expand Down

0 comments on commit 58e5f0b

Please sign in to comment.