Class: Tavus::Resources::Conversations
- Inherits:
-
Object
- Object
- Tavus::Resources::Conversations
- Defined in:
- lib/tavus/resources/conversations.rb
Instance Method Summary collapse
-
#create(replica_id: nil, persona_id: nil, **options) ⇒ Hash
Create a new conversation.
-
#delete(conversation_id) ⇒ Hash
Delete a conversation.
-
#end(conversation_id) ⇒ Hash
End a conversation.
-
#get(conversation_id) ⇒ Hash
Get a single conversation by ID.
-
#initialize(client) ⇒ Conversations
constructor
A new instance of Conversations.
-
#list(**options) ⇒ Hash
List all conversations.
Constructor Details
#initialize(client) ⇒ Conversations
Returns a new instance of Conversations.
6 7 8 |
# File 'lib/tavus/resources/conversations.rb', line 6 def initialize(client) @client = client end |
Instance Method Details
#create(replica_id: nil, persona_id: nil, **options) ⇒ Hash
Create a new conversation
26 27 28 29 30 31 32 |
# File 'lib/tavus/resources/conversations.rb', line 26 def create(replica_id: nil, persona_id: nil, **) body = .dup body[:replica_id] = replica_id if replica_id body[:persona_id] = persona_id if persona_id @client.post("/v2/conversations", body: body) end |
#delete(conversation_id) ⇒ Hash
Delete a conversation
61 62 63 |
# File 'lib/tavus/resources/conversations.rb', line 61 def delete(conversation_id) @client.delete("/v2/conversations/#{conversation_id}") end |
#end(conversation_id) ⇒ Hash
End a conversation
54 55 56 |
# File 'lib/tavus/resources/conversations.rb', line 54 def end(conversation_id) @client.post("/v2/conversations/#{conversation_id}/end") end |
#get(conversation_id) ⇒ Hash
Get a single conversation by ID
37 38 39 |
# File 'lib/tavus/resources/conversations.rb', line 37 def get(conversation_id) @client.get("/v2/conversations/#{conversation_id}") end |
#list(**options) ⇒ Hash
List all conversations
47 48 49 |
# File 'lib/tavus/resources/conversations.rb', line 47 def list(**) @client.get("/v2/conversations", params: ) end |