Documentation SDK for framework documentation access. Provides a unified JavaScript implementation with full TypeScript type definitions.
npm install @docs4ai/sdkconst { Docs4AI } = require('@docs4ai/sdk');
const sdk = new Docs4AI({
apiKey: 'your-api-key',
baseUrl: 'optional-custom-url'
});
// Get supported frameworks
const frameworks = await sdk.getFrameworks();
// Search documentation
const results = await sdk.search({
framework: 'react',
version: '17.0.0',
query: 'hooks'
});import { Docs4AI } from '@docs4ai/sdk';
import type { SearchParams, SearchResult } from '@docs4ai/sdk';
const sdk = new Docs4AI({
apiKey: 'your-api-key',
baseUrl: 'optional-custom-url'
});
// Get supported frameworks
const frameworks = await sdk.getFrameworks();
// Search documentation with type safety
const params: SearchParams = {
framework: 'react',
version: '17.0.0',
query: 'hooks'
};
const results: SearchResult[] = await sdk.search(params);src/
├── index.js # Core implementation
├── index.d.ts # TypeScript type definitions
└── __tests__/
├── index.test.js # Functional tests
└── type-validation.test.ts # Type system tests
new Docs4AI(config: Docs4AIConfig)apiKey(required): Your API key for authenticationbaseUrl(optional): Custom base URL for API requests
getFrameworks(): Get list of supported frameworks and versionsgetChapters(framework: string, version: string): Get chapters for a specific framework versiongetDocContent(framework: string, version: string, chapterId: string): Get documentation contentsearch(params: SearchParams): Search documentationquery(params: QueryRequest): Query documentation using AIchat(request: ChatRequest): Chat completions
# Install dependencies
npm install
# Run tests
npm test # Run all tests
npm run test:unit # Run unit tests only
npm run test:types # Run type validation tests
# Build
npm run buildMIT