Skip to content
← Public packages

@kody/producthunt

Read today's Product Hunt posts, lookups, and comments through the saved Product Hunt OAuth integration.

FollowFork

Files

get-viewer.ts

17 lines · 531 B · TypeScript
import { parseAuthInput } from './auth.ts'
import { getViewer } from './domain.ts'
import { requireRecord } from './types.ts'

/**
 * Return the connected Product Hunt hunter from `viewer.user`.
 * Requires the `private` OAuth scope.
 * @example
 * import getViewer from 'kody:@kody/producthunt/get-viewer'
 * const me = await getViewer()
 */
export default async function getViewerEntrypoint(
	params: Record<string, unknown> = {},
) {
	const input = requireRecord(params, 'get-viewer')
	return getViewer(parseAuthInput(input))
}