Versions in this module Expand all Collapse all v0 v0.3.0 Apr 23, 2024 Changes in this version type Client + GetLogger func() Logger type ClientImpl + func (c *ClientImpl) GetLogger() Logger type Config + HttpTimeout time.Duration v0.2.0 Feb 26, 2024 Changes in this version + const AP + const APNortheastRegionDomainPrefix + const APSoutheastRegionDomainPrefix + const CN + const CNEastRegionDomainPrefix + const CNNorthRegionDomainPrefix + const ChinaMainlandMajorDomain + const EU + const EUCentralRegionDomainPrefix + const EUWestRegionDomainPrefix + const GlobalDomainPrefix + const OverseaMajorDomain + const US + const USEastRegionDomainPrefix + const USWestRegionDomainPrefix + var DiscardLogger = &discardLogger + var RegionDomain = map[RegionArea]Domain + func Contains(S []string, E string) bool + func NewDefaultLogger(level LogLevel) *sampleLogger + func RetryDo(retryFunc RetryFunc, stopFunc RetryShouldStopFunc, delayFunc DelayFunc, ...) error + type BaseResponse struct + HttpStatusCode int + RawBody []byte + func (r *BaseResponse) UnmarshallToTarget(target interface{}) error + type BasicAuthCredential struct + Password string + Username string + func NewBasicAuthCredential(username string, password string) *BasicAuthCredential + func (b *BasicAuthCredential) Type() CredentialType + func (b *BasicAuthCredential) Visit(r *http.Request) + type Client interface + DoREST func(ctx context.Context, path string, method string, requestBody interface{}) (*BaseResponse, error) + GetAppID func() string + type ClientImpl struct + func NewClient(config *Config) *ClientImpl + func (c *ClientImpl) DoREST(ctx context.Context, path string, method string, requestBody interface{}) (*BaseResponse, error) + func (c *ClientImpl) GetAppID() string + type Config struct + AppID string + Credential Credential + Logger Logger + RegionCode RegionArea + Timeout time.Duration + type Credential interface + Type func() CredentialType + Visit func(r *http.Request) + type CredentialType int + const BasicAuth + type DelayFunc func(int) time.Duration + type Domain struct + MajorDomainSuffixes []string + RegionDomainPrefixes []string + type DomainPool struct + func NewDomainPool(domainArea RegionArea, logger Logger) *DomainPool + func (d *DomainPool) AllDomainsSuffixes() []string + func (d *DomainPool) GetCurrentRegion() string + func (d *DomainPool) GetCurrentUrl() string + func (d *DomainPool) NextRegion() + func (d *DomainPool) SelectBestDomain(ctx context.Context) error + type DomainResolver interface + Resolve func(ctx context.Context, domains []string, regionPrefix string) (string, error) + type DomainResolverFunc func(ctx context.Context, domains []string, regionPrefix string) (string, error) + func (d DomainResolverFunc) Resolve(ctx context.Context, domains []string, regionPrefix string) (string, error) + type GatewayErr struct + Code int + Msg string + func NewGatewayErr(code int, msg string) *GatewayErr + func (g *GatewayErr) Error() string + type InternalErr struct + Err string + func NewInternalErr(msg string) *InternalErr + func (i *InternalErr) Error() string + type LogLevel int + const LogDebug + const LogErr + const LogInfo + const LogUnknown + const LogWarning + type Logger interface + Debug func(ctx context.Context, module string, v ...interface{}) + Debugf func(ctx context.Context, module string, format string, v ...interface{}) + Error func(ctx context.Context, module string, v ...interface{}) + Errorf func(ctx context.Context, module string, format string, v ...interface{}) + Info func(ctx context.Context, module string, v ...interface{}) + Infof func(ctx context.Context, module string, format string, v ...interface{}) + Level func() LogLevel + SetLevel func(level LogLevel) + Warn func(ctx context.Context, module string, v ...interface{}) + Warnf func(ctx context.Context, module string, format string, v ...interface{}) + type OnFailedAttemptFunc func(error) + type RegionArea int + type ResponseInterface interface + IsSuccess func() bool + type RetryErr struct + Err error + func NewRetryErr(needRetry bool, err error) *RetryErr + func (r *RetryErr) Error() string + func (r *RetryErr) NeedRetry() bool + func (r *RetryErr) Unwrap() error + type RetryFunc func(retryCount int) error + type RetryShouldStopFunc func() bool