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

Method Detail

module/router/iml.go:130–161  ·  view source on GitHub ↗
(ctx context.Context, serviceId string, apiId string)

Source from the content-addressed store, hash-verified

128}
129
130func (i *imlRouterModule) Detail(ctx context.Context, serviceId string, apiId string) (*router_dto.Detail, error) {
131 _, err := i.serviceService.Check(ctx, serviceId, asServer)
132 if err != nil {
133 return nil, err
134 }
135
136 detail, err := i.apiService.GetInfo(ctx, apiId)
137 if err != nil {
138 return nil, err
139 }
140 protocols := []string{"HTTP", "HTTPS"}
141 if len(detail.Protocols) > 0 {
142 protocols = detail.Protocols
143 }
144
145 apiDetail := &router_dto.Detail{
146 SimpleDetail: *router_dto.GenSimpleDetail(detail),
147 Protocols: protocols,
148 Disable: detail.Disable,
149 }
150 proxy, err := i.apiService.LatestProxy(ctx, apiId)
151 if err != nil {
152 if !errors.Is(err, gorm.ErrRecordNotFound) {
153 return nil, err
154 }
155 }
156 if proxy != nil {
157 apiDetail.Proxy = router_dto.FromServiceProxy(proxy.Data)
158 }
159
160 return apiDetail, nil
161}
162
163func (i *imlRouterModule) SimpleDetail(ctx context.Context, serviceId string, apiId string) (*router_dto.SimpleDetail, error) {
164 _, err := i.serviceService.Check(ctx, serviceId, asServer)

Callers

nothing calls this directly

Calls 3

CheckMethod · 0.65
GetInfoMethod · 0.65
LatestProxyMethod · 0.65

Tested by

no test coverage detected