Versions in this module Expand all Collapse all v3 v3.0.22 May 16, 2023 v3.0.21 May 16, 2023 Changes in this version + const AppAccessTokenInternalUrlPath + const AppAccessTokenUrlPath + const ApplyAppTicketPath + const HttpHeaderKeyLogId + const HttpHeaderKeyRequestId + const TenantAccessTokenInternalUrlPath + const TenantAccessTokenUrlPath + var ErrAppTicketIsEmpty = errors.New("app ticket is empty") + 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 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 string + const AccessTokenTypeApp + const AccessTokenTypeNone + const AccessTokenTypeTenant + const AccessTokenTypeUser + type ApiReq struct + ApiPath string + Body interface{} + HttpMethod string + PathParams PathParams + QueryParams QueryParams + SupportedAccessTokenTypes []AccessTokenType + type ApiResp struct + Header http.Header + RawBody []byte + StatusCode int + func Request(ctx context.Context, req *ApiReq, config *Config, options ...RequestOptionFunc) (*ApiResp, error) + func (resp ApiResp) JSONUnmarshalBody(val interface{}, config *Config) error + func (resp ApiResp) RequestId() string + func (resp ApiResp) String() string + func (resp ApiResp) Write(writer http.ResponseWriter) + type AppAccessTokenResp struct + AppAccessToken string + Expire int + func (t *AppAccessTokenResp) Success() bool + type AppTicketManager struct + func GetAppTicketManager() *AppTicketManager + func (m *AppTicketManager) Get(ctx context.Context, config *Config) (string, error) + func (m *AppTicketManager) Set(ctx context.Context, appId, value string, ttl time.Duration) error + type AppType string + const AppTypeMarketplace + const AppTypeSelfBuilt + type Cache interface + Get func(ctx context.Context, key string) (string, error) + Set func(ctx context.Context, key string, value string, expireTime time.Duration) error + type ClientTimeoutError struct + func (err *ClientTimeoutError) Error() string + type CodeError struct + Code int + Err ... + Msg string + func (ce CodeError) Error() string + func (ce CodeError) String() string + type CodeErrorDetail struct + Key string + Value string + type CodeErrorFieldViolation struct + Description string + Field string + Value string + type CodeErrorPermissionViolation struct + Description string + Subject string + Type string + type Config struct + AppId string + AppSecret string + AppType AppType + BaseUrl string + EnableTokenCache bool + Header http.Header + HelpDeskId string + HelpDeskToken string + HelpdeskAuthToken string + HttpClient HttpClient + LogLevel LogLevel + LogReqAtDebug bool + Logger Logger + ReqTimeout time.Duration + Serializable Serializable + SkipSignVerify bool + TokenCache Cache + type DecryptErr struct + Message string + func (e DecryptErr) Error() string + type DefaultSerialization struct + func (d *DefaultSerialization) Deserialize(data []byte, v interface{}) error + func (d *DefaultSerialization) Serialize(v interface{}) ([]byte, error) + type DialFailedError struct + func (err *DialFailedError) Error() string + type Formdata struct + func NewFormdata() *Formdata + func (fd *Formdata) AddField(field string, val interface{}) *Formdata + func (fd *Formdata) AddFile(field string, r io.Reader) *Formdata + type HttpClient interface + Do func(*http.Request) (*http.Response, error) + type IllegalParamError struct + func (err *IllegalParamError) Error() string + type LogLevel int + const LogLevelDebug + const LogLevelError + const LogLevelInfo + const LogLevelWarn + type Logger interface + Debug func(context.Context, ...interface{}) + Error func(context.Context, ...interface{}) + Info func(context.Context, ...interface{}) + Warn func(context.Context, ...interface{}) + func NewEventLogger() Logger + type MarketplaceAppAccessTokenReq struct + AppID string + AppSecret string + AppTicket string + type MarketplaceTenantAccessTokenReq struct + AppAccessToken string + TenantKey string + type PathParams map[string]string + func (u PathParams) Get(key string) string + func (u PathParams) Set(key, value string) + type QueryParams map[string][]string + func (u QueryParams) Add(key, value string) + func (u QueryParams) Encode() string + func (u QueryParams) Get(key string) string + func (u QueryParams) Set(key, value string) + type ReqTranslator struct + type RequestOption struct + AppAccessToken string + AppTicket string + FileDownload bool + FileUpload bool + Header http.Header + NeedHelpDeskAuth bool + RequestId string + TenantAccessToken string + TenantKey string + UserAccessToken string + type RequestOptionFunc func(option *RequestOption) + 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 struct + AppID string + AppSecret string + type ResendAppTicketResp struct + func (r *ResendAppTicketResp) Success() bool + type SelfBuiltAppAccessTokenReq struct + AppID string + AppSecret string + type SelfBuiltTenantAccessTokenReq struct + AppID string + AppSecret string + type Serializable interface + Deserialize func(data []byte, v interface{}) error + Serialize func(v interface{}) ([]byte, error) + type ServerTimeoutError struct + func (err *ServerTimeoutError) Error() string + type TenantAccessTokenResp struct + Expire int + TenantAccessToken string + func (t *TenantAccessTokenResp) Success() bool + type TokenManager struct + type Value struct