Metadata-Version: 2.4
Name: chatiss-open-sdk
Version: 0.1.1
Summary: Official Python SDK for Chatiss Open Platform
License: MIT License
        
        Copyright (c) 2026 Chimboon Corporation & Chimboon Hospital
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx<1.0,>=0.24
Requires-Dist: httpx-sse<1.0,>=0.4
Dynamic: license-file

﻿# Chatiss Open SDK

Official Python SDK for Chatiss Open Platform.

## What's New in 0.1.1

- Added `word_article_detail` API support for sync and async clients
- Added typed SSE result models for `tongue_create`
- Improved response parsing and test coverage for new result models

## Features

- Sync client: `OpenAPIClient`
- Async client: `AsyncOpenAPIClient`
- Automatic JWT token acquisition and refresh
- Structured API response models
- Unified exception model
- SSE stream support for tongue analysis API

## Installation

```bash
pip install chatiss-open-sdk
```

## Quick Start (Sync)

```python
from chatiss_open_sdk import SDKConfig, OpenAPIClient
from chatiss_open_sdk.types import TongueCreateRequest

config = SDKConfig(
    access_key_id="your_access_key_id",
    access_key_secret="your_access_key_secret",
)

with OpenAPIClient(config) as client:
    token_resp = client.get_jwt_token()
    print(token_resp.status)

    req = TongueCreateRequest(
        original_img="https://example.com/original.png",
        skin_img="https://example.com/skin.png",
        gender=1,
        birthday="1990-01-01",
        use_flash=True,
    )
    for event in client.tongue_create(req):
        print(event.event, event.data.status)
```

## Quick Start (Async)

```python
import asyncio
from chatiss_open_sdk import SDKConfig, AsyncOpenAPIClient
from chatiss_open_sdk.types import TongueCreateRequest


async def main():
    config = SDKConfig(
        access_key_id="your_access_key_id",
        access_key_secret="your_access_key_secret",
    )

    async with AsyncOpenAPIClient(config) as client:
        req = TongueCreateRequest(
            original_img="https://example.com/original.png",
            skin_img="https://example.com/skin.png",
            gender=1,
            birthday="1990-01-01",
            use_flash=True,
        )
        async for event in client.tongue_create(req):
            print(event.event, event.data.status)


asyncio.run(main())
```

## Word Article Detail

```python
from chatiss_open_sdk import SDKConfig, OpenAPIClient

config = SDKConfig(
    access_key_id="your_access_key_id",
    access_key_secret="your_access_key_secret",
)

with OpenAPIClient(config) as client:
    resp = client.word_article_detail("632278c7-5e6c-487a-b8b3-ec91fc42840f")
    if resp.status == "SUCCESS" and resp.result is not None:
        print(resp.result.id)
        for paragraph in resp.result.paragraphs:
            print(paragraph.title)
```

## Error Handling

- Business failures (`status == "FAIL"`) are returned in `APIResponse`
- Network failures raise `NetworkError`
- Auth failures raise `AuthError`
- Protocol/schema failures raise `ProtocolError`
- SSE interruption raises `SSEStreamError`

## License

MIT
See `LICENSE` for the full text.
