Class: Vapi::CreateWebCallDto

Inherits:
Object
  • Object
show all
Defined in:
lib/vapi_server_sdk/types/create_web_call_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, squad_id: OMIT, squad: OMIT, additional_properties: nil) ⇒ Vapi::CreateWebCallDto

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)

    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.

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

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/vapi_server_sdk/types/create_web_call_dto.rb', line 46

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



27
28
29
# File 'lib/vapi_server_sdk/types/create_web_call_dto.rb', line 27

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/create_web_call_dto.rb', line 16

def assistant
  @assistant
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/create_web_call_dto.rb', line 13

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.



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

def assistant_overrides
  @assistant_overrides
end

#squadVapi::CreateSquadDto (readonly)

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

Returns:

  • (Vapi::CreateSquadDto)

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



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

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.

Returns:

  • (String)

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



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

def squad_id
  @squad_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateWebCallDto

Deserialize a JSON object to an instance of CreateWebCallDto

Parameters:

  • json_object (String)

Returns:



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/vapi_server_sdk/types/create_web_call_dto.rb', line 69

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
  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
  new(
    assistant_id: assistant_id,
    assistant: assistant,
    assistant_overrides: assistant_overrides,
    squad_id: squad_id,
    squad: squad,
    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)


115
116
117
118
119
120
121
# File 'lib/vapi_server_sdk/types/create_web_call_dto.rb', line 115

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.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)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CreateWebCallDto to a JSON object

Returns:

  • (String)


105
106
107
# File 'lib/vapi_server_sdk/types/create_web_call_dto.rb', line 105

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