1"""Routes of the Quest API."""
2
3from wow._async._resource import AsyncResource
4from wow.models.quest import (
5 Quest,
6 QuestArea,
7 QuestAreaIndex,
8 QuestCategory,
9 QuestCategoryIndex,
10 QuestType,
11 QuestTypeIndex,
12)
13
14__all__ = ["AsyncQuestAreas", "AsyncQuestCategories", "AsyncQuestTypes", "AsyncQuests"]
15
16
[docs]
17class AsyncQuests(AsyncResource):
18 """``client.quests``: individual quests."""
19
20 __slots__ = ()
21
[docs]
22 async def get(self, quest_id: int) -> Quest:
23 """Get one quest by id."""
24 return await self._get("static", f"/data/wow/quest/{quest_id}", Quest)
25
26
[docs]
27class AsyncQuestAreas(AsyncResource):
28 """``client.quest_areas``: the zones quests take place in."""
29
30 __slots__ = ()
31
[docs]
32 async def index(self) -> QuestAreaIndex:
33 """List every quest area."""
34 return await self._get("static", "/data/wow/quest/area/index", QuestAreaIndex)
35
[docs]
36 async def get(self, area_id: int) -> QuestArea:
37 """Get one quest area and its quests by id."""
38 return await self._get("static", f"/data/wow/quest/area/{area_id}", QuestArea)
39
40
[docs]
41class AsyncQuestCategories(AsyncResource):
42 """``client.quest_categories``: quest groupings such as Epic or Seasonal."""
43
44 __slots__ = ()
45
[docs]
46 async def index(self) -> QuestCategoryIndex:
47 """List every quest category."""
48 return await self._get("static", "/data/wow/quest/category/index", QuestCategoryIndex)
49
[docs]
50 async def get(self, category_id: int) -> QuestCategory:
51 """Get one quest category and its quests by id."""
52 return await self._get("static", f"/data/wow/quest/category/{category_id}", QuestCategory)
53
54
[docs]
55class AsyncQuestTypes(AsyncResource):
56 """``client.quest_types``: quest kinds such as Elite, PvP or Raid."""
57
58 __slots__ = ()
59
[docs]
60 async def index(self) -> QuestTypeIndex:
61 """List every quest type."""
62 return await self._get("static", "/data/wow/quest/type/index", QuestTypeIndex)
63
[docs]
64 async def get(self, type_id: int) -> QuestType:
65 """Get one quest type and its quests by id."""
66 return await self._get("static", f"/data/wow/quest/type/{type_id}", QuestType)