Skip to content

Kody is live

Watch the launch video — what Kody is, and why it exists.

← Public packages

@noah/hey-email

HEY.com email integration with Kody: search threads, read messages/attachments, create drafts, and send with explicit confirmation.

src/topic.js

17 lines · 484 B · JavaScript
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:@noah/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`)
}