import { tl } from '../../../tl/index.js'; import { ITelegramClient } from '../../client.types.js'; import { InputDialogFolder, Dialog } from '../../types/index.js'; /** * Iterate over dialogs. * * Note that due to Telegram API limitations, * ordering here can only be anti-chronological * (i.e. newest - first), and draft update date * is not considered when sorting. * * @param params Fetch parameters */ export declare function iterDialogs(client: ITelegramClient, params?: { /** * Offset message date used as an anchor for pagination. */ offsetDate?: Date | number; /** * Offset message ID used as an anchor for pagination */ offsetId?: number; /** * Offset peer used as an anchor for pagination */ offsetPeer?: tl.TypeInputPeer; /** * Limits the number of dialogs to be received. * * @default `Infinity`, i.e. all dialogs are fetched */ limit?: number; /** * Chunk size which will be passed to `messages.getDialogs`. * You shouldn't usually care about this. * * @default 100. */ chunkSize?: number; /** * How to handle pinned dialogs? * * Whether to `include` them at the start of the list, * `exclude` them at all, or `only` return pinned dialogs. * * Additionally, for folders you can specify * `keep`, which will return pinned dialogs * ordered by date among other non-pinned dialogs. * * > **Note**: When using `include` mode with folders, * > pinned dialogs will only be fetched if all offset * > parameters are unset. * * @default `include`. */ pinned?: 'include' | 'exclude' | 'only' | 'keep'; /** * How to handle archived chats? * * Whether to `keep` them among other dialogs, * `exclude` them from the list, or `only` * return archived dialogs * * Ignored for folders, since folders * themselves contain information about archived chats. * * > **Note**: when `pinned=only`, `archived=keep` will act as `only` * > because of Telegram API limitations. * * @default `exclude` */ archived?: 'keep' | 'exclude' | 'only'; /** * Folder from which the dialogs will be fetched. * * You can pass folder object, id or title * * Note that passing anything except object will * cause the list of the folders to be fetched, * and passing a title may fetch from * a wrong folder if you have multiple with the same title. * * Also note that fetching dialogs in a folder is * orders of magnitudes* slower than normal because * of Telegram API limitations - we have to fetch all dialogs * and filter the ones we need manually. If possible, * use {@link Dialog.filterFolder} instead. * * When a folder with given ID or title is not found, * {@link MtArgumentError} is thrown * * @default (fetches from "All" folder) */ folder?: InputDialogFolder; /** * Additional filtering for the dialogs. * * If `folder` is not provided, this filter is used instead. * If `folder` is provided, fields from this object are used * to override filters inside the folder. */ filter?: Partial>; }): AsyncIterableIterator;