@Isaac Wesego Apologies for late response, You may refer to quickstart documentation here:
Quickstart - Add chat to your app - An Azure Communication Services quickstart | Microsoft Learn
The listMessages()
returns a PagedAsyncIterableIterator
:
/**
* Gets a list of message from a thread identified by threadId.
* Returns the list of the messages.
* @param options - Get messages options.
*/
listMessages(options?: ListMessagesOptions): PagedAsyncIterableIterator<ChatMessage>;
That has a next()
method:
/**
An interface that allows async iterable iteration both to completion and by page.
*/
export declare interface PagedAsyncIterableIterator<TElement, TPage = TElement[], TPageSettings = PageSettings> {
/**
* The next method, part of the iteration protocol
*/
next(): Promise<IteratorResult<TElement>>;
/**
* The connection to the async iterator, part of the iteration protocol
*/
Symbol.asyncIterator: PagedAsyncIterableIterator<TElement, TPage, TPageSettings>;
/**
* Return an AsyncIterableIterator that works a page at a time
*/
byPage: (settings?: TPageSettings) => AsyncIterableIterator<TPage>;
}
The documentation for the core-paging module is here: azure-sdk-for-js/sdk/core/core-paging/README.md at main · Azure/azure-sdk-for-js (github.com)
Hope this helps, let us know,