hn-ts
Version:
TypeScript client for the Hacker News API
32 lines • 759 B
TypeScript
import { Item } from "./item";
/**
* `getItemById` returns the `Item` with the given ID.
* If the item is not available, `getItemById` returns `undefined`.
*
* @example
* ```typescript
* import { getItemById } from 'hn-ts';
*
* (async () => {
* const item = await getItemById({
* id: 27107832,
* });
*
* // Output: `27107832`
* console.log(item.id);
*
* // Output: `story`
* console.log(item.type);
*
* // Output: `velut`
* console.log(item.author);
* })();
* ```
*
* @see {@link Item}
* @see {@link https://github.com/HackerNews/API#items}
*/
export declare function getItemById({ id, }: {
id: number;
}): Promise<Item | undefined>;
//# sourceMappingURL=get-item-by-id.d.ts.map