hts/apps/blogai/网关接口说明.md

636 lines
12 KiB
Markdown

---
title: 个人项目
language_tabs:
- shell: Shell
- http: HTTP
- javascript: JavaScript
- ruby: Ruby
- python: Python
- php: PHP
- java: Java
- go: Go
toc_footers: []
includes: []
search: true
code_clipboard: true
highlight_theme: darkula
headingLevel: 2
generator: "@tarslib/widdershins v4.0.22"
---
# 个人项目
Base URLs:
* <a href="http://192.168.2.11:8082">gateway(local): http://192.168.2.11:8082</a>
# Authentication
# coeus-labs/gateway
## POST 用户注册
POST /api/v1/register
> Body Parameters
```json
{
"user_name": "lory",
"password": "e10adc3949ba59abbe56e057f20f883e",
"email": "civet148@126.com",
"reg_code": "6328"
}
```
### Params
|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|body|body|object| no |none|
> Response Examples
> 成功
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {}
}
```
```json
{
"header": {
"code": 1018,
"message": "Email already exist",
"total": 0,
"count": 0
},
"data": {}
}
```
### Responses
|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|
### Responses Data Schema
HTTP Status Code **200**
|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» header|object|true|none||none|
|»» code|integer|true|none||0表示正常 其他值表示具体错误码|
|»» message|string|true|none||错误消息|
|»» total|integer|true|none||数据总数(分页用途)|
|»» count|integer|true|none||当前数据数(分页用途)|
|» data|object|true|none||none|
## POST 发送验证码
POST /api/v1/auth-code
> Body Parameters
```json
{
"user_name": "lory",
"email": "civet148@126.com"
}
```
### Params
|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|body|body|object| no |none|
> Response Examples
> 成功
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {}
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {}
}
```
### Responses
|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|
### Responses Data Schema
HTTP Status Code **200**
|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» header|object|true|none||none|
|»» code|integer|true|none||none|
|»» message|string|true|none||none|
|»» total|integer|true|none||none|
|»» count|integer|true|none||none|
|» data|object|true|none||none|
## POST 用户登录
POST /api/v1/login
> Body Parameters
```json
{
"user_name": "lory",
"password": "e10adc3949ba59abbe56e057f20f883e"
}
```
### Params
|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|body|body|object| no |none|
> Response Examples
> 成功
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {
"version": "v0.1.0",
"user_name": "libin",
"auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGFpbV9hbGlhcyI6ImxpYmluIiwiY2xhaW1fZXhwaXJlIjoxNzA5ODM0OTExLCJjbGFpbV9pYXQiOjE3MDk3OTE3MTEsImNsYWltX2lkIjoyLCJjbGFpbV9pc19hZG1pbiI6ZmFsc2UsImNsYWltX3Bob25lX251bWJlciI6IiIsImNsYWltX3VzZXJuYW1lIjoibGliaW4ifQ.7PS-paXa5FALiiLgBMgQFF_U4kb4FDcrCqf2n-3hVCc",
"login_ip": "172.27.192.1",
"login_time": 1709791711,
"role": "",
"privilege": []
}
}
```
### Responses
|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|
### Responses Data Schema
HTTP Status Code **200**
|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» header|object|true|none||none|
|»» code|integer|true|none||none|
|»» message|string|true|none||none|
|»» total|integer|true|none||none|
|»» count|integer|true|none||none|
|» data|object|true|none||none|
|»» version|string|true|none||程序版本号|
|»» user_name|string|true|none||账户名|
|»» auth_token|string|true|none||JWT令牌|
|»» login_ip|string|true|none||最近登录IP|
|»» login_time|integer|true|none||最近登录时间|
|»» role|string|true|none||角色名|
|»» privilege|[string]|true|none||权限列表|
## POST 项目列表
POST /api/v1/project/list
> Body Parameters
```json
{
"user_id": 2,
"page_no": 0,
"page_size": 20
}
```
### Params
|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| no |none|
|body|body|object| no |none|
> Response Examples
> 成功
```json
{
"user_id": 2,
"page_no": 0,
"page_size": 20
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 2,
"count": 2
},
"data": {
"list": [
{
"id": 1,
"project_name": "我的ChatGPT项目",
"project_type": 1,
"project_key": "Ol98KeAD6vSlegu1",
"project_secret": "IjQUZFis8MrXKA7uupFlqnewaqCV5Hhs2BKJWlMdI2ahbcvw",
"end_points": [
"https://api.hobbychain.org//rpc",
"wss://api.hobbychain.org//ws"
],
"deleted": false,
"created_time": "2024-03-07 15:44:43",
"request_total": 0,
"request_today": 0,
"request_max": 30,
"pool_id": 0,
"pool_name": ""
},
{
"id": 2,
"project_name": "我的ChatGPT项目",
"project_type": 1,
"project_key": "p4Sx9mcEIcDzZOjG",
"project_secret": "wzZwy8jxsdjuHDk1kBgaMYWh7C8XJa5yUGPRRFGOQqwwY4gt",
"end_points": [
"https://api.hobbychain.org//rpc",
"wss://api.hobbychain.org//ws"
],
"deleted": false,
"created_time": "2024-03-07 15:47:02",
"request_total": 0,
"request_today": 0,
"request_max": 30,
"pool_id": 0,
"pool_name": ""
}
]
}
}
```
### Responses
|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|
### Responses Data Schema
HTTP Status Code **200**
|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» header|object|true|none||none|
|»» code|integer|true|none||none|
|»» message|string|true|none||none|
|»» total|integer|true|none||none|
|»» count|integer|true|none||none|
|» data|object|true|none||none|
|»» list|[object]|true|none||none|
|»»» id|integer|true|none||none|
|»»» project_name|string|true|none||none|
|»»» project_type|integer|true|none||none|
|»»» project_key|string|true|none||none|
|»»» project_secret|string|true|none||none|
|»»» end_points|[string]|true|none||none|
|»»» deleted|boolean|true|none||none|
|»»» created_time|string|true|none||none|
|»»» request_total|integer|true|none||none|
|»»» request_today|integer|true|none||none|
|»»» request_max|integer|true|none||none|
|»»» pool_id|integer|true|none||none|
|»»» pool_name|string|true|none||none|
## POST 添加项目
POST /api/v1/project/create
> Body Parameters
```json
{
"project_type": 1,
"project_name": "我的ChatGPT项目"
}
```
### Params
|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| no |none|
|body|body|object| no |none|
> Response Examples
> 成功
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {}
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {
"version": "v0.1.0",
"user_name": "libin",
"auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGFpbV9hbGlhcyI6ImxpYmluIiwiY2xhaW1fZXhwaXJlIjoxNzA5ODM0OTExLCJjbGFpbV9pYXQiOjE3MDk3OTE3MTEsImNsYWltX2lkIjoyLCJjbGFpbV9pc19hZG1pbiI6ZmFsc2UsImNsYWltX3Bob25lX251bWJlciI6IiIsImNsYWltX3VzZXJuYW1lIjoibGliaW4ifQ.7PS-paXa5FALiiLgBMgQFF_U4kb4FDcrCqf2n-3hVCc",
"login_ip": "172.27.192.1",
"login_time": 1709791711,
"role": "",
"privilege": []
}
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {
"project_key": "p4Sx9mcEIcDzZOjG",
"project_secret": "wzZwy8jxsdjuHDk1kBgaMYWh7C8XJa5yUGPRRFGOQqwwY4gt"
}
}
```
### Responses
|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|
### Responses Data Schema
HTTP Status Code **200**
|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» header|object|true|none||none|
|»» code|integer|true|none||none|
|»» message|string|true|none||none|
|»» total|integer|true|none||none|
|»» count|integer|true|none||none|
|» data|object|true|none||none|
|»» project_key|string|true|none||API key|
|»» project_secret|string|true|none||API secret|
## POST 删除项目
POST /api/v1/project/delete
> Body Parameters
```json
{
"id": 2
}
```
### Params
|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| no |none|
|body|body|object| no |none|
> Response Examples
> 成功
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {}
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {
"version": "v0.1.0",
"user_name": "libin",
"auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGFpbV9hbGlhcyI6ImxpYmluIiwiY2xhaW1fZXhwaXJlIjoxNzA5ODM0OTExLCJjbGFpbV9pYXQiOjE3MDk3OTE3MTEsImNsYWltX2lkIjoyLCJjbGFpbV9pc19hZG1pbiI6ZmFsc2UsImNsYWltX3Bob25lX251bWJlciI6IiIsImNsYWltX3VzZXJuYW1lIjoibGliaW4ifQ.7PS-paXa5FALiiLgBMgQFF_U4kb4FDcrCqf2n-3hVCc",
"login_ip": "172.27.192.1",
"login_time": 1709791711,
"role": "",
"privilege": []
}
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {
"project_key": "p4Sx9mcEIcDzZOjG",
"project_secret": "wzZwy8jxsdjuHDk1kBgaMYWh7C8XJa5yUGPRRFGOQqwwY4gt"
}
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {}
}
```
### Responses
|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|
### Responses Data Schema
HTTP Status Code **200**
|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» header|object|true|none||none|
|»» code|integer|true|none||none|
|»» message|string|true|none||none|
|»» total|integer|true|none||none|
|»» count|integer|true|none||none|
|» data|object|true|none||none|
## POST 退出登录
POST /api/v1/platform/logout
> Body Parameters
```json
{}
```
### Params
|Name|Location|Type|Required|Description|
|---|---|---|---|---|
|Authorization|header|string| no |none|
|body|body|object| no |none|
> Response Examples
> 成功
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {}
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {
"version": "v0.1.0",
"user_name": "libin",
"auth_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjbGFpbV9hbGlhcyI6ImxpYmluIiwiY2xhaW1fZXhwaXJlIjoxNzA5ODM0OTExLCJjbGFpbV9pYXQiOjE3MDk3OTE3MTEsImNsYWltX2lkIjoyLCJjbGFpbV9pc19hZG1pbiI6ZmFsc2UsImNsYWltX3Bob25lX251bWJlciI6IiIsImNsYWltX3VzZXJuYW1lIjoibGliaW4ifQ.7PS-paXa5FALiiLgBMgQFF_U4kb4FDcrCqf2n-3hVCc",
"login_ip": "172.27.192.1",
"login_time": 1709791711,
"role": "",
"privilege": []
}
}
```
```json
{
"header": {
"code": 0,
"message": "OK",
"total": 1,
"count": 1
},
"data": {
"project_key": "p4Sx9mcEIcDzZOjG",
"project_secret": "wzZwy8jxsdjuHDk1kBgaMYWh7C8XJa5yUGPRRFGOQqwwY4gt"
}
}
```
### Responses
|HTTP Status Code |Meaning|Description|Data schema|
|---|---|---|---|
|200|[OK](https://tools.ietf.org/html/rfc7231#section-6.3.1)|成功|Inline|
### Responses Data Schema
HTTP Status Code **200**
|Name|Type|Required|Restrictions|Title|description|
|---|---|---|---|---|---|
|» header|object|true|none||none|
|»» code|integer|true|none||none|
|»» message|string|true|none||none|
|»» total|integer|true|none||none|
|»» count|integer|true|none||none|
|» data|object|true|none||none|
|»» project_key|string|true|none||API key|
|»» project_secret|string|true|none||API secret|
# Data Schema