# About
Official API client library for [**Ascentrade**](https://github.com/Ascentrade). Automatically generated by [**Ariadne Codegen**](https://github.com/mirumee/ariadne-codegen).

This library is available on PyPi. You can easily install it using ```pip install ascentrade_client```

## Virtual Environment
Create a virtual Python 3.10 environment and activate + install all dependencies.
```
python3.10 -m venv venv
source venv/bin/activate
pip3.10 install -r requirements.txt
```

# Build Package
- Start the backend API with **introspection** (debug) **turned on**
- Run ```ariadne-codegen``` from inside this folder
- The generated client library **ascentrade_client** will be copied to ./ascentrade_client

After the steps above you can then build the library by running ```python3 -m build```

**Optional:** Install the generated package locally with ```python3 -m pip install ./dist/ascentrade_client-*.tar.gz```


# Example Use
The script **tests/test.py** shows an example usage of the generated client code.
```python
import asyncio
from ascentrade_client import AscentradeClient

async def main():
	client = AscentradeClient("http://localhost:8042/graphql/")

	data = await client.currencies()
	for c in data.currencies:
		print(f'{c.id}: {c.name} ({c.iso_code})')

if __name__ == '__main__':
	asyncio.run(main())
```

# Packaging
This package was created using the [Python Packaging User Guide](https://packaging.python.org/en/latest/tutorials/packaging-projects/).

# Custom Functions
If you need any special function calls for your application, just modify the **queries.gql** file and generate the library again.