zdx

package
v2.72.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 30, 2024 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ZDX_API_KEY_ID = "ZDX_API_KEY_ID"
	ZDX_API_SECRET = "ZDX_API_SECRET"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthRequest

type AuthRequest struct {
	APIKeyID     string `json:"key_id"`
	APIKeySecret string `json:"key_secret"`
	Timestamp    int64  `json:"timestamp"`
}

type AuthToken

type AuthToken struct {
	TokenType   string `json:"token_type"`
	AccessToken string `json:"token"`
	ExpiresIn   int    `json:"expires_in"`
}

type BackoffConfig

type BackoffConfig struct {
	Enabled             bool // Set to true to enable backoff and retry mechanism
	RetryWaitMinSeconds int  // Minimum time to wait
	RetryWaitMaxSeconds int  // Maximum time to wait
	MaxNumOfRetries     int  // Maximum number of retries
}

type Client

type Client struct {
	Config *Config
}

func NewClient

func NewClient(config *Config) (c *Client)

NewClient returns a new client for the specified apiKey.

func (*Client) NewRequestDo

func (client *Client) NewRequestDo(method, urlStr string, options, body, v interface{}) (*http.Response, error)

type Config

type Config struct {
	BaseURL *url.URL

	// The logger writer interface to write logging messages to. Defaults to standard out.
	Logger logger.Logger
	// Credentials for basic authentication.
	APIKeyID, APISecret string
	// Backoff config
	BackoffConf *BackoffConfig
	AuthToken   *AuthToken
	sync.Mutex
	UserAgent string
	// contains filtered or unexported fields
}

Config contains all the configuration data for the API client

func NewConfig

func NewConfig(apiKeyID, apiSecret, userAgent string) (*Config, error)

func (*Config) GetHTTPClient

func (c *Config) GetHTTPClient() *http.Client

func (*Config) SetBackoffConfig

func (c *Config) SetBackoffConfig(backoffConf BackoffConfig)

type CredentialsConfig

type CredentialsConfig struct {
	APIKeyID  string `json:"zdx_api_key_id"`
	APISecret string `json:"zdx_api_secret"`
}

type ErrorResponse

type ErrorResponse struct {
	Response *http.Response
	Message  string
}

func (*ErrorResponse) Error

func (r *ErrorResponse) Error() string

func (ErrorResponse) IsObjectNotFound

func (r ErrorResponse) IsObjectNotFound() bool

IsObjectNotFound returns true on missing object error (404).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL