-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
api definition: get knowledge and tags of knowledge #2192
- Loading branch information
1 parent
f1fbe1a
commit 0719fe8
Showing
4 changed files
with
458 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
package v1 | ||
|
||
import ( | ||
"github.com/actiontech/sqle/sqle/api/controller" | ||
"github.com/labstack/echo/v4" | ||
) | ||
|
||
type GetKnowledgeListReq struct { | ||
KeyWords string `json:"keywords" query:"keywords" example:"keywords"` // 搜索内容 | ||
Tags []string `json:"tags" query:"tags" example:"tag1"` // 搜索标签 | ||
Limit uint32 `json:"limit" query:"limit" example:"10" validate:"required"` | ||
Offset uint32 `json:"offset" query:"offset" example:"0"` | ||
} | ||
|
||
type GetKnowledgeListRes struct { | ||
controller.BaseRes | ||
Data []*Knowledge `json:"data"` | ||
TotalNums uint64 `json:"total_nums"` | ||
} | ||
|
||
type Knowledge struct { | ||
ID uint `json:"id"` // 知识库ID | ||
Title string `json:"title"` // 标题 | ||
Description string `json:"description"` // 描述 | ||
Content string `json:"content"` // 内容 | ||
Tags []*Tag `json:"tags"` // 标签 | ||
} | ||
|
||
type Tag struct { | ||
ID uint `json:"id"` // 标签ID | ||
Name string `json:"name"` // 标签名称 | ||
} | ||
|
||
// GetKnowledgeList | ||
// @Summary 获取知识库列表 | ||
// @Description get knowledge list | ||
// @Id getKnowledgeList | ||
// @Tags knowledge | ||
// @Param keywords query string false "keywords" | ||
// @Param tags query []string false "tags" | ||
// @Security ApiKeyAuth | ||
// @Success 200 {object} v1.GetKnowledgeListRes | ||
// @router /v1/knowledge [get] | ||
func GetKnowledgeList(c echo.Context) error { | ||
return nil | ||
} | ||
|
||
type GetKnowledgeTagListRes struct { | ||
controller.BaseRes | ||
TotalNums uint64 `json:"total_nums"` | ||
Data []*Tag `json:"data"` | ||
} | ||
|
||
// GetKnowledgeTagList | ||
// @Summary 获取知识库标签列表 | ||
// @Description get knowledge tag list | ||
// @Id getKnowledgeTagList | ||
// @Tags knowledge | ||
// @Security ApiKeyAuth | ||
// @Success 200 {object} v1.GetKnowledgeTagListRes | ||
// @router /v1/knowledge/tags [get] | ||
func GetKnowledgeTagList(c echo.Context) error { | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.