oPoint realtime news feed API client
Installation
$ npm install --save @opoint/storedsearch
$ npm install --save-dev @opoint/types
Using stored search
See tests/stored-search.test.ts
and @opoint/types
for more options.
import { StoredSearch } from '@opoint/storedsearch'
const api = new StoredSearch({ api_key: process.env.OPOINT_API_KEY })
const props: StoredSearchAddProps = { search: "Anthropic"}
const res = await api.add(props)
const res = await api.list()
const body = res.data as StoredSearchListResponse
const params: StoredSearchRetrieveProps = {
id: 0,
}
const res = await api.retrieve(params)
const body = res.data as StoredSearchRetrieveResponse
const params: StoredSearchFeedProps = {
from: 0,
format: 'json' as FormatEnum,
num_art: 50,
}
const res = await api.feed(params)
const body = res.data as StoredSearchFeedResponse
const documents: Array<DocumentProps> = body.searchresult.document
const params: StoredSearchUpdateProps = {
id: 0,
search: "Anthropic Claude"
}
const res = await api.update(params)
const body = res.data as StoredSearchUpdateResponse
const props: StoredSearchDeleteProps = {
id: searches[0]?.id
}
const res = await api.delete(props)
Contributing
Tests
$ npm install --dev
$ npm run tests
Add a new package
Following this pattern:
https://www.yieldcode.blog/post/npm-workspaces/
https://stackoverflow.com/questions/72055371/npm-workspaces-typescript-unable-to-find-local-modules
$ npm init --workspace packages/types --scope @opoint -y
$ ls -la node_modules/@opoint/
Require a new package
$ npm install @opoint/types --workspace ./packages/storedsearch
$ cat packages/storedsearch/package.json | grep -C1 opoint
$ npm ls