Class: Vapi::SquadMemberDto

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, assistant_destinations: OMIT, additional_properties: nil) ⇒ Vapi::SquadMemberDto

Parameters:

  • assistant_id (String) (defaults to: OMIT)

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

  • 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.

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

    This can be used to override the assistant’s settings and provide values for it’s template variables.

  • assistant_destinations (Array<Vapi::TransferDestinationAssistant>) (defaults to: OMIT)

    These are the others assistants that this assistant can transfer to. If the assistant already has transfer call tool, these destinations are just appended to existing ones.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 43

def initialize(assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, assistant_destinations: OMIT,
               additional_properties: nil)
  @assistant_id = assistant_id if assistant_id != OMIT
  @assistant = assistant if assistant != OMIT
  @assistant_overrides = assistant_overrides if assistant_overrides != OMIT
  @assistant_destinations = assistant_destinations if assistant_destinations != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "assistantId": assistant_id,
    "assistant": assistant,
    "assistantOverrides": assistant_overrides,
    "assistantDestinations": assistant_destinations
  }.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



25
26
27
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 25

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.

Returns:

  • (Vapi::CreateAssistantDto)

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



16
17
18
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 16

def assistant
  @assistant
end

#assistant_destinationsArray<Vapi::TransferDestinationAssistant> (readonly)

Returns These are the others assistants that this assistant can transfer to. If the assistant already has transfer call tool, these destinations are just appended to existing ones.

Returns:

  • (Array<Vapi::TransferDestinationAssistant>)

    These are the others assistants that this assistant can transfer to. If the assistant already has transfer call tool, these destinations are just appended to existing ones.



23
24
25
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 23

def assistant_destinations
  @assistant_destinations
end

#assistant_idString (readonly)

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

Returns:

  • (String)

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



13
14
15
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 13

def assistant_id
  @assistant_id
end

#assistant_overridesVapi::AssistantOverrides (readonly)

Returns This can be used to override the assistant’s settings and provide values for it’s template variables.

Returns:

  • (Vapi::AssistantOverrides)

    This can be used to override the assistant’s settings and provide values for it’s template variables.



19
20
21
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 19

def assistant_overrides
  @assistant_overrides
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::SquadMemberDto

Deserialize a JSON object to an instance of SquadMemberDto

Parameters:

  • json_object (String)

Returns:



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 64

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  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
  assistant_destinations = parsed_json["assistantDestinations"]&.map do |item|
    item = item.to_json
    Vapi::TransferDestinationAssistant.from_json(json_object: item)
  end
  new(
    assistant_id: assistant_id,
    assistant: assistant,
    assistant_overrides: assistant_overrides,
    assistant_destinations: assistant_destinations,
    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)


106
107
108
109
110
111
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 106

def self.validate_raw(obj:)
  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.assistant_destinations&.is_a?(Array) != false || raise("Passed value for field obj.assistant_destinations is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of SquadMemberDto to a JSON object

Returns:

  • (String)


96
97
98
# File 'lib/vapi_server_sdk/types/squad_member_dto.rb', line 96

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