UNPKG

1.88 kBPlain TextView Raw
1/**
2 * This package provides a TypeScript client for the Hacker News API.
3 *
4 * @remarks
5 *
6 * @example
7 * Get the ID of the latest item created on HN:
8 *
9 * ```typescript
10 * import { getMaxItemId } from 'hn-ts';
11 *
12 * (async () => {
13 * const id = await getMaxItemId();
14 *
15 * // Output: a number like `27107832`
16 * console.log(id);
17 * })();
18 * ```
19 *
20 * @example
21 * Get the item (story, comment, job, poll or poll option) with the given ID:
22 *
23 * ```typescript
24 * import { getItemById } from 'hn-ts';
25 *
26 * (async () => {
27 * const item = await getItemById({
28 * id: 27107832,
29 * });
30 *
31 * // Output: `27107832`
32 * console.log(item.id);
33 *
34 * // Output: `story`
35 * console.log(item.type);
36 *
37 * // Output: `velut`
38 * console.log(item.author);
39 * })();
40 * ```
41 *
42 * @example
43 * Get the user with the given name:
44 *
45 * ```typescript
46 * import { getUserById } from 'hn-ts';
47 *
48 * (async () => {
49 * const user = await getUserById({
50 * id: "velut",
51 * });
52 *
53 * // Output: `velut`
54 * console.log(user.id);
55 * })();
56 * ```
57 *
58 * @see {@link https://news.ycombinator.com/}
59 * @see {@link https://github.com/HackerNews/API}
60 *
61 * @packageDocumentation
62 */
63
64export * from "./get-ask-stories-ids";
65export * from "./get-best-stories-ids";
66export * from "./get-item-by-id";
67export * from "./get-job-stories-ids";
68export * from "./get-latest-item-and-user-updates";
69export * from "./get-max-item-id";
70export * from "./get-new-stories-ids";
71export * from "./get-raw-item-by-id";
72export * from "./get-raw-user-by-id";
73export * from "./get-show-stories-ids";
74export * from "./get-top-stories-ids";
75export * from "./get-user-by-id";
76export * from "./hn-api-base-url";
77export * from "./item";
78export * from "./item-type";
79export * from "./raw-item";
80export * from "./raw-item-type";
81export * from "./raw-user";
82export * from "./updated";
83export * from "./user";