Skip to content
← Public packages

@danj/hey-email

HEY.com email for Kody: search threads, read messages, download PDF attachments, and write drafts. Sending is barred until you allow it.

src/topic.js

17 lines · 484 B · JavaScript
Raw
import { heyFetch } from './client.js'

/**
 * Get one HEY topic (thread) by id.
 *
 * @param {{ topicId: number|string }} input
 * @returns {Promise<unknown>}
 *
 * @example
 * import getTopic from 'kody:@danj/hey-email/topic'
 * const topic = await getTopic({ topicId: 123456789 })
 */
export default async function getTopic(input) {
  const topicId = input?.topicId
  if (topicId == null) throw new Error('topicId is required')
  return await heyFetch(`/topics/${topicId}.json`)
}