Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(opapi): allow getting state without exporting it #60

Merged
merged 2 commits into from
Oct 3, 2023

Conversation

franklevasseur
Copy link
Member

This will allow doing:

import { OpenApi } from '@bpinternal/opapi'
import { api } from '@botpress/api'

const { errors } = api.getState()

const chatApi = OpenApi({
  metadata: {
    description: '...',
    server: 'http://localhost:3000',
    title: '...',
    version: '0.0.0',
  },
  errors // simply reuse errors from the Botpress API
})

instead of:

// gen.ts
import { api } from '@botpress/api'
api.exportState("./gen")

// index.ts
import { state } from './gen'
const chatApi = OpenApi({
  metadata: {
    description: '...',
    server: 'http://localhost:3000',
    title: '...',
    version: '0.0.0',
  },
  errors: state.errors
})

@franklevasseur franklevasseur merged commit 92dafe0 into master Oct 3, 2023
@franklevasseur franklevasseur deleted the fl_opapi_get_state branch February 7, 2024 16:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants