Metadata-Version: 2.1
Name: pywaclient
Version: 1.5.1
Summary: A small wrapper library around the World Anvil Aragorn API: https://www.worldanvil.com/api/aragorn/documentation.
Home-page: https://gitlab.com/SoulLink/world-anvil-api-client
Author: Jonas Waeber
Author-email: jonaswaeber@gmail.com
License: Apache 2.0
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3.7
Description-Content-Type: text/markdown
License-File: LICENCE

# World Anvil API Python Client [WIP]

This wrapper client is a work in progress. It is not feature complete and the API is subject to change.
It works with the Boromir API released by World Anvil on 26th of August 2023. I will attempt to keep this 
client up to date with the latest version of the API. If you find any issues feel free to open an issue and 
I will try to fix it.



The World Anvil API provides endpoints to interact with the World Anvil database.

Boromir API Documentation is available at:
[Boromir API Documentation](https://www.worldanvil.com/api/boromir/documentation)

[Boromir API Swagger Documentation](https://www.worldanvil.com/api/external/boromir/swagger-documentation)

The Aragorn API is deprecated and will be removed in the future. It is still available at:

[Aragorn API Documentation](https://www.worldanvil.com/api/aragorn/documentation)

The latest version which works with Aragorn is `0.12.1`. After that the client only works with Boromir. I will not 
maintain the Aragorn version of the client.
## Installation
The package is published on PYPI and can be installed with pip.

`pip --install pywaclient`

## Usage
This is a simple example on how to use the endpoints.

```python
import os
from pywaclient.api import BoromirApiClient

client = BoromirApiClient(
    '<YourScriptName>',
    '<link-to-your-website-or-bot-repository>', '<version>', os.environ['WA_APPLICATION_KEY'],
    os.environ['WA_AUTH_TOKEN']
)

# get your own user id. It is not possible to discover the user ids of other users via the API.
authenticated_user = client.user.identity()

# get the references to all the worlds on your account.
worlds = [world for world in client.user.worlds(authenticated_user['id'])]

# get the references to all the category on the first world.
categories = [category for category in client.world.categories(worlds[0]['id'])]

# gets a list of all the articles without a category in the first world
articles = [article for article in client.category.articles(worlds[0]['id'], '-1')]

# gets the full content of the first article
article = client.article.get(articles[0]['id'], 2)

# gets the full content of the first category. Categories and most other resources do not have a granularity of 2.
category = client.category.get(categories[0]['id'], 1)
```



