import { parseAuthInput } from './auth.ts'
import { getUser } from './domain.ts'
import { optionalString, requireRecord } from './types.ts'
/**
* Look up a Product Hunt hunter by id or username.
* @example
* import getUser from 'kody:@kody/producthunt/get-user'
* const hunter = await getUser({ username: 'some-hunter' })
*/
export default async function getUserEntrypoint(
params: Record<string, unknown> = {},
) {
const input = requireRecord(params, 'get-user')
return getUser({
...parseAuthInput(input),
id: optionalString(input.id, 'id'),
username: optionalString(input.username, 'username'),
})
}