Source code for wow._sync.resources.guild

 1# Generated by scripts/unasync.py from src/wow/_async/resources/guild.py. Do not edit.
 2"""Routes of the Guild API."""
 3
 4from urllib.parse import quote
 5
 6from wow._sync._resource import Resource
 7from wow.models.guild import Guild, GuildRoster
 8
 9__all__ = ["Guilds"]
10
11
12def _path(slug: str, document: str = "") -> str:
13    return f"/data/wow/guild/{quote(slug.lower(), safe='')}{document}"
14
15
[docs] 16class Guilds(Resource): 17 """``client.guilds``: any guild and its roster. An app token is enough. 18 19 Each method takes the guild's slug, such as ``sidequest``: its name in lowercase, with spaces as hyphens. 20 """ 21 22 __slots__ = () 23
[docs] 24 def get(self, slug: str) -> Guild: 25 """Get a guild's faction, ruleset and size.""" 26 return self._get("profile", _path(slug), Guild)
27
[docs] 28 def roster(self, slug: str) -> GuildRoster: 29 """Get every member of a guild, with their rank, level, class and race.""" 30 return self._get("profile", _path(slug, "/roster"), GuildRoster)