Merge branch 'dev'
This commit is contained in:
commit
40fa9d1581
@ -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)
|
||||||
|
|||||||
53
docs/api.md
Normal file
53
docs/api.md
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# Sink API
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
### Create Short Link
|
||||||
|
|
||||||
|
```http
|
||||||
|
POST /api/link/create
|
||||||
|
```
|
||||||
|
|
||||||
|
| Header | Description |
|
||||||
|
| :----- | :------------------------- |
|
||||||
|
| `authorization` | `Bearer SinkCool` |
|
||||||
|
| `content-type` | `application/json` |
|
||||||
|
|
||||||
|
#### Example
|
||||||
|
|
||||||
|
```http
|
||||||
|
POST /api/link/create
|
||||||
|
HEADER authorization: Bearer SinkCool
|
||||||
|
HEADER content-type: application/json
|
||||||
|
BODY {
|
||||||
|
"url": "https://github.com/ccbikai/Sink/issues/14",
|
||||||
|
"slug": "issue14"
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
The BODY data must be JSON.
|
||||||
|
|
||||||
|
```http
|
||||||
|
RESPONSE 201
|
||||||
|
BODY {
|
||||||
|
"link": {
|
||||||
|
"id": "xpqhaurv5q",
|
||||||
|
"url": "https://github.com/ccbikai/Sink/issues/14",
|
||||||
|
"slug": "issue14",
|
||||||
|
"createdAt": 1718119809,
|
||||||
|
"updatedAt": 1718119809
|
||||||
|
}
|
||||||
|
}
|
||||||
|
```
|
||||||
|
|
||||||
|
| Parameter | Type | Description |
|
||||||
|
| :-------- | :------- | :------------------------- |
|
||||||
|
| `id` | `string` | This is automatically generated by Sink |
|
||||||
|
| `url` | `string` | This is confirmation of the submitted URL and is required. |
|
||||||
|
| `slug` | `string` | This is slug generated by the system, either automatically or from the input (if provided) |
|
||||||
|
| `createdAt` | `timestamp` | This is automatically generated with a UNIX Timestamp. |
|
||||||
|
| `updatedAt` | `timestamp` | This is automatically generated with a UNIX Timestamp. |
|
||||||
@ -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 New Issue
Block a user