Metadata-Version: 2.4
Name: timeback-qti
Version: 0.3.2b20260717234752
Summary: Timeback QTI client for assessment item and test operations
Project-URL: Homepage, https://developer.timeback.com
Project-URL: Documentation, https://docs.timeback.com
Project-URL: Repository, https://github.com/superbuilders/timeback-dev-python
Author-email: Timeback <dev@timeback.dev>
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: pydantic>=2.0
Requires-Dist: timeback-common>=0.1.0
Description-Content-Type: text/markdown

# timeback-qti

Python client for the Timeback QTI assessment API.

## Installation

```bash
pip install timeback-qti
```

## Quick Start

```python
from timeback_qti import QtiClient

async def main():
    client = QtiClient(
        env="staging",
        client_id="your-client-id",
        client_secret="your-client-secret",
    )

    # List assessment items
    result = await client.assessment_items.list()

    # Create an item from QTI XML
    item = await client.assessment_items.create_from_xml({
        "format": "xml",
        "xml": "<qti-assessment-item>...</qti-assessment-item>",
    })

    # Validate QTI XML
    validation = await client.validate.validate({
        "schema": "item",
        "xml": "<qti-assessment-item>...</qti-assessment-item>",
    })

    await client.close()
```

## Resources

- `client.assessment_items` - Assessment item CRUD, XML/metadata creation, response processing
- `client.assessment_tests` - Assessment test CRUD with nested test parts, sections, and items
- `client.stimuli` - Stimulus material CRUD
- `client.validate` - QTI XML validation (single and batch)
- `client.lesson` - Lesson and question feedback
- `client.general` - General operations (delete by ID)

## Filtering

The top-level assessment-item and assessment-test lists accept the same `where` clause as the other Timeback clients, compiled to the server-side `filter` expression:

```python
# Exact match
drafts = await client.assessment_tests.list({"where": {"title": "Unit 5 Final"}})

# Substring/regex match (case-insensitive)
mine = await client.assessment_items.list(
    {"where": {"identifier": {"contains": "^playcademy-test-"}}}
)

# Streams filter server-side too
async for test in client.assessment_tests.stream(where={"title": {"contains": "math"}}):
    print(test["identifier"])
```

Nested lists (test parts, sections) and stimuli do not support filtering.
