@thehive/cms-content-api
TypeScript icon, indicating that this package has built-in type declarations

0.11.4 • Public • Published

The Hive CMS: Content API

.github/workflows/tests.yml npm NPM npm

First, install the package:

npm install @thehive/cms-content-api

Create an instance:

import { CmsContentApi } from '@thehive/cms-content-api'

const contentApi = new CmsContentApi({
  apiKey: process.env.THE_HIVE_CMS_API_KEY,
  organization: 'my-org',
  space: 'my-space',
  environment: 'main'
})

Use the client to request content:

// Content
contentApi.content.getPage<MyContentResult>(
  'type',
  { pageNumber: 0, pageSize: 10 }
)
contentApi.content.getById<MyContentResult>('type', entryId)
contentApi.content.getByUniqueField<MyContentResult>('type', 'field', value)

// Posts
contentApi.posts.getPage({
  pageNumber: 1, pageSize: 10, postType: 'news'
})
contentApi.posts.getById(postId)
contentApi.posts.getBySlug(slug)
contentApi.posts.view(postId)

// Tags
contentApi.tags.getPage(pagination)
contentApi.tags.getBySlug('tag')

Readme

Keywords

none

Package Sidebar

Install

npm i @thehive/cms-content-api

Weekly Downloads

48

Version

0.11.4

License

MIT

Unpacked Size

26.3 kB

Total Files

52

Last publish

Collaborators

  • fernando.antunes
  • diogokawamoto
  • nicolasmq
  • gabrielscapim
  • yan-indigo
  • rafae2k
  • kuteken