Fix message API conformance and add bulk-send/send-group commands#292
Draft
SeanAlexanderHarris wants to merge 2 commits intomainfrom
Draft
Fix message API conformance and add bulk-send/send-group commands#292SeanAlexanderHarris wants to merge 2 commits intomainfrom
SeanAlexanderHarris wants to merge 2 commits intomainfrom
Conversation
Align CLI message commands with the current Prolific Messages API: - Fix Message model fields (datetime_created→sent_at, add id/type/channel_id) - Replace map[string]any Data with typed MessageData struct (study_id, category) - Eliminate UnreadMessage struct; unify both endpoints on Message - Remove post-processing loop in GetMessages (JSON unmarshaling handles it) - Update list output to 6 curated columns (ID, Sender ID, Study ID, Category, Sent At, Body) - Add bulk-send command (POST /api/v1/messages/bulk/) - Add send-group command (POST /api/v1/messages/participant-group/) - Add BulkSendMessage and SendGroupMessage to client.API interface - Regenerate mocks; all tests pass, lint clean (99.2% coverage on cmd/message) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
…eated) The Prolific API documentation was inaccurate — the real API returns "sender" (not "sender_id") for the unread endpoint and "datetime_created" (not "sent_at") for timestamps. This adds both sender fields with a GetSenderID() coalescing method and reverts the timestamp json tag. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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.
Summary
datetime_created→sent_at, add missingid/type/channel_idfields, replacemap[string]anyData with typedMessageDatastruct (exposingstudy_idandcategory)UnreadMessagestruct — both/messages/and/messages/unread/return the sameMessageschema per API docsGetMessagesthat extractedstudy_idfrom the Data map — the typed struct handles this via JSON unmarshalingID,Sender ID,Study ID,Category,Sent At,Body(breaking change — old output was incorrect/incomplete)bulk-sendcommand (POST /api/v1/messages/bulk/) for sending messages to multiple participantssend-groupcommand (POST /api/v1/messages/participant-group/) for messaging a participant group (study_id optional)BulkSendMessageandSendGroupMessagetoclient.APIinterface with implementationscmd/messageTest plan
make test— all 24 packages passmake lint— 0 issuesgo test ./cmd/message/... -v— 17 tests pass (99.2% coverage)--helpoutput for all 4 message subcommandsMessagestruct matches API schema,UnreadMessagedeleted,MessageDataaddedPROLIFIC_TOKEN(seespecs/002-fix-message-api-conformance/quickstart.md)🤖 Generated with Claude Code