fix(headless): correct chat room model, message body format, and auth flow#1
Merged
fix(headless): correct chat room model, message body format, and auth flow#1
Conversation
… flow - ChatRoomList now paginates ChatRoomDetail directly instead of the ChatRoom wrapper that always returned None for all fields - create_chat_message accepts body=string and auto-converts to the tiptap rich_text_body format Circle requires (fixes messages appearing as empty/undefined) - Added _text_to_tiptap helper for plain text to tiptap conversion - Updated create_chat_room, get_chat_room, update_chat_participant return types from ChatRoom to ChatRoomDetail (sync and async) - Added headless_as_user convenience method to CircleClient for the two-step headless auth flow (auth token -> user access token)
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.
Changes
ChatRoomList model fix:
PaginatedResponse[ChatRoomDetail]instead ofPaginatedResponse[ChatRoom]. TheChatRoomwrapper always returnedNonefor all fields because the API returns flat records, not nested underchat_room.create_chat_message body helper: Accepts
body="plain text"and auto-converts to Circle's tiptaprich_text_bodyformat. Previously, passingbody="text"silently sent but displayed as empty/undefined in Circle.headless_as_user convenience method: Simplifies the two-step headless auth flow into one call:
client.headless_as_user(email="...")returns a ready-to-use headless namespace.Return type fixes:
create_chat_room,get_chat_room,update_chat_participantnow returnChatRoomDetailinstead ofChatRoom(both sync and async).Before/After
Testing
Tested against live Circle.so community with 10K+ members.