interface Story { by: string; descendants: number; id: number; kids: number[]; score: number; /** Unix time in seconds */ time: number; title: string; type: "story"; url: string; } interface Comment { by: string; id: number; kids: number[]; parent: number; text: string; /** Unix time in seconds */ time: number; type: "comment"; } interface Ask { by: string; descendants: number; id: number; kids: number[]; score: number; text: string; /** Unix time in seconds */ time: number; title: string; type: "story"; } interface Job { by: string; id: number; score: number; text: string; time: number; title: string; type: "job"; url: string; } interface Poll { by: string; descendants: number; id: number; kids: number[]; parts: number[]; score: number; text: string; time: number; title: string; type: "poll"; } interface PollOpt { by: string; id: number; poll: number; score: number; text: string; time: number; type: "pollopt"; } /** Response from the /item/${id}.json endpoint */ type Item = Story | Comment | Ask | Job | Poll | PollOpt; interface User { about: string; created: number; delay: number; id: string; karma: number; submitted: number[]; } interface Updates { items: number[]; profiles: string[]; } type ItemMap = { story: Story; comment: Comment; poll: Poll; pollopt: PollOpt; job: Job; ask: Ask; }; declare const API: { is(item: Item, type: TType): item is ItemMap[TType]; /** Fetches up to 500 top and new stories */ getTopStories(): Promise; getNewStories(): Promise; /** Fetches up to 200 of the latest Ask HN stories */ getAskStories(): Promise; /** Fetches up to 200 of the latest Show stories */ getShowStories(): Promise; /** Fetches up to 200 of the latest Job stories */ getJobStories(): Promise; /** Fetches a Story, Comment, Ask, Job, Poll, or Polopt item */ getItem(id: number): Promise; /** Fetches a list of items in parallel. NOTE: this makes one request per item provided & the order of the returned stories is not guaranteed. */ getItems(ids: number[]): Promise; getUser(id: string): Promise; /** Fetches the latest Item Id. You can walk backward from here to discover all items. */ getMaxItemId(): Promise; getChangedItemsAndProfiles(): Promise; }; export { API as default, Story, Comment, Ask, Job, Poll, PollOpt, Item, User, Updates };