(ctx context.Context, serviceId string, apiId string)
| 128 | } |
| 129 | |
| 130 | func (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 | |
| 163 | func (i *imlRouterModule) SimpleDetail(ctx context.Context, serviceId string, apiId string) (*router_dto.SimpleDetail, error) { |
| 164 | _, err := i.serviceService.Check(ctx, serviceId, asServer) |
nothing calls this directly
no test coverage detected