Halo admin api client.
npm install @guching/admin-apiA js sdk for Halo's Admin APIs,implemented with TypeScript,encapsulating parameter types and return value types to make the use of API more brief.
``shell`
npm install @halo-dev/admin-api --save
Here is a simple code for obtaining a list of articles.
`javascript``
import { AdminApiClient, HaloRestAPIClient } from "@halo-dev/admin-api";
// http request tool for halo rest api.
const haloRestApiClient = new HaloRestAPIClient({
baseUrl: process.env.HALO_BASE_URL,
auth: { adminToken: "halo admin token" },
});
// create adminApiClient by haloRestApiCLient.
const haloAdminClient = new AdminApiClient(haloRestApiClient);
// obtaining a list of articles.
haloAdminClient.post.list().then((res) => {
console.log(res);
});
Specific use example reference example