move
pokelance.ext.move
⚓︎
Move(client)
⚓︎
Bases: BaseExtension
Extension for move related endpoints.
Attributes:
Name | Type | Description |
---|---|---|
cache |
Move
|
The cache for this extension. |
Initializes the extension.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
client |
HttpClient
|
The client to use for requests. |
required |
Source code in pokelance/ext/_base.py
Python | |
---|---|
fetch_move(name)
async
⚓︎
Fetches a move from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move. |
required |
Returns:
Type | Description |
---|---|
Move
|
The move if it exists in the API, else raises ResourceNotFound. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move does not exist in the API. |
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... move = await client.move.fetch_move(1)
... print(move.name)
... await client.close()
>>> asyncio.run(main())
pound
Source code in pokelance/ext/move.py
fetch_move_ailment(name)
async
⚓︎
Fetches a move ailment from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move ailment. |
required |
Returns:
Type | Description |
---|---|
MoveAilment
|
The move ailment if it exists in the API, else raises ResourceNotFound. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move ailment does not exist in the API. |
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... ailment = await client.move.fetch_move_ailment(1)
... print(ailment.name)
... await client.close()
>>> asyncio.run(main())
paralysis
Source code in pokelance/ext/move.py
fetch_move_battle_style(name)
async
⚓︎
Fetches a move battle style from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move battle style. |
required |
Returns:
Type | Description |
---|---|
MoveBattleStyle
|
The move battle style if it exists in the API, else raises ResourceNotFound. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move battle style does not exist in the API. |
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... style = await client.move.fetch_move_battle_style(1)
... print(style.name)
... await client.close()
>>> asyncio.run(main())
attack
Source code in pokelance/ext/move.py
fetch_move_category(name)
async
⚓︎
Fetches a move category from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move category. |
required |
Returns:
Type | Description |
---|---|
MoveCategory
|
The move category if it exists in the API, else raises ResourceNotFound. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move category does not exist in the API. |
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... category = await client.move.fetch_move_category(1)
... print(category.name)
... await client.close()
>>> asyncio.run(main())
ailment
Source code in pokelance/ext/move.py
fetch_move_damage_class(name)
async
⚓︎
Fetches a move damage class from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move damage class. |
required |
Returns:
Type | Description |
---|---|
MoveDamageClass
|
The move damage class if it exists in the API, else raises ResourceNotFound. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move damage class does not exist in the API. |
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... damage_class = await client.move.fetch_move_damage_class(1)
... print(damage_class.name)
... await client.close()
>>> asyncio.run(main())
status
Source code in pokelance/ext/move.py
fetch_move_learn_method(name)
async
⚓︎
Fetches a move learn method from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move learn method. |
required |
Returns:
Type | Description |
---|---|
MoveLearnMethod
|
The move learn method if it exists in the API, else raises ResourceNotFound. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move learn method does not exist in the API. |
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... learn_method = await client.move.fetch_move_learn_method(1)
... print(learn_method.name)
... await client.close()
>>> asyncio.run(main())
level-up
Source code in pokelance/ext/move.py
fetch_move_target(name)
async
⚓︎
Fetches a move target from the API.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move target. |
required |
Returns:
Type | Description |
---|---|
MoveTarget
|
The move target if it exists in the API, else raises ResourceNotFound. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move target does not exist in the API. |
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
... target = await client.move.fetch_move_target(1)
... print(target.name)
... await client.close()
>>> asyncio.run(main())
specific-pokemon
Source code in pokelance/ext/move.py
get_message(case, data)
staticmethod
⚓︎
Gets the error message for a resource not found error.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
case |
str
|
The case to use for the error message. |
required |
data |
Set[str]
|
The data to use for the error message. |
required |
Returns:
Type | Description |
---|---|
str
|
The error message. |
Source code in pokelance/ext/_base.py
get_move(name)
⚓︎
Gets a move from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move. |
required |
Returns:
Type | Description |
---|---|
Optional[Move]
|
The move if it exists in the cache, else None. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move does not exist in the cache. |
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> move = client.move.get_move(1)
>>> move.name
'pound'
Source code in pokelance/ext/move.py
get_move_ailment(name)
⚓︎
Gets a move ailment from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move ailment. |
required |
Returns:
Type | Description |
---|---|
Optional[MoveAilment]
|
The move ailment if it exists in the cache, else None. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move ailment does not exist in the cache. |
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> ailment = client.move.get_move_ailment(1)
>>> ailment.name
'paralysis'
Source code in pokelance/ext/move.py
get_move_battle_style(name)
⚓︎
Gets a move battle style from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move battle style. |
required |
Returns:
Type | Description |
---|---|
Optional[MoveBattleStyle]
|
The move battle style if it exists in the cache, else None. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move battle style does not exist in the cache. |
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> style = client.move.get_move_battle_style(1)
>>> style.name
'attack'
Source code in pokelance/ext/move.py
get_move_category(name)
⚓︎
Gets a move category from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move category. |
required |
Returns:
Type | Description |
---|---|
Optional[MoveCategory]
|
The move category if it exists in the cache, else None. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move category does not exist in the cache. |
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> category = client.move.get_move_category(1)
>>> category.name
'ailment'
Source code in pokelance/ext/move.py
get_move_damage_class(name)
⚓︎
Gets a move damage class from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move damage class. |
required |
Returns:
Type | Description |
---|---|
Optional[MoveDamageClass]
|
The move damage class if it exists in the cache, else None. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move damage class does not exist in the cache. |
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> damage_class = client.move.get_move_damage_class(1)
>>> damage_class.name
'status'
Source code in pokelance/ext/move.py
get_move_learn_method(name)
⚓︎
Gets a move learn method from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move learn method. |
required |
Returns:
Type | Description |
---|---|
Optional[MoveLearnMethod]
|
The move learn method if it exists in the cache, else None. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move learn method does not exist in the cache. |
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> learn_method = client.move.get_move_learn_method(1)
>>> learn_method.name
'level-up'
Source code in pokelance/ext/move.py
get_move_target(name)
⚓︎
Gets a move target from the cache.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name |
Union[str, int]
|
The id of the move target. |
required |
Returns:
Type | Description |
---|---|
Optional[MoveTarget]
|
The move target if it exists in the cache, else None. |
Raises:
Type | Description |
---|---|
ResourceNotFound
|
If the move target does not exist in the cache. |
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> target = client.move.get_move_target(1)
>>> target.name
'specific-pokemon'
Source code in pokelance/ext/move.py
setup()
async
⚓︎
Sets up the extension.