mirror of
https://github.com/APIParkLab/APIPark.git
synced 2026-06-14 20:41:15 +08:00
apinto对接完成
This commit is contained in:
@@ -29,6 +29,7 @@ type HistoryType string
|
||||
const (
|
||||
HistoryRequest HistoryType = "request"
|
||||
HistoryProxy HistoryType = "proxy"
|
||||
HistoryPlugin HistoryType = "plugin"
|
||||
)
|
||||
|
||||
type imlAPIService struct {
|
||||
@@ -36,10 +37,31 @@ type imlAPIService struct {
|
||||
apiInfoStore api.IAPIInfoStore `autowired:""`
|
||||
requestCommitService commit.ICommitWithKeyService[Request] `autowired:""`
|
||||
proxyCommitService commit.ICommitWithKeyService[Proxy] `autowired:""`
|
||||
//pluginCommitService commit.ICommitWithKeyService[Plugin] `autowired:""`
|
||||
universally.IServiceGet[API]
|
||||
universally.IServiceDelete
|
||||
}
|
||||
|
||||
//func (i *imlAPIService) ListLatestCommitPlugin(ctx context.Context, aid ...string) ([]*commit.Commit[Plugin], error) {
|
||||
// return i.pluginCommitService.ListLatest(ctx, aid...)
|
||||
//}
|
||||
//
|
||||
//func (i *imlAPIService) GetPluginCommit(ctx context.Context, commitId string) (*commit.Commit[Plugin], error) {
|
||||
// return i.pluginCommitService.Get(ctx, commitId)
|
||||
//}
|
||||
//
|
||||
//func (i *imlAPIService) ListPluginCommit(ctx context.Context, commitId ...string) ([]*commit.Commit[Plugin], error) {
|
||||
// return i.pluginCommitService.List(ctx, commitId...)
|
||||
//}
|
||||
//
|
||||
//func (i *imlAPIService) SavePlugin(ctx context.Context, aid string, data *Plugin) error {
|
||||
// return i.pluginCommitService.Save(ctx, aid, data)
|
||||
//}
|
||||
//
|
||||
//func (i *imlAPIService) LatestPlugin(ctx context.Context, aid string) (*commit.Commit[Plugin], error) {
|
||||
// return i.pluginCommitService.Latest(ctx, aid)
|
||||
//}
|
||||
|
||||
func (i *imlAPIService) ListLatestCommitRequest(ctx context.Context, aid ...string) ([]*commit.Commit[Request], error) {
|
||||
return i.requestCommitService.ListLatest(ctx, aid...)
|
||||
}
|
||||
@@ -228,12 +250,18 @@ func (i *imlAPIService) Exist(ctx context.Context, aid string, a *Exist) error {
|
||||
}
|
||||
continue
|
||||
}
|
||||
if t.UUID == aid {
|
||||
continue
|
||||
}
|
||||
|
||||
for _, m := range t.Method {
|
||||
|
||||
existMethodMap[m] = struct{}{}
|
||||
}
|
||||
}
|
||||
for _, m := range a.Methods {
|
||||
if _, ok := existMethodMap[m]; ok {
|
||||
|
||||
return fmt.Errorf("method(%s),path(%s) is exist", m, a.Path)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,6 @@ type PluginSetting struct {
|
||||
}
|
||||
|
||||
type Request struct {
|
||||
//ID string `json:"id"`
|
||||
Path string `json:"path"`
|
||||
Methods []string `json:"methods"`
|
||||
Protocols []string `json:"protocols"`
|
||||
@@ -143,3 +142,5 @@ type Match struct {
|
||||
Key string `json:"key"`
|
||||
Pattern string `json:"pattern"`
|
||||
}
|
||||
|
||||
type Plugin map[string]interface{}
|
||||
|
||||
+10
-2
@@ -20,17 +20,24 @@ type IAPIService interface {
|
||||
GetInfo(ctx context.Context, aid string) (*Info, error)
|
||||
ListInfo(ctx context.Context, aids ...string) ([]*Info, error)
|
||||
ListInfoForService(ctx context.Context, serviceId string) ([]*Info, error)
|
||||
ListLatestCommitRequest(ctx context.Context, aid ...string) ([]*commit.Commit[Request], error)
|
||||
|
||||
ListLatestCommitProxy(ctx context.Context, aid ...string) ([]*commit.Commit[Proxy], error)
|
||||
LatestRequest(ctx context.Context, aid string) (*commit.Commit[Request], error)
|
||||
LatestProxy(ctx context.Context, aid string) (*commit.Commit[Proxy], error)
|
||||
GetProxyCommit(ctx context.Context, commitId string) (*commit.Commit[Proxy], error)
|
||||
ListProxyCommit(ctx context.Context, commitId ...string) ([]*commit.Commit[Proxy], error)
|
||||
SaveProxy(ctx context.Context, aid string, data *Proxy) error
|
||||
|
||||
ListLatestCommitRequest(ctx context.Context, aid ...string) ([]*commit.Commit[Request], error)
|
||||
GetRequestCommit(ctx context.Context, commitId string) (*commit.Commit[Request], error)
|
||||
ListRequestCommit(ctx context.Context, commitId ...string) ([]*commit.Commit[Request], error)
|
||||
SaveRequest(ctx context.Context, aid string, data *Request) error
|
||||
LatestRequest(ctx context.Context, aid string) (*commit.Commit[Request], error)
|
||||
|
||||
//ListLatestCommitPlugin(ctx context.Context, aid ...string) ([]*commit.Commit[Plugin], error)
|
||||
//GetPluginCommit(ctx context.Context, commitId string) (*commit.Commit[Plugin], error)
|
||||
//ListPluginCommit(ctx context.Context, commitId ...string) ([]*commit.Commit[Plugin], error)
|
||||
//SavePlugin(ctx context.Context, aid string, data *Plugin) error
|
||||
//LatestPlugin(ctx context.Context, aid string) (*commit.Commit[Plugin], error)
|
||||
|
||||
Save(ctx context.Context, id string, model *Edit) error
|
||||
Create(ctx context.Context, input *Create) (err error)
|
||||
@@ -47,5 +54,6 @@ func init() {
|
||||
|
||||
commit.InitCommitWithKeyService[Proxy]("api", string(HistoryProxy))
|
||||
commit.InitCommitWithKeyService[Request]("api", string(HistoryRequest))
|
||||
commit.InitCommitWithKeyService[Plugin]("api", string(HistoryPlugin))
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user