hareq

package
v0.2.73 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthFastGet

func AuthFastGet(url string, resData interface{}, th string) error

func AuthFastPost

func AuthFastPost(body interface{}, url string, resData interface{}, th string) error

post with body, url and auth, get decoded res

func BodyParser added in v0.0.14

func BodyParser(r *http.Request, body interface{}) error

http post req body parser

func Delete added in v0.2.9

func Delete(url string, header map[string]string) ([]byte, error)

func DownloadFileFromUrl added in v0.1.23

func DownloadFileFromUrl(url string, saveIn string, name string) error

func FastGet

func FastGet(url string, resData interface{}) error

get with url, get decoded res

func FastPost

func FastPost(body interface{}, url string, resData interface{}) error

post with body and url, get decoded res

func FastUpload

func FastUpload(url string, body map[string]string, resData interface{}, files ...FileToUpload) error

func Get added in v0.2.6

func Get(url string, header map[string]string) ([]byte, error)

func Post added in v0.2.6

func Post(url string, body interface{}, header map[string]string) ([]byte, error)

func Put added in v0.2.9

func Put(url string, body interface{}, header map[string]string) ([]byte, error)

func SendJson added in v0.0.15

func SendJson(w http.ResponseWriter, data interface{}) error

http send json

func SendString added in v0.0.15

func SendString(w http.ResponseWriter, data string) error

http send string

func SetStatus added in v0.0.15

func SetStatus(w http.ResponseWriter, status int)

http set header

Types

type Caller added in v0.1.20

type Caller struct {
	Url    string
	Body   interface{}
	Data   []byte
	Err    error
	Param  []string
	Auth   string
	Header map[string]string
	Query  map[string]string
}

func NewCaller added in v0.1.20

func NewCaller(url string) *Caller

func (*Caller) AddQuery added in v0.2.9

func (caller *Caller) AddQuery(k string, v string) *Caller

func (*Caller) Decode added in v0.1.20

func (caller *Caller) Decode(res any) error

func (*Caller) Delete added in v0.2.9

func (caller *Caller) Delete() *Caller

func (*Caller) Get added in v0.1.20

func (caller *Caller) Get() *Caller

func (*Caller) GetData added in v0.2.6

func (caller *Caller) GetData() string

func (*Caller) GetHeader added in v0.2.6

func (caller *Caller) GetHeader() map[string]string

func (*Caller) GetUrl added in v0.1.43

func (caller *Caller) GetUrl() string

func (*Caller) Post added in v0.2.6

func (caller *Caller) Post() *Caller

func (*Caller) Put added in v0.2.9

func (caller *Caller) Put() *Caller

func (*Caller) SetAuth added in v0.2.6

func (caller *Caller) SetAuth(auth string) *Caller

func (*Caller) SetBody added in v0.2.6

func (caller *Caller) SetBody(body interface{}) *Caller

func (*Caller) SetHeader added in v0.2.6

func (caller *Caller) SetHeader(header map[string]string) *Caller

func (*Caller) SetParam added in v0.1.43

func (caller *Caller) SetParam(param []string) *Caller

func (*Caller) SetQuery added in v0.2.9

func (caller *Caller) SetQuery(query map[string]string) *Caller

func (*Caller) SetUrl added in v0.2.7

func (caller *Caller) SetUrl(url string) *Caller

type FileToUpload added in v0.0.8

type FileToUpload struct {
	Name string
	Path string
}

type HaConnection added in v0.1.18

type HaConnection struct {
	Host     string
	Port     int
	Protocol string
}

func (HaConnection) GetConnection added in v0.1.18

func (conn HaConnection) GetConnection() string

func (HaConnection) GetPort added in v0.1.18

func (conn HaConnection) GetPort() string

type MsgRes added in v0.1.19

type MsgRes struct {
	Message string `json:"message"`
	Success bool   `json:"success"`
}

Jump to

Keyboard shortcuts

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