Documentation
¶
Overview ¶
Package connectors provides base implementations and utilities for external system connectors.
Index ¶
- type BaseConnector
- func (c *BaseConnector) BaseURL() string
- func (c *BaseConnector) Close() error
- func (c *BaseConnector) Config() *core.ConnectorConfig
- func (c *BaseConnector) Connect(ctx context.Context) error
- func (c *BaseConnector) Do(ctx context.Context, req *http.Request) (*http.Response, error)
- func (c *BaseConnector) HTTPClient() *http.Client
- func (c *BaseConnector) IsConnected() bool
- func (c *BaseConnector) Name() string
- func (c *BaseConnector) NewRequest(ctx context.Context, method, path string, body interface{}) (*http.Request, error)
- func (c *BaseConnector) RateLimited() bool
- func (c *BaseConnector) SetVerbose(v bool)
- func (c *BaseConnector) TestConnection(ctx context.Context) error
- func (c *BaseConnector) Type() string
- func (c *BaseConnector) Verbose() bool
- func (c *BaseConnector) WaitForRateLimit(ctx context.Context) error
- type BaseConnectorConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BaseConnector ¶
type BaseConnector struct {
// contains filtered or unexported fields
}
BaseConnector provides a base implementation for connectors with common functionality like rate limiting, authentication, and HTTP client management.
func NewBaseConnector ¶
func NewBaseConnector(cfg *BaseConnectorConfig) *BaseConnector
NewBaseConnector creates a new BaseConnector with the given configuration.
func (*BaseConnector) BaseURL ¶
func (c *BaseConnector) BaseURL() string
BaseURL returns the base URL.
func (*BaseConnector) Config ¶
func (c *BaseConnector) Config() *core.ConnectorConfig
Config returns the connector configuration.
func (*BaseConnector) Connect ¶
func (c *BaseConnector) Connect(ctx context.Context) error
Connect establishes connection to the external system. Override this method for custom connection logic.
func (*BaseConnector) HTTPClient ¶
func (c *BaseConnector) HTTPClient() *http.Client
HTTPClient returns the configured HTTP client.
func (*BaseConnector) IsConnected ¶
func (c *BaseConnector) IsConnected() bool
IsConnected returns true if connected.
func (*BaseConnector) NewRequest ¶
func (c *BaseConnector) NewRequest(ctx context.Context, method, path string, body interface{}) (*http.Request, error)
NewRequest creates a new HTTP request with authentication headers.
func (*BaseConnector) RateLimited ¶
func (c *BaseConnector) RateLimited() bool
RateLimited returns true if rate limiting is enabled.
func (*BaseConnector) SetVerbose ¶
func (c *BaseConnector) SetVerbose(v bool)
SetVerbose enables or disables verbose mode.
func (*BaseConnector) TestConnection ¶
func (c *BaseConnector) TestConnection(ctx context.Context) error
TestConnection verifies the connection is working. Override this method for actual connection testing.
func (*BaseConnector) Verbose ¶
func (c *BaseConnector) Verbose() bool
Verbose returns true if verbose mode is enabled.
func (*BaseConnector) WaitForRateLimit ¶
func (c *BaseConnector) WaitForRateLimit(ctx context.Context) error
WaitForRateLimit blocks until rate limit allows next request.
type BaseConnectorConfig ¶
type BaseConnectorConfig struct {
Name string
Type string // "scm", "cloud", "ticketing", etc.
BaseURL string
Config *core.ConnectorConfig
Verbose bool
}
BaseConnectorConfig holds configuration for creating a BaseConnector.