Documentation ¶
Index ¶
- Constants
- Variables
- func BoolPtr(v bool) *bool
- func BoolValue(v *bool) bool
- func DownloadFile(ctx context.Context, url string) ([]byte, error)
- func EncryptedEventMsg(ctx context.Context, data interface{}, encryptKey string) (string, error)
- func File2Bytes(fileName string) ([]byte, error)
- func FileNameByHeader(header http.Header) string
- func Float32Ptr(v float32) *float32
- func Float32Value(v *float32) float32
- func Float64Ptr(v float64) *float64
- func Float64Value(v *float64) float64
- func Int16Ptr(v int16) *int16
- func Int16Value(v *int16) int16
- func Int32Ptr(v int32) *int32
- func Int32Value(v *int32) int32
- func Int64Ptr(v int64) *int64
- func Int64Value(v *int64) int64
- func Int8Ptr(v int8) *int8
- func Int8Value(v *int8) int8
- func IntPtr(v int) *int
- func IntValue(v *int) int
- func NewCache(config *Config)
- func NewDefaultLogger(level LogLevel) *loggerProxy
- func NewHttpClient(config *Config)
- func NewLogger(config *Config)
- func NewSerialization(config *Config)
- func Prettify(i interface{}) string
- func StringPtr(v string) *string
- func StringValue(v *string) string
- func StructToMap(val interface{}) (map[string]interface{}, error)
- func TimePtr(v time.Time) *time.Time
- func TimeValue(v *time.Time) time.Time
- type AccessTokenType
- type ApiReq
- type ApiResp
- type AppAccessTokenResp
- type AppTicketManager
- type AppType
- type Cache
- type ClientTimeoutError
- type CodeError
- type CodeErrorDetail
- type CodeErrorFieldViolation
- type CodeErrorPermissionViolation
- type Config
- type DecryptErr
- type DefaultSerialization
- type DialFailedError
- type Formdata
- type HttpClient
- type IllegalParamError
- type LogLevel
- type Logger
- type MarketplaceAppAccessTokenReq
- type MarketplaceTenantAccessTokenReq
- type PathParams
- type QueryParams
- type ReqTranslator
- type RequestOption
- type RequestOptionFunc
- func WithAppTicket(appTicket string) RequestOptionFunc
- func WithFileDownload() RequestOptionFunc
- func WithFileUpload() RequestOptionFunc
- func WithHeaders(header http.Header) RequestOptionFunc
- func WithNeedHelpDeskAuth() RequestOptionFunc
- func WithRequestId(requestId string) RequestOptionFunc
- func WithTenantAccessToken(tenantAccessToken string) RequestOptionFunc
- func WithTenantKey(tenantKey string) RequestOptionFunc
- func WithUserAccessToken(userAccessToken string) RequestOptionFunc
- type ResendAppTicketReq
- type ResendAppTicketResp
- type SelfBuiltAppAccessTokenReq
- type SelfBuiltTenantAccessTokenReq
- type Serializable
- type ServerTimeoutError
- type TenantAccessTokenResp
- type TokenManager
- type Value
Constants ¶
const ( HttpHeaderKeyRequestId = "X-Request-Id" HttpHeaderKeyLogId = "X-Tt-Logid" )
const ( AppAccessTokenInternalUrlPath string = "/open-apis/auth/v3/app_access_token/internal" AppAccessTokenUrlPath string = "/open-apis/auth/v3/app_access_token" TenantAccessTokenInternalUrlPath string = "/open-apis/auth/v3/tenant_access_token/internal" TenantAccessTokenUrlPath string = "/open-apis/auth/v3/tenant_access_token" ApplyAppTicketPath string = "/open-apis/auth/v3/app_ticket/resend" )
Variables ¶
var ErrAppTicketIsEmpty = errors.New("app ticket is empty")
Functions ¶
func BoolValue ¶
BoolValue returns the value of the bool pointer passed in or false if the pointer is nil.
func DownloadFile ¶
DownloadFile returns the url of resource
func EncryptedEventMsg ¶
func File2Bytes ¶
func FileNameByHeader ¶
func Float32Ptr ¶
Float32Ptr returns a pointer to the float32 value passed in.
func Float32Value ¶
Float32Value returns the value of the float32 pointer passed in or 0 if the pointer is nil.
func Float64Ptr ¶
Float64Ptr returns a pointer to the float64 value passed in.
func Float64Value ¶
Float64Value returns the value of the float64 pointer passed in or 0 if the pointer is nil.
func Int16Value ¶
Int16Value returns the value of the int16 pointer passed in or 0 if the pointer is nil.
func Int32Value ¶
Int32Value returns the value of the int32 pointer passed in or 0 if the pointer is nil.
func Int64Value ¶
Int64Value returns the value of the int64 pointer passed in or 0 if the pointer is nil.
func Int8Value ¶
Int8Value returns the value of the int8 pointer passed in or 0 if the pointer is nil.
func NewDefaultLogger ¶ added in v3.2.0
func NewDefaultLogger(level LogLevel) *loggerProxy
func NewHttpClient ¶
func NewHttpClient(config *Config)
func NewSerialization ¶ added in v3.0.10
func NewSerialization(config *Config)
func Prettify ¶
func Prettify(i interface{}) string
Prettify returns the string representation of a value.
func StringValue ¶
StringValue returns the value of the string pointer passed in or "" if the pointer is nil.
func StructToMap ¶
Types ¶
type AccessTokenType ¶
type AccessTokenType string
const ( AccessTokenTypeNone AccessTokenType = "none_access_token" AccessTokenTypeApp AccessTokenType = "app_access_token" AccessTokenTypeTenant AccessTokenType = "tenant_access_token" AccessTokenTypeUser AccessTokenType = "user_access_token" )
type ApiReq ¶ added in v3.0.1
type ApiReq struct { HttpMethod string ApiPath string Body interface{} QueryParams QueryParams PathParams PathParams SupportedAccessTokenTypes []AccessTokenType }
type ApiResp ¶ added in v3.0.1
type ApiResp struct { StatusCode int `json:"-"` Header http.Header `json:"-"` RawBody []byte `json:"-"` }
func (ApiResp) JSONUnmarshalBody ¶ added in v3.0.1
func (ApiResp) Write ¶ added in v3.0.1
func (resp ApiResp) Write(writer http.ResponseWriter)
type AppAccessTokenResp ¶ added in v3.0.1
type AppAccessTokenResp struct { *ApiResp `json:"-"` CodeError Expire int `json:"expire"` AppAccessToken string `json:"app_access_token"` }
func (*AppAccessTokenResp) Success ¶ added in v3.0.1
func (t *AppAccessTokenResp) Success() bool
type AppTicketManager ¶
type AppTicketManager struct {
// contains filtered or unexported fields
}
func GetAppTicketManager ¶
func GetAppTicketManager() *AppTicketManager
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 Config ¶
type Config struct { BaseUrl string AppId string AppSecret string HelpDeskId string HelpDeskToken string HelpdeskAuthToken string ReqTimeout time.Duration LogLevel LogLevel HttpClient HttpClient Logger Logger AppType AppType EnableTokenCache bool TokenCache Cache LogReqAtDebug bool Header http.Header Serializable Serializable SkipSignVerify bool }
type DecryptErr ¶
type DecryptErr struct {
Message string
}
func (DecryptErr) Error ¶
func (e DecryptErr) Error() string
type DefaultSerialization ¶ added in v3.0.10
type DefaultSerialization struct { }
func (*DefaultSerialization) Deserialize ¶ added in v3.0.10
func (d *DefaultSerialization) Deserialize(data []byte, v interface{}) error
func (*DefaultSerialization) Serialize ¶ added in v3.0.10
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 MarketplaceAppAccessTokenReq ¶ added in v3.0.1
type MarketplaceTenantAccessTokenReq ¶ added in v3.0.1
type PathParams ¶ added in v3.0.1
func (PathParams) Get ¶ added in v3.0.1
func (u PathParams) Get(key string) string
func (PathParams) Set ¶ added in v3.0.1
func (u PathParams) Set(key, value string)
type QueryParams ¶ added in v3.0.1
func (QueryParams) Add ¶ added in v3.0.7
func (u QueryParams) Add(key, value string)
func (QueryParams) Encode ¶ added in v3.0.1
func (u QueryParams) Encode() string
func (QueryParams) Get ¶ added in v3.0.1
func (u QueryParams) Get(key string) string
func (QueryParams) Set ¶ added in v3.0.1
func (u QueryParams) Set(key, value string)
type ReqTranslator ¶
type ReqTranslator struct { }
type RequestOption ¶
type RequestOptionFunc ¶
type RequestOptionFunc func(option *RequestOption)
func WithAppTicket ¶ added in v3.0.1
func WithAppTicket(appTicket string) RequestOptionFunc
func WithFileDownload ¶
func WithFileDownload() RequestOptionFunc
func WithFileUpload ¶
func WithFileUpload() RequestOptionFunc
func WithHeaders ¶
func WithHeaders(header http.Header) RequestOptionFunc
func WithNeedHelpDeskAuth ¶
func WithNeedHelpDeskAuth() RequestOptionFunc
func WithRequestId ¶
func WithRequestId(requestId string) RequestOptionFunc
func WithTenantAccessToken ¶
func WithTenantAccessToken(tenantAccessToken string) RequestOptionFunc
func WithTenantKey ¶
func WithTenantKey(tenantKey string) RequestOptionFunc
func WithUserAccessToken ¶
func WithUserAccessToken(userAccessToken string) RequestOptionFunc
type ResendAppTicketReq ¶ added in v3.0.1
type ResendAppTicketResp ¶ added in v3.0.1
func (*ResendAppTicketResp) Success ¶ added in v3.0.1
func (r *ResendAppTicketResp) Success() bool
type SelfBuiltAppAccessTokenReq ¶ added in v3.0.1
type SelfBuiltTenantAccessTokenReq ¶ added in v3.0.1
type Serializable ¶ added in v3.0.10
type ServerTimeoutError ¶
type ServerTimeoutError struct {
// contains filtered or unexported fields
}
func (*ServerTimeoutError) Error ¶
func (err *ServerTimeoutError) Error() string
type TenantAccessTokenResp ¶ added in v3.0.1
type TenantAccessTokenResp struct { *ApiResp `json:"-"` CodeError Expire int `json:"expire"` TenantAccessToken string `json:"tenant_access_token"` }
func (*TenantAccessTokenResp) Success ¶ added in v3.0.1
func (t *TenantAccessTokenResp) Success() bool
type TokenManager ¶
type TokenManager struct {
// contains filtered or unexported fields
}