From 36c55c1f8b85f977c926b9273e56ea887f3e77e0 Mon Sep 17 00:00:00 2001 From: Jennifer Hasegawa <5481259+jhaaaa@users.noreply.github.com> Date: Tue, 22 Aug 2023 09:07:43 -0700 Subject: [PATCH] rm deprecated pagination code --- docs/build/messages.md | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/docs/build/messages.md b/docs/build/messages.md index 6db3ee0ea..b9ab8bd13 100644 --- a/docs/build/messages.md +++ b/docs/build/messages.md @@ -251,27 +251,6 @@ for (const conversation of await xmtp.conversations.list()) { If a conversation has a lot of messages, it's more performant to retrieve and process the messages page by page instead of handling all of the messages at once. - - -Call `conversation.messagesPaginated()`, which will return an [AsyncGenerator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator) yielding one page of results at a time. `conversation.messages()` uses this under the hood internally to gather all messages. - -```ts -const conversation = await xmtp.conversations.newConversation( - "0x3F11b27F323b62B159D2642964fa27C46C841897", -); - -for await (const page of conversation.messagesPaginated({ pageSize: 25 })) { - for (const msg of page) { - // Breaking from the outer loop will stop the client from requesting any further pages - if (msg.content === "gm") { - return; - } - console.log(msg.content); - } -} -``` - - Call `conversation.messages(limit: Int, before: Date)`, which will return the specified number of messages sent before that time.