0.4.2 • Published 5 months ago

@nimblebrain/api-spec v0.4.2

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

NimbleBrain API Specification

This repository contains the OpenAPI specification for the NimbleBrain API, generated from TypeScript and Zod schemas. It provides a comprehensive documentation of all available endpoints, request/response schemas, and authentication requirements.

šŸš€ Features

  • OpenAPI 3.0.0 specification
  • Type-safe schema definitions using Zod
  • Automatic SwaggerUI generation
  • Bearer token authentication
  • Detailed request/response examples
  • Built with TypeScript
  • Pagination support
  • Error handling standardization

šŸ“– API Documentation

The API documentation is available at: https://developer.nimblebrain.ai/

šŸ”‘ Authentication

All endpoints require authentication using a Bearer token. To authenticate:

  1. Include an Authorization header with your requests
  2. Format: Authorization: Bearer [your_jwt_token]

šŸ› ļø Available Endpoints

Conversations

Agents

  • GET /agents - List all agents (paginated)
  • GET /agents/:agentId - Get a specific agent

Conversations

  • GET /agents/:agentId/conversations - List agent conversations (paginated)
  • POST /agents/:agentId/conversations - Create a new conversation
  • GET /agents/:agentId/conversations/:conversationId - Get conversation details
  • DELETE /agents/:agentId/conversations/:conversationId - Delete a conversation

Messages

  • GET /agents/:agentId/conversations/:conversationId/messages - List conversation messages (paginated)
  • POST /agents/:agentId/conversations/:conversationId/messages - Add a message to a conversation

Response formats

All API endpoints follow a consistent response format:

šŸ› ļø Standard Response

{
  "data": T | null,
  "error": {
    "id": string,
    "errorCode": string,
    "message": string,
    "details"?: object,
    "timestamp": string
  } | null
}

Paginated Response

{
  "data": {
    "items": T[],
    "page": number,
    "limit": number,
    "total": number
  } | null,
  "error": {
    "id": string,
    "errorCode": string,
    "message": string,
    "details"?: object,
    "timestamp": string
  } | null
}

šŸ’» Local Development

Prerequisites

  • Node.js (v20 or later)
  • npm (or yarn)

Setup

  1. Clone the repository:
git clone https://github.com/NimbleBrainInc/nimblebrain-api-spec.git
cd nimblebrain-api-spec
  1. Install dependencies:
npm install
  1. Generate documentation:
npm run generate-docs
  1. Start local server:
npm start

The SwaggerUI will be available at http://localhost:9000

Project Structure

src/
ā”œā”€ā”€ schemas/                  # Zod schema definitions
│   ā”œā”€ā”€ zodSetup.ts           # Zod configuration
│   ā”œā”€ā”€ agent.schema.ts       # Agent schemas
│   ā”œā”€ā”€ conversation.schema.ts
│   ā”œā”€ā”€ message.schema.ts
│   ā”œā”€ā”€ pagination.schema.ts
│   ā”œā”€ā”€ responses.schema.ts   # API response schemas
│   └── route-params.schema.ts
ā”œā”€ā”€ routes/                   # API route definitions
│   ā”œā”€ā”€ agents/
│   │   └── index.ts
│   ā”œā”€ā”€ conversations/
│   │   └── index.ts
│   └── common.ts             # Common route types & error responses
└── generateDocs.ts           # Documentation generator

šŸ”„ Publishing Updates

  1. Make changes to the schemas or routes
  2. Run npm run generate-docs to regenerate the documentation
  3. Run npm start and confirm your changes are correct
  4. Release new version
npm run release:patch  # For bug fixes
npm run release:minor  # For new features
npm run release:major  # For breaking changes

šŸ¤ Contributing

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

šŸ“ License

This project is licensed under the MIT License - see the LICENSE file for details.

šŸ“® Support

For support, please reach out to our team at support@nimblebrain.ai

0.4.2

5 months ago

0.4.1

5 months ago

0.4.0

5 months ago

0.3.9

9 months ago

0.3.8

9 months ago

0.3.7

9 months ago

0.3.6

9 months ago

0.3.5

9 months ago

0.3.4

9 months ago

0.3.3

9 months ago

0.3.2

9 months ago

0.3.1

9 months ago

0.3.0

9 months ago

0.2.0

9 months ago

0.1.0

9 months ago

0.0.16

9 months ago

0.0.15

9 months ago

0.0.14

9 months ago

0.0.13

9 months ago

0.0.12

9 months ago

0.0.11

9 months ago

0.0.10

9 months ago

0.0.9

9 months ago

0.0.8

9 months ago

0.0.7

9 months ago

0.0.6

9 months ago

0.0.5

9 months ago

0.0.4

9 months ago

0.0.3

9 months ago

0.0.1

9 months ago