import { BoardId } from './Board.d.js'; import { Comment, CommentId } from './Comment.d.js'; export type ThreadId = number; export interface Thread { // Thread ID. // Same as the "id" of the first comment. id: ThreadId; // Board ID. // Example: "b". boardId: BoardId; // Thread title ("subject"). title?: string; // If the thread has no `title`, then `autogeneratedTitle` // is generated from the thread's "original comment" `content`. // This could be empty too: for example, if the "original comment" has no `content`. autogeneratedTitle?: string; // The date on which the thread was created. // Is absent in "get threads list" API response // of `lynxchan` engine which is a bug // but seems like they don't want to fix it. createdAt?: Date; // "Last Modified Date", usually including: // posting new comments, deleting existing comments, sticky/closed status changes. // Is usually present on all imageboards in "get threads list" API response // but not in "get thread comments" API response. updatedAt?: Date; // If this was an incremental "get thread" API request, // `afterCommentId` could potentially contain the ID of the latest comment // that was skipped when returning a list of `comments` in this thread. afterCommentId?: CommentId; // Comments count in this thread. // (including the main comment of the thread). commentsCount: number; // Attachments count in this thread. // (including the attachments of the main comment of the thread). attachmentsCount: number; // Attachments count in comments of this thread. // (not including the attachments of the main comment of the thread). commentAttachmentsCount: number; // Unique poster IP address subnets count. // Only present in "get thread" API response. uniquePostersCount?: number; // The list of comments in this thread. // (including the main comment of the thread). comments: Comment[]; // The list of "latest comments" in this thread. // Is returned when "get thread" API is called with `withLatestComments: true` parameter. latestComments?: Comment[]; // Is this thread "sticky" ("pinned") ("on top of others"). pinned?: boolean; // The order of a "sticky" ("pinned") thread amongst other "sticky" ("pinned") ones. // // For example, `threadA.pinnedOrder: 1` means that `threadA` is at position 1 in the threads list, // and `threadB.pinnedOrder: 2` means that `threadB` is at position 2 in the threads list, // which also means that `threadA` is positioned above `threadB` in the list. // // `pinnedOrder` can start with any number and is not required to be sequential, // i.e. there could be gaps in the order numbers. // pinnedOrder?: number; // Is this thread "locked", i.e. doesn't allow any new comments. locked?: boolean; // A "trimming" thread is one where old messages are purged as new ones come in, // so that the total comments count doesn't exceed a certain threshold. trimming?: boolean; // On imageboards, threads "expire" due to being pushed off the // last page of a board because there haven't been new replies. // On some boards, such "expired" threads are moved into an "archive" // rather than just being deleted immediately. // Eventually, a thread is deleted from the archive too. // If a thread is archived, then it's locked too (by definition). archived?: boolean; // If `archived` is `true`, then `archivedAt` date might be defined. // So far, only `4chan`, `makaba` and `lynxchan` seem to have the archive feature. // * `4chan` provides both `archived` and `archivedAt` data in thread properties. // * `makaba` doesn't provide such data, but the code employs some hacks // to find out whether a thread is archived, and, if it is, when has it been archived. // `makaba` requires the `request()` function to return a `{ response, url }` object // in order to get the `archivedAt` date of an `archived` thread. // * `lynxchan` allows admins or moderators to manually archive threads, // but doesn't provide `archivedAt` date. archivedAt?: Date; // Was the "bump limit" reached for this thread already. // Is `false` when the thread is "sticky" or "trimming" // because such threads don't expire. bumpLimitReached?: boolean; // `4chan.org` sets a limit on maximum attachments count in a thread. attachmentsMaxCountLimitReached?: boolean; // Custom spoiler ID (if custom spoilers are used on the board). // For example, `4chan.org` has this feature. customSpoilerId?: number; // If this thread is marked by any "tags", this is gonna be a list of those. // "Tags" could be used when searching for threads. tags?: string[]; }