0.3.0: media messages, room/bot lifecycle, state + account data, devices#14
Merged
Conversation
mx_get_state() is the read-side counterpart of mx_set_state() (e.g. check m.room.encryption before joining the send path); both it and mx_get_account_data() return NULL on M_NOT_FOUND rather than erroring. Account data stays generic (type + content) -- no DM-semantics helpers.
Generic upload-then-post: mx_upload() to the media repo, then an m.room.message with url + info (mimetype, size). Sugar wrappers fix the msgtype. Richer metadata (dimensions, duration) is caller-supplied via info -- no media-inspection dependencies.
mx_profile() reads displayname/avatar_url; mx_set_displayname() and mx_set_avatar_url() let a bot dress itself after mx_upload(). mx_room_invite() covers inviting into an existing room (creation-time invites already existed). mx_redact() is Matrix deletion, rounding out reactions. mx_typing() shows/clears the typing indicator while a slow reply generates.
Listing is a plain GET. Deletion passes any user-interactive auth payload through verbatim and documents the 401-then-retry dance; mx.api deliberately does not automate the password exchange (that needs stored credentials, which is client-layer state).
README: refresh the stale dev-version references (was still describing the pre-0.2.0 delta), extend the coverage table with the new endpoint families, and point the E2EE framing at mx.client as the stateful integration layer. NEWS: 0.3.0 entry covering the full batch, including mx_send_event()/mx_set_state() from #13 which never got an entry.
…onfig() mx_send_media(msgtype = NULL) now derives m.image/m.audio/m.video from the MIME family, so pointing it at a file just works. mx_guess_mime() is exported so callers don't maintain their own extension table. mx_media_config() asks the server for its upload cap (m.upload.size), v1 endpoint with legacy fallback.
All HTTP failures now signal a condition classed
c("mx_error_<ERRCODE>", "mx_error", "error"), carrying $errcode,
$status, and the parsed $body, so code can react to specific failures
(tryCatch(..., mx_error_M_UNKNOWN_TOKEN = relogin)) instead of grepling
the message. Message text keeps the historical "Matrix error [CODE]:
msg" shape, so string-matching callers keep working. mx_get_state()
and mx_get_account_data() now catch by class.
mx_upload() read the whole file into RAM before sending; switch to curl upload mode with a readfunction so multi-GB files stream from a connection (customrequest keeps the method POST). Verified live with an 8MB byte-identical round-trip. mx_guess_mime() returned NA instead of the documented octet-stream fallback on unknown extensions (named-vector miss is NA, not NULL, so %||% never fired) -- now load-bearing for msgtype auto-detection.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Batches every known gap into one CRAN slot (one endpoint family per commit for review):
mx_get_state()(read-side ofmx_set_state(); returns NULL on M_NOT_FOUND), genericmx_get_account_data()/mx_set_account_data().mx_send_media()(upload + post) withmx_send_file/image/audio/video()wrappers. Metadata beyond mimetype/size is caller-supplied; no media-inspection deps.mx_profile()",mx_set_displayname(),mx_set_avatar_url(),mx_room_invite(),mx_redact(),mx_typing()`.mx_devices(),mx_delete_device(auth = NULL)passing UIA payloads through verbatim (no automated reauth).Verified: suite 169/0;
R CMD check --as-cran0/0/0; every new endpoint exercised live against Conduit, including the documented 401→auth retry on device deletion.Boundary note: everything here is a stateless single-endpoint wrapper (mx_send_media composes two of its own endpoints, still zero state) — the stateful/orchestration layer stays in mx.client.