(ctx context.Context, in *ConversationIDParam)
| 184 | } |
| 185 | |
| 186 | func (s *Server) handleGetConversation(ctx context.Context, in *ConversationIDParam) (*conversationOutput, error) { |
| 187 | ag, err := s.resolveOwnedAgent(ctx, in.Address) |
| 188 | if err != nil { |
| 189 | return nil, err |
| 190 | } |
| 191 | if len(in.ConversationID) > maxFilterStr { |
| 192 | return nil, NewError(http.StatusBadRequest, "invalid_request", "conversation_id too long (max 200 chars)") |
| 193 | } |
| 194 | if err := validateConversationID(in.ConversationID); err != nil { |
| 195 | return nil, NewError(http.StatusBadRequest, "invalid_request", err.Error()) |
| 196 | } |
| 197 | if s.deps.GetConversation == nil { |
| 198 | return nil, NewError(http.StatusInternalServerError, "internal_error", "conversation lookup unavailable") |
| 199 | } |
| 200 | detail, err := s.deps.GetConversation(ctx, ag.ID, in.ConversationID) |
| 201 | if err != nil || detail == nil { |
| 202 | return nil, NewError(http.StatusNotFound, "not_found", "conversation not found") |
| 203 | } |
| 204 | out := &conversationOutput{Body: ConversationDetailView{ |
| 205 | ConversationSummaryView: conversationSummaryView(detail.ConversationSummary), |
| 206 | Participants: orEmptyStrings(detail.Participants), |
| 207 | Labels: orEmptyStrings(detail.Labels), |
| 208 | Messages: make([]MessageSummaryView, len(detail.Messages)), |
| 209 | }} |
| 210 | for i, m := range detail.Messages { |
| 211 | out.Body.Messages[i] = messageSummaryFromIdentity(m) |
| 212 | } |
| 213 | return out, nil |
| 214 | } |
nothing calls this directly
no test coverage detected