Documentation
¶
Index ¶
- Constants
- func LoadEnvironmentVariables() error
- func ParseAPIError(statusCode int, body string, headers http.Header) error
- type APIClient
- func (c *APIClient) BuildQueryString(params map[string]interface{}) string
- func (c *APIClient) CallAPI(ctx context.Context, method, path string, body interface{}, ...) (*http.Response, error)
- func (c *APIClient) CallAPIWithArrayQueryParams(ctx context.Context, method, path string, body interface{}, ...) (*http.Response, error)
- func (c *APIClient) CallAPIWithQueryParams(ctx context.Context, method, path string, body interface{}, ...) (*http.Response, error)
- func (c *APIClient) GetConfig() *Configuration
- func (c *APIClient) ProcessResponse(resp *http.Response, target interface{}) error
- func (c *APIClient) SetConfig(config *Configuration)
- type APIError
- type AuthenticationError
- type Configuration
- func NewConfiguration() *Configuration
- func NewConfigurationFromEnvironment() (*Configuration, error)
- func NewConfigurationFromMap(configMap map[string]interface{}) (*Configuration, error)
- func NewConfigurationWithCredentials(credentials *auth.LWAAuthorizationCredentials) *Configuration
- func NewConfigurationWithCredentialsAndCache(credentials *auth.LWAAuthorizationCredentials, cache auth.LWAAccessTokenCache) *Configuration
- func (c *Configuration) DisableCache()
- func (c *Configuration) EnableCache(cache auth.LWAAccessTokenCache)
- func (c *Configuration) GetBooleanFormatForQuery() string
- func (c *Configuration) GetHTTPClient() *http.Client
- func (c *Configuration) GetHost() string
- func (c *Configuration) GetUserAgent() string
- func (c *Configuration) IsDebug() bool
- func (c *Configuration) IsRateLimiterEnabled() bool
- func (c *Configuration) SetBooleanFormatForQuery(format string)
- func (c *Configuration) SetDebug(debug bool)
- func (c *Configuration) SetHTTPClient(client *http.Client)
- func (c *Configuration) SetHost(host string)
- func (c *Configuration) SetHostByRegion(region string)
- func (c *Configuration) SetRateLimiterEnabled(enabled bool)
- func (c *Configuration) SetUserAgent(userAgent string)
- func (c *Configuration) SignRequest(req *http.Request) error
- type ConfigurationError
- type NetworkError
- type RateLimitExceededError
- type ValidationError
Constants ¶
const ( ErrMissingCredentials = "missing required credentials" ErrInvalidHost = "invalid host configuration" ErrInvalidEndpoint = "invalid endpoint configuration" ErrRateLimitExceeded = "rate limit exceeded" ErrForbidden = "forbidden access" ErrNotFound = "resource not found" ErrInternalServer = "internal server error" ErrBadRequest = "bad request" ErrTimeout = "request timeout" ErrConnectionFailed = "connection failed" ErrInvalidResponse = "invalid response format" ErrMissingRequiredField = "missing required field" ErrInvalidFieldValue = "invalid field value" ErrSandboxLimitation = "sandbox environment limitation" )
Common error messages
Variables ¶
This section is empty.
Functions ¶
func LoadEnvironmentVariables ¶ added in v1.2.0
func LoadEnvironmentVariables() error
LoadEnvironmentVariables loads environment variables from .env files It tries multiple possible paths for the .env file
Types ¶
type APIClient ¶
type APIClient struct {
// contains filtered or unexported fields
}
APIClient represents the base API client
func NewAPIClient ¶
func NewAPIClient(config *Configuration) *APIClient
NewAPIClient creates a new API client
func (*APIClient) BuildQueryString ¶
BuildQueryString builds a query string from parameters
func (*APIClient) CallAPI ¶
func (c *APIClient) CallAPI(ctx context.Context, method, path string, body interface{}, headers map[string]string) (*http.Response, error)
CallAPI makes an API call
func (*APIClient) CallAPIWithArrayQueryParams ¶
func (c *APIClient) CallAPIWithArrayQueryParams(ctx context.Context, method, path string, body interface{}, headers map[string]string, queryParams map[string][]string) (*http.Response, error)
CallAPIWithArrayQueryParams makes an API call with array query parameters
func (*APIClient) CallAPIWithQueryParams ¶
func (c *APIClient) CallAPIWithQueryParams(ctx context.Context, method, path string, body interface{}, headers map[string]string, queryParams map[string]string) (*http.Response, error)
CallAPIWithQueryParams makes an API call with query parameters
func (*APIClient) GetConfig ¶
func (c *APIClient) GetConfig() *Configuration
GetConfig returns the configuration
func (*APIClient) ProcessResponse ¶
ProcessResponse processes the API response
func (*APIClient) SetConfig ¶
func (c *APIClient) SetConfig(config *Configuration)
SetConfig sets the configuration
type APIError ¶
type APIError struct {
StatusCode int
Message string
Body string
Headers http.Header
RequestID string
}
APIError represents an API error
func (*APIError) IsRetryable ¶ added in v1.2.0
IsRetryable returns true if the error is retryable
type AuthenticationError ¶
AuthenticationError represents an authentication error
func (*AuthenticationError) Error ¶
func (e *AuthenticationError) Error() string
Error implements the error interface
type Configuration ¶
type Configuration struct {
Host string
UserAgent string
Debug bool
DebugFile string
TempFolderPath string
LwaAuthSigner *auth.LWAAuthorizationSigner
HTTPClient *http.Client
BooleanFormatForQuery string
RateLimiterEnabled bool
RateLimitConfiguration map[string]interface{}
}
Configuration represents the SDK configuration
func NewConfiguration ¶
func NewConfiguration() *Configuration
NewConfiguration creates a new configuration
func NewConfigurationFromEnvironment ¶ added in v1.2.0
func NewConfigurationFromEnvironment() (*Configuration, error)
NewConfigurationFromEnvironment creates a new configuration by loading environment variables and creating credentials from them
func NewConfigurationFromMap ¶
func NewConfigurationFromMap(configMap map[string]interface{}) (*Configuration, error)
NewConfigurationFromMap creates a new configuration from a map
func NewConfigurationWithCredentials ¶
func NewConfigurationWithCredentials(credentials *auth.LWAAuthorizationCredentials) *Configuration
NewConfigurationWithCredentials creates a new configuration with LWA credentials
func NewConfigurationWithCredentialsAndCache ¶
func NewConfigurationWithCredentialsAndCache(credentials *auth.LWAAuthorizationCredentials, cache auth.LWAAccessTokenCache) *Configuration
NewConfigurationWithCredentialsAndCache creates a new configuration with LWA credentials and cache
func (*Configuration) DisableCache ¶
func (c *Configuration) DisableCache()
DisableCache disables token caching
func (*Configuration) EnableCache ¶
func (c *Configuration) EnableCache(cache auth.LWAAccessTokenCache)
EnableCache enables token caching
func (*Configuration) GetBooleanFormatForQuery ¶
func (c *Configuration) GetBooleanFormatForQuery() string
GetBooleanFormatForQuery returns the boolean format for query strings
func (*Configuration) GetHTTPClient ¶
func (c *Configuration) GetHTTPClient() *http.Client
GetHTTPClient returns the HTTP client
func (*Configuration) GetHost ¶
func (c *Configuration) GetHost() string
GetHost returns the API host
func (*Configuration) GetUserAgent ¶
func (c *Configuration) GetUserAgent() string
GetUserAgent returns the user agent
func (*Configuration) IsDebug ¶
func (c *Configuration) IsDebug() bool
IsDebug returns debug mode status
func (*Configuration) IsRateLimiterEnabled ¶
func (c *Configuration) IsRateLimiterEnabled() bool
IsRateLimiterEnabled returns whether rate limiter is enabled
func (*Configuration) SetBooleanFormatForQuery ¶
func (c *Configuration) SetBooleanFormatForQuery(format string)
SetBooleanFormatForQuery sets the boolean format for query strings
func (*Configuration) SetDebug ¶
func (c *Configuration) SetDebug(debug bool)
SetDebug sets debug mode
func (*Configuration) SetHTTPClient ¶
func (c *Configuration) SetHTTPClient(client *http.Client)
SetHTTPClient sets the HTTP client
func (*Configuration) SetHost ¶
func (c *Configuration) SetHost(host string)
SetHost sets the API host
func (*Configuration) SetHostByRegion ¶
func (c *Configuration) SetHostByRegion(region string)
SetHostByRegion sets the host based on region
func (*Configuration) SetRateLimiterEnabled ¶
func (c *Configuration) SetRateLimiterEnabled(enabled bool)
SetRateLimiterEnabled sets whether rate limiter is enabled
func (*Configuration) SetUserAgent ¶
func (c *Configuration) SetUserAgent(userAgent string)
SetUserAgent sets the user agent
func (*Configuration) SignRequest ¶
func (c *Configuration) SignRequest(req *http.Request) error
SignRequest signs a request with LWA authorization
type ConfigurationError ¶
ConfigurationError represents a configuration error
func (*ConfigurationError) Error ¶
func (e *ConfigurationError) Error() string
Error implements the error interface
type NetworkError ¶ added in v1.2.0
NetworkError represents a network-related error
func (*NetworkError) Error ¶ added in v1.2.0
func (e *NetworkError) Error() string
Error implements the error interface
func (*NetworkError) Unwrap ¶ added in v1.2.0
func (e *NetworkError) Unwrap() error
Unwrap returns the underlying error
type RateLimitExceededError ¶
RateLimitExceededError represents a rate limit exceeded error
func (*RateLimitExceededError) Error ¶
func (e *RateLimitExceededError) Error() string
Error implements the error interface
type ValidationError ¶ added in v1.2.0
type ValidationError struct {
Message string
Field string
Value interface{}
RequestID string
IsSandboxEnv bool
Suggestions []string
}
ValidationError represents a validation error
func (*ValidationError) Error ¶ added in v1.2.0
func (e *ValidationError) Error() string
Error implements the error interface
func (*ValidationError) IsSandboxError ¶ added in v1.2.0
func (e *ValidationError) IsSandboxError() bool
IsSandboxError returns true if this is likely a sandbox environment error