(endpoints []*EndpointInfo, limit int)
| 91 | } |
| 92 | |
| 93 | func (*Server) formatEndpoints(endpoints []*EndpointInfo, limit int) string { |
| 94 | var sb strings.Builder |
| 95 | |
| 96 | if limit > 0 && len(endpoints) > limit { |
| 97 | fmt.Fprintf(&sb, "Showing %d of %d results:\n\n", limit, len(endpoints)) |
| 98 | endpoints = endpoints[:limit] |
| 99 | } else { |
| 100 | fmt.Fprintf(&sb, "Found %d endpoints:\n\n", len(endpoints)) |
| 101 | } |
| 102 | |
| 103 | for i, ep := range endpoints { |
| 104 | fmt.Fprintf(&sb, "### %d. %s/%s\n", i+1, ep.Service, ep.Method) |
| 105 | fmt.Fprintf(&sb, "%s\n", ep.Summary) |
| 106 | |
| 107 | if len(ep.Permissions) > 0 { |
| 108 | fmt.Fprintf(&sb, "Permissions: `%s`\n", strings.Join(ep.Permissions, "`, `")) |
| 109 | } |
| 110 | sb.WriteString("\n") |
| 111 | } |
| 112 | |
| 113 | return sb.String() |
| 114 | } |
| 115 | |
| 116 | func (s *Server) formatEndpointDetail(operationID string) string { |
| 117 | ep, ok := s.openAPIIndex.GetEndpoint(operationID) |
no test coverage detected