API Reference
This section contains the complete API reference for Legend.
Core API
Section titled “Core API”createLegend(config)
Section titled “createLegend(config)”Creates a new Legend instance.
Parameters:
| Parameter | Type | Description |
|---|---|---|
config | object | Configuration object |
Returns: Legend instance
Example:
import { createLegend } from '@legend/core'
const legend = createLegend({ apiKey: 'your-api-key',})legend.query(collection, options)
Section titled “legend.query(collection, options)”Query a collection for documents.
Parameters:
| Parameter | Type | Description |
|---|---|---|
collection | string | Collection name |
options | object | Query options |
Returns: Promise<Document[]>
Example:
const users = await legend.query('users', { where: { status: 'active' }, limit: 10,})