item
            pokelance.ext.item
⚓︎
    
              Item(client)
⚓︎
    
              Bases: BaseExtension
Extension for item related endpoints.
Attributes:
| Name | Type | Description | 
|---|---|---|
cache | 
            
                  Item
             | 
            
               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_item(name)
  
      async
  
⚓︎
    Fetches an item from the API.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  Item
             | 
            
               The item if it exists in the API, else raises ResourceNotFound.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
...     item = await client.item.fetch_item("potion")
...     print(item.id)
...     await client.close()
>>> asyncio.run(main())
17
Source code in pokelance/ext/item.py
              
            fetch_item_attribute(name)
  
      async
  
⚓︎
    Fetches an item attribute from the API.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item attribute.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  ItemAttribute
             | 
            
               The item attribute if it exists in the API, else raises ResourceNotFound.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item attribute is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
...     item_attribute = await client.item.fetch_item_attribute("holdable")
...     print(item_attribute.id)
...     await client.close()
>>> asyncio.run(main())
5
Source code in pokelance/ext/item.py
              
            fetch_item_category(name)
  
      async
  
⚓︎
    Fetches an item category from the API.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item category.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  ItemCategory
             | 
            
               The item category if it exists in the API, else raises ResourceNotFound.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item category is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
...     item_category = await client.item.fetch_item_category(1)
...     print(item_category.name)
...     await client.close()
>>> asyncio.run(main())
stat-boosts
Source code in pokelance/ext/item.py
              
            fetch_item_fling_effect(name)
  
      async
  
⚓︎
    Fetches an item fling effect from the API.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item fling effect.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  ItemFlingEffect
             | 
            
               The item fling effect if it exists in the API, else raises ResourceNotFound.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item fling effect is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
...     item_fling_effect = await client.item.fetch_item_fling_effect(1)
...     print(item_fling_effect.name)
...     await client.close()
>>> asyncio.run(main())
badly-poison
Source code in pokelance/ext/item.py
              
            fetch_item_pocket(name)
  
      async
  
⚓︎
    Fetches an item pocket from the API.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item pocket.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  ItemPocket
             | 
            
               The item pocket if it exists in the API, else raises ResourceNotFound.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item pocket is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> import asyncio
>>> client = PokeLance()
>>> async def main() -> None:
...     item_pocket = await client.item.fetch_item_pocket(1)
...     print(item_pocket.name)
...     await client.close()
>>> asyncio.run(main())
misc
Source code in pokelance/ext/item.py
              
            get_item(name)
⚓︎
    Gets an item from the cache.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  Optional[Item]
             | 
            
               The item if it exists in the cache, else None.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> item = client.item.get_item("potion")
>>> item.id
17
Source code in pokelance/ext/item.py
              
            get_item_attribute(name)
⚓︎
    Gets an item attribute from the cache.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item attribute.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  Optional[ItemAttribute]
             | 
            
               The item attribute if it exists in the cache, else None.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item attribute is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> item_attribute = client.item.get_item_attribute("holdable")
>>> item_attribute.id
5
Source code in pokelance/ext/item.py
              
            get_item_category(name)
⚓︎
    Gets an item category from the cache.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item category.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  Optional[ItemCategory]
             | 
            
               The item category if it exists in the cache, else None.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item category is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> item_category = client.item.get_item_category(1)
>>> item_category.name
'stat-boosts'
Source code in pokelance/ext/item.py
              
            get_item_fling_effect(name)
⚓︎
    Gets an item fling effect from the cache.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item fling effect.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  Optional[ItemFlingEffect]
             | 
            
               The item fling effect if it exists in the cache, else None.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item fling effect is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> item_fling_effect = client.item.get_item_fling_effect(1)
>>> item_fling_effect.name
'badly-poison'
Source code in pokelance/ext/item.py
              
            get_item_pocket(name)
⚓︎
    Gets an item pocket from the cache.
Parameters:
| Name | Type | Description | Default | 
|---|---|---|---|
name | 
            
                  Union[str, int]
             | 
            
               The name or id of the item pocket.  | 
            required | 
Returns:
| Type | Description | 
|---|---|
                  Optional[ItemPocket]
             | 
            
               The item pocket if it exists in the cache, else None.  | 
          
Raises:
| Type | Description | 
|---|---|
                  ResourceNotFound
             | 
            
               The name or id of the item pocket is invalid.  | 
          
Examples:
>>> from pokelance import PokeLance
>>> client = PokeLance()
>>> item_pocket = client.item.get_item_pocket(1)
>>> item_pocket.name
'misc'
Source code in pokelance/ext/item.py
              
            setup()
  
      async
  
⚓︎
    Sets up the extension.