stemedb/cmd/pitch-voiceover/pkg/elevenlabs/voices.go
jordan 157dbbb9eb feat: Complete Aphoria Phase 8-9 + UAT suite (90/90 tests passing)
## Phase 8: Enterprise Extractor Improvements 
- 14 security extractors (TLS, JWT, SQL injection, XSS, etc.)
- 10 framework-specific extractors (Spring, Django, Rails, etc.)
- Config file security detection (YAML, TOML)

## Phase 9: Autonomous Extractor Generation 
- Shadow mode executor with TP/FP tracking
- Graduation pipeline with confidence thresholds
- Auto-rollback on regression detection
- Cross-project pattern syncing

## UAT Suite Complete (14 scripts, 90 tests)
- test-core-detection.sh (6 tests)
- test-declarative-extractors.sh (5 tests)
- test-domain-frameworks.sh (5 tests)
- test-domain-unreal.sh (3 tests)
- test-llm-extraction.sh (6 tests)
- test-eval-harness.sh (5 tests)
- test-cross-language.sh (3 tests)
- test-precommit-performance.sh (4 tests)
- test-output-formats.sh (8 tests)
- test-drift-detection.sh (6 tests)
- test-exit-codes.sh (12 tests)
+ 3 more scripts

## Other Changes
- Updated roadmap to mark Phase 8-9 complete
- Added .gitignore entries for build artifacts
- Updated pre-commit: 800 line limit, exclude tests/data/cmd

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-06 22:50:55 -07:00

55 lines
1.4 KiB
Go

package elevenlabs
import (
"context"
"encoding/json"
"fmt"
"net/http"
)
// ListVoices returns all available voices for the authenticated user.
func (c *Client) ListVoices(ctx context.Context) ([]Voice, error) {
respBody, err := c.doRequest(ctx, http.MethodGet, "/voices", nil)
if err != nil {
return nil, fmt.Errorf("list voices: %w", err)
}
var voicesResp VoicesResponse
if err := json.Unmarshal(respBody, &voicesResp); err != nil {
return nil, fmt.Errorf("unmarshal voices response: %w", err)
}
return voicesResp.Voices, nil
}
// GetVoice returns a specific voice by ID.
func (c *Client) GetVoice(ctx context.Context, voiceID string) (*Voice, error) {
if voiceID == "" {
return nil, fmt.Errorf("%w: voice ID is required", ErrInvalidConfig)
}
path := fmt.Sprintf("/voices/%s", voiceID)
respBody, err := c.doRequest(ctx, http.MethodGet, path, nil)
if err != nil {
return nil, fmt.Errorf("get voice: %w", err)
}
var voice Voice
if err := json.Unmarshal(respBody, &voice); err != nil {
return nil, fmt.Errorf("unmarshal voice response: %w", err)
}
return &voice, nil
}
// Health verifies the API connectivity and authentication.
// Returns nil if the API is reachable and the API key is valid.
func (c *Client) Health(ctx context.Context) error {
// Use the user endpoint as a lightweight health check
_, err := c.doRequest(ctx, http.MethodGet, "/user", nil)
if err != nil {
return fmt.Errorf("health check: %w", err)
}
return nil
}