Documentation ¶
Index ¶
- func CommonResponse[RES any]() client.ResponseBodyCheck
- func CommonResponse2[RES any]() client.ResponseBodyCheck
- func CommonResponse3[RES any]() client.ResponseBodyCheck
- func Delete[RES any](url string, param any) (*RES, error)
- func Get[RES any](url string, param any) (*RES, error)
- func GetSubData[RES ResponseInterface[T], T any](url string, param any) (T, error)
- func GetWithOption[RES ResponseInterface[T], T any](url string, param any, options ...client.Option) (T, error)
- func Post[RES any](url string, param any) (*RES, error)
- func Put[RES any](url string, param any) (*RES, error)
- type Request
- func DeleteRequest[RES any](url string) *Request[RES]
- func GetRequest[RES any](url string) *Request[RES]
- func NewFromRequest[RES any](req *client.Request) *Request[RES]
- func NewRequest[RES any](method, url string) *Request[RES]
- func PostRequest[RES any](url string) *Request[RES]
- func PutRequest[RES any](url string) *Request[RES]
- func (req *Request[RES]) AddHeader(k, v string) *Request[RES]
- func (req *Request[RES]) Client() *client.Client
- func (req *Request[RES]) ContentType(contentType client.ContentType) *Request[RES]
- func (req *Request[RES]) Context(ctx context.Context) *Request[RES]
- func (r *Request[RES]) Do(param any) (*RES, error)
- func (req *Request[RES]) DoNoParam() (*RES, error)
- func (r *Request[RES]) Origin() *client.Request
- func (req *Request[RES]) SetClient(set func(c *client.Client)) *Request[RES]
- func (req *Request[RES]) WithClient(client2 *client.Client) *Request[RES]
- type ResponseBody
- type ResponseBody2
- type ResponseBody3
- type ResponseInterface
- type SubDataRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommonResponse ¶
func CommonResponse[RES any]() client.ResponseBodyCheck
func CommonResponse2 ¶
func CommonResponse2[RES any]() client.ResponseBodyCheck
func CommonResponse3 ¶
func CommonResponse3[RES any]() client.ResponseBodyCheck
func GetSubData ¶
func GetSubData[RES ResponseInterface[T], T any](url string, param any) (T, error)
func GetWithOption ¶
Types ¶
type Request ¶
func DeleteRequest ¶
func GetRequest ¶
func NewRequest ¶
func PostRequest ¶
func PutRequest ¶
func (*Request[RES]) ContentType ¶
func (req *Request[RES]) ContentType(contentType client.ContentType) *Request[RES]
type ResponseBody ¶
func (*ResponseBody[RES]) CheckError ¶
func (res *ResponseBody[RES]) CheckError() error
func (*ResponseBody[RES]) GetData ¶
func (res *ResponseBody[RES]) GetData() *RES
type ResponseBody2 ¶
type ResponseBody2[RES any] struct { Code int `json:"code"` Msg string `json:"msg"` Data RES `json:"data"` }
func (*ResponseBody2[RES]) CheckError ¶
func (res *ResponseBody2[RES]) CheckError() error
func (*ResponseBody2[RES]) GetData ¶
func (res *ResponseBody2[RES]) GetData() *RES
type ResponseBody3 ¶
type ResponseBody3[RES any] struct { Status int `json:"status"` Data RES `json:"data"` Message string `json:"message"` }
func (*ResponseBody3[RES]) CheckError ¶
func (res *ResponseBody3[RES]) CheckError() error
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)
Click to show internal directories.
Click to hide internal directories.