client

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CommonResponse

func CommonResponse[RES any]() client.ResponseBodyCheck

func Delete

func Delete[RES any](url string, param any) (*RES, error)

func Get

func Get[RES any](url string, param any) (*RES, error)

func GetSubData

func GetSubData[RES ResponseInterface[T], T any](url string, param any) (T, error)

func GetWithOption

func GetWithOption[RES ResponseInterface[T], T any](url string, param any, options ...client.Option) (T, error)

func Post

func Post[RES any](url string, param any) (*RES, error)

func Put

func Put[RES any](url string, param any) (*RES, error)

Types

type Request

type Request[RES any] client.Request

func DeleteRequest

func DeleteRequest[RES any](url string) *Request[RES]

func GetRequest

func GetRequest[RES any](url string) *Request[RES]

func NewRequest

func NewRequest[RES any](method, url string) *Request[RES]

func NewRequestFromV1 added in v0.0.33

func NewRequestFromV1[RES any](req *client.Request) *Request[RES]

func PostRequest

func PostRequest[RES any](url string) *Request[RES]

func PutRequest

func PutRequest[RES any](url string) *Request[RES]

func (*Request[RES]) AddHeader

func (req *Request[RES]) AddHeader(k, v string) *Request[RES]

func (*Request[RES]) Client

func (req *Request[RES]) Client() *client.Client

func (*Request[RES]) ContentType

func (req *Request[RES]) ContentType(contentType client.ContentType) *Request[RES]

func (*Request[RES]) Context

func (req *Request[RES]) Context(ctx context.Context) *Request[RES]

func (*Request[RES]) Do

func (r *Request[RES]) Do(param any) (*RES, error)

Do create a HTTP request

func (*Request[RES]) DoNoParam

func (req *Request[RES]) DoNoParam() (*RES, error)

func (*Request[RES]) Header added in v0.0.35

func (req *Request[RES]) Header(header httpi.Header) *Request[RES]

func (*Request[RES]) Origin

func (r *Request[RES]) Origin() *client.Request

func (*Request[RES]) SetClient

func (req *Request[RES]) SetClient(set func(c *client.Client)) *Request[RES]

func (*Request[RES]) WithClient

func (req *Request[RES]) WithClient(client2 *client.Client) *Request[RES]

type ResData added in v0.0.33

type ResData[RES any] httpi.ResData[RES]

func (*ResData[RES]) CheckError added in v0.0.33

func (res *ResData[RES]) CheckError() error

func (*ResData[RES]) GetData added in v0.0.33

func (res *ResData[RES]) GetData() *RES

type ResponseInterface

type ResponseInterface[T any] interface {
	client.ResponseBodyCheck
	SubData() T
}

type SubDataRequest

type SubDataRequest[RES ResponseInterface[T], T any] Request[RES]

一个语法糖,一般不用

func NewSubDataRequest

func NewSubDataRequest[RES ResponseInterface[T], T any](req *client.Request) *SubDataRequest[RES, T]

func (*SubDataRequest[RES, T]) Do

func (r *SubDataRequest[RES, T]) Do(param any) (T, error)

Do create a HTTP request

func (*SubDataRequest[RES, T]) Origin

func (req *SubDataRequest[RES, T]) Origin() *client.Request

func (*SubDataRequest[RES, T]) SubData

func (req *SubDataRequest[RES, T]) SubData(param any) (T, error)

Jump to

Keyboard shortcuts

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