elevenlabs

package
v3.88.13 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2025 License: AGPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Code generated by go generate; DO NOT EDIT.

Index

Constants

This section is empty.

Variables

View Source
var (
	PermissionStrings = map[Permission]string{
		TextToSpeech:                   "text_to_speech",
		SpeechToSpeech:                 "speech_to_speech",
		AudioIsolation:                 "audio_isolation",
		DubbingRead:                    "dubbing_read",
		DubbingWrite:                   "dubbing_write",
		ProjectsRead:                   "projects_read",
		ProjectsWrite:                  "projects_write",
		AudioNativeRead:                "audio_native_read",
		AudioNativeWrite:               "audio_native_write",
		PronunciationDictionariesRead:  "pronunciation_dictionaries_read",
		PronunciationDictionariesWrite: "pronunciation_dictionaries_write",
		VoicesRead:                     "voices_read",
		VoicesWrite:                    "voices_write",
		ModelsRead:                     "models_read",
		SpeechHistoryRead:              "speech_history_read",
		SpeechHistoryWrite:             "speech_history_write",
		UserRead:                       "user_read",
		WorkspaceRead:                  "workspace_read",
		WorkspaceWrite:                 "workspace_write",
	}

	StringToPermission = map[string]Permission{
		"text_to_speech":                   TextToSpeech,
		"speech_to_speech":                 SpeechToSpeech,
		"audio_isolation":                  AudioIsolation,
		"dubbing_read":                     DubbingRead,
		"dubbing_write":                    DubbingWrite,
		"projects_read":                    ProjectsRead,
		"projects_write":                   ProjectsWrite,
		"audio_native_read":                AudioNativeRead,
		"audio_native_write":               AudioNativeWrite,
		"pronunciation_dictionaries_read":  PronunciationDictionariesRead,
		"pronunciation_dictionaries_write": PronunciationDictionariesWrite,
		"voices_read":                      VoicesRead,
		"voices_write":                     VoicesWrite,
		"models_read":                      ModelsRead,
		"speech_history_read":              SpeechHistoryRead,
		"speech_history_write":             SpeechHistoryWrite,
		"user_read":                        UserRead,
		"workspace_read":                   WorkspaceRead,
		"workspace_write":                  WorkspaceWrite,
	}

	PermissionIDs = map[Permission]int{
		TextToSpeech:                   1,
		SpeechToSpeech:                 2,
		AudioIsolation:                 3,
		DubbingRead:                    4,
		DubbingWrite:                   5,
		ProjectsRead:                   6,
		ProjectsWrite:                  7,
		AudioNativeRead:                8,
		AudioNativeWrite:               9,
		PronunciationDictionariesRead:  10,
		PronunciationDictionariesWrite: 11,
		VoicesRead:                     12,
		VoicesWrite:                    13,
		ModelsRead:                     14,
		SpeechHistoryRead:              15,
		SpeechHistoryWrite:             16,
		UserRead:                       17,
		WorkspaceRead:                  18,
		WorkspaceWrite:                 19,
	}

	IdToPermission = map[int]Permission{
		1:  TextToSpeech,
		2:  SpeechToSpeech,
		3:  AudioIsolation,
		4:  DubbingRead,
		5:  DubbingWrite,
		6:  ProjectsRead,
		7:  ProjectsWrite,
		8:  AudioNativeRead,
		9:  AudioNativeWrite,
		10: PronunciationDictionariesRead,
		11: PronunciationDictionariesWrite,
		12: VoicesRead,
		13: VoicesWrite,
		14: ModelsRead,
		15: SpeechHistoryRead,
		16: SpeechHistoryWrite,
		17: UserRead,
		18: WorkspaceRead,
		19: WorkspaceWrite,
	}
)
View Source
var (

	// error statuses
	NotVerifiable                   = "api_key_not_verifiable"
	InvalidAPIKey                   = "invalid_api_key"
	MissingPermissions              = "missing_permissions"
	DubbingNotFound                 = "dubbing_not_found"
	ProjectNotFound                 = "project_not_found"
	VoiceDoesNotExist               = "voice_does_not_exist"
	InvalidSubscription             = "invalid_subscription"
	PronunciationDictionaryNotFound = "pronunciation_dictionary_not_found"
	InternalServerError             = "internal_server_error"
	InvalidProjectID                = "invalid_project_id"
	ModelNotFound                   = "model_not_found"
	VoiceNotFound                   = "voice_not_found"
	InvalidContent                  = "invalid_content"
)

Functions

func AnalyzeAndPrintPermissions

func AnalyzeAndPrintPermissions(cfg *config.Config, key string)

Types

type AgentsResponse

type AgentsResponse struct {
	Agents []struct {
		ID          string `json:"agent_id"`
		Name        string `json:"name"`
		AccessLevel string `json:"access_level"`
	} `json:"agents"`
}

AgentsResponse is the /agents API response

type Analyzer

type Analyzer struct {
	Cfg *config.Config
}

func (Analyzer) Analyze

func (a Analyzer) Analyze(_ context.Context, credInfo map[string]string) (*analyzers.AnalyzerResult, error)

func (Analyzer) Type

func (a Analyzer) Type() analyzers.AnalyzerType

type ConversationResponse

type ConversationResponse struct {
	Conversations []struct {
		AgentID string `json:"agent_id"`
		ID      string `json:"conversation_id"`
		Status  string `json:"status"`
	}
}

ConversationResponse is the /conversation API response

type ElevenLabsResource

type ElevenLabsResource struct {
	ID         string
	Name       string
	Type       string
	Metadata   map[string]string
	Permission string
}

ElevenLabsResource hold information about the elevenlabs resource the key has access

type ErrorResponse

type ErrorResponse struct {
	Detail struct {
		Status string `json:"status"`
	} `json:"detail"`
}

ErrorResponse is the error response for all APIs

type HistoryResponse

type HistoryResponse struct {
	History []struct {
		ID      string `json:"history_item_id"`
		ModelID string `json:"model_id"`
		VoiceID string `json:"voice_id"`
	} `json:"history"`
}

HistoryResponse is the /history API response

type ModelsResponse

type ModelsResponse struct {
	ID   string `json:"model_id"`
	Name string `json:"name"`
}

Models is the /models API response

type Permission

type Permission int
const (
	Invalid                        Permission = iota
	TextToSpeech                   Permission = iota
	SpeechToSpeech                 Permission = iota
	AudioIsolation                 Permission = iota
	DubbingRead                    Permission = iota
	DubbingWrite                   Permission = iota
	ProjectsRead                   Permission = iota
	ProjectsWrite                  Permission = iota
	AudioNativeRead                Permission = iota
	AudioNativeWrite               Permission = iota
	PronunciationDictionariesRead  Permission = iota
	PronunciationDictionariesWrite Permission = iota
	VoicesRead                     Permission = iota
	VoicesWrite                    Permission = iota
	ModelsRead                     Permission = iota
	SpeechHistoryRead              Permission = iota
	SpeechHistoryWrite             Permission = iota
	UserRead                       Permission = iota
	WorkspaceRead                  Permission = iota
	WorkspaceWrite                 Permission = iota
)

func PermissionFromID

func PermissionFromID(id int) (Permission, error)

PermissionFromID converts an ID to its Permission enum

func PermissionFromString

func PermissionFromString(s string) (Permission, error)

PermissionFromString converts a string representation to its Permission enum

func (Permission) ToID

func (p Permission) ToID() (int, error)

ToID converts a Permission enum to its ID

func (Permission) ToString

func (p Permission) ToString() (string, error)

ToString converts a Permission enum to its string representation

type ProjectsResponse

type ProjectsResponse struct {
	Projects []struct {
		ID          string `json:"project_id"`
		Name        string `json:"name"`
		State       string `json:"state"`
		AccessLevel string `json:"access_level"`
	} `json:"projects"`
}

ProjectsResponse is the /projects API response

type PronunciationDictionariesResponse

type PronunciationDictionariesResponse struct {
	PronunciationDictionaries []struct {
		ID   string `json:"id"`
		Name string `json:"name"`
	} `json:"pronunciation_dictionaries"`
}

PronunciationDictionaries is the /pronunciation-dictionaries API response

type SecretInfo

type SecretInfo struct {
	User                User // the owner of key
	Valid               bool
	Reference           string
	Permissions         []string             // list of Permissions assigned to the key
	ElevenLabsResources []ElevenLabsResource // list of resources the key has access to
	// contains filtered or unexported fields
}

SecretInfo hold information about key

func AnalyzePermissions

func AnalyzePermissions(cfg *config.Config, key string) (*SecretInfo, error)

AnalyzePermissions check if key is valid and analyzes the permission for the key

func (*SecretInfo) AppendPermission

func (s *SecretInfo) AppendPermission(perm string)

AppendPermissions safely append new permission to secret info permissions list.

func (*SecretInfo) AppendResource

func (s *SecretInfo) AppendResource(resource ElevenLabsResource)

AppendResource safely append new resource to secret info elevenlabs resource list.

func (*SecretInfo) HasPermission

func (s *SecretInfo) HasPermission(perm Permission) bool

HasPermission safely read secret info permission list to check if passed permission exist in the list.

type User

type User struct {
	ID                 string
	Name               string
	SubscriptionTier   string
	SubscriptionStatus string
}

User hold the information about user to whom the key belongs to

type UserResponse

type UserResponse struct {
	UserID       string `json:"user_id"`
	FirstName    string `json:"first_name"`
	Subscription struct {
		Tier   string `json:"tier"`
		Status string `json:"status"`
	} `json:"subscription"`
}

UserResponse is the /user API response

type VoicesResponse

type VoicesResponse struct {
	Voices []struct {
		ID       string `json:"voice_id"`
		Name     string `json:"name"`
		Category string `json:"category"`
	} `json:"voices"`
}

VoiceResponse is the /voices API response

Jump to

Keyboard shortcuts

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