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

1.0.2 • Public • Published

Content API Client

npm version npm node-current NPM

JavaScript SDK for Halo's Content API,implemented with TypeScript,encapsulating parameter types and return value types to make the use of API more brief.

Installation

npm install @nineya/halo-content-api --save

Usage

Here is a simple code for obtaining a list of posts.

import { ContentApiClient, HaloRestAPIClient } from '@nineya/halo-content-api'

// http request tool for halo rest api.
const haloRestApiClient = new HaloRestAPIClient({
  baseUrl: process.env.HALO_BASE_URL,
  auth: { apiToken: process.env.HALO_API_TOKEN },
})

// create contentApiClient by haloRestApiCLient.
const haloContentClient = new ContentApiClient(haloRestApiClient)

// obtaining a list of articles.
haloContentClient.post.list().then((res) => {
  console.log(res)
})

License

MIT license

Package Sidebar

Install

npm i @nineya/halo-content-api

Weekly Downloads

1

Version

1.0.2

License

MIT

Unpacked Size

71.3 kB

Total Files

78

Last publish

Collaborators

  • nineya