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/boxes.js

16 lines · 434 B · JavaScript
Raw
import { heyFetch } from './client.js'

/**
 * List HEY boxes (Imbox, Feed, etc).
 * Use when you need box ids/kinds before reading a mailbox.
 *
 * @returns {Promise<unknown[]>}
 *
 * @example
 * import listBoxes from 'kody:@danj/hey-email/boxes'
 * const boxes = await listBoxes()
 */
export default async function listBoxes() {
  const data = await heyFetch('/boxes.json')
  return Array.isArray(data) ? data : data?.boxes || []
}