MCPcopy Index your code
hub / github.com/APIParkLab/APIPark / SimpleSearch

Method SimpleSearch

module/router/iml.go:225–251  ·  view source on GitHub ↗
(ctx context.Context, keyword string, serviceId string)

Source from the content-addressed store, hash-verified

223}
224
225func (i *imlRouterModule) SimpleSearch(ctx context.Context, keyword string, serviceId string) ([]*router_dto.SimpleItem, error) {
226 _, err := i.serviceService.Check(ctx, serviceId, asServer)
227 if err != nil {
228 return nil, err
229 }
230
231 list, err := i.apiService.Search(ctx, keyword, map[string]interface{}{
232 "service": serviceId,
233 })
234 if err != nil {
235 return nil, err
236 }
237 apiInfos, err := i.apiService.ListInfo(ctx, utils.SliceToSlice(list, func(s *api.API) string {
238 return s.UUID
239 })...)
240 if err != nil {
241 return nil, err
242 }
243 out := utils.SliceToSlice(apiInfos, func(item *api.Info) *router_dto.SimpleItem {
244 return &router_dto.SimpleItem{
245 Id: item.UUID,
246 Methods: item.Methods,
247 Path: item.Path,
248 }
249 })
250 return out, nil
251}
252
253func (i *imlRouterModule) Create(ctx context.Context, serviceId string, dto *router_dto.Create) (*router_dto.SimpleDetail, error) {
254 info, err := i.serviceService.Check(ctx, serviceId, asServer)

Callers

nothing calls this directly

Calls 3

CheckMethod · 0.65
SearchMethod · 0.65
ListInfoMethod · 0.65

Tested by

no test coverage detected