Documentation
¶
Overview ¶
Package sdk provides core SDK interfaces for the Basecamp API client.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CredentialStore ¶
type CredentialStore interface {
// Load retrieves credentials for the given origin (e.g., "https://3.basecampapi.com").
Load(origin string) (*Credentials, error)
// Save stores credentials for the given origin.
Save(origin string, creds *Credentials) error
// Delete removes credentials for the given origin.
Delete(origin string) error
}
CredentialStore provides persistent storage for OAuth credentials. Implementations can use keychain, file storage, or other backends.
type Credentials ¶
type Credentials struct {
AccessToken string `json:"access_token"`
RefreshToken string `json:"refresh_token,omitempty"`
ExpiresAt int64 `json:"expires_at,omitempty"`
TokenEndpoint string `json:"token_endpoint,omitempty"`
OAuthType string `json:"oauth_type,omitempty"` // "bc3" or "launchpad"
Scope string `json:"scope,omitempty"`
UserID string `json:"user_id,omitempty"`
}
Credentials holds OAuth tokens and metadata.
type EnvTokenSource ¶
type EnvTokenSource struct {
EnvVar string // Environment variable name (default: BASECAMP_TOKEN)
}
EnvTokenSource returns a token from an environment variable. Useful for CI/CD or testing where OAuth flow isn't available.
type StaticTokenSource ¶
type StaticTokenSource struct {
AccessToken string
}
StaticTokenSource provides a fixed token. Useful for testing.
type StoreError ¶
type StoreError struct {
Operation string // "load", "save", "delete"
Origin string
Message string
Cause error
}
StoreError indicates a credential storage error.
func (*StoreError) Error ¶
func (e *StoreError) Error() string
func (*StoreError) Unwrap ¶
func (e *StoreError) Unwrap() error
type TokenError ¶
TokenError indicates a token sourcing error.
func (*TokenError) Error ¶
func (e *TokenError) Error() string
func (*TokenError) Unwrap ¶
func (e *TokenError) Unwrap() error
type TokenSource ¶
type TokenSource interface {
// Token returns a valid access token.
// Implementations should handle token refresh automatically.
Token(ctx context.Context) (string, error)
// Refresh forces a token refresh, invalidating any cached token.
Refresh(ctx context.Context) error
}
TokenSource provides access tokens for API authentication. Implementations handle token acquisition, caching, and refresh.