Client
======

The Client is your **entry point** to the Artifacts MMO API.

**Purpose:**

- Authenticate with your API token
- Query game data (items, monsters, maps, resources)
- Create Character controllers

**There are two client types:**

- ``ArtifactsClient`` - Synchronous (blocking)
- ``AsyncArtifactsClient`` - Asynchronous (non-blocking)

Sync Client
-----------

Use the sync client for simple scripts and tools:

.. code-block:: python

   from artifacts import ArtifactsClient
   
   with ArtifactsClient(token="your_token") as client:
       # Query game data
       items = client.get_all_items()
       
       # Control a character
       char = client.character("MyCharacter")
       char.move(x=1, y=2)

.. autoclass:: artifacts.ArtifactsClient
   :members:
   :undoc-members:
   :show-inheritance:

Async Client
------------

Use the async client for bots managing multiple characters:

.. code-block:: python

   from artifacts import AsyncArtifactsClient
   import asyncio
   
   async def main():
       async with AsyncArtifactsClient(token="your_token") as client:
           # Control multiple characters in parallel
           char1 = client.character("Fighter")
           char2 = client.character("Mage")
           
           await asyncio.gather(
               char1.fight(),
               char2.fight()
           )
   
   asyncio.run(main())

.. autoclass:: artifacts.AsyncArtifactsClient
   :members:
   :undoc-members:
   :show-inheritance:
