Metadata-Version: 2.4
Name: spond-classes
Version: 0.18.0a0
Summary: Unofficial class abstraction layer for the `spond` library package.
Author: elliot-100
Author-email: elliot-100 <3186037+elliot-100@users.noreply.github.com>
License-Expression: GPL-3.0-only
License-File: LICENSE
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Typing :: Typed
Requires-Dist: pydantic[email]>=2.7.1
Requires-Python: >=3.10
Project-URL: Documentation, https://elliot-100.github.io/Spond-classes/
Project-URL: Repository, https://github.com/elliot-100/Spond-classes/
Project-URL: Issues, https://github.com/elliot-100/Spond-classes/issues/
Project-URL: Changelog, https://github.com/elliot-100/Spond-classes/blob/main/CHANGELOG.md
Description-Content-Type: text/markdown

# Spond-classes

## About

[Spond](https://spond.com/welcome) is a team/group-oriented events system.

The unofficial Python `spond` library package ([GitHub](https://github.com/Olen/Spond/),
[PyPI](https://pypi.org/project/spond/))  returns data from the Spond API.

This unofficial Python `spond-classes` library package
([GitHub](https://github.com/elliot-100/Spond-classes),
[PyPI](https://pypi.org/project/spond-classes/)) parses that data using
[Pydantic](https://docs.pydantic.dev/) to create class instances.

Partial, read-only implementation.


## Install

Install from PyPI, e.g:
```shell
pip install spond-classes
```

Note that [`spond`](https://github.com/Olen/Spond/) is required for practical use, but
is not a technical dependency, so needs to be installed separately.


## Example code

Adapting the example code in [`Spond`](https://github.com/Olen/Spond/) README:

```python
import asyncio
from spond.spond import Spond
from spond_classes import Group

# fake credentials and ids
USERNAME = 'my@mail.invalid'
PASSWORD = 'Pa55worD'
SUBGROUP_ID = 'SG1'

async def main():
    s = Spond(username=USERNAME, password=PASSWORD)
    groups_data = await s.get_groups()
    await s.clientsession.close()

    # Now we can create class instances from the data...
    groups = Group.list_from_data(groups_data)

    # ... use class attributes instead of dict keys ...
    my_group = groups[0]
    print(my_group.uid)

    # ... access subordinate instances and their attributes ...
    for member in my_group.members:
        print(f"{member.full_name} is in the {my_group.name} group")

    # ... and use some helper methods
    subgroup = my_group.subgroup_by_uid(SUBGROUP_ID)
    for member in my_group.members_by_subgroup(subgroup):
        print(f"{member.full_name} is in the {subgroup.name} subgroup")

asyncio.run(main())
```


## Documentation

Full API documentation is published at https://elliot-100.github.io/Spond-classes/ and
is also included as HTML in the package source `docs` folder.


## Development

Build documentation:
```shell
uv run pdoc src/spond_classes -d numpy -t docs_templates -o docs
```
