diff options
Diffstat (limited to 'internal/tui/app')
| -rw-r--r-- | internal/tui/app/app.go | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/internal/tui/app/app.go b/internal/tui/app/app.go index 3ee0f564d..b00a6d61a 100644 --- a/internal/tui/app/app.go +++ b/internal/tui/app/app.go @@ -143,26 +143,30 @@ func (a *App) ListSessions(ctx context.Context) ([]client.SessionInfo, error) { if err != nil { return nil, err } - if resp.StatusCode() != 200 { return nil, fmt.Errorf("failed to list sessions: %d", resp.StatusCode()) } - if resp.JSON200 == nil { return []client.SessionInfo{}, nil } - infos := *resp.JSON200 + sessions := *resp.JSON200 + return sessions, nil +} - sessions := make([]client.SessionInfo, len(infos)) - for i, info := range infos { - sessions[i] = client.SessionInfo{ - Id: info.Id, - Title: info.Title, - } +func (a *App) ListMessages(ctx context.Context, sessionId string) ([]client.MessageInfo, error) { + resp, err := a.Client.PostSessionMessagesWithResponse(ctx, client.PostSessionMessagesJSONRequestBody{SessionID: sessionId}) + if err != nil { + return nil, err } - - return sessions, nil + if resp.StatusCode() != 200 { + return nil, fmt.Errorf("failed to list messages: %d", resp.StatusCode()) + } + if resp.JSON200 == nil { + return []client.MessageInfo{}, nil + } + messages := *resp.JSON200 + return messages, nil } // initTheme sets the application theme based on the configuration |
