unirest

package module
v0.0.0-...-858ed28 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2019 License: MIT Imports: 15 Imported by: 130

README

Unirest HTTP Client for Go

Build Status

Setup

To setup your project, follow these steps:

  1. Download Unirest-Go using go get github.com/apimatic/unirest-go.
  2. Import Unirest-Go in your project using
import "github.com/apimatic/unirest-go"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToString

func ToString(data interface{}, dVal string) string

*

  • Uses reflection to get string representation of a given data
  • @param data The given data for the finding the string representation
  • @param dVal The default value string to use if the given value is nil

Types

type HttpMethod

type HttpMethod int
const (
	GET HttpMethod = 1 + iota
	POST
	PUT
	PATCH
	DELETE
)

func (HttpMethod) ToString

func (method HttpMethod) ToString() string

type Request

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

func Delete

func Delete(url string, headers map[string]interface{}, body interface{}) *Request

func DeleteWithAuth

func DeleteWithAuth(url string, headers map[string]interface{}, body interface{}, username string, password string) *Request

func Get

func Get(url string, headers map[string]interface{}) *Request

func GetWithAuth

func GetWithAuth(url string, headers map[string]interface{}, username string, password string) *Request

func NewRequest

func NewRequest(method HttpMethod, url string,
	headers map[string]interface{}, parameters interface{},
	username string, password string) *Request

func Patch

func Patch(url string, headers map[string]interface{}, body interface{}) *Request

func PatchWithAuth

func PatchWithAuth(url string, headers map[string]interface{}, body interface{}, username string, password string) *Request

func Post

func Post(url string, headers map[string]interface{}, body interface{}) *Request

func PostWithAuth

func PostWithAuth(url string, headers map[string]interface{}, body interface{}, username string, password string) *Request

func Put

func Put(url string, headers map[string]interface{}, body interface{}) *Request

func PutWithAuth

func PutWithAuth(url string, headers map[string]interface{}, body interface{}, username string, password string) *Request

func (*Request) PerformRequest

func (me *Request) PerformRequest(skipVerify bool) (*http.Response, error)

type Response

type Response struct {
	Code    int
	RawBody []byte
	Body    string
	Headers map[string][]string
}

func AsBinary

func AsBinary(request *Request, skipVerify bool) (*Response, error)

func AsString

func AsString(request *Request, skipVerify bool) (*Response, error)

func NewBinaryResponse

func NewBinaryResponse(resp *http.Response) (*Response, error)

func NewStringResponse

func NewStringResponse(resp *http.Response) (*Response, error)

Jump to

Keyboard shortcuts

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