How foad-khab/baleclient works
BaleClient is an asynchronous Python client library for Bale Messenger. A consumer creates a Client, authenticates or loads a session, invokes domain operations, and receives parsed response models. The client coordinates the HTTP session and method dispatch; domain methods describe operations across messaging, groups, users, files, presence, and other Bale services. The README documents asynchronous use and parsing/error-handling improvements. Source excerpts are partial, so links not evidenced by those excerpts, the SOURCE INDEX, or the README are omitted.
Main entry points: client.py Client API · types Domain models · aiohttp.py HTTP sessions · grpc_post.py Request encoding
Components 18
Client and transport
- Client API
baleclient/client/client.py - Authentication
baleclient/client/auth_cli.py - HTTP sessions
baleclient/client/session/aiohttp.py - Request encoding
baleclient/utils/grpc_post.py
Bale operations
- Messaging
baleclient/methods/messaging - Group management
baleclient/methods/groups - User and contacts
baleclient/methods/user - File operations
baleclient/methods/files - Presence
baleclient/methods/presence/typing.py - Other Bale services
baleclient/methods
Protocol models
- Domain models
baleclient/types - Response models
baleclient/types/responses
Events and filters
- Dispatcher
baleclient/dispatcher/dispatcher.py - Event router
baleclient/dispatcher/router.py - Handlers and filters
baleclient/dispatcher/event/handler.py - Filter library
baleclient/filters
Other components
- Client consumer
- Bale API
Connections 22
- Client consumer → Client API: creates and calls
- Client API → Authentication: delegates authentication
baleclient/client/client.py - Client API → HTTP sessions: creates and uses
baleclient/client/client.py - Client API → Request encoding: uses request helper
baleclient/client/client.py - Client API → Messaging: dispatches operations
- Client API → Group management: dispatches operations
- Client API → User and contacts: dispatches operations
- Client API → File operations: dispatches operations
- Client API → Presence: dispatches operations
baleclient/client/client.py - Client API → Other Bale services: dispatches operations
baleclient/methods/__init__.py - Client API → Dispatcher: configures dispatcher
baleclient/client/client.py - HTTP sessions → Bale API: sends API requests
- Request encoding → Bale API: encodes requests
- Messaging → Domain models: uses domain data
- Group management → Domain models: uses domain data
baleclient/methods/groups/get_group_preview.py - User and contacts → Domain models: uses domain data
baleclient/methods/user/search_contact.py - File operations → Domain models: uses domain data
- Presence → Domain models: uses peer data
baleclient/methods/presence/typing.py - Domain models → Response models: provides parsed data
baleclient/types/responses/__init__.py - Dispatcher → Event router: routes events
baleclient/dispatcher/dispatcher.py - Event router → Handlers and filters: registers handlers
baleclient/dispatcher/router.py - Handlers and filters → Filter library: evaluates filters
baleclient/dispatcher/event/handler.py