Skip to content

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

Package listing

@kody/netlify

src/request.js

17 lines · 747 B · JavaScript
import { netlifyRequest } from './netlify.js'

/**
 * Call a Netlify REST endpoint using the caller's personal access token.
 * Prefer named helpers; use this for paths not wrapped by this package.
 * Mutating methods require `dryRun: true` or `confirm: true`.
 * @param {Object} [input]
 * @param {string} input.path Relative API path such as `/user` or `/sites`.
 * @param {boolean} [input.dryRun] Return the request preview without calling Netlify.
 * @returns {Promise<{ status: number, data: unknown } | { dryRun: true }>}
 * @example
 * import request from 'kody:@kody/netlify/request'
 * const result = await request({ path: '/user' })
 */
export default async function requestEntrypoint(input = {}) {
	return await netlifyRequest(input)
}