client

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package client - Http Client

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrArgument indicates a argument error
	ErrArgument = fmt.Errorf("client: unexcept argument")
	// ErrConfigure indicates a config error
	ErrConfigure = fmt.Errorf("client: unexcept configure")
)

Functions

This section is empty.

Types

type Context

type Context struct {
	*base.TaskBase
	// contains filtered or unexported fields
}

Context of client

func NewContext

func NewContext(name string) *Context

NewContext return a new Context of http client

func (*Context) Get

func (c *Context) Get(ctx context.Context, args ...string) (*resty.Response, error)

Get resource by http request

func (*Context) Post

func (c *Context) Post(ctx context.Context, body interface{}, args ...string) (*resty.Response, error)

Post resource by http request

func (*Context) Put

func (c *Context) Put(ctx context.Context, body interface{}, args ...string) (*resty.Response, error)

Put resource by http request

func (*Context) R

func (c *Context) R() *resty.Request

R return a *resty.Request

func (*Context) Reload

func (c *Context) Reload(ctx context.Context) error

Reload to get lastest config by config file

func (*Context) Retire

func (c *Context) Retire(ctx context.Context) error

Retire was execute when exit

func (*Context) Schedule

func (c *Context) Schedule(ctx context.Context) error

Schedule was execute when schedule

Jump to

Keyboard shortcuts

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