# api-laird

> api生成工具

Latest version **1.0.8** (published 2021-08-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install api-laird
pnpm add api-laird
yarn add api-laird
bun add api-laird
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high quality score.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.8 |
| Published | 2021-08-15 |
| First published | 2021-05-16 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=6.0.0 |
| Dependencies | 5 |
| Unpacked size | 2.7 MB |
| Known vulnerabilities | 0 (+24 in 2 direct dependencies) |
| Install scripts | no |
| Author | 2353536563@qq.com |
| Maintainers | zhuaofei |

## Links

- npm: https://www.npmjs.com/package/api-laird
- Repository: https://github.com/stogefei/api-laird
- Homepage: https://github.com/stogefei/api-laird#readme
- Issues: https://github.com/stogefei/api-laird/issues
- npm.io page: https://npm.io/package/api-laird

## Dependencies (5)

- [qs](https://npm.io/package/qs.md) ^6.8.0
- [axios](https://npm.io/package/axios.md) ^0.21.1
- [mockjs](https://npm.io/package/mockjs.md) ^1.1.0
- [@types/qs](https://npm.io/package/@types/qs.md) ^6.5.3
- [typescript](https://npm.io/package/typescript.md) ^3.0.3

## Recent versions

- 1.0.8 (latest) — 2021-08-15
- 1.0.7 — 2021-08-08
- 1.0.6 — 2021-08-07
- 1.0.5 — 2021-08-03
- 1.0.4 — 2021-07-25
- 1.0.3 — 2021-07-22
- 1.0.2 — 2021-07-18
- 1.0.1 — 2021-07-17
- 1.0.0 — 2021-07-17
- 0.0.9 — 2021-07-09
- 0.0.8 — 2021-06-16
- 0.0.7 — 2021-06-14
- 0.0.6 — 2021-06-08
- 0.0.5 — 2021-06-08
- 0.0.4 — 2021-05-27
- … 1 more at https://npm.io/package/api-laird/versions

## README

##### 说明文件
  src 文件夹: api请求核心代码
  src/tools 文件夹: 解析swagger接口文件 生成ts📃文件

# TypeScript of Swagger Api

    npm i api-swag-core
# Notice
    1.此工具目前只是使用部分
    2.生成代码的部分暂时未提交
    3.如果有需要的话可以提供给大家
4. [语雀文档](https://www.yuque.com/docs/share/55c674a1-2e1b-4bdf-baad-5e08a1a0feb7?#TypeScriptofSwaggerApi)
# Use
	import API from 'api-swag-core';
	 // Role 表示角色模块
    // getList 表示请求角色列表
    API.Role.getList().then(res = > {});

# Init
![6E8E4C51-607C-45D2-BB46-0BC3AF086E6F](assets/6E8E4C51-607C-45D2-BB46-0BC3AF086E6F-1.png)

    一个使用TypeScript自动解析集成Swagger接口的🔧
    1. 生成ts接口文档 /generate
    2. 核心导出文件 /core

# Other

    通常前端要定义一大堆接口来进行调用
    一旦后台的参数变更或者调整 前端则要手动修改

    然后 我们可以有一个工具 

    1. 自动解析后台的接口 包括： url 请求方式 入参 出参 
    2. 根据后台的controller生成不同模块的ts接口文档
    3. 构建一个类 里面包含了每个controller的方法
    4. 最重要的一步：他是自动构建出来的不需要手写 每次自动更新获取
    5. 这以后应该是前端的标配工具了
    
# All
	1. 我们不需要再手动写定义接口的代码
	2. 根据生成的文档 我们可以根据代码提示 调用方法 传入参数

# Now
![Mar-29-2021 20-12-06](assets/Mar-29-2021%2020-12-06.gif)

---
_Source: https://npm.io/package/api-laird · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
