Class: Telnyx::Resources::AI::Missions::Tools

Inherits:
Object
  • Object
show all
Defined in:
lib/telnyx/resources/ai/missions/tools.rb

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Tools

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Tools.

Parameters:



132
133
134
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 132

def initialize(client:)
  @client = client
end

Instance Method Details

#create_tool(mission_id, request_options: {}) ⇒ Object

Create a new tool for a mission

Parameters:

  • mission_id (String)

    Unique identifier of the mission.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (Object)

See Also:



19
20
21
22
23
24
25
26
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 19

def create_tool(mission_id, params = {})
  @client.request(
    method: :post,
    path: ["ai/missions/%1$s/tools", mission_id],
    model: Telnyx::Internal::Type::Unknown,
    options: params[:request_options]
  )
end

#delete_tool(tool_id, mission_id:, request_options: {}) ⇒ nil

Delete a tool from a mission

Parameters:

  • tool_id (String)

    Unique identifier of the tool.

  • mission_id (String)

    Unique identifier of the mission.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 41

def delete_tool(tool_id, params)
  parsed, options = Telnyx::AI::Missions::ToolDeleteToolParams.dump_request(params)
  mission_id =
    parsed.delete(:mission_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :delete,
    path: ["ai/missions/%1$s/tools/%2$s", mission_id, tool_id],
    model: NilClass,
    options: options
  )
end

#get_tool(tool_id, mission_id:, request_options: {}) ⇒ Object

Get a specific tool by ID

Parameters:

  • tool_id (String)

    Unique identifier of the tool.

  • mission_id (String)

    Unique identifier of the mission.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (Object)

See Also:



68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 68

def get_tool(tool_id, params)
  parsed, options = Telnyx::AI::Missions::ToolGetToolParams.dump_request(params)
  mission_id =
    parsed.delete(:mission_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :get,
    path: ["ai/missions/%1$s/tools/%2$s", mission_id, tool_id],
    model: Telnyx::Internal::Type::Unknown,
    options: options
  )
end

#list_tools(mission_id, request_options: {}) ⇒ Object

List all tools for a mission

Parameters:

  • mission_id (String)

    Unique identifier of the mission.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (Object)

See Also:



93
94
95
96
97
98
99
100
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 93

def list_tools(mission_id, params = {})
  @client.request(
    method: :get,
    path: ["ai/missions/%1$s/tools", mission_id],
    model: Telnyx::Internal::Type::Unknown,
    options: params[:request_options]
  )
end

#update_tool(tool_id, mission_id:, request_options: {}) ⇒ Object

Update a tool definition

Parameters:

  • tool_id (String)

    Unique identifier of the tool.

  • mission_id (String)

    Unique identifier of the mission.

  • request_options (Telnyx::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (Object)

See Also:



115
116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/telnyx/resources/ai/missions/tools.rb', line 115

def update_tool(tool_id, params)
  parsed, options = Telnyx::AI::Missions::ToolUpdateToolParams.dump_request(params)
  mission_id =
    parsed.delete(:mission_id) do
      raise ArgumentError.new("missing required path argument #{_1}")
    end
  @client.request(
    method: :put,
    path: ["ai/missions/%1$s/tools/%2$s", mission_id, tool_id],
    model: Telnyx::Internal::Type::Unknown,
    options: options
  )
end