Mixins – API Completa del Cliente
Esta página documenta todos los mixins que componen ToDusClient2. Cada mixin agrupa métodos por dominio funcional.
ToDusAuthMixin (Autenticación)
| Método | Descripción |
|---|---|
request_code(phone_number) | Solicita código de verificación SMS. |
validate_code(phone_number, code) -> str | Valida el código y retorna el token. |
login(phone_number, password) -> str | Inicia sesión con contraseña. |
ToDusMessageMixin (Mensajería Privada)
| Método | Descripción |
|---|---|
send_message(token, to_jid, body, reply_to_id) -> msg_id | Envía texto. |
edit_message(token, to_jid, new_body, original_msg_id, reply_to_id) -> msg_id | Edita un mensaje. |
send_file_message(token, to_jid, url, file_type, caption, file_name, file_size, reply_to_id) -> msg_id | Envía archivo. |
send_image_message(token, to_jid, url, file_name, file_size, width, height, thumbnail, caption, reply_to_id) -> msg_id | Envía imagen con metadatos. |
send_image_message_simple(token, to_jid, url, file_name, file_size, msg_id, reply_to_id) -> msg_id | Envía imagen sin metadatos. |
send_button_message(token, to_jid, text, buttons, reply_to_id) -> msg_id | Envía mensaje con botones. |
send_contact_message(token, to_jid, contact_id, contact_name, contact_phone, reply_to_id) -> msg_id | Envía contacto. |
send_sticker_message(token, to_jid, sticker_id, sticker_name, sticker_pack, sticker_hash, reply_to_id) -> msg_id | Envía sticker. |
send_video_message(token, to_jid, url, video_id, file_name, file_size, duration, width, height, thumbnail, info_text, reply_to_id) -> msg_id | Envía video. |
send_location_message(token, to_jid, lat, lon, zoom, text, reply_to_id) -> msg_id | Envía ubicación. |
send_event_message(token, to_jid, title, start, end, all_day, ics_data, event_id, reply_to_id) -> msg_id | Envía evento. |
send_chat_state(token, to_jid, state) | Notifica estado de escritura. |
delete_message(token, to_jid, message_id, msg_type, body, media_xml, reply_to_id) -> msg_id | Elimina mensaje. |
send_read_receipt(token, to_jid, msg_id, msg_type) -> msg_id | Confirma lectura. |
listen_messages(token, callback) | Bucle de escucha de mensajes. |
ToDusFileMixin (Archivos)
| Método | Descripción |
|---|---|
reserve_upload_url(token, size, file_type, file_name) -> (up_url, down_url) | Reserva URLs de subida/descarga. |
get_real_download_url(token, url) -> str | Obtiene URL real de descarga. |
upload_file(token, data, file_type, progress_callback, file_name) -> str | Sube archivo y retorna URL. |
download_file(token, url, path) -> int | Descarga a ruta local. |
download_file_to_folder(token, url, folder, filename) -> (int, str) | Descarga a carpeta. |
ToDusProfileMixin (Perfil)
| Método | Descripción |
|---|---|
update_profile(token, alias, bio, picture_url, thumbnail_url) -> bool | Actualiza perfil. |
upload_avatar(token, image_data, thumbnail_data) -> (profile_url, thumb_url) | Sube avatar. |
set_todus_id(new_id, msg_id) -> msg_id | Cambia @username (requiere sesión activa). |
ToDusChannelMixin (Canales)
| Método | Descripción |
|---|---|
create_channel(name, link, public, desc, picture, subs) -> msg_id | Crea canal. |
publish_to_channel(channel_jid, publ_xml) -> msg_id | Publica en canal. |
subscribe_channel(channel_jid) -> msg_id | Se suscribe a canal. |
leave_channel(channel_jid) -> msg_id | Abandona canal. |
get_my_channels() -> msg_id | Lista canales del usuario. |
get_channel_info(channel_link) -> msg_id | Obtiene info del canal. |
get_channel_publications(channel_jid, last_id, limit) -> msg_id | Obtiene publicaciones. |
ToDusStatusMixin (Estados/Historias)
| Método | Descripción |
|---|---|
publish_status(json_content) -> msg_id | Publica estado. |
delete_status(status_id) -> msg_id | Elimina estado. |
get_status(status_id) -> msg_id | Obtiene estado específico. |
follow_user(phone_number) -> msg_id | Sigue estados de usuario. |
unfollow_user(phone_number) -> msg_id | Deja de seguir. |
get_followers(phone_number, limit) -> msg_id | Lista seguidores. |
get_following(phone_number, limit) -> msg_id | Lista seguidos. |
get_follower_info(phone_number) -> msg_id | Info de relación. |
ToDusPrivacyMixin (Privacidad)
| Método | Descripción |
|---|---|
get_profile_privacy() -> msg_id | Obtiene privacidad de perfil. |
set_profile_privacy(profile_photo, last, info) -> msg_id | Configura privacidad. |
get_group_privacy() -> msg_id | Obtiene privacidad de grupos. |
set_group_privacy(who_can, exceptions) -> msg_id | Configura privacidad de grupos. |
ToDusBlockMixin (Bloqueos)
| Método | Descripción |
|---|---|
block_user(phone_number) -> msg_id | Bloquea usuario. |
unblock_user(phone_number) -> msg_id | Desbloquea usuario. |
get_block_list() -> msg_id | Lista bloqueados. |
get_block_list_paginated(limit, offset) -> msg_id | Lista paginada. |
ToDusLastMixin (Última Conexión)
| Método | Descripción |
|---|---|
get_last_seen(phone_number) -> msg_id | Obtiene última conexión. |
ToDusLocationMixin (Ubicación)
| Método | Descripción |
|---|---|
set_location(lat, lon) -> msg_id | Comparte ubicación. |
hide_location() -> msg_id | Oculta ubicación. |
get_people_near(limit, offset) -> msg_id | Personas cerca. |
get_near_status() -> msg_id | Estado de visibilidad. |
ToDusCallMixin (Llamadas)
| Método | Descripción |
|---|---|
get_turn_credentials(phone_number) -> msg_id | Obtiene credenciales TURN. |
start_call(phone_number, content) -> msg_id | Inicia llamada. |
end_call(phone_number, reason) -> msg_id | Finaliza llamada. |
pickup_call(phone_number, content) -> msg_id | Responde llamada. |
reject_call(phone_number) -> msg_id | Rechaza llamada. |