pokelance.ext.game
⚓︎
Game(client)
⚓︎
Bases: BaseExtension
Extension for game related endpoints.
Attributes: |
|
---|
Initializes the extension.
Parameters: |
|
---|
Returns: |
|
---|
Source code in pokelance/ext/_base.py
fetch_generation(name)
async
⚓︎
Fetches a generation from the API.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... generation = await client.game.fetch_generation(1)
... print(generation.id)
... await client.close()
>>> asyncio.run(main())
1
Source code in pokelance/ext/game.py
fetch_pokedex(name)
async
⚓︎
Fetches a pokedex from the API.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... pokedex = await client.game.fetch_pokedex(1)
... print(pokedex.region)
... await client.close()
>>> asyncio.run(main())
None
Source code in pokelance/ext/game.py
fetch_version(name)
async
⚓︎
Fetches a version from the API.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... version = await client.game.fetch_version(1)
... print(version.name)
... await client.close()
>>> asyncio.run(main())
red
Source code in pokelance/ext/game.py
fetch_version_group(name)
async
⚓︎
Fetches a version group from the API.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... version_group = await client.game.fetch_version_group(1)
... print(version_group.id)
... await client.close()
>>> asyncio.run(main())
1
Source code in pokelance/ext/game.py
get_generation(name)
⚓︎
Gets a generation from the cache.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> generation = client.game.get_generation(1)
>>> generation.id
1
Source code in pokelance/ext/game.py
get_message(case, data)
staticmethod
⚓︎
Gets the error message for a resource not found error.
Parameters: |
---|
Returns: |
|
---|
Source code in pokelance/ext/_base.py
get_pokedex(name)
⚓︎
Gets a pokedex from the cache.
Parameters: |
---|
Returns: |
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> pokedex = client.game.get_pokedex(1)
>>> pokedex.region
None
Source code in pokelance/ext/game.py
get_version(name)
⚓︎
Gets a version from the cache.
Parameters: |
---|
Returns: |
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> version = client.game.get_version(1)
>>> version.name
'red'
Source code in pokelance/ext/game.py
get_version_group(name)
⚓︎
Gets a version group from the cache.
Parameters: |
---|
Returns: |
|
---|
Raises: |
|
---|
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> version_group = client.game.get_version_group(1)
>>> version_group.id
1
Source code in pokelance/ext/game.py
setup()
async
⚓︎
Sets up the extension.