Add unified support conversations endpoints#1288
Draft
jkmassel wants to merge 2 commits into
Draft
Conversation
Wires `/wpcom/v2/mobile-support/unified-conversations` into `WpComApiClient`: list, get one, and reply. Message/attachment shape differs from the older `/mobile-support/conversations` endpoints, and reference-link attachments carry a float `score` in metadata — using `JsonValue` for metadata values rather than extending the Eq-bound `AttachmentMetadataValue`.
- Swift: expose `unifiedConversations` on `WPComApiClient`; add a read-only "Unified Conversations" row to the WPCom root list showing title, status, and created date. - Kotlin: add a list screen (tappable) and a detail screen showing messages, author role/name, and attachment count. Wired through `WpComSiteScreen` and `App.kt` navigation. Conversation ID passed through remembered state to match the existing pattern for post type / taxonomy navigation.
Collaborator
XCFramework BuildThis PR's XCFramework is available for testing. Add to your .package(url: "https://github.com/automattic/wordpress-rs", branch: "pr-build/1288")Built from bc3f97d |
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.
Description
Wires
/wpcom/v2/mobile-support/unified-conversationsintoWpComApiClient. This is the newer unified support endpoint that supersedes/mobile-support/conversations; the response shape is different enough that reusing the existingSupportConversationtypes isn't a good fit.Changes
wp_com::unified_conversationswith response/param types:UnifiedConversationSummary(list item — addscan_accept_reply: boolvs. the older summary)UnifiedConversation+UnifiedMessage(flatmessage/author_role/author_nameshape — not the older nestedSupportMessageAuthorenum)UnifiedAttachmentwithmetadata: HashMap<String, JsonValue>— reference-link attachments carry a floatscore, and the existingAttachmentMetadataValueisEq-bound so can't holdf64. Reusing the crate-wideJsonValueavoided either breakingEqon the existing type or inventing a parallel value enum.ReplyToUnifiedConversationParams { message: String }— JSON body, no attachments (the current API doesn't accept them on reply)ConversationIdfromsupport_tickets(the IDs are in the same namespace)UnifiedConversationsRequestendpoint enum underWpComNamespace::V2:GET /mobile-support/unified-conversationsGET /mobile-support/unified-conversations/<conversation_id>POST /mobile-support/unified-conversations/<conversation_id>wp_com/mod.rs,wp_com/endpoint.rs, andwp_com/client.rs(builder + executor +api_client_generate_endpoint_impl!)Test plan
cargo build -p wp_apicargo test --lib -p wp_api unified_conversations— 6 tests passcan_accept_reply/statusspot-checkedJsonValue::Floatscorecargo fmt --all -- --checkcargo clippy -p wp_api --tests --all-features -- -D warningspublic-api.wordpress.comfrom the example app (follow-up)