# common **Repository Path**: sstscode/common ## Basic Information - **Project Name**: common - **Description**: 智能终端源码-公共 - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 0 - **Created**: 2025-02-07 - **Last Updated**: 2025-02-08 ## Categories & Tags **Categories**: Uncategorized **Tags**: ssts, common ## README # @sstscode/common Common utilities for SSTS projects ## Installation ```bash npm install @sstscode/common ``` ## Usage ```typescript import { HyperRequest } from '@sstscode/common' // 创建一个新的请求实例 const hyperRequest = new HyperRequest({ baseURL: '/api', // 可选的基础URL interceptors: { requestInterceptor: (config) => config, responseInterceptor: (response) => response } }) // Basic GET request hyperRequest .get({ url: '/data', showLoading: true // 可选的loading显示控制 }) .then((response) => console.log(response)) // Basic POST request hyperRequest .post({ url: '/endpoint', data: { key: 'value' }, method: 'POST' }) .then((result) => console.log(result)) ``` ## API Reference ### HyperRequest Class - Constructor(config: HyperRequestConfig): 初始化新的请求实例。 - request(config: HyperRequestConfig): Promise - 发送自定义配置的HTTP请求。 - get(config: HyperRequestConfig): Promise - 发送GET请求。 - post(config: HyperRequestConfig): Promise - 发送POST请求。 - delete(config: HyperRequestConfig): Promise - 发送DELETE请求。 - patch(config: HyperRequestConfig): Promise - 发送PATCH请求。 ## Development 1. Clone the repository 2. Install dependencies: `npm install` 3. Build the project: `npm run build` 4. Run tests: `npm test`