client

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2021 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DebugMode = false

用来打印调试信息

View Source
var DeepDebugInfo = false
View Source
var DefaultClient = Client{&http.Client{Transport: http.DefaultTransport}}
View Source
var UserAgent = "Golang douyin/client package"

Functions

func CallRet

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

func ResponseError

func ResponseError(resp *http.Response) (err error)

func TurnOnDebug

func TurnOnDebug()

TurnOnDebug 开启Debug模式

Types

type Client

type Client struct {
	*http.Client
}

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

func (Client) Call

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

func (Client) CallWith

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

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)

func (Client) CallWithForm

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

func (Client) CallWithJson

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

func (Client) CredentialedCall

func (r Client) CredentialedCall(ctx context.Context, cred *auth.Credentials, tokenType auth.TokenType, ret interface{},
	method, reqUrl string, headers http.Header) error

func (Client) CredentialedCallWith

func (r Client) CredentialedCallWith(ctx context.Context, cred *auth.Credentials, tokenType auth.TokenType, ret interface{},
	method, reqUrl string, headers http.Header, body io.Reader, bodyLength int) error

func (Client) CredentialedCallWith64

func (r Client) CredentialedCallWith64(ctx context.Context, cred *auth.Credentials, tokenType auth.TokenType, ret interface{},
	method, reqUrl string, headers http.Header, body io.Reader, bodyLength int64) error

func (Client) CredentialedCallWithForm

func (r Client) CredentialedCallWithForm(ctx context.Context, cred *auth.Credentials, tokenType auth.TokenType, ret interface{},
	method, reqUrl string, headers http.Header, param map[string][]string) error

func (Client) CredentialedCallWithJson

func (r Client) CredentialedCallWithJson(ctx context.Context, cred *auth.Credentials, tokenType auth.TokenType, ret interface{},
	method, reqUrl string, headers http.Header, param interface{}) error

func (Client) Do

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

func (Client) DoRequest

func (r Client) DoRequest(ctx context.Context, method, reqUrl string, headers http.Header) (resp *http.Response, err error)

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)

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)

func (Client) DoRequestWithForm

func (r Client) DoRequestWithForm(ctx context.Context, method, reqUrl string, headers http.Header,
	data map[string][]string) (resp *http.Response, err error)

func (Client) DoRequestWithJson

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

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"`
}

func (*ErrorInfo) Error

func (r *ErrorInfo) Error() string

func (*ErrorInfo) ErrorDetail

func (r *ErrorInfo) ErrorDetail() string

func (*ErrorInfo) HttpCode

func (r *ErrorInfo) HttpCode() int

func (*ErrorInfo) RpcError

func (r *ErrorInfo) RpcError() (code, errno int, key, err string)

Jump to

Keyboard shortcuts

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