http

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 28, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewAliyunDriveError

func NewAliyunDriveError(code, message string) error

Types

type AliyunDriveError

type AliyunDriveError struct {
	Code    string
	Message string
}

func (*AliyunDriveError) Error

func (p *AliyunDriveError) Error() string

type BaseRequest

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

func (*BaseRequest) GetHeaders

func (receiver *BaseRequest) GetHeaders() map[string]string

func (*BaseRequest) GetHttpMethod

func (receiver *BaseRequest) GetHttpMethod() Method

func (*BaseRequest) GetQueryParams

func (receiver *BaseRequest) GetQueryParams() map[string]string

func (*BaseRequest) GetUrl

func (receiver *BaseRequest) GetUrl() string

func (*BaseRequest) Init

func (receiver *BaseRequest) Init(endpoint string) *BaseRequest

func (*BaseRequest) SetHttpMethod

func (receiver *BaseRequest) SetHttpMethod(method Method) Request

func (*BaseRequest) SetUrl

func (receiver *BaseRequest) SetUrl(url string) Request

type BaseResponse

type BaseResponse struct {
	Code    string `json:"code"`
	Message string `json:"message"`
}

func (*BaseResponse) ParseErrorFromHTTPResponse

func (b *BaseResponse) ParseErrorFromHTTPResponse(body []byte) error

type Client

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

func NewClient

func NewClient() *Client

func (*Client) Send

func (c *Client) Send(request Request, response Response) error

type Method

type Method string
const (
	Get     Method = "GET"
	Post    Method = "POST"
	Put     Method = "PUT"
	Delete  Method = "DELETE"
	Patch   Method = "PATCH"
	Head    Method = "HEAD"
	Options Method = "OPTIONS"
)

type Request

type Request interface {
	GetHttpMethod() Method
	GetUrl() string
	GetQueryParams() map[string]string
	GetHeaders() map[string]string

	SetHttpMethod(method Method) Request
	SetUrl(url string) Request
}

type Response

type Response interface {
	ParseErrorFromHTTPResponse(body []byte) error
}

Jump to

Keyboard shortcuts

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