[CHA-4661] feat: page getChannel messages by message ID - #265
Merged
Conversation
Adds messagesIdLt, messagesIdLte, messagesIdGt, messagesIdGte and messagesIdAround to the getChannel request. They page the messages of the channel by message ID, so a caller no longer needs getOrCreate for that. The cursors need state(true), and a message ID the channel does not hold yields a 404.
Pages a three-message channel with messagesIdLt and messagesIdGt, and asserts that a cursor the channel does not hold fails with 400.
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.
Adds
messagesIdLt,messagesIdLte,messagesIdGt,messagesIdGteandmessagesIdAroundtoChannel.getChannel(...). Bumble needs to page a channel's messages by message ID withoutgetOrCreate, which can create the channel.The cursors need
state(true). A message ID the channel does not hold yields a 400, and two conflicting cursors yield a 400 as well. Both come from the backend, GetStream/chat#15616.Verify:
GetChannelTestasserts the cursors reach thepayloadquery parameter, with no network access. Checked end to end against a shard that already runs the backend change:messagesIdLtandmessagesIdGtpage as expected, and an unknown cursor fails with 400. Integration tests follow once the backend change is deployed fleet-wide, because CI runs against a live app.Until that deploy, a shard without the change ignores these fields and returns the unpaginated messages, so this SDK change is safe to release on its own.
Linear: https://linear.app/stream/issue/CHA-4661/bumble-wants-messageid-pagination-for-getchannel-endpoint