rest

package
v1.4.4 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2023 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultJsonVar  = ""
	DefaultJsonBody = ""
	DefaultJsonFile = ""
	DefaultFormBody = ""
	DefaultXMLVar   = ""
	DefaultXMLFile  = ""
	DefaultFormVar  = ""
	DefaultBodyFile = ""
)

Variables

View Source
var (
	RESTBASEURLKEY  = "RestBaseUrl"
	RESTBASEAUTHKEY = "RestBaseAuth"
)

Constants for keys of stored globals

Functions

func AddCommands

func AddCommands()

func GenerateBaseUrl

func GenerateBaseUrl(route string) string

func GetBaseAuthContext

func GetBaseAuthContext() shell.Auth

Types

type BaseCommand

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

func NewBaseCommand

func NewBaseCommand() *BaseCommand

func (*BaseCommand) AddOptions

func (cmd *BaseCommand) AddOptions(set shell.CmdSet)

func (*BaseCommand) Execute

func (cmd *BaseCommand) Execute(args []string) error

type BmGetCommand

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

func NewBmGetCommand

func NewBmGetCommand() *BmGetCommand

func (*BmGetCommand) Abort

func (cmd *BmGetCommand) Abort()

Abort() function to abort a benchmark

func (*BmGetCommand) AddOptions

func (cmd *BmGetCommand) AddOptions(set shell.CmdSet)

AddOptions - construct the options for the command

func (*BmGetCommand) Execute

func (cmd *BmGetCommand) Execute(args []string) error

type BmPostCommand

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

func NewBmPostCommand

func NewBmPostCommand() *BmPostCommand

func (*BmPostCommand) Abort

func (cmd *BmPostCommand) Abort()

func (*BmPostCommand) AddOptions

func (cmd *BmPostCommand) AddOptions(set shell.CmdSet)

func (*BmPostCommand) Execute

func (cmd *BmPostCommand) Execute(args []string) error

type CookieAuth

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

func NewCookieAuth

func NewCookieAuth() *CookieAuth

NewCookieAuth -- Create an Auth context that adds cookies to the request

func (*CookieAuth) AddAuth

func (a *CookieAuth) AddAuth(req *http.Request)

func (*CookieAuth) AddCookie

func (a *CookieAuth) AddCookie(name string, value string)

func (*CookieAuth) IsAuthed

func (a *CookieAuth) IsAuthed() bool

func (*CookieAuth) ToString

func (a *CookieAuth) ToString() string

type GetCommand

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

func NewGetCommand

func NewGetCommand() *GetCommand

func (*GetCommand) AddOptions

func (cmd *GetCommand) AddOptions(set shell.CmdSet)

func (*GetCommand) Execute

func (cmd *GetCommand) Execute(args []string) error

Execute -- GET the results from an API

type HeaderAuth

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

func NewHeaderAuth

func NewHeaderAuth() *HeaderAuth

NewHeaderAuth -- Create an Auth context that adds cookies to the request

func (*HeaderAuth) AddAuth

func (a *HeaderAuth) AddAuth(req *http.Request)

func (*HeaderAuth) AddHeader

func (a *HeaderAuth) AddHeader(name string, value string)

func (*HeaderAuth) IsAuthed

func (a *HeaderAuth) IsAuthed() bool

func (*HeaderAuth) ToString

func (a *HeaderAuth) ToString() string

type LoginCommand

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

func NewLoginCommand

func NewLoginCommand() *LoginCommand

func (*LoginCommand) AddOptions

func (cmd *LoginCommand) AddOptions(set shell.CmdSet)

func (*LoginCommand) Execute

func (cmd *LoginCommand) Execute(args []string) error

Execute - execute the given command

func (*LoginCommand) ExtendedUsage

func (cmd *LoginCommand) ExtendedUsage(w io.Writer)

ExtendedUsage -- write the extended useage

func (*LoginCommand) GetSubCommands

func (cmd *LoginCommand) GetSubCommands() []string

func (*LoginCommand) HeaderUsage

func (cmd *LoginCommand) HeaderUsage(w io.Writer)

type PostBody

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

func (*PostBody) Content

func (pb *PostBody) Content() string

Body -- the body of a post

func (*PostBody) ContentType

func (pb *PostBody) ContentType() string

ContentType -- the default content type based on data options

type PostCommand

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

PostCommand -- State and options for PostCommand

func NewPostCommand

func NewPostCommand() *PostCommand

func (*PostCommand) AddOptions

func (cmd *PostCommand) AddOptions(set shell.CmdSet)

func (*PostCommand) Execute

func (cmd *PostCommand) Execute(args []string) error

Execute -- Execute the post command

type PostOptions

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

func AddPostOptions

func AddPostOptions(set shell.CmdSet) PostOptions

AddModifierOptions -- Add options for modifiers

func (*PostOptions) GetPostBody

func (p *PostOptions) GetPostBody() (*PostBody, error)

GetPostBody -- Get a post body based on post options

func (*PostOptions) GetPostMethod

func (p *PostOptions) GetPostMethod() string

GetPostMethod -- Returns the configured HTTP method

type SmGetCommand added in v1.3.0

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

func NewSmGetCommand added in v1.3.0

func NewSmGetCommand() *SmGetCommand

func (*SmGetCommand) Abort added in v1.3.0

func (cmd *SmGetCommand) Abort()

Abort - Requests the current command to abort

func (*SmGetCommand) AddOptions added in v1.3.0

func (cmd *SmGetCommand) AddOptions(set shell.CmdSet)

func (*SmGetCommand) Execute added in v1.3.0

func (cmd *SmGetCommand) Execute(args []string) error

type SmPostCommand added in v1.3.0

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

func NewSmPostCommand added in v1.3.0

func NewSmPostCommand() *SmPostCommand

func (*SmPostCommand) Abort added in v1.3.0

func (cmd *SmPostCommand) Abort()

Abort -- Request the command to abort the current operation

func (*SmPostCommand) AddOptions added in v1.3.0

func (cmd *SmPostCommand) AddOptions(set shell.CmdSet)

func (*SmPostCommand) Execute added in v1.3.0

func (cmd *SmPostCommand) Execute(args []string) error

Jump to

Keyboard shortcuts

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