shcp-api-lib
v1.0.9
Published
SHCP Model Library
Readme
SHCP Model Library
这是一个包含 SHCP 项目所有数据模型、常量和 API 的 TypeScript 库。
安装
npm install @shcp/model-lib使用
使用模型
import { ConsumerModel, DeviceModel } from '@shcp/model-lib'
// 使用模型
const consumer = new ConsumerModel()
const device = new DeviceModel()使用常量
import { ShcpUserType, ClientType, Gender, MessageStatus } from '@shcp/model-lib'
// 使用枚举
const userType = ShcpUserType.Consumer
const clientType = ClientType.CApp
const gender = Gender.Male
const messageStatus = MessageStatus.Unread使用 API
import { consumerApi, deviceApi, healthMetricApi } from '@shcp/model-lib'
// 使用 API
const getConsumerList = async () => {
const result = await consumerApi.list()
return result
}
const getDeviceList = async () => {
const result = await deviceApi.list()
return result
}
const getHealthMetrics = async () => {
const result = await healthMetricApi.list()
return result
}开发
# 安装依赖
npm install
# 开发模式
npm run dev
# 构建
npm run build发布
npm publish