Move
move
¶
Move
¶
Bases: SyncBaseExtension[Move]
Extension for move related endpoints.
Source code in pokelance/ext/_base.py
get_move
¶
Gets a move from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
Move | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/move.py
def get_move(self, name: str | int) -> models.Move | None:
"""Gets a move from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.Move | None
The cached model or None.
Examples
--------
```python
move = client.move.get_move("pound")
if move:
print(move)
```"""
route = Endpoint.get_move(name)
self._validate_resource(self._cache_group.move, name, route)
return self._cache_group.move.get(route, None)
fetch_move
¶
Fetches a move from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
Move
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/move.py
def fetch_move(self, name: str | int) -> models.Move:
"""Fetches a move from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.Move
The fetched model.
Examples
--------
```python
move = client.move.fetch_move("pound")
print(move)
```"""
route = Endpoint.get_move(name)
self._validate_resource(self._cache_group.move, name, route)
data = self._client.request(route)
return self._cache_group.move.setdefault(route, self._cache_group.move.from_payload(data))
get_move_ailment
¶
get_move_ailment(name: str | int) -> MoveAilment | None
Gets a move ailment from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveAilment | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/move.py
def get_move_ailment(self, name: str | int) -> models.MoveAilment | None:
"""Gets a move ailment from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveAilment | None
The cached model or None.
Examples
--------
```python
ailment = client.move.get_move_ailment("paralysis")
if ailment:
print(ailment)
```"""
route = Endpoint.get_move_ailment(name)
self._validate_resource(self._cache_group.move_ailment, name, route)
return self._cache_group.move_ailment.get(route, None)
fetch_move_ailment
¶
fetch_move_ailment(name: str | int) -> MoveAilment
Fetches a move ailment from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveAilment
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/move.py
def fetch_move_ailment(self, name: str | int) -> models.MoveAilment:
"""Fetches a move ailment from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveAilment
The fetched model.
Examples
--------
```python
ailment = client.move.fetch_move_ailment("paralysis")
print(ailment)
```"""
route = Endpoint.get_move_ailment(name)
self._validate_resource(self._cache_group.move_ailment, name, route)
data = self._client.request(route)
return self._cache_group.move_ailment.setdefault(route, self._cache_group.move_ailment.from_payload(data))
get_move_battle_style
¶
get_move_battle_style(
name: str | int,
) -> MoveBattleStyle | None
Gets a move battle style from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveBattleStyle | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/move.py
def get_move_battle_style(self, name: str | int) -> models.MoveBattleStyle | None:
"""Gets a move battle style from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveBattleStyle | None
The cached model or None.
Examples
--------
```python
style = client.move.get_move_battle_style("attack")
if style:
print(style)
```"""
route = Endpoint.get_move_battle_style(name)
self._validate_resource(self._cache_group.move_battle_style, name, route)
return self._cache_group.move_battle_style.get(route, None)
fetch_move_battle_style
¶
fetch_move_battle_style(name: str | int) -> MoveBattleStyle
Fetches a move battle style from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveBattleStyle
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/move.py
def fetch_move_battle_style(self, name: str | int) -> models.MoveBattleStyle:
"""Fetches a move battle style from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveBattleStyle
The fetched model.
Examples
--------
```python
style = client.move.fetch_move_battle_style("attack")
print(style)
```"""
route = Endpoint.get_move_battle_style(name)
self._validate_resource(self._cache_group.move_battle_style, name, route)
data = self._client.request(route)
return self._cache_group.move_battle_style.setdefault(
route, self._cache_group.move_battle_style.from_payload(data)
)
get_move_category
¶
get_move_category(name: str | int) -> MoveCategory | None
Gets a move category from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveCategory | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/move.py
def get_move_category(self, name: str | int) -> models.MoveCategory | None:
"""Gets a move category from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveCategory | None
The cached model or None.
Examples
--------
```python
category = client.move.get_move_category("damage")
if category:
print(category)
```"""
route = Endpoint.get_move_category(name)
self._validate_resource(self._cache_group.move_category, name, route)
return self._cache_group.move_category.get(route, None)
fetch_move_category
¶
fetch_move_category(name: str | int) -> MoveCategory
Fetches a move category from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveCategory
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/move.py
def fetch_move_category(self, name: str | int) -> models.MoveCategory:
"""Fetches a move category from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveCategory
The fetched model.
Examples
--------
```python
category = client.move.fetch_move_category("damage")
print(category)
```"""
route = Endpoint.get_move_category(name)
self._validate_resource(self._cache_group.move_category, name, route)
data = self._client.request(route)
return self._cache_group.move_category.setdefault(route, self._cache_group.move_category.from_payload(data))
get_move_damage_class
¶
get_move_damage_class(
name: str | int,
) -> MoveDamageClass | None
Gets a move damage class from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveDamageClass | None
|
The cached model or None. |
Examples:
move_damage_class_data = client.move.get_move_damage_class("physical")
if move_damage_class_data:
print(move_damage_class_data)
Source code in pokelance/ext/sync/move.py
def get_move_damage_class(self, name: str | int) -> models.MoveDamageClass | None:
"""Gets a move damage class from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveDamageClass | None
The cached model or None.
Examples
--------
```python
move_damage_class_data = client.move.get_move_damage_class("physical")
if move_damage_class_data:
print(move_damage_class_data)
```"""
route = Endpoint.get_move_damage_class(name)
self._validate_resource(self._cache_group.move_damage_class, name, route)
return self._cache_group.move_damage_class.get(route, None)
fetch_move_damage_class
¶
fetch_move_damage_class(name: str | int) -> MoveDamageClass
Fetches a move damage class from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveDamageClass
|
The fetched model. |
Examples:
move_damage_class_data = client.move.fetch_move_damage_class("physical")
print(move_damage_class_data)
Source code in pokelance/ext/sync/move.py
def fetch_move_damage_class(self, name: str | int) -> models.MoveDamageClass:
"""Fetches a move damage class from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveDamageClass
The fetched model.
Examples
--------
```python
move_damage_class_data = client.move.fetch_move_damage_class("physical")
print(move_damage_class_data)
```"""
route = Endpoint.get_move_damage_class(name)
self._validate_resource(self._cache_group.move_damage_class, name, route)
data = self._client.request(route)
return self._cache_group.move_damage_class.setdefault(
route, self._cache_group.move_damage_class.from_payload(data)
)
get_move_learn_method
¶
get_move_learn_method(
name: str | int,
) -> MoveLearnMethod | None
Gets a move learn method from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveLearnMethod | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/move.py
def get_move_learn_method(self, name: str | int) -> models.MoveLearnMethod | None:
"""Gets a move learn method from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveLearnMethod | None
The cached model or None.
Examples
--------
```python
method = client.move.get_move_learn_method("level-up")
if method:
print(method)
```"""
route = Endpoint.get_move_learn_method(name)
self._validate_resource(self._cache_group.move_learn_method, name, route)
return self._cache_group.move_learn_method.get(route, None)
fetch_move_learn_method
¶
fetch_move_learn_method(name: str | int) -> MoveLearnMethod
Fetches a move learn method from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveLearnMethod
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/move.py
def fetch_move_learn_method(self, name: str | int) -> models.MoveLearnMethod:
"""Fetches a move learn method from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveLearnMethod
The fetched model.
Examples
--------
```python
method = client.move.fetch_move_learn_method("level-up")
print(method)
```"""
route = Endpoint.get_move_learn_method(name)
self._validate_resource(self._cache_group.move_learn_method, name, route)
data = self._client.request(route)
return self._cache_group.move_learn_method.setdefault(
route, self._cache_group.move_learn_method.from_payload(data)
)
get_move_target
¶
get_move_target(name: str | int) -> MoveTarget | None
Gets a move target from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveTarget | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/move.py
def get_move_target(self, name: str | int) -> models.MoveTarget | None:
"""Gets a move target from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveTarget | None
The cached model or None.
Examples
--------
```python
target = client.move.get_move_target("specific-move")
if target:
print(target)
```"""
route = Endpoint.get_move_target(name)
self._validate_resource(self._cache_group.move_target, name, route)
return self._cache_group.move_target.get(route, None)
fetch_move_target
¶
fetch_move_target(name: str | int) -> MoveTarget
Fetches a move target from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
MoveTarget
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/move.py
def fetch_move_target(self, name: str | int) -> models.MoveTarget:
"""Fetches a move target from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.MoveTarget
The fetched model.
Examples
--------
```python
target = client.move.fetch_move_target("specific-move")
print(target)
```"""
route = Endpoint.get_move_target(name)
self._validate_resource(self._cache_group.move_target, name, route)
data = self._client.request(route)
return self._cache_group.move_target.setdefault(route, self._cache_group.move_target.from_payload(data))
setup
¶
setup(lance: PokeLanceSyncClient) -> None