Source code for wow._async.resources.talent

 1"""Routes of the Talent and Talent Tree APIs."""
 2
 3from wow._async._resource import AsyncResource
 4from wow.models.talent import Talent, TalentIndex, TalentTree, TalentTreeIndex
 5
 6__all__ = ["AsyncTalentTrees", "AsyncTalents"]
 7
 8
[docs] 9class AsyncTalents(AsyncResource): 10 """``client.talents``: individual talents across every class and specialization.""" 11 12 __slots__ = () 13
[docs] 14 async def index(self) -> TalentIndex: 15 """List every talent.""" 16 return await self._get("static", "/data/wow/talent/index", TalentIndex)
17
[docs] 18 async def get(self, talent_id: int) -> Talent: 19 """Get one talent by id.""" 20 return await self._get("static", f"/data/wow/talent/{talent_id}", Talent)
21 22
[docs] 23class AsyncTalentTrees(AsyncResource): 24 """``client.talent_trees``: class and specialization talent trees.""" 25 26 __slots__ = () 27
[docs] 28 async def index(self) -> TalentTreeIndex: 29 """List every class and specialization talent tree.""" 30 return await self._get("static", "/data/wow/talent-tree/index", TalentTreeIndex)
31
[docs] 32 async def get(self, tree_id: int, specialization_id: int) -> TalentTree: 33 """Get one specialization's talent tree by its class tree id and specialization id.""" 34 return await self._get( 35 "static", 36 f"/data/wow/talent-tree/{tree_id}/playable-specialization/{specialization_id}", 37 TalentTree, 38 )