1 | import { ItemType } from "./item-type";
|
2 |
|
3 | /**
|
4 | * `Item` represents an HN item.
|
5 | *
|
6 | * @remarks
|
7 | * An `Item` differs from a `RawItem` as some of its properties are renamed
|
8 | * and their values cleaned up.
|
9 | *
|
10 | * @see {@link RawItem}
|
11 | * @see {@link https://github.com/HackerNews/API#items}
|
12 | */
|
13 | export interface Item {
|
14 | /** Unique integer item ID */
|
15 | readonly id: number;
|
16 |
|
17 | /** Item type (`job`, `story`, `comment`, `poll`, `pollopt` or `unknown`) */
|
18 | readonly type: ItemType;
|
19 |
|
20 | /** User who submitted the item */
|
21 | readonly author?: string;
|
22 |
|
23 | /** Title text for a story, poll or job */
|
24 | readonly title?: string;
|
25 |
|
26 | /** URL for a story or job */
|
27 | readonly url?: string;
|
28 |
|
29 | /** Text for a story, comment, poll, poll option or job */
|
30 | readonly text?: string;
|
31 |
|
32 | /**
|
33 | * UTC timestamp in ISO 8601 format for when the item was created
|
34 | * (for example, `2021-10-02T18:12:10.149Z`)
|
35 | */
|
36 | readonly timestamp?: string;
|
37 |
|
38 | /** Score for a story, job or poll; votes for a poll option */
|
39 | readonly score?: number;
|
40 |
|
41 | /** Number of total comments for a story or poll */
|
42 | readonly numChildren?: number;
|
43 |
|
44 | /** Set to `true` if the item is deleted */
|
45 | readonly deleted: boolean;
|
46 |
|
47 | /** Set to `true` if the item is dead */
|
48 | readonly dead: boolean;
|
49 |
|
50 | /** ID of the parent item of a comment (a story or another comment) */
|
51 | readonly parentId?: number;
|
52 |
|
53 | /** List of IDs of the item's comments, in ranked display order */
|
54 | readonly childrenIds?: number[];
|
55 |
|
56 | /** ID of the poll associated to a poll option */
|
57 | readonly pollId?: number;
|
58 |
|
59 | /** List of IDs of related poll options, in display order */
|
60 | readonly pollOptionsIds?: number[];
|
61 | }
|