Class: Vapi::ServerMessageResponseAssistantRequest

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/server_message_response_assistant_request.rb

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(destination: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, workflow_id: OMIT, workflow: OMIT, workflow_overrides: OMIT, error: OMIT, additional_properties: nil) ⇒ Vapi::ServerMessageResponseAssistantRequest

Parameters:

  • destination (Vapi::ServerMessageResponseAssistantRequestDestination) (defaults to: OMIT)

    This is the destination to transfer the inbound call to. This will immediately transfer without using any assistants. If this is sent, ‘assistantId`, `assistant`, `squadId`, and `squad` are ignored.

  • assistant_id (String) (defaults to: OMIT)

    This is the assistant ID that will be used for the call. To use a transient assistant, use ‘assistant` instead. To start a call with:

    • Assistant, use ‘assistantId` or `assistant`

    • Squad, use ‘squadId` or `squad`

    • Workflow, use ‘workflowId` or `workflow`

  • assistant (Vapi::CreateAssistantDto) (defaults to: OMIT)

    This is the assistant that will be used for the call. To use an existing assistant, use ‘assistantId` instead. To start a call with:

    • Assistant, use ‘assistant`

    • Squad, use ‘squad`

    • Workflow, use ‘workflow`

  • assistant_overrides (Vapi::AssistantOverrides) (defaults to: OMIT)

    These are the overrides for the ‘assistant` or `assistantId`’s settings and template variables.

  • squad_id (String) (defaults to: OMIT)

    This is the squad that will be used for the call. To use a transient squad, use ‘squad` instead. To start a call with:

    • Assistant, use ‘assistant` or `assistantId`

    • Squad, use ‘squad` or `squadId`

    • Workflow, use ‘workflow` or `workflowId`

  • squad (Vapi::CreateSquadDto) (defaults to: OMIT)

    This is a squad that will be used for the call. To use an existing squad, use ‘squadId` instead. To start a call with:

    • Assistant, use ‘assistant` or `assistantId`

    • Squad, use ‘squad` or `squadId`

    • Workflow, use ‘workflow` or `workflowId`

  • workflow_id (String) (defaults to: OMIT)

    This is the workflow that will be used for the call. To use a transient workflow, use ‘workflow` instead. To start a call with:

    • Assistant, use ‘assistant` or `assistantId`

    • Squad, use ‘squad` or `squadId`

    • Workflow, use ‘workflow` or `workflowId`

  • workflow (Vapi::CreateWorkflowDto) (defaults to: OMIT)

    This is a workflow that will be used for the call. To use an existing workflow, use ‘workflowId` instead. To start a call with:

    • Assistant, use ‘assistant` or `assistantId`

    • Squad, use ‘squad` or `squadId`

    • Workflow, use ‘workflow` or `workflowId`

  • workflow_overrides (Vapi::WorkflowOverrides) (defaults to: OMIT)

    These are the overrides for the ‘workflow` or `workflowId`’s settings and template variables.

  • error (String) (defaults to: OMIT)

    This is the error if the call shouldn’t be accepted. This is spoken to the customer. If this is sent, ‘assistantId`, `assistant`, `squadId`, `squad`, and `destination` are ignored.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 128

def initialize(destination: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT,
               squad: OMIT, workflow_id: OMIT, workflow: OMIT, workflow_overrides: OMIT, error: OMIT, additional_properties: nil)
  @destination = destination if destination != OMIT
  @assistant_id = assistant_id if assistant_id != OMIT
  @assistant = assistant if assistant != OMIT
  @assistant_overrides = assistant_overrides if assistant_overrides != OMIT
  @squad_id = squad_id if squad_id != OMIT
  @squad = squad if squad != OMIT
  @workflow_id = workflow_id if workflow_id != OMIT
  @workflow = workflow if workflow != OMIT
  @workflow_overrides = workflow_overrides if workflow_overrides != OMIT
  @error = error if error != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "destination": destination,
    "assistantId": assistant_id,
    "assistant": assistant,
    "assistantOverrides": assistant_overrides,
    "squadId": squad_id,
    "squad": squad,
    "workflowId": workflow_id,
    "workflow": workflow,
    "workflowOverrides": workflow_overrides,
    "error": error
  }.reject do |_k, v|
    v == OMIT
  end
end

Instance Attribute Details

#additional_propertiesOpenStruct (readonly)

Returns Additional properties unmapped to the current class definition.

Returns:

  • (OpenStruct)

    Additional properties unmapped to the current class definition



72
73
74
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 72

def additional_properties
  @additional_properties
end

#assistantVapi::CreateAssistantDto (readonly)

Returns This is the assistant that will be used for the call. To use an existing assistant, use ‘assistantId` instead. To start a call with:

  • Assistant, use ‘assistant`

  • Squad, use ‘squad`

  • Workflow, use ‘workflow`.

Returns:

  • (Vapi::CreateAssistantDto)

    This is the assistant that will be used for the call. To use an existing assistant, use ‘assistantId` instead. To start a call with:

    • Assistant, use ‘assistant`

    • Squad, use ‘squad`

    • Workflow, use ‘workflow`



31
32
33
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 31

def assistant
  @assistant
end

#assistant_idString (readonly)

Returns This is the assistant ID that will be used for the call. To use a transient assistant, use ‘assistant` instead. To start a call with:

  • Assistant, use ‘assistantId` or `assistant`

  • Squad, use ‘squadId` or `squad`

  • Workflow, use ‘workflowId` or `workflow`.

Returns:

  • (String)

    This is the assistant ID that will be used for the call. To use a transient assistant, use ‘assistant` instead. To start a call with:

    • Assistant, use ‘assistantId` or `assistant`

    • Squad, use ‘squadId` or `squad`

    • Workflow, use ‘workflowId` or `workflow`



24
25
26
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 24

def assistant_id
  @assistant_id
end

#assistant_overridesVapi::AssistantOverrides (readonly)

Returns These are the overrides for the ‘assistant` or `assistantId`’s settings and template variables.

Returns:

  • (Vapi::AssistantOverrides)

    These are the overrides for the ‘assistant` or `assistantId`’s settings and template variables.



34
35
36
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 34

def assistant_overrides
  @assistant_overrides
end

#destinationVapi::ServerMessageResponseAssistantRequestDestination (readonly)

Returns This is the destination to transfer the inbound call to. This will immediately transfer without using any assistants. If this is sent, ‘assistantId`, `assistant`, `squadId`, and `squad` are ignored.

Returns:



17
18
19
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 17

def destination
  @destination
end

#errorString (readonly)

Returns This is the error if the call shouldn’t be accepted. This is spoken to the customer. If this is sent, ‘assistantId`, `assistant`, `squadId`, `squad`, and `destination` are ignored.

Returns:

  • (String)

    This is the error if the call shouldn’t be accepted. This is spoken to the customer. If this is sent, ‘assistantId`, `assistant`, `squadId`, `squad`, and `destination` are ignored.



70
71
72
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 70

def error
  @error
end

#squadVapi::CreateSquadDto (readonly)

Returns This is a squad that will be used for the call. To use an existing squad, use ‘squadId` instead. To start a call with:

  • Assistant, use ‘assistant` or `assistantId`

  • Squad, use ‘squad` or `squadId`

  • Workflow, use ‘workflow` or `workflowId`.

Returns:

  • (Vapi::CreateSquadDto)

    This is a squad that will be used for the call. To use an existing squad, use ‘squadId` instead. To start a call with:

    • Assistant, use ‘assistant` or `assistantId`

    • Squad, use ‘squad` or `squadId`

    • Workflow, use ‘workflow` or `workflowId`



48
49
50
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 48

def squad
  @squad
end

#squad_idString (readonly)

Returns This is the squad that will be used for the call. To use a transient squad, use ‘squad` instead. To start a call with:

  • Assistant, use ‘assistant` or `assistantId`

  • Squad, use ‘squad` or `squadId`

  • Workflow, use ‘workflow` or `workflowId`.

Returns:

  • (String)

    This is the squad that will be used for the call. To use a transient squad, use ‘squad` instead. To start a call with:

    • Assistant, use ‘assistant` or `assistantId`

    • Squad, use ‘squad` or `squadId`

    • Workflow, use ‘workflow` or `workflowId`



41
42
43
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 41

def squad_id
  @squad_id
end

#workflowVapi::CreateWorkflowDto (readonly)

Returns This is a workflow that will be used for the call. To use an existing workflow, use ‘workflowId` instead. To start a call with:

  • Assistant, use ‘assistant` or `assistantId`

  • Squad, use ‘squad` or `squadId`

  • Workflow, use ‘workflow` or `workflowId`.

Returns:

  • (Vapi::CreateWorkflowDto)

    This is a workflow that will be used for the call. To use an existing workflow, use ‘workflowId` instead. To start a call with:

    • Assistant, use ‘assistant` or `assistantId`

    • Squad, use ‘squad` or `squadId`

    • Workflow, use ‘workflow` or `workflowId`



62
63
64
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 62

def workflow
  @workflow
end

#workflow_idString (readonly)

Returns This is the workflow that will be used for the call. To use a transient workflow, use ‘workflow` instead. To start a call with:

  • Assistant, use ‘assistant` or `assistantId`

  • Squad, use ‘squad` or `squadId`

  • Workflow, use ‘workflow` or `workflowId`.

Returns:

  • (String)

    This is the workflow that will be used for the call. To use a transient workflow, use ‘workflow` instead. To start a call with:

    • Assistant, use ‘assistant` or `assistantId`

    • Squad, use ‘squad` or `squadId`

    • Workflow, use ‘workflow` or `workflowId`



55
56
57
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 55

def workflow_id
  @workflow_id
end

#workflow_overridesVapi::WorkflowOverrides (readonly)

Returns These are the overrides for the ‘workflow` or `workflowId`’s settings and template variables.

Returns:

  • (Vapi::WorkflowOverrides)

    These are the overrides for the ‘workflow` or `workflowId`’s settings and template variables.



65
66
67
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 65

def workflow_overrides
  @workflow_overrides
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::ServerMessageResponseAssistantRequest

Deserialize a JSON object to an instance of

ServerMessageResponseAssistantRequest

Parameters:

  • json_object (String)

Returns:



162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 162

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  if parsed_json["destination"].nil?
    destination = nil
  else
    destination = parsed_json["destination"].to_json
    destination = Vapi::ServerMessageResponseAssistantRequestDestination.from_json(json_object: destination)
  end
  assistant_id = parsed_json["assistantId"]
  if parsed_json["assistant"].nil?
    assistant = nil
  else
    assistant = parsed_json["assistant"].to_json
    assistant = Vapi::CreateAssistantDto.from_json(json_object: assistant)
  end
  if parsed_json["assistantOverrides"].nil?
    assistant_overrides = nil
  else
    assistant_overrides = parsed_json["assistantOverrides"].to_json
    assistant_overrides = Vapi::AssistantOverrides.from_json(json_object: assistant_overrides)
  end
  squad_id = parsed_json["squadId"]
  if parsed_json["squad"].nil?
    squad = nil
  else
    squad = parsed_json["squad"].to_json
    squad = Vapi::CreateSquadDto.from_json(json_object: squad)
  end
  workflow_id = parsed_json["workflowId"]
  if parsed_json["workflow"].nil?
    workflow = nil
  else
    workflow = parsed_json["workflow"].to_json
    workflow = Vapi::CreateWorkflowDto.from_json(json_object: workflow)
  end
  if parsed_json["workflowOverrides"].nil?
    workflow_overrides = nil
  else
    workflow_overrides = parsed_json["workflowOverrides"].to_json
    workflow_overrides = Vapi::WorkflowOverrides.from_json(json_object: workflow_overrides)
  end
  error = parsed_json["error"]
  new(
    destination: destination,
    assistant_id: assistant_id,
    assistant: assistant,
    assistant_overrides: assistant_overrides,
    squad_id: squad_id,
    squad: squad,
    workflow_id: workflow_id,
    workflow: workflow,
    workflow_overrides: workflow_overrides,
    error: error,
    additional_properties: struct
  )
end

.validate_raw(obj:) ⇒ Void

Leveraged for Union-type generation, validate_raw attempts to parse the given

hash and check each fields type against the current object's property
definitions.

Parameters:

  • obj (Object)

Returns:

  • (Void)


233
234
235
236
237
238
239
240
241
242
243
244
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 233

def self.validate_raw(obj:)
  obj.destination.nil? || Vapi::ServerMessageResponseAssistantRequestDestination.validate_raw(obj: obj.destination)
  obj.assistant_id&.is_a?(String) != false || raise("Passed value for field obj.assistant_id is not the expected type, validation failed.")
  obj.assistant.nil? || Vapi::CreateAssistantDto.validate_raw(obj: obj.assistant)
  obj.assistant_overrides.nil? || Vapi::AssistantOverrides.validate_raw(obj: obj.assistant_overrides)
  obj.squad_id&.is_a?(String) != false || raise("Passed value for field obj.squad_id is not the expected type, validation failed.")
  obj.squad.nil? || Vapi::CreateSquadDto.validate_raw(obj: obj.squad)
  obj.workflow_id&.is_a?(String) != false || raise("Passed value for field obj.workflow_id is not the expected type, validation failed.")
  obj.workflow.nil? || Vapi::CreateWorkflowDto.validate_raw(obj: obj.workflow)
  obj.workflow_overrides.nil? || Vapi::WorkflowOverrides.validate_raw(obj: obj.workflow_overrides)
  obj.error&.is_a?(String) != false || raise("Passed value for field obj.error is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ServerMessageResponseAssistantRequest to a JSON object

Returns:

  • (String)


223
224
225
# File 'lib/vapi_server_sdk/types/server_message_response_assistant_request.rb', line 223

def to_json(*_args)
  @_field_set&.to_json
end