Encounter
encounter
¶
Encounter
¶
Bases: SyncBaseExtension[Encounter]
Extension for encounter related endpoints.
Source code in pokelance/ext/_base.py
get_encounter_method
¶
get_encounter_method(
name: str | int,
) -> EncounterMethod | None
Gets a encounter method from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
EncounterMethod | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/encounter.py
def get_encounter_method(self, name: str | int) -> models.EncounterMethod | None:
"""Gets a encounter method from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.EncounterMethod | None
The cached model or None.
Examples
--------
```python
method = client.encounter.get_encounter_method("walk")
if method:
print(method)
```"""
route = Endpoint.get_encounter_method(name)
self._validate_resource(self._cache_group.encounter_method, name, route)
return self._cache_group.encounter_method.get(route, None)
fetch_encounter_method
¶
fetch_encounter_method(name: str | int) -> EncounterMethod
Fetches a encounter method from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
EncounterMethod
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/encounter.py
def fetch_encounter_method(self, name: str | int) -> models.EncounterMethod:
"""Fetches a encounter method from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.EncounterMethod
The fetched model.
Examples
--------
```python
method = client.encounter.fetch_encounter_method("walk")
print(method)
```"""
route = Endpoint.get_encounter_method(name)
self._validate_resource(self._cache_group.encounter_method, name, route)
data = self._client.request(route)
return self._cache_group.encounter_method.setdefault(
route, self._cache_group.encounter_method.from_payload(data)
)
get_encounter_condition
¶
get_encounter_condition(
name: str | int,
) -> EncounterCondition | None
Gets a encounter condition from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
EncounterCondition | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/encounter.py
def get_encounter_condition(self, name: str | int) -> models.EncounterCondition | None:
"""Gets a encounter condition from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.EncounterCondition | None
The cached model or None.
Examples
--------
```python
condition = client.encounter.get_encounter_condition("swarm")
if condition:
print(condition)
```"""
route = Endpoint.get_encounter_condition(name)
self._validate_resource(self._cache_group.encounter_condition, name, route)
return self._cache_group.encounter_condition.get(route, None)
fetch_encounter_condition
¶
fetch_encounter_condition(
name: str | int,
) -> EncounterCondition
Fetches a encounter condition from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
EncounterCondition
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/encounter.py
def fetch_encounter_condition(self, name: str | int) -> models.EncounterCondition:
"""Fetches a encounter condition from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.EncounterCondition
The fetched model.
Examples
--------
```python
condition = client.encounter.fetch_encounter_condition("swarm")
print(condition)
```"""
route = Endpoint.get_encounter_condition(name)
self._validate_resource(self._cache_group.encounter_condition, name, route)
data = self._client.request(route)
return self._cache_group.encounter_condition.setdefault(
route, self._cache_group.encounter_condition.from_payload(data)
)
get_encounter_condition_value
¶
get_encounter_condition_value(
name: str | int,
) -> EncounterConditionValue | None
Gets a encounter condition value from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
EncounterConditionValue | None
|
The cached model or None. |
Examples:
Source code in pokelance/ext/sync/encounter.py
def get_encounter_condition_value(self, name: str | int) -> models.EncounterConditionValue | None:
"""Gets a encounter condition value from the cache.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.EncounterConditionValue | None
The cached model or None.
Examples
--------
```python
value = client.encounter.get_encounter_condition_value("swarm-yes")
if value:
print(value)
```"""
route = Endpoint.get_encounter_condition_value(name)
self._validate_resource(self._cache_group.encounter_condition_value, name, route)
return self._cache_group.encounter_condition_value.get(route, None)
fetch_encounter_condition_value
¶
fetch_encounter_condition_value(
name: str | int,
) -> EncounterConditionValue
Fetches a encounter condition value from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
str | int
|
The name or id. |
required |
Returns:
| Type | Description |
|---|---|
EncounterConditionValue
|
The fetched model. |
Examples:
Source code in pokelance/ext/sync/encounter.py
def fetch_encounter_condition_value(self, name: str | int) -> models.EncounterConditionValue:
"""Fetches a encounter condition value from the API.
Parameters
----------
name : str | int
The name or id.
Returns
-------
models.EncounterConditionValue
The fetched model.
Examples
--------
```python
value = client.encounter.fetch_encounter_condition_value("swarm-yes")
print(value)
```"""
route = Endpoint.get_encounter_condition_value(name)
self._validate_resource(self._cache_group.encounter_condition_value, name, route)
data = self._client.request(route)
return self._cache_group.encounter_condition_value.setdefault(
route, self._cache_group.encounter_condition_value.from_payload(data)
)
setup
¶
setup(lance: PokeLanceSyncClient) -> None