This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
chattolib is an async Python client library for the Chatto webchat GraphQL API (https://chat.chatto.run/api/graphql). It wraps the full Chatto GraphQL schema — queries, mutations, and subscriptions — into a typed, Pythonic async interface.
# Install in development mode
pip install -e ".[dev]"
# Run all tests
pytest
# Run a single test
pytest tests/test_foo.py::test_bar -v
# Lint & format
ruff check .
ruff format .
# Type checking
mypy src/chattolib
The library uses httpx for async HTTP and websockets for GraphQL subscriptions (real-time events via WebSocket).
src/chattolib/ChattoClient async class. Holds the httpx session, auth token, and base URL. All API methods live here or are mixed in from domain modules.| Domain | Queries | Mutations | Subscriptions |
|---|---|---|---|
| Spaces | spaces, space(id) |
createSpace, updateSpace, joinSpace, leaveSpace, logo/banner uploads |
mySpaceEvents |
| Rooms | room, roomEvents, roomEventByEventId, threadEvents, roomEventsAround |
createRoom, updateRoom, archiveRoom, joinRoom, leaveRoom, markRoomAsRead |
via space events |
| Messages | (via roomEvents) | postMessage, editMessage, deleteMessage |
MessagePostedEvent, MessageUpdatedEvent, MessageDeletedEvent |
| Reactions | (on message events) | addReaction, removeReaction |
ReactionAddedEvent, ReactionRemovedEvent |
| Threads | threadEvents, myFollowedThreads |
followThread, unfollowThread, markThreadAsOpened |
ThreadFollowChangedEvent |
| Users | me, user(id), userByLogin, users |
updateMyProfile, uploadMyAvatar, deleteMyAvatar, createUser |
UserProfileUpdatedEvent, PresenceChangedEvent |
| DMs | (via rooms) | startDM |
NewDirectMessageNotificationEvent |
| Notifications | notifications, hasNotifications |
dismissNotification, dismissAllNotifications |
NotificationCreatedEvent, NotificationDismissedEvent |
| Permissions/Roles | via admin query, space.roles |
grantInstancePermission, createRole, assignInstanceRole, space-level equivalents |
— |
| Voice calls | voiceCallToken, activeCallRoomIds, callParticipants |
— | CallParticipantJoinedEvent, CallParticipantLeftEvent |
| Admin | admin.systemInfo, admin.instanceConfig, admin.roles |
admin.updateInstanceConfig, admin.resetInstanceConfig |
myInstanceEvents |
ID scalar).Int64 scalar (e.g., byte counts) — map to Python int.Upload scalar (multipart form).limit/before/after cursor style on room events; limit/offset on space members.input argument with a corresponding *Input type.spaceId scoping (mySpaceEvents) or are instance-wide (myInstanceEvents).width, height, fit (enum: CONTAIN, COVER, EXACT) for server-side resizing.snake_case (translated from GraphQL camelCase)PascalCase matching the GraphQL type namesverb_noun style (e.g., create_room, post_message, mark_room_as_read)