Skip to content

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

Package listing

@kody/producthunt

src/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))
}