rest

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2019 License: MIT Imports: 8 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()

func (*BmGetCommand) AddOptions

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

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

Jump to

Keyboard shortcuts

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