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

12 KiB

title language_tabs toc_footers includes search code_clipboard highlight_theme headingLevel generator
个人项目
shell
Shell
http
HTTP
javascript
JavaScript
ruby
Ruby
python
Python
php
PHP
java
Java
go
Go
true true darkula 2 @tarslib/widdershins v4.0.22

个人项目

Base URLs:

Authentication

coeus-labs/gateway

POST 用户注册

POST /api/v1/register

Body Parameters

{
  "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

成功

{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
{
  "header": {
    "code": 1018,
    "message": "Email already exist",
    "total": 0,
    "count": 0
  },
  "data": {}
}

Responses

HTTP Status Code Meaning Description Data schema
200 OK 成功 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

{
  "user_name": "lory",
  "email": "civet148@126.com"
}

Params

Name Location Type Required Description
body body object no none

Response Examples

成功

{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}

Responses

HTTP Status Code Meaning Description Data schema
200 OK 成功 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

{
  "user_name": "lory",
  "password": "e10adc3949ba59abbe56e057f20f883e"
}

Params

Name Location Type Required Description
body body object no none

Response Examples

成功

{
  "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 成功 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

{
  "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

成功

{
  "user_id": 2,
  "page_no": 0,
  "page_size": 20
}
{
  "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 成功 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

{
  "project_type": 1,
  "project_name": "我的ChatGPT项目"
}

Params

Name Location Type Required Description
Authorization header string no none
body body object no none

Response Examples

成功

{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
{
  "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": []
  }
}
{
  "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 成功 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

{
  "id": 2
}

Params

Name Location Type Required Description
Authorization header string no none
body body object no none

Response Examples

成功

{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
{
  "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": []
  }
}
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {
    "project_key": "p4Sx9mcEIcDzZOjG",
    "project_secret": "wzZwy8jxsdjuHDk1kBgaMYWh7C8XJa5yUGPRRFGOQqwwY4gt"
  }
}
{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}

Responses

HTTP Status Code Meaning Description Data schema
200 OK 成功 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

{}

Params

Name Location Type Required Description
Authorization header string no none
body body object no none

Response Examples

成功

{
  "header": {
    "code": 0,
    "message": "OK",
    "total": 1,
    "count": 1
  },
  "data": {}
}
{
  "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": []
  }
}
{
  "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 成功 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