utils

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SCHEME      = "https"
	OPENAPIHOST = "openapi.baidu.com"
	SPAPIHOST   = "spapi.baidu.com"
	SDKLANG     = "Go"
	SDKVERSION  = "0.1.2"
)
View Source
const (
	ContentTypeForm      = "application/x-www-form-urlencoded"
	ContentTypeJSON      = "application/json"
	ContentTypeMultiPart = "multipart/form-data"
	ConverterTypeJSON    = "json"
	ConverterTypePNG     = "png"
	ConverterTypeStream  = "octet-stream"
)

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(opts ...Option) *httpClient

newHTTPClient 创建一个HTTPClient opts 支持optTimeout 或 optRetry

Types

type APIError

type APIError struct {
	ErrNo  int64       // 错误码
	ErrMsg string      // 错误信息
	Detail interface{} // 详情
}

业务接口错误响应结构体

func (*APIError) Error

func (e *APIError) Error() string

type OpenAPIError

type OpenAPIError struct {
	ErrorCode int64       // openapi 错误码
	ErrorMsg  string      // openapi 错误信息
	Detail    interface{} // 详情
}

网关错误响应结构体

func (*OpenAPIError) Error

func (e *OpenAPIError) Error() string

type Option

type Option interface {
	// contains filtered or unexported methods
}

func OptRetry

func OptRetry(retry int) Option

func OptTimeout

func OptTimeout(timeout time.Duration) Option

Jump to

Keyboard shortcuts

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