Documentation ¶
Index ¶
- Constants
- func DownloadFile(ctx context.Context, url string) ([]byte, error)
- func FileNameByHeader(header http.Header) string
- func NewCache(config *Config)
- func NewHttpClient(config *Config)
- func NewLogger(config *Config)
- func Prettify(i interface{}) string
- type APIReq
- type APIResp
- type AccessToken
- type AccessTokenErr
- type AccessTokenType
- type Cache
- type ClientTimeoutError
- type CodeError
- type Config
- type FormData
- type GetAccessTokenReq
- type GetAccessTokenResp
- type HttpClient
- type IllegalParamError
- type LogLevel
- type Logger
- type MarketplaceAppAccessTokenReq
- type MarketplaceTenantAccessTokenReq
- type PathParams
- type QueryParams
- type ReqTranslator
- type RequestOption
- type RequestOptionFunc
- type ServerTimeoutError
- type TokenManager
- type Value
Constants ¶
View Source
const ( HTTPHeaderUserKey = "X-USER-KEY" HTTPHeaderAccessToken = "X-PLUGIN-TOKEN" HTTPHeaderIdemUUID = "X-IDEM-UUID" HTTPHeaderKeyRequestID = "X-Request-Id" HTTPHeaderKeyLogID = "X-Tt-Logid" )
View Source
const (
PluginAccessTokenInternalUrlPath string = "/open_api/authen/plugin_token"
)
Variables ¶
This section is empty.
Functions ¶
func DownloadFile ¶
DownloadFile returns the url of resource
func FileNameByHeader ¶
func NewHttpClient ¶
func NewHttpClient(config *Config)
Types ¶
type APIReq ¶
type APIReq struct { HttpMethod string ApiPath string Body interface{} QueryParams QueryParams PathParams PathParams SkipAuth bool }
type APIResp ¶
type APIResp struct { StatusCode int `json:"-"` Header http.Header `json:"-"` RawBody []byte `json:"-"` }
func (APIResp) JSONUnmarshalBody ¶
type AccessToken ¶
type AccessTokenErr ¶
func (AccessTokenErr) Error ¶
func (ce AccessTokenErr) Error() string
func (AccessTokenErr) String ¶
func (ce AccessTokenErr) String() string
type AccessTokenType ¶
type AccessTokenType int
const ( AccessTokenTypePlugin AccessTokenType = 0 AccessTokenTypeVirtualPlugin AccessTokenType = 1 )
type ClientTimeoutError ¶
type ClientTimeoutError struct {
// contains filtered or unexported fields
}
func (*ClientTimeoutError) Error ¶
func (err *ClientTimeoutError) Error() string
type CodeError ¶
type FormData ¶
type FormData struct {
// contains filtered or unexported fields
}
func NewFormdata ¶
func NewFormdata() *FormData
func (*FormData) SetMimeType ¶ added in v1.0.2
type GetAccessTokenReq ¶
type GetAccessTokenResp ¶
type GetAccessTokenResp struct { *APIResp `json:"-"` Error *AccessTokenErr `json:"error"` Data *AccessToken `json:"data"` }
func (*GetAccessTokenResp) Success ¶
func (t *GetAccessTokenResp) Success() bool
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 WithAccessToken ¶
func WithAccessToken(accessToken string) RequestOptionFunc
func WithHeaders ¶
func WithHeaders(header http.Header) RequestOptionFunc
func WithIdemUUID ¶
func WithIdemUUID(uuid string) RequestOptionFunc
func WithUserKey ¶
func WithUserKey(userKey string) RequestOptionFunc
type ServerTimeoutError ¶
type ServerTimeoutError struct {
// contains filtered or unexported fields
}
func (*ServerTimeoutError) Error ¶
func (err *ServerTimeoutError) Error() string
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.