models

package
v0.0.0-...-19e0c05 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package models contains Bubble Tea models for the presentation layer.

Package models contains Bubble Tea models for the presentation layer.

Package models contains Bubble Tea models for the presentation layer.

Package models contains Bubble Tea models for the presentation layer.

Index

Constants

View Source
const (
	TabRequest = iota
	TabResponse
	TabHistory
)

Tab indices.

View Source
const (
	// KeyCtrlC represents the Ctrl+C keyboard combination for quitting.
	KeyCtrlC = "ctrl+c"
)

Key binding constants for keyboard shortcuts.

Variables

This section is empty.

Functions

This section is empty.

Types

type HistoryModel

type HistoryModel struct {
	// contains filtered or unexported fields
}

HistoryModel represents the history browser.

func NewHistoryModel

func NewHistoryModel(historyService *app.HistoryService) HistoryModel

NewHistoryModel creates a new history browser model.

func (*HistoryModel) GetEntries

func (m *HistoryModel) GetEntries() []*repository.HistoryEntry

GetEntries returns all history entries.

func (*HistoryModel) GetSelectedEntry

func (m *HistoryModel) GetSelectedEntry() *repository.HistoryEntry

GetSelectedEntry returns the currently selected history entry.

func (HistoryModel) Init

func (m HistoryModel) Init() tea.Cmd

Init initializes the model and loads history.

func (*HistoryModel) IsLoading

func (m *HistoryModel) IsLoading() bool

IsLoading returns whether history is currently being loaded.

func (HistoryModel) Update

func (m HistoryModel) Update(msg tea.Msg) (HistoryModel, tea.Cmd)

Update handles messages and updates the model.

func (HistoryModel) View

func (m HistoryModel) View() string

View renders the history browser.

type MainModel

type MainModel struct {
	// contains filtered or unexported fields
}

MainModel is the root model with tab navigation.

func NewMainModel

func NewMainModel(
	requestService *app.RequestService,
	historyService *app.HistoryService,
	authService *app.AuthService,
) MainModel

NewMainModel creates a new main model with all sub-models.

func (MainModel) GetActiveTab

func (m MainModel) GetActiveTab() int

GetActiveTab returns the currently active tab index.

func (MainModel) Init

func (m MainModel) Init() tea.Cmd

Init initializes the main model and sub-models.

func (*MainModel) SetStatusMessage

func (m *MainModel) SetStatusMessage(msg string)

SetStatusMessage sets the status bar message.

func (MainModel) Update

func (m MainModel) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages and updates the model.

func (MainModel) View

func (m MainModel) View() string

View renders the main view with tabs.

type RequestModel

type RequestModel struct {
	// contains filtered or unexported fields
}

RequestModel represents the request builder form.

func NewRequestModel

func NewRequestModel(requestService *app.RequestService, authService *app.AuthService) RequestModel

NewRequestModel creates a new request builder model.

func (*RequestModel) GetRequest

func (m *RequestModel) GetRequest() *domain.Request

GetRequest returns the current request being built.

func (RequestModel) Init

func (m RequestModel) Init() tea.Cmd

Init initializes the model.

func (*RequestModel) IsLoading

func (m *RequestModel) IsLoading() bool

IsLoading returns whether a request is currently being sent.

func (*RequestModel) LoadRequest

func (m *RequestModel) LoadRequest(req *domain.Request)

LoadRequest loads a request into the form fields.

func (RequestModel) NeedsArrowKeys

func (m RequestModel) NeedsArrowKeys() bool

NeedsArrowKeys returns true if the current focused field is a text input that needs arrow keys for cursor movement (URL, Name, or Body fields). This prevents global arrow key handlers from hijacking cursor navigation.

func (RequestModel) RenderView

func (m RequestModel) RenderView() string

RenderView renders the full request view with all components.

func (*RequestModel) SetError

func (m *RequestModel) SetError(err string)

SetError sets an error message to display.

func (RequestModel) Update

func (m RequestModel) Update(msg tea.Msg) (RequestModel, tea.Cmd)

Update handles messages and updates the model.

func (RequestModel) View

func (m RequestModel) View() string

View renders the request builder form.

type ResponseModel

type ResponseModel struct {
	// contains filtered or unexported fields
}

ResponseModel represents the response viewer.

func NewResponseModel

func NewResponseModel() ResponseModel

NewResponseModel creates a new response viewer model.

func (*ResponseModel) GetResponse

func (m *ResponseModel) GetResponse() *domain.Response

GetResponse returns the current response.

func (*ResponseModel) HasResponse

func (m *ResponseModel) HasResponse() bool

HasResponse returns whether a response is currently loaded.

func (ResponseModel) Init

func (m ResponseModel) Init() tea.Cmd

Init initializes the model.

func (*ResponseModel) SetResponse

func (m *ResponseModel) SetResponse(response *domain.Response)

SetResponse sets the response to display.

func (ResponseModel) Update

func (m ResponseModel) Update(msg tea.Msg) (ResponseModel, tea.Cmd)

Update handles messages and updates the model.

func (ResponseModel) View

func (m ResponseModel) View() string

View renders the response viewer.

type SaveDialogModel

type SaveDialogModel struct {
	// contains filtered or unexported fields
}

SaveDialogModel represents a dialog for saving a request with a name.

func NewSaveDialogModel

func NewSaveDialogModel(defaultName string) SaveDialogModel

NewSaveDialogModel creates a new save dialog with optional default name.

func (SaveDialogModel) Init

func (m SaveDialogModel) Init() tea.Cmd

Init initializes the save dialog.

func (SaveDialogModel) Update

func (m SaveDialogModel) Update(msg tea.Msg) (SaveDialogModel, tea.Cmd)

Update handles messages for the save dialog.

func (SaveDialogModel) View

func (m SaveDialogModel) View() string

View renders the save dialog as a centered modal overlay.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL