Metadata-Version: 2.4
Name: cristalixtop
Version: 1.0.0
Summary: Python client for https://api.cristalix.gg
Author: LisoMandiy
License: MIT License
        
        Copyright (c) 2026 CristalixTop
        
        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.
        
Project-URL: Homepage, https://api.cristalix.gg
Project-URL: Repository, https://github.com/LisoMandiy/cristalixtop
Project-URL: Issues, https://github.com/LisoMandiy/cristalixtop/issues
Keywords: cristalix
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 :: Only
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: Typing :: Typed
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: httpx[http2]>=0.27.0
Dynamic: license-file

# Cristalix API (Python)

Клиентская библиотека для `https://api.cristalix.gg` с аккуратным API и нормальной типизацией. Подходит и для быстрых запросов, и для асинхронных сценариев.

## Что внутри

- Синхронный и асинхронный клиент.
- Типизированные модели ответов.
- Проверка параметров на стороне клиента.

## Установка

```bash
pip install httpx[http2]
```

## Быстрый старт (sync)

```python
from cristalixtop import CristalixClient

client = CristalixClient(
    project_key="YOUR_PROJECT_KEY",
    token="YOUR_TOKEN",
)

profile = client.get_profile_by_name("LisoMandiy")
print(profile)

client.close()
```

## Контекстный менеджер

```python
from cristalixtop import CristalixClient

with CristalixClient(project_key="YOUR_PROJECT_KEY", token="YOUR_TOKEN") as client:
    profiles = client.get_profiles_by_names(["LisoMandiy", "kkp_"])
    print(profiles)
```

## Асинхронный клиент

```python
import asyncio
import httpx
from cristalixtop import AsyncCristalixClient


async def main() -> None:
    limits = httpx.Limits(max_connections=100, max_keepalive_connections=20)
    async with AsyncCristalixClient(
        project_key="YOUR_PROJECT_KEY",
        token="YOUR_TOKEN",
        limits=limits,
    ) as client:
        profile = await client.get_profile_by_name("LisoMandiy")
        print(profile)


asyncio.run(main())
```

## Настройка клиента

```python
from cristalixtop import CristalixClient

client = CristalixClient(
    project_key="YOUR_PROJECT_KEY",
    token="YOUR_TOKEN",
    enforce_http2=True,
    max_retries=2,
    timeout=10.0,
)
```

## Обработка ошибок

```python
from cristalixtop import (
    CristalixClient,
    CristalixHTTPError,
    CristalixRateLimitError,
    CristalixValidationError,
)

try:
    with CristalixClient(project_key="YOUR_PROJECT_KEY", token="YOUR_TOKEN") as client:
        client.get_profile_by_name("LisoMandiy")
except CristalixRateLimitError as exc:
    print("Rate limited:", exc.status_code)
except CristalixHTTPError as exc:
    print("HTTP error:", exc.status_code, exc.payload)
except CristalixValidationError as exc:
    print("Bad input:", exc)
```

## Методы

- `get_profiles_by_names(names)` — профили по списку никнеймов (до 50).
- `get_profile_by_name(name)` — профиль по никнейму.
- `get_profiles_by_ids(ids)` — профили по списку UUID (до 50).
- `get_profile_by_id(player_id)` — профиль по UUID.
- `get_profile_reactions(player_id)` — лайки/дизлайки профиля.
- `get_friends(player_id, skip=0, limit=25)` — список друзей с пагинацией.
- `get_subscriptions(player_id, skip=0, limit=25)` — подписчики с пагинацией.
- `get_profile_activity_statistics(player_id)` — активность по играм за текущий день.
- `get_all_profile_statistics(player_id)` — вся статистика по всем периодам.
- `get_profile_statistics(player_id)` — общая статистика без периодов.
- `games_list()` — список игр и режимов.
- `read_by_time_rating(time, game_id, mode_key, sub_mode_key, sort_field, season_key)` — лидерборд по периоду.
