Class: ElevenlabsClient::Endpoints::AgentsPlatform::Widgets
- Inherits:
-
Object
- Object
- ElevenlabsClient::Endpoints::AgentsPlatform::Widgets
- Defined in:
- lib/elevenlabs_client/endpoints/agents_platform/widgets.rb
Instance Method Summary collapse
-
#create_avatar(agent_id, avatar_file_io:, filename:) ⇒ Hash
POST /v1/convai/agents/agent_id/avatar Sets the avatar for an agent displayed in the widget Documentation: https://elevenlabs.io/docs/api-reference/convai/agents/create-avatar.
-
#get(agent_id, **options) ⇒ Hash
GET /v1/convai/agents/agent_id/widget Retrieve the widget configuration for an agent Documentation: https://elevenlabs.io/docs/api-reference/convai/agents/get-widget.
-
#initialize(client) ⇒ Widgets
constructor
A new instance of Widgets.
Constructor Details
#initialize(client) ⇒ Widgets
Returns a new instance of Widgets.
7 8 9 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/widgets.rb', line 7 def initialize(client) @client = client end |
Instance Method Details
#create_avatar(agent_id, avatar_file_io:, filename:) ⇒ Hash
POST /v1/convai/agents/agent_id/avatar Sets the avatar for an agent displayed in the widget Documentation: https://elevenlabs.io/docs/api-reference/convai/agents/create-avatar
39 40 41 42 43 44 45 46 47 48 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/widgets.rb', line 39 def create_avatar(agent_id, avatar_file_io:, filename:) endpoint = "/v1/convai/agents/#{agent_id}/avatar" # Prepare multipart form data payload = { "avatar_file" => @client.file_part(avatar_file_io, filename) } @client.post_multipart(endpoint, payload) end |
#get(agent_id, **options) ⇒ Hash
GET /v1/convai/agents/agent_id/widget Retrieve the widget configuration for an agent Documentation: https://elevenlabs.io/docs/api-reference/convai/agents/get-widget
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/elevenlabs_client/endpoints/agents_platform/widgets.rb', line 19 def get(agent_id, **) endpoint = "/v1/convai/agents/#{agent_id}/widget" query_params = .compact if query_params.any? query_string = URI.encode_www_form(query_params) endpoint = "#{endpoint}?#{query_string}" end @client.get(endpoint) end |