Metadata-Version: 2.4
Name: ttclient
Version: 0.4
Summary: Chat client
Author-email: Tamtam team <support@tamtamteam.com>
License: MIT License
Keywords: async,bot
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Plugins
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: AsyncIO
Requires-Python: >=3.12
Description-Content-Type: text/markdown
License-File: LICENSE.md
Requires-Dist: httpx
Requires-Dist: ttutils
Provides-Extra: dev
Requires-Dist: pytest-runner; extra == "dev"
Requires-Dist: pytest; extra == "dev"
Requires-Dist: pytest-asyncio; extra == "dev"
Requires-Dist: pytest-cov; extra == "dev"
Requires-Dist: ruff; extra == "dev"
Requires-Dist: mypy; extra == "dev"
Dynamic: license-file

[![Version][version-image]][pypi-url]
[![Supported Python Version][py-versions-image]][pypi-url]
[![Downloads][downloads-image]][pypi-url]

---

# TTClient

Клиент для АПИ чата


## INSTALL

Достаточно установить библиотеку ttclient

```
$ pip install ttclient
```


## USAGE

Basic usage

```python
base_client = BaseClient('YOUR_API_SECRET', host='YOUR_API_HOST')
data = await base_client.get('/user/me')
```

Uri template use arguments for formatting, arguments must be string or integer

```python
data = await base_client.get('/core/chat/{}', chat_id)
```

Keywords convert to query string for `GET` and `DELETE` methods
and to json for `POST`, `PUT`, `PATCH`

```python
data = await base_client.get('/core/chat', ids=','.join({chat1_id, chat2_id}))
data = await base_client.post('/core/chat', title='Title', org_visible=True)
data = await base_client.put('/core/chat/{}', chat_id, title='Title', org_visible=True)
data = await base_client.delete('/core/chat/{}', chat_id)
data = await base_client.patch('/user/settings', push_resend=True)
```

Extending client

```python
class MyClient(BaseClient):
    async def my_name(self) -> str:
        data = await self.get('/user/me')
        self.log.debug('Client data %s', str(data))
        return data['name']


client = MyClient('YOUR_API_SECRET', host='YOUR_API_HOST')
name = await client.my_name()
```

<!-- Badges -->
[pypi-url]: https://pypi.org/project/ttclient
[version-image]: https://img.shields.io/pypi/v/ttclient.svg
[py-versions-image]: https://img.shields.io/pypi/pyversions/ttclient.svg
[downloads-image]: https://img.shields.io/pypi/dm/ttclient.svg
