Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/reddit

src/get-listing.ts

15 lines · 676 B · TypeScript
import { getListing } from './client.ts'
import type { GetListingInput } from './client.ts'

/**
 * Read a Reddit listing (front page or a subreddit).
 * @param params.subreddit - Community name. Omit for the authenticated front page.
 * @param params.sort - `best`, `hot`, `new`, `top`, `rising`, or `controversial`.
 * @example
 * import getListing from 'kody:@kody/reddit/get-listing'
 * const listing = await getListing({ subreddit: 'programming', sort: 'hot', limit: 5 })
 * // => { listing: { after: '...', posts: [{ id, title, author, score, ... }] } }
 */
export default async function getListingEntrypoint(params: GetListingInput = {}) {
	return getListing(params)
}