Class: Vapi::CreateSquadDto

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(members:, name: OMIT, members_overrides: OMIT, additional_properties: nil) ⇒ Vapi::CreateSquadDto

Parameters:

  • name (String) (defaults to: OMIT)

    This is the name of the squad.

  • members (Array<Vapi::SquadMemberDto>)

    This is the list of assistants that make up the squad. The call will start with the first assistant in the list.

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

    This can be used to override all the assistants’ settings and provide values for their template variables. Both ‘membersOverrides` and `members.assistantOverrides` can be used together. First, `members.assistantOverrides` is applied. Then, `membersOverrides` is applied as a global override.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



39
40
41
42
43
44
45
46
47
# File 'lib/vapi_server_sdk/types/create_squad_dto.rb', line 39

def initialize(members:, name: OMIT, members_overrides: OMIT, additional_properties: nil)
  @name = name if name != OMIT
  @members = members
  @members_overrides = members_overrides if members_overrides != OMIT
  @additional_properties = additional_properties
  @_field_set = { "name": name, "members": members, "membersOverrides": members_overrides }.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



22
23
24
# File 'lib/vapi_server_sdk/types/create_squad_dto.rb', line 22

def additional_properties
  @additional_properties
end

#membersArray<Vapi::SquadMemberDto> (readonly)

Returns This is the list of assistants that make up the squad. The call will start with the first assistant in the list.

Returns:

  • (Array<Vapi::SquadMemberDto>)

    This is the list of assistants that make up the squad. The call will start with the first assistant in the list.



14
15
16
# File 'lib/vapi_server_sdk/types/create_squad_dto.rb', line 14

def members
  @members
end

#members_overridesVapi::AssistantOverrides (readonly)

Returns This can be used to override all the assistants’ settings and provide values for their template variables. Both ‘membersOverrides` and `members.assistantOverrides` can be used together. First, `members.assistantOverrides` is applied. Then, `membersOverrides` is applied as a global override.

Returns:

  • (Vapi::AssistantOverrides)

    This can be used to override all the assistants’ settings and provide values for their template variables. Both ‘membersOverrides` and `members.assistantOverrides` can be used together. First, `members.assistantOverrides` is applied. Then, `membersOverrides` is applied as a global override.



20
21
22
# File 'lib/vapi_server_sdk/types/create_squad_dto.rb', line 20

def members_overrides
  @members_overrides
end

#nameString (readonly)

Returns This is the name of the squad.

Returns:

  • (String)

    This is the name of the squad.



11
12
13
# File 'lib/vapi_server_sdk/types/create_squad_dto.rb', line 11

def name
  @name
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateSquadDto

Deserialize a JSON object to an instance of CreateSquadDto

Parameters:

  • json_object (String)

Returns:



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/vapi_server_sdk/types/create_squad_dto.rb', line 53

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  members = parsed_json["members"]&.map do |item|
    item = item.to_json
    Vapi::SquadMemberDto.from_json(json_object: item)
  end
  if parsed_json["membersOverrides"].nil?
    members_overrides = nil
  else
    members_overrides = parsed_json["membersOverrides"].to_json
    members_overrides = Vapi::AssistantOverrides.from_json(json_object: members_overrides)
  end
  new(
    name: name,
    members: members,
    members_overrides: members_overrides,
    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)


88
89
90
91
92
# File 'lib/vapi_server_sdk/types/create_squad_dto.rb', line 88

def self.validate_raw(obj:)
  obj.name&.is_a?(String) != false || raise("Passed value for field obj.name is not the expected type, validation failed.")
  obj.members.is_a?(Array) != false || raise("Passed value for field obj.members is not the expected type, validation failed.")
  obj.members_overrides.nil? || Vapi::AssistantOverrides.validate_raw(obj: obj.members_overrides)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CreateSquadDto to a JSON object

Returns:

  • (String)


78
79
80
# File 'lib/vapi_server_sdk/types/create_squad_dto.rb', line 78

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