MCPcopy Create free account
hub / github.com/GoSimplicity/LinkMe / ListApis

Method ListApis

internal/api/api.go:36–56  ·  view source on GitHub ↗

ListApis 获取API列表

(c *gin.Context)

Source from the content-addressed store, hash-verified

34
35// ListApis 获取API列表
36func (a *ApiHandler) ListApis(c *gin.Context) {
37 var req req.ListApisRequest
38 if err := c.ShouldBindJSON(&req); err != nil {
39 a.l.Error("绑定请求参数失败", zap.Error(err))
40 apiresponse.Error(c)
41 return
42 }
43
44 // 调用service层获取API列表
45 apis, total, err := a.svc.ListApis(c.Request.Context(), req.PageNumber, req.PageSize)
46 if err != nil {
47 a.l.Error("获取API列表失败", zap.Error(err))
48 apiresponse.Error(c)
49 return
50 }
51
52 apiresponse.SuccessWithData(c, gin.H{
53 "list": apis,
54 "total": total,
55 })
56}
57
58// CreateAPI 创建新的API
59func (a *ApiHandler) CreateAPI(c *gin.Context) {

Callers

nothing calls this directly

Calls 3

ErrorFunction · 0.92
SuccessWithDataFunction · 0.92
ListApisMethod · 0.65

Tested by

no test coverage detected