helpers

package
v0.0.0-...-c26fdb2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsEmptyValue

func IsEmptyValue(v reflect.Value) bool

IsEmptyValue checks if the reflect.Value given is empty or not

func MakeHTTPRequest

func MakeHTTPRequest(url string, credentials types.Credentials, method types.Action, data interface{}, debug bool) (status int, resp []byte, err error)

MakeHTTPRequest makes a request to exotel platform api for desire operation

func StructToMap

func StructToMap(tag string, structs ...interface{}) (m map[string]interface{}, err error)

StructToMap converts one or more struct to a map of string to interface Its uses the tag 'tag' to check the name to be used ,if the second struct had the same tag name the second one will be overriding the first if the value is nil or no tag is defined no key is added

Types

type Exorequester

type Exorequester struct {
	LastError error
	// contains filtered or unexported fields
}

Exorequester makes actual requests to the p.URL

func NewExorequester

func NewExorequester() *Exorequester

NewExorequester creates a new instance of Exorequester

func (*Exorequester) DELETE

func (p *Exorequester) DELETE(url string) *Exorequester

DELETE Makes Delete request to the end point

func (*Exorequester) Debug

func (p *Exorequester) Debug(debug bool) *Exorequester

Debug set the client in debug mode

func (*Exorequester) Do

func (p *Exorequester) Do() (status int, response []byte, err error)

Do does the execution of request

func (*Exorequester) GET

func (p *Exorequester) GET(url string) *Exorequester

GET Makes get request to the end point

func (*Exorequester) Log

func (p *Exorequester) Log(vals ...interface{})

Log writes log for the Client

func (*Exorequester) POST

func (p *Exorequester) POST(url string) *Exorequester

POST Makes post request to the end point

func (*Exorequester) PUT

func (p *Exorequester) PUT(url string) *Exorequester

PUT Makes put request to the end point

func (*Exorequester) Params

func (p *Exorequester) Params(requestData interface{}) *Exorequester

Params sets the parameters for requestss

func (*Exorequester) SetAuth

func (p *Exorequester) SetAuth(username string, password string) *Exorequester

SetAuth sets basic auth

func (*Exorequester) SetHeaders

func (p *Exorequester) SetHeaders() *Exorequester

SetHeaders Sets needed headers

Jump to

Keyboard shortcuts

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