Client API Gateway¶
TryxClient is the runtime facade passed to every handler, and it exposes a root messaging surface plus 12 namespace clients.
How To Read This Section
- Start with this gateway page.
- Open the namespace page that matches your task.
- Jump to Events API for event contracts and Types API for enum/value-object constraints.
Client Topology¶
flowchart TD
A[TryxClient] --> B[Root send/download/upload methods]
A --> C[contact]
A --> D[chat_actions]
A --> E[community]
A --> F[newsletter]
A --> G[groups]
A --> H[status]
A --> I[chatstate]
A --> J[blocking]
A --> K[polls]
A --> L[presence]
A --> M[privacy]
A --> N[profile]
Namespace Router¶
Find users, check registration state, and fetch profile pictures.
Archive, pin, mute, read-state, edit/revoke/react operations.
Create and manage communities with linked subgroups.
Join, manage, post, and read newsletter channels.
Group lifecycle, membership approval, and participant administration.
Post/revoke statuses and manage status audience privacy.
Typing and recording state signaling.
Blocklist management and identity checks.
Poll creation, encrypted vote operations, and tally aggregation.
Presence state updates and subscription controls.
Privacy categories, values, and disallowed-list updates.
Push name, status text, and profile picture lifecycle.
Root Transport Methods¶
These methods stay on TryxClient directly because they are cross-domain primitives.
| Method | Purpose | Typical usage |
|---|---|---|
is_connected() -> bool | Connection health check | Guard before sends in long-running jobs |
download_media(message) -> bytes | Download media blob from message proto media node | Save image/audio/document payloads |
upload_file(path, media_type) -> UploadResponse | Upload file path for later message/status usage | Status media workflows |
upload(data, media_type) -> UploadResponse | Upload in-memory bytes | Transform pipelines |
send_message(to, message) -> SendResult | Raw protobuf message send | Advanced custom payloads |
send_text(...) -> SendResult | Text helper | Most command handlers |
send_photo(...) -> SendResult | Image helper | Client replies with screenshots/posters |
send_document(...) -> SendResult | File helper | Reports, exports, invoices |
send_audio(...) -> SendResult | Audio helper | Voice notes / TTS |
send_video(...) -> SendResult | Video helper | Clips, demos |
send_gif(...) -> SendResult | GIF helper | Motion responses |
send_sticker(...) -> SendResult | Sticker helper | Lightweight reactions |
request_media_reupload(...) -> MediaReuploadResult | Recover stale media references | Retry failed media downloads |
Reconnect-safe Pattern
Avoid caching TryxClient on global module state across runtime restarts. Always use the client object injected in the current handler call.
Practical Flow By Goal¶
Use root send methods + chat_actions + chatstate.
- Parse incoming event.
- Signal typing with
client.chatstate.send_composing(chat). - Send reply with
client.send_text(...). - Optional message edit/revoke via
client.chat_actions.
Use groups, blocking, privacy.
- Resolve sender via Types API.
- Apply participant actions (
promote,remove,approve request). - Enforce policy with blocklist/privacy settings.
Use status, newsletter, polls.
- Upload content or build text payload.
- Publish status/newsletter message.
- Track engagement using polls and reactions.
Cross-References¶
- Event contracts: Events API
- Shared value objects: Types API
- Builders and utility helpers: Helpers API
- End-to-end client composition: Tutorial: Command Automation