client

package
v1.0.8 Latest Latest
Warning

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

Go to latest
Published: Oct 19, 2023 License: GPL-3.0 Imports: 13 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugMode = false

DebugMode 用来打印调试信息

View Source
var DeepDebugInfo = false

DeepDebugInfo 调试信息

View Source
var DefaultClient = Client{&http.Client{Transport: http.DefaultTransport}}

DefaultClient 默认Client

View Source
var UserAgent = "Golang douyin/client package"

UserAgent UA

Functions

func CallRet

func CallRet(ctx context.Context, ret interface{}, resp *http.Response) (err error)

CallRet Http请求

func ResponseError

func ResponseError(resp *http.Response) error

ResponseError 错误响应

func TurnOnDebug

func TurnOnDebug()

TurnOnDebug 开启Debug模式

Types

type Client

type Client struct {
	*http.Client
}

Client 负责发送HTTP请求到抖音接口服务器

func (Client) CallWith64

func (r Client) CallWith64(ctx context.Context, ret interface{}, method, reqUrl string, headers http.Header, body io.Reader,
	bodyLength int64) (err error)

CallWith64 请求

func (Client) CallWithJson

func (r Client) CallWithJson(ctx context.Context, ret interface{}, method, reqUrl string, headers http.Header,
	param interface{}) (err error)

CallWithJson JSON请求

func (Client) Do

func (r Client) Do(ctx context.Context, req *http.Request) (resp *http.Response, err error)

Do 请求

func (Client) DoRequestWith

func (r Client) DoRequestWith(ctx context.Context, method, reqUrl string, headers http.Header, body io.Reader,
	bodyLength int) (resp *http.Response, err error)

DoRequestWith 请求

func (Client) DoRequestWith64

func (r Client) DoRequestWith64(ctx context.Context, method, reqUrl string, headers http.Header, body io.Reader,
	bodyLength int64) (resp *http.Response, err error)

DoRequestWith64 请求

func (Client) DoRequestWithJson

func (r Client) DoRequestWithJson(ctx context.Context, method, reqUrl string, headers http.Header,
	data interface{}) (resp *http.Response, err error)

DoRequestWithJson JSON请求

type ErrorInfo

type ErrorInfo struct {
	Err   string `json:"error,omitempty"`
	Key   string `json:"key,omitempty"`
	Reqid string `json:"reqid,omitempty"`
	Errno int    `json:"errno,omitempty"`
	Code  int    `json:"code"`
}

ErrorInfo 错误信息

func (*ErrorInfo) Error

func (r *ErrorInfo) Error() string

Error 错误

Jump to

Keyboard shortcuts

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