Documentation
¶
Index ¶
- type AppState
- type CollectionItem
- func (c *CollectionItem) AddChild(item *CollectionItem)
- func (c *CollectionItem) AddHeader(key string, value string)
- func (c *CollectionItem) AddHeaders(key string, values []string)
- func (c *CollectionItem) Ancestors() []*CollectionItem
- func (c *CollectionItem) InsertChildAfter(item *CollectionItem, after *CollectionItem)
- func (c *CollectionItem) IsDescendentOf(item *CollectionItem) bool
- func (c *CollectionItem) RemoveChild(item *CollectionItem) error
- func (c *CollectionItem) RemoveHeader(key string)
- type HTTPResult
- type ItemAuthentication
- type Manager
- type RequestBody
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AppState ¶
type AppState struct { Focused tview.Primitive LastError error `json:"-"` // do not serialize Collection *CollectionItem SelectedItem *CollectionItem ActiveItem *CollectionItem }
AppState represents the state of the application.
func DeserializeAppState ¶
DeserializeAppState returns an AppState from data.
func (*AppState) EnsureDefaultItems ¶
func (a *AppState) EnsureDefaultItems()
EnsureDefaultItems ensures that both the active and selected item are not nil. If either is nil, they will be set to the first non-group CollectionItem in the collection.
func (*AppState) FirstCollectionItem ¶
func (a *AppState) FirstCollectionItem(filter func(item *CollectionItem) bool) *CollectionItem
FirstCollectionItem returns the first CollectionItem that satisfies the filter predicate.
func (*AppState) RemoveCollectionItem ¶
func (a *AppState) RemoveCollectionItem(item *CollectionItem)
RemoveCollectionItem removes the given item from the collection. If the removed item was currently active or selected, then the active and/or selected item will be set to nil. It is the responsibility of the caller to reestablish the active and selected item after the fact.
type CollectionItem ¶
type CollectionItem struct { UUID uuid.UUID IsGroup bool Name string Method string URL string Headers map[string][]string RequestBody *RequestBody Authentication ItemAuthentication Result *HTTPResult `json:"-"` // do not serialize Parent *CollectionItem `json:"-"` // prepare circular references when serializing Children []*CollectionItem }
CollectionItem is a grouping or a single, saved REST API request with a given name.
func NewCollectionGroup ¶
func NewCollectionGroup(name string, parent *CollectionItem) *CollectionItem
NewCollectionGroup returns a CollectionGroup with a given name and no children. An optional parent may be provided to make this group a child of that item.
func NewCollectionRequest ¶
func NewCollectionRequest(name, method string, url string, parent *CollectionItem) *CollectionItem
NewCollectionRequest returns a CollectionRequest representing a REST API request. An optional parent may be provided // to make this item a child of that item.
func (*CollectionItem) AddChild ¶
func (c *CollectionItem) AddChild(item *CollectionItem)
AddChild appends an item to the end of this item's children. If this item is not a group (isGroup is false), then this method does nothing.
func (*CollectionItem) AddHeader ¶
func (c *CollectionItem) AddHeader(key string, value string)
AddHeader adds a header with the given key and value.
func (*CollectionItem) AddHeaders ¶
func (c *CollectionItem) AddHeaders(key string, values []string)
AddHeaders adds headers with the given key and values.
func (*CollectionItem) Ancestors ¶
func (c *CollectionItem) Ancestors() []*CollectionItem
Ancestors returns the collection items that form a path to this item. The list will be ordered by most distant to most recent ancestor, with the current item being the last element in the list.
func (*CollectionItem) InsertChildAfter ¶
func (c *CollectionItem) InsertChildAfter(item *CollectionItem, after *CollectionItem)
InsertChildAfter inserts an item after the given child item. If this item is not a group (isGroup is false), then this method does nothing.
func (*CollectionItem) IsDescendentOf ¶
func (c *CollectionItem) IsDescendentOf(item *CollectionItem) bool
IsDescendentOf returns true if this item is a descendent of the given item.
func (*CollectionItem) RemoveChild ¶
func (c *CollectionItem) RemoveChild(item *CollectionItem) error
RemoveChild removes the given item from the list of children of this item. If the item cannot be removed, an error will be returned.
func (*CollectionItem) RemoveHeader ¶
func (c *CollectionItem) RemoveHeader(key string)
RemoveHeader removes a header with the given key and value.
type HTTPResult ¶
type HTTPResult struct { Response *http.Response Payload []byte PayloadError error Duration time.Duration }
HTTPResult stores a http.Response and its associated metadata for a collection item.
type ItemAuthentication ¶
type ItemAuthentication struct {
Data auth.RequestAuthentication
}
ItemAuthentication is a container for authentication parameters for a collection item.
func (*ItemAuthentication) MarshalJSON ¶
func (i *ItemAuthentication) MarshalJSON() ([]byte, error)
func (*ItemAuthentication) None ¶
func (i *ItemAuthentication) None() bool
func (*ItemAuthentication) UnmarshalJSON ¶
func (i *ItemAuthentication) UnmarshalJSON(b []byte) error
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager provides maintenance and lifecycle handling for AppState changes.
func NewStateManager ¶
NewStateManager returns an instance of Manager that handles an instance of AppState.
type RequestBody ¶
RequestBody stores the request body and associated content information.