@ebitex/data-sdk
v0.1.347
Published
The client for the ebitex Data Delivery API: typed queries with filters, sorts, facets, keyset paging and reference expansion, for a server or a browser.
Maintainers
Readme
@ebitex/data-sdk
The client for the ebitex Data Delivery API. Filters, sorts, facets, keyset paging and reference expansion, typed, in a browser or on a server. No runtime dependencies.
import { createDataClient } from '@ebitex/data-sdk'
const data = createDataClient({ apiKey: 'ebx_your_key' })
const page = await data.records({ model: 'dog', filters: { colour: 'black' }, sort: '-born', limit: 25 })
for await (const dog of data.eachRecord({ model: 'dog' })) console.log(dog.name)- Keys. A key with no origin or address restriction is a server key and reads everything in its partition; never ship one to a browser. A key restricted to your site's origins is browser-safe and reads only the models and fields marked public.
- Read
models()first. It lists what your key may ask for: each field's type and whether it can be filtered, sorted or counted. - A cursor belongs to its query.
eachRecordandeachPagecapture the query once and send it unchanged with every cursor. - Nothing is cached or retried. Pass your own
fetchto add either. - Errors.
DataApiErrorcarries the status, the server'scode, and theX-Request-Idto quote.DataNetworkErroris a failure to connect. A request the client refuses to send (a limit of 500, more than 5 facets) is aDataApiErrorwithlocal: true.
Documentation: https://developers.ebitex.io/reference/data-sdk/
Licensed under Apache-2.0.
