connectors

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 5, 2026 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Overview

Package connectors provides base implementations and utilities for external system connectors.

Index

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) Close

func (c *BaseConnector) Close() error

Close closes the connection.

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) Do

func (c *BaseConnector) Do(ctx context.Context, req *http.Request) (*http.Response, error)

Do executes an HTTP request with rate limiting.

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) Name

func (c *BaseConnector) Name() string

Name returns the connector name.

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) Type

func (c *BaseConnector) Type() string

Type returns the connector type.

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.

Directories

Path Synopsis
Package github provides a GitHub connector for the OpenCTEM SDK.
Package github provides a GitHub connector for the OpenCTEM SDK.

Jump to

Keyboard shortcuts

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