Class: VoiceML::AssistantsV1Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/voiceml/resources/assistants_v1.rb

Overview

client.assistants_v1 — Twilio AI-Assistants v1 (assistants.twilio.com/v1). Sits outside the /2010-04-01/Accounts/... namespace; account resolved from Basic auth. 7 families / 30 ops:

- Assistant (5 CRUD)
- Tool (5 CRUD + attach/detach + per-assistant list)
- Knowledge (5 CRUD + status fetch + chunks list + attach/detach + per-assistant list)
- Session (list + fetch + per-session messages list)
- Message send (POST /v1/Assistants/{id}/Messages)
- Feedback (list + create under /v1/Assistants/{id}/Feedbacks)
- Policy (list /v1/Policies)

Wire format: application/json request bodies (snake_case keys) — distinct from the form-urlencoded Conversations/Voice v1 surfaces. Responses are JSON with the shared meta envelope (V1Pageable).

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ AssistantsV1Resource

Returns a new instance of AssistantsV1Resource.



21
22
23
24
25
26
27
28
# File 'lib/voiceml/resources/assistants_v1.rb', line 21

def initialize(transport)
  @transport         = transport
  @assistants_top    = AssistantsV1AssistantsResource.new(transport)
  @tools_top         = AssistantsV1ToolsResource.new(transport)
  @knowledge_top     = AssistantsV1KnowledgeResource.new(transport)
  @sessions_top      = AssistantsV1SessionsResource.new(transport)
  @policies_top      = AssistantsV1PoliciesResource.new(transport)
end

Instance Method Details

#assistants(assistant_id = nil) ⇒ Object

Scope factory: with no arg, returns the top-level Assistants resource (list/create/fetch/update/delete). With an assistant_id, returns the nested scope exposing .tools, .knowledge, .feedbacks, .messages.



33
34
35
# File 'lib/voiceml/resources/assistants_v1.rb', line 33

def assistants(assistant_id = nil)
  assistant_id.nil? ? @assistants_top : AssistantsV1AssistantScope.new(@transport, assistant_id)
end

#knowledge(knowledge_id = nil) ⇒ Object

Scope factory: with no arg, returns the top-level Knowledge resource (list/create/fetch/update/delete). With a knowledge_id, returns the nested scope exposing .status and .chunks.



45
46
47
# File 'lib/voiceml/resources/assistants_v1.rb', line 45

def knowledge(knowledge_id = nil)
  knowledge_id.nil? ? @knowledge_top : AssistantsV1KnowledgeScope.new(@transport, knowledge_id)
end

#policiesObject



56
57
58
# File 'lib/voiceml/resources/assistants_v1.rb', line 56

def policies
  @policies_top
end

#sessions(session_id = nil) ⇒ Object

Scope factory: with no arg, returns the top-level Sessions resource (list/fetch on /v1/Sessions). With a session_id, returns the nested scope exposing .messages.



52
53
54
# File 'lib/voiceml/resources/assistants_v1.rb', line 52

def sessions(session_id = nil)
  session_id.nil? ? @sessions_top : AssistantsV1SessionScope.new(@transport, session_id)
end

#toolsObject

Top-level Tools resource (list/create/fetch/update/delete on /v1/Tools).



38
39
40
# File 'lib/voiceml/resources/assistants_v1.rb', line 38

def tools
  @tools_top
end