Skip to content

Built for people who want to own their automations. Join the waitlist for an invite.

Package listing

@kody/sentry

src/get-latest-issue-event.ts

18 lines · 824 B · TypeScript
import { type IssueInput, getLatestIssueEvent, requireRecord, requireStringOrNumber } from './client.ts'

/**
 * Fetch the most recent event for a Sentry issue.
 *
 * @param params.issueId - Sentry issue id (required).
 * @param params.host - Optional API host. Default `sentry.io`.
 * @returns Latest event payload (stack traces, breadcrumbs, tags).
 * @example
 * import getLatestEvent from 'kody:@kody/sentry/get-latest-issue-event'
 * const event = await getLatestEvent({ issueId: '1234567890' })
 * // => { id: '...', title: 'TypeError', entries: [...] }
 */
export default async function getLatestIssueEventEntrypoint(params: unknown) {
	const input = requireRecord(params, 'get-latest-issue-event')
	requireStringOrNumber(input, 'issueId', 'get-latest-issue-event')
	return getLatestIssueEvent(input as IssueInput)
}