client

package
v0.0.0-...-9a938bf Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ContentTypeJson       = "application/json"
	ContentTypeUrlEncoded = "application/x-www-form-urlencoded"
	ContentTypeOgg        = "audio/ogg;codecs=opus"
)

Variables

View Source
var (
	Err401StatusCode        = errors.New("unauthorized - 401")
	ErrWrongStatusCode      = errors.New("wrong status code")
	ErrCantCreateRequest    = errors.New("can't create request")
	ErrAuthInfoNotSpecified = errors.New("auth info wasn't specified")
	ErrCantUpdateToken      = errors.New("can't update token")
	ErrCantCreateClient     = errors.New("can't create client")
)

Functions

This section is empty.

Types

type HTTPClient

type HTTPClient struct {
	Host     string
	BasePath string
	// contains filtered or unexported fields
}

func NewHTTPClient

func NewHTTPClient(host, basePath string) *HTTPClient

func (*HTTPClient) CreateRequest

func (hc *HTTPClient) CreateRequest(method string, url string, header http.Header, body io.Reader, query url.Values) (*http.Request, error)

CreateRequest return http.Request with given parameters. If you don't need some of the parameters then give nil.

func (*HTTPClient) Do

func (hc *HTTPClient) Do(r *http.Request) ([]byte, error)

func (*HTTPClient) GetFullUrl

func (hc *HTTPClient) GetFullUrl() *url.URL

func (*HTTPClient) GetUlrWithMethods

func (hc *HTTPClient) GetUlrWithMethods(method string) *url.URL

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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