Documentation
¶
Index ¶
- Constants
- func File2Bytes(fileName string) ([]byte, error)
- func FileNameByHeader(header http.Header) string
- func NewHttpClient(config *Config)
- func NewLogger(config *Config)
- func NewSerialization(config *Config)
- func Prettify(i interface{}) string
- type AccessTokenType
- type ApiReq
- type ApiResp
- type ClientTimeoutError
- type CodeError
- type CodeErrorDetail
- type CodeErrorFieldViolation
- type CodeErrorPermissionViolation
- type Config
- type DefaultSerialization
- type DialFailedError
- type Formdata
- type HttpClient
- type IllegalParamError
- type LogLevel
- type Logger
- type PathParams
- type QueryParams
- type ReqTranslator
- type RequestOption
- type RequestOptionFunc
- type Serializable
- type ServerTimeoutError
Constants ¶
View Source
const ( HttpHeaderKeyRequestId = "X-Request-Id" HttpHeaderKeyLogId = "X-Tt-Logid" )
Variables ¶
This section is empty.
Functions ¶
func File2Bytes ¶
func FileNameByHeader ¶
func NewHttpClient ¶
func NewHttpClient(config *Config)
func NewSerialization ¶
func NewSerialization(config *Config)
Types ¶
type AccessTokenType ¶
type AccessTokenType string
const ( AccessTokenTypePersonal AccessTokenType = "personal_access_token" AccessTokenTypeNone AccessTokenType = "none_access_token" )
type ApiReq ¶
type ApiReq struct { HttpMethod string ApiPath string Body interface{} QueryParams QueryParams PathParams PathParams SupportedAccessTokenTypes []AccessTokenType }
type ApiResp ¶
type ApiResp struct { StatusCode int `json:"-"` Header http.Header `json:"-"` RawBody []byte `json:"-"` }
func (ApiResp) JSONUnmarshalBody ¶
func (ApiResp) Write ¶
func (resp ApiResp) Write(writer http.ResponseWriter)
type ClientTimeoutError ¶
type ClientTimeoutError struct {
// contains filtered or unexported fields
}
func (*ClientTimeoutError) Error ¶
func (err *ClientTimeoutError) Error() string
type CodeError ¶
type CodeError struct { Code int `json:"code"` Msg string `json:"msg"` Err *struct { Details []*CodeErrorDetail `json:"details,omitempty"` PermissionViolations []*CodeErrorPermissionViolation `json:"permission_violations,omitempty"` FieldViolations []*CodeErrorFieldViolation `json:"field_violations,omitempty"` } `json:"error"` }
type CodeErrorDetail ¶
type CodeErrorFieldViolation ¶
type DefaultSerialization ¶
type DefaultSerialization struct { }
func (*DefaultSerialization) Deserialize ¶
func (d *DefaultSerialization) Deserialize(data []byte, v interface{}) error
func (*DefaultSerialization) Serialize ¶
func (d *DefaultSerialization) Serialize(v interface{}) ([]byte, error)
type DialFailedError ¶
type DialFailedError struct {
// contains filtered or unexported fields
}
func (*DialFailedError) Error ¶
func (err *DialFailedError) Error() string
type Formdata ¶
type Formdata struct {
// contains filtered or unexported fields
}
func NewFormdata ¶
func NewFormdata() *Formdata
type HttpClient ¶
HttpClient :sdk-core面向HttpClient接口编程,实现core与httpclient解耦 1.可以适配所有基于go-sdk内置httpclient构建的三方httpclient 2.可以方便的对httpclient进行mock, 方便编写单元测试
type IllegalParamError ¶
type IllegalParamError struct {
// contains filtered or unexported fields
}
func (*IllegalParamError) Error ¶
func (err *IllegalParamError) Error() string
type Logger ¶
type Logger interface { Debug(context.Context, ...interface{}) Info(context.Context, ...interface{}) Warn(context.Context, ...interface{}) Error(context.Context, ...interface{}) }
func NewEventLogger ¶
func NewEventLogger() Logger
type PathParams ¶
func (PathParams) Get ¶
func (u PathParams) Get(key string) string
func (PathParams) Set ¶
func (u PathParams) Set(key, value string)
type QueryParams ¶
func (QueryParams) Add ¶
func (u QueryParams) Add(key, value string)
func (QueryParams) Encode ¶
func (u QueryParams) Encode() string
func (QueryParams) Get ¶
func (u QueryParams) Get(key string) string
func (QueryParams) Set ¶
func (u QueryParams) Set(key, value string)
type ReqTranslator ¶
type ReqTranslator struct { }
type RequestOption ¶
type RequestOptionFunc ¶
type RequestOptionFunc func(option *RequestOption)
func WithFileDownload ¶
func WithFileDownload() RequestOptionFunc
func WithFileUpload ¶
func WithFileUpload() RequestOptionFunc
func WithHeaders ¶
func WithHeaders(header http.Header) RequestOptionFunc
func WithRequestId ¶
func WithRequestId(requestId string) RequestOptionFunc
type Serializable ¶
type ServerTimeoutError ¶
type ServerTimeoutError struct {
// contains filtered or unexported fields
}
func (*ServerTimeoutError) Error ¶
func (err *ServerTimeoutError) Error() string
Click to show internal directories.
Click to hide internal directories.