docs: add API Docs
This commit is contained in:
parent
9355ff5503
commit
686ecd151a
4 changed files with 23 additions and 17 deletions
|
|
@ -1 +1 @@
|
||||||
v20.11
|
v20
|
||||||
|
|
|
||||||
|
|
@ -73,6 +73,10 @@ We welcome your contributions and PRs.
|
||||||
|
|
||||||
[Configuration Docs](./docs/configuration.md)
|
[Configuration Docs](./docs/configuration.md)
|
||||||
|
|
||||||
|
## 🔌 API
|
||||||
|
|
||||||
|
[API Docs](./docs/api.md)
|
||||||
|
|
||||||
## 🙋🏻 FAQs
|
## 🙋🏻 FAQs
|
||||||
|
|
||||||
[FAQs](./docs/faqs.md)
|
[FAQs](./docs/faqs.md)
|
||||||
|
|
|
||||||
30
docs/api.md
30
docs/api.md
|
|
@ -1,6 +1,8 @@
|
||||||
# Sink API
|
# Sink API
|
||||||
|
|
||||||
Sink has a basic API implementation but it is not stable written yet.
|
Writing API documentation manually can be very laborious, and we will automatically generate documents after the official release of [Nitro's OpenAPI](https://nitro.unjs.io/config#openapi).
|
||||||
|
|
||||||
|
This place provides an example of creating a short link API. Other APIs are currently available for viewing through browser developer tools.
|
||||||
|
|
||||||
## API Reference
|
## API Reference
|
||||||
|
|
||||||
|
|
@ -15,15 +17,15 @@ Sink has a basic API implementation but it is not stable written yet.
|
||||||
| `authorization` | `Bearer SinkCool` |
|
| `authorization` | `Bearer SinkCool` |
|
||||||
| `content-type` | `application/json` |
|
| `content-type` | `application/json` |
|
||||||
|
|
||||||
|
|
||||||
#### Example
|
#### Example
|
||||||
|
|
||||||
```http
|
```http
|
||||||
POST /api/link/create
|
POST /api/link/create
|
||||||
HEADER authorization:Bearer SinkCool, content-type:application/json
|
HEADER authorization: Bearer SinkCool
|
||||||
BODY {
|
HEADER content-type: application/json
|
||||||
"url": "https://github.com/ccbikai/Sink/issues/14",
|
BODY {
|
||||||
"slug": issue14
|
"url": "https://github.com/ccbikai/Sink/issues/14",
|
||||||
|
"slug": "issue14"
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -31,14 +33,14 @@ The BODY data must be JSON.
|
||||||
|
|
||||||
```http
|
```http
|
||||||
RESPONSE 201
|
RESPONSE 201
|
||||||
BODY {
|
BODY {
|
||||||
"link": {
|
"link": {
|
||||||
"id": "xpqhaurv5q",
|
"id": "xpqhaurv5q",
|
||||||
"url": "https://github.com/ccbikai/Sink/issues/14",
|
"url": "https://github.com/ccbikai/Sink/issues/14",
|
||||||
slug": "issue14",
|
"slug": "issue14",
|
||||||
"createdAt": 1718119809,
|
"createdAt": 1718119809,
|
||||||
"updatedAt": 1718119809
|
"updatedAt": 1718119809
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@
|
||||||
"lint-staged": "lint-staged"
|
"lint-staged": "lint-staged"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=20.11.0"
|
"node": ">=20"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@unovis/ts": "^1.4.1",
|
"@unovis/ts": "^1.4.1",
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue