client

package
v0.0.0-...-776acb3 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var GlobalCfgFile string

GlobalCfgFile is the config filename

View Source
var GlobalHome string

GlobalHome is the user HOME

Functions

func DurationAsSecondsString

func DurationAsSecondsString(d time.Duration) string

DurationAsSecondsString returns a string representation of a duration (seconds)

func InitExitMessage

func InitExitMessage()

InitExitMessage resets global ExitMessage

func ParseExpiration

func ParseExpiration(duration string) (time.Duration, error)

ParseExpiration returns a duration from string (ex: 1h, 10d, 1y) An empty string is valid (expiration = 0)

Types

type API

type API struct {
	ServerURL string
	APIKey    string
	Trace     bool
	Time      bool
}

API describes the basic elements to call the API

var GlobalAPI *API

GlobalAPI is the global API instance

func NewAPI

func NewAPI(server string, apiKey string, trace bool, time bool) *API

NewAPI create a new API instance

func (*API) NewCall

func (api *API) NewCall(method string, path string, args map[string]string) *APICall

NewCall create a new APICall

type APICall

type APICall struct {
	Method        string
	Path          string
	Args          map[string]string
	JSONCallback  func(io.Reader, http.Header)
	DestFilePath  string
	DestStream    *os.File
	PrintLogTopic bool
	// contains filtered or unexported fields
}

APICall describes a call to the API

func (*APICall) AddFile

func (call *APICall) AddFile(fieldname string, filename string) error

AddFile to the request (upload)

func (*APICall) Do

func (call *APICall) Do()

Do the actual API call

func (*APICall) TimestampShow

func (call *APICall) TimestampShow(show bool)

TimestampShow allow to override -d / --time flag

type ExitMessage

type ExitMessage struct {
	Disabled bool
	Message  string
}

ExitMessage is displayed during client exit

func GetExitMessage

func GetExitMessage() *ExitMessage

GetExitMessage return a pointer to the global ExitMessage

func (*ExitMessage) Disable

func (em *ExitMessage) Disable()

Disable global ExitMessage

func (*ExitMessage) Display

func (em *ExitMessage) Display()

Display global ExitMessage

type RootConfig

type RootConfig struct {
	ConfigFile string

	URL string
	Key string

	Trace bool
	Time  bool
}

RootConfig describes client application config parameters

var GlobalConfig *RootConfig

GlobalConfig is the global RootConfig instance

Jump to

Keyboard shortcuts

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