fetch

package module
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2021 License: MIT Imports: 17 Imported by: 0

README

fetch

A general purpose http client. Responses implement fs.File interfaces.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type OAuthToken added in v0.1.1

type OAuthToken struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
	Scope       string `json:"scope"`
}

func (OAuthToken) Header added in v0.1.1

func (t OAuthToken) Header() (string, error)

type Request

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

func Delete

func Delete(url string) *Request

func Get

func Get(url string) *Request

func New

func New(method, url string) *Request

func Post

func Post(url string) *Request

func Put

func Put(url string) *Request

func (Request) Authorization

func (t Request) Authorization(authHeader string) *Request

func (Request) Body

func (t Request) Body(data []byte, mime string) *Request

func (Request) Client

func (t Request) Client(c *http.Client) *Request

func (Request) Context

func (t Request) Context(ctx context.Context) *Request

func (Request) Download

func (t Request) Download(name string) error

func (Request) Err

func (t Request) Err() error

func (Request) Form

func (t Request) Form(data url.Values) *Request

func (Request) Header

func (t Request) Header(key string, vs ...interface{}) *Request

func (Request) JSON

func (t Request) JSON(v interface{}) *Request

func (Request) Limit

func (t Request) Limit(l *rate.Limiter) *Request

func (Request) Open

func (t Request) Open() (fs.File, error)

func (Request) Query

func (t Request) Query(key string, vs ...interface{}) *Request

func (Request) Read

func (t Request) Read() ([]byte, error)

func (Request) ReadJSON

func (t Request) ReadJSON(v interface{}) error

func (Request) ReadString

func (t Request) ReadString() (string, error)

func (Request) ReadXML

func (t Request) ReadXML(v interface{}) error

func (Request) Stat

func (t Request) Stat() (os.FileInfo, error)

func (Request) User

func (t Request) User(u *url.Userinfo) *Request

func (Request) UserAgent

func (t Request) UserAgent(ua string) *Request

Jump to

Keyboard shortcuts

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