import { type SentryRequestInput, requireRecord, requireStringOrNumber, sentryRequestFromInput } from './client.ts'
/**
* Call an arbitrary Sentry REST endpoint.
*
* Mutating methods (`POST`, `PUT`, `PATCH`, `DELETE`, …) default to dry-run.
* Pass `dryRun: false` only after the user confirms the exact path and body.
*
* @param params.path - API path starting with `/` (required).
* @param params.host - Optional API host. Default `sentry.io`.
* @param params.dryRun - Defaults to true for writes. Set false to execute.
* @returns Parsed JSON response, or `{ dryRun: true, wouldCall }` for writes.
* @example
* import sentryRequest from 'kody:@kody/sentry/request'
* const teams = await sentryRequest({ path: '/organizations/acme/teams/' })
* // => [{ slug: '...', name: '...' }]
*/
export default async function requestEntrypoint(params: unknown) {
const input = requireRecord(params, 'request')
requireStringOrNumber(input, 'path', 'request')
return sentryRequestFromInput(input as SentryRequestInput)
}