utility
pokelance.ext.utility
⚓︎
Utility(client)
⚓︎
Bases: BaseExtension
Extension for utility related endpoints.
Attributes:
| Name | Type | Description |
|---|---|---|
cache |
Utility
|
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_api_metadata()
async
⚓︎
Fetches the API metadata from the API.
Returns:
| Type | Description |
|---|---|
APIMetadata
|
The API metadata. |
Source code in pokelance/ext/utility.py
fetch_language(name)
async
⚓︎
Fetches a language from the API.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Union[str, int]
|
The name or id of the language. |
required |
Returns:
| Type | Description |
|---|---|
Language
|
The language. |
Raises:
| Type | Description |
|---|---|
ResourceNotFound
|
The name or id of the language is invalid. |
Source code in pokelance/ext/utility.py
get_api_metadata()
⚓︎
Gets the API metadata from the cache.
Returns:
| Type | Description |
|---|---|
Optional[APIMetadata]
|
The API metadata if it exists in the cache, else None. |
Source code in pokelance/ext/utility.py
get_language(name)
⚓︎
Gets a language from the cache.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
Union[str, int]
|
The name or id of the language. |
required |
Returns:
| Type | Description |
|---|---|
Optional[Language]
|
The language if it exists in the cache, else None. |
Raises:
| Type | Description |
|---|---|
ResourceNotFound
|
The name or id of the language is invalid. |
Source code in pokelance/ext/utility.py
setup()
async
⚓︎
Sets up the extension.