Class: ElevenlabsClient::AudioNative
- Inherits:
-
Object
- Object
- ElevenlabsClient::AudioNative
- Defined in:
- lib/elevenlabs_client/endpoints/audio_native.rb
Instance Method Summary collapse
-
#create(name, **options) ⇒ Hash
(also: #create_project)
POST /v1/audio-native Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet Documentation: https://elevenlabs.io/docs/api-reference/audio-native/create.
-
#get_settings(project_id) ⇒ Hash
(also: #project_settings)
GET /v1/audio-native/:project_id/settings Get player settings for the specific project Documentation: https://elevenlabs.io/docs/api-reference/audio-native/settings.
-
#initialize(client) ⇒ AudioNative
constructor
A new instance of AudioNative.
-
#update_content(project_id, **options) ⇒ Hash
(also: #update_project_content)
POST /v1/audio-native/:project_id/content Updates content for the specific AudioNative Project Documentation: https://elevenlabs.io/docs/api-reference/audio-native/update.
Constructor Details
#initialize(client) ⇒ AudioNative
Returns a new instance of AudioNative.
5 6 7 |
# File 'lib/elevenlabs_client/endpoints/audio_native.rb', line 5 def initialize(client) @client = client end |
Instance Method Details
#create(name, **options) ⇒ Hash Also known as: create_project
POST /v1/audio-native Creates Audio Native enabled project, optionally starts conversion and returns project ID and embeddable HTML snippet Documentation: https://elevenlabs.io/docs/api-reference/audio-native/create
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/elevenlabs_client/endpoints/audio_native.rb', line 29 def create(name, **) endpoint = "/v1/audio-native" payload = { name: name } # Add optional parameters if provided payload[:image] = [:image] if [:image] payload[:author] = [:author] if [:author] payload[:title] = [:title] if [:title] payload[:small] = [:small] unless [:small].nil? payload[:text_color] = [:text_color] if [:text_color] payload[:background_color] = [:background_color] if [:background_color] payload[:sessionization] = [:sessionization] if [:sessionization] payload[:voice_id] = [:voice_id] if [:voice_id] payload[:model_id] = [:model_id] if [:model_id] payload[:auto_convert] = [:auto_convert] unless [:auto_convert].nil? payload[:apply_text_normalization] = [:apply_text_normalization] if [:apply_text_normalization] # Add file if provided if [:file] && [:filename] payload[:file] = @client.file_part([:file], [:filename]) end @client.post_multipart(endpoint, payload) end |
#get_settings(project_id) ⇒ Hash Also known as: project_settings
GET /v1/audio-native/:project_id/settings Get player settings for the specific project Documentation: https://elevenlabs.io/docs/api-reference/audio-native/settings
89 90 91 92 |
# File 'lib/elevenlabs_client/endpoints/audio_native.rb', line 89 def get_settings(project_id) endpoint = "/v1/audio-native/#{project_id}/settings" @client.get(endpoint) end |
#update_content(project_id, **options) ⇒ Hash Also known as: update_project_content
POST /v1/audio-native/:project_id/content Updates content for the specific AudioNative Project Documentation: https://elevenlabs.io/docs/api-reference/audio-native/update
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/elevenlabs_client/endpoints/audio_native.rb', line 66 def update_content(project_id, **) endpoint = "/v1/audio-native/#{project_id}/content" payload = {} # Add optional parameters if provided payload[:auto_convert] = [:auto_convert] unless [:auto_convert].nil? payload[:auto_publish] = [:auto_publish] unless [:auto_publish].nil? # Add file if provided if [:file] && [:filename] payload[:file] = @client.file_part([:file], [:filename]) end @client.post_multipart(endpoint, payload) end |