models

package
v0.0.0-...-2bde531 Latest Latest
Warning

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

Go to latest
Published: Nov 8, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AppCtx

type AppCtx struct {
	GetRootPrmt func() *tview.Pages

	AddListenerMRD     map[string]func(data MakeRequestData)
	AddListenerConfig  map[string]func(data Config)
	AddContextListener map[string]func(data Context)

	GetMDR    func() MakeRequestData
	UpdateMDR func(data MakeRequestData)

	GetConfig    func() Config
	UpdateConfig func(data Config)

	GetOutput func() Output

	UpdateContext func(data Context)

	RefreshViews func(views string)
	SwitchView   func(view string)
	// contains filtered or unexported fields
}

Event contains all events to manage application data

func NewAppCtx

func NewAppCtx(
	getRootPrmt func() *tview.Pages,
	getMDR func() MakeRequestData,
	upMDR func(data MakeRequestData),
	getConfig func() Config,
	updateConfig func(data Config),
	getOutput func() Output,
	updateContext func(data Context),
	printOut func(level string, value string),
	refreshViews func(views string),
	switchView func(views string)) *AppCtx

NewEvent makes a new event struct

func (AppCtx) CloseModal

func (ctx AppCtx) CloseModal()

CloseModal closes modal from the screen.

func (AppCtx) DisplayModal

func (ctx AppCtx) DisplayModal(prmt tview.Primitive)

DisplayModal displays a model to the screen.

func (AppCtx) PrintDebug

func (ctx AppCtx) PrintDebug(value string)

PrintDebug prints "debug" log to file

func (AppCtx) PrintError

func (ctx AppCtx) PrintError(value string)

PrintError prints "error" log to file

func (AppCtx) PrintInfo

func (ctx AppCtx) PrintInfo(value string)

PrintInfo prints "info" log to file

func (AppCtx) PrintTrace

func (ctx AppCtx) PrintTrace(value string)

PrintTrace prints "trace" log to file

type Config

type Config struct {
	Pattern string
}

Config contains the app configuration

type Context

type Context struct {
	Env map[string][]ContextVariable
}

Context reprensents a context structure

func (*Context) Add

func (c *Context) Add(env string, variable string, value string)

Add adds new variable to an environment

func (Context) FindVariableByEnv

func (c Context) FindVariableByEnv(env string, variable string) ContextVariable

FindVariableByEnv finds variable for an specific environment

func (Context) GetAllKeyValue

func (c Context) GetAllKeyValue(env string) map[string]string

GetAllKeyValue gets all ContextVariable for an specific environment

func (Context) GetAllVariables

func (c Context) GetAllVariables(env string) core.StringSlice

GetAllVariables returns all variables for an specific environment

func (Context) GetEnvsName

func (c Context) GetEnvsName() core.StringSlice

GetEnvsName gets all environments name

func (*Context) Remove

func (c *Context) Remove(env string, variable string)

Remove removes a variable to an environment

type ContextVariable

type ContextVariable struct {
	Variable string
	Value    string
}

ContextVariable reprensents a context variable structure

func NewContextVariable

func NewContextVariable(variable string, value string) ContextVariable

NewContextVariable creates new ContextVariable struct

type MakeRequestData

type MakeRequestData struct {
	Method                   types.Method
	URL                      types.URL
	MapRequestHeaderKeyValue core.StringMap
	Body                     string
	ContentType              string
	ProjectName              string
	Alias                    string
}

MakeRequestData reprensents a request structure

func EmptyMakeRequestData

func EmptyMakeRequestData() MakeRequestData

EmptyMakeRequestData creates an empty new MakeRequestData struct

func NewMakeRequestData

func NewMakeRequestData(
	method string,
	url string,
	header core.StringMap,
	body string,
	contentType string,
	projectName string,
	alias string) MakeRequestData

NewMakeRequestData creates a new MakeRequestData

func SimpleMakeRequestData

func SimpleMakeRequestData(
	method string,
	url string,
	projectName string,
	alias string) MakeRequestData

SimpleMakeRequestData creates a simple new MakeRequestData

func (MakeRequestData) GetHTTPHeaderValues

func (m MakeRequestData) GetHTTPHeaderValues() core.StringMap

GetHTTPHeaderValues filters by HTTP request header params

func (MakeRequestData) ToLog

func (m MakeRequestData) ToLog(url types.URL) string

ToLog builds request to str message to be logged

func (MakeRequestData) TreeFormat

func (m MakeRequestData) TreeFormat(pattern string) string

type Output

type Output struct {
	Data    []MakeRequestData
	Config  Config
	Context Context
}

Output struct corresponds to serialize and deserialize json app file

func (*Output) AddOrReplace

func (out *Output) AddOrReplace(data MakeRequestData)

AddOrReplace adds or replaces a MakeRequestData struct

func (Output) Find

func (out Output) Find(method string, url string) (MakeRequestData, error)

Find finds a MakeRequestData from "method"/"url"

func (*Output) Remove

func (out *Output) Remove(data MakeRequestData)

Remove removes MakeRequestData struct

func (Output) SortDataAPIsByProjectName

func (out Output) SortDataAPIsByProjectName() ([]string, map[string][]MakeRequestData)

SortDataAPIsByProjectName filters data APIs by project name and sorts by them

func (Output) UpdateMakeRequestData

func (out Output) UpdateMakeRequestData(values []MakeRequestData) Output

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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