import { heyFetch } from './client.js' /** * List entries (messages) in a HEY topic. * Use when reading full purchase/shipping thread bodies after search. * * @param {{ topicId: number|string }} input * @returns {Promise} * * @example * import getEntries from 'kody:@danj/hey-email/entries' * const entries = await getEntries({ topicId: 123456789 }) */ export default async function getEntries(input) { const topicId = input?.topicId if (topicId == null) throw new Error('topicId is required') const data = await heyFetch(`/topics/${topicId}/entries.json`) return Array.isArray(data) ? data : [] }