← Public packages
@kody/openapi
Bind an OpenAPI spec and call selected operations with saved integration or secret names.
src/index.ts
50 lines · 1.5 KB · TypeScriptimport bind from './bind.ts'
import call from './call.ts'
import get from './get.ts'
import list from './list.ts'
import refresh from './refresh.ts'
import unbind from './unbind.ts'
export { default as bind } from './bind.ts'
export { default as list } from './list.ts'
export { default as get } from './get.ts'
export { default as unbind } from './unbind.ts'
export { default as refresh } from './refresh.ts'
export { default as call } from './call.ts'
export { default as smokeTest } from './smoke-test.ts'
export type { BindInput, BindOutput } from './bind.ts'
export type { CallInput } from './call.ts'
export type { OpenApiBoundAuth } from './auth.ts'
/**
* Bind a named OpenAPI provider and call selected operations.
* Prefer `/bind` and `/call` subpaths when you only need one action.
* Person accounts must community_fork this package first.
*
* @param input - Same as bind()
* @returns Binding summary and selected slugs
*
* @example
* import openapi from 'kody:@<username>/openapi'
* await openapi.bind({
* name: 'acme',
* specUrl: 'https://api.example.com/openapi.json',
* apiBaseUrl: 'https://api.example.com',
* auth: { kind: 'none' },
* selection: { pathPrefixes: ['/ping'] },
* })
*/
async function openapi(
input: Parameters<typeof bind>[0],
): Promise<Awaited<ReturnType<typeof bind>>> {
return bind(input)
}
openapi.bind = bind
openapi.list = list
openapi.get = get
openapi.unbind = unbind
openapi.refresh = refresh
openapi.call = call
export default openapi