requests

package
v7.0.0-...-1c7ecba Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder interface {
	WithContext(context.Context) Builder
	WithBody(io.Reader) Builder
	WithMethod(string) Builder
	WithHeaders(http.Header) Builder
	SetHeader(key, value string) Builder
	Do() Result
}

Builder allows users to construct a request and then execute the request via Do(). Do returns a Result which allows the user to get the body, unmarshal the body into an interface, or into a simplejson.Json.

func New

func New(endpoint string) Builder

New provides a new Builder for the given endpoint.

type Result

type Result interface {
	Error() error
	StatusCode() int
	Headers() http.Header
	Body() []byte
	UnmarshalInto(interface{}) error
	UnmarshalSimpleJSON() (*simplejson.Json, error)
}

Result is the result of a request created by a Builder

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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