← Public packages
@kody/openapi
Bind an OpenAPI spec and call selected operations with saved integration or secret names.
src/refresh.ts
28 lines · 841 B · TypeScriptimport bind from './bind.ts'
import { assertBindingName } from './selection.ts'
import { requireBinding } from './storage.ts'
/**
* Re-fetch the stored spec URL and re-apply the binding's selection.
* Use when the provider published a new OpenAPI document.
*
* @param input - Binding name
* @returns The same shape as bind()
*
* @example
* import refresh from 'kody:@<username>/openapi/refresh'
* await refresh({ name: 'acme' })
*/
export default async function refresh(input: { name: string }) {
const name = assertBindingName(input.name)
const binding = await requireBinding(name)
return bind({
name: binding.name,
specUrl: binding.specUrl,
apiBaseUrl: binding.apiBaseUrl,
auth: binding.auth,
selection: binding.selection,
includeDestructive: binding.includeDestructive,
description: binding.description,
})
}