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

Method Get

module/dynamic-module/iml.go:411–433  ·  view source on GitHub ↗
(ctx context.Context, module string, id string)

Source from the content-addressed store, hash-verified

409}
410
411func (i *imlDynamicModule) Get(ctx context.Context, module string, id string) (*dynamic_module_dto.DynamicModule, error) {
412 suffix := fmt.Sprintf("_%s", module)
413 if !strings.HasSuffix(id, suffix) {
414 id = strings.ToLower(fmt.Sprintf("%s_%s", id, module))
415 }
416
417 info, err := i.get(ctx, module, id)
418 if err != nil {
419 return nil, err
420 }
421 cfg := make(map[string]interface{})
422 err = json.Unmarshal([]byte(info.Config), &cfg)
423 if err != nil {
424 return nil, err
425 }
426 return &dynamic_module_dto.DynamicModule{
427 Id: strings.TrimSuffix(info.ID, suffix),
428 Name: info.Name,
429 Driver: info.Driver,
430 Description: info.Description,
431 Config: cfg,
432 }, nil
433}
434
435func (i *imlDynamicModule) get(ctx context.Context, module string, id string) (*dynamic_module.DynamicModule, error) {
436 info, err := i.dynamicModuleService.Get(ctx, id)

Callers 2

CreateMethod · 0.95
EditMethod · 0.95

Calls 1

getMethod · 0.95

Tested by

no test coverage detected