Packages
Search packages... ⌘K
Go Package
adapter
HTTP client adapter — standardized external API client with retry and auth
Go Ready SI
Adapter Configuration go
1 2 3 4 5 6 7 8 9 10 11 12 13
dokploy := adapter.NewAdapter("dokploy", "https://deploy.example.com/api",
adapter.WithAuth("Bearer", apiToken),
adapter.WithRetry(3, 500*time.Millisecond),
adapter.WithTimeout(30*time.Second),
)
// All requests inherit retry, auth, and timeout
resp, err := dokploy.Request(ctx, "POST", "/application/deploy", payload)
if err != nil {
// Typed error: *adapter.RetryExhaustedError, *adapter.TimeoutError
return fmt.Errorf("deploy failed: %w", err)
}
// resp.StatusCode, resp.Body, resp.DurationAbout
Provides a standardized HTTP client wrapper for external API integrations. Handles automatic retry with exponential backoff, authentication header injection, request/response logging, and timeout enforcement.
Public API
| Name | Kind | Signature |
|---|---|---|
| Adapter | type | type Adapter struct |
| NewAdapter | func | func NewAdapter(name string, baseURL string, opts ...Option) *Adapter |
| Request | func | func (a *Adapter) Request(ctx context.Context, method, path string, body any) (*Response, error) |
| WithRetry | func | func WithRetry(maxAttempts int, backoff time.Duration) Option |
| WithAuth | func | func WithAuth(scheme string, credential string) Option |
Dependencies
Imports (2)
Related Packages
clientregistry Go Ready
Client registry — centralized HTTP client pool with per-service configuration
client-poolservice-registrycentralizedconfiguration
4 exports 2 deps
vault Go Ready
1Password vault adapter — credential retrieval, caching, op:// URI resolution
1passwordsecretscredentialsop-uri
5 exports 4 deps
Source
github.com/shredbx/sbx-core/pkg/adapter
http-clientretryauthenticationexternal-api