Class: Vapi::CreateOutboundCallDto

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT, squad: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, additional_properties: nil) ⇒ Vapi::CreateOutboundCallDto

Parameters:

  • name (String) (defaults to: OMIT)

    This is the name of the call. This is just for your own reference.

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

  • phone_number_id (String) (defaults to: OMIT)

    This is the phone number that will be used for the call. To use a transient number, use ‘phoneNumber` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

  • phone_number (Vapi::ImportTwilioPhoneNumberDto) (defaults to: OMIT)

    This is the phone number that will be used for the call. To use an existing number, use ‘phoneNumberId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

  • customer_id (String) (defaults to: OMIT)

    This is the customer that will be called. To call a transient customer , use ‘customer` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

  • customer (Vapi::CreateCustomerDto) (defaults to: OMIT)

    This is the customer that will be called. To call an existing customer, use ‘customerId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

  • additional_properties (OpenStruct) (defaults to: nil)

    Additional properties unmapped to the current class definition



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 79

def initialize(name: OMIT, assistant_id: OMIT, assistant: OMIT, assistant_overrides: OMIT, squad_id: OMIT,
               squad: OMIT, phone_number_id: OMIT, phone_number: OMIT, customer_id: OMIT, customer: OMIT, additional_properties: nil)
  @name = name if name != 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
  @phone_number_id = phone_number_id if phone_number_id != OMIT
  @phone_number = phone_number if phone_number != OMIT
  @customer_id = customer_id if customer_id != OMIT
  @customer = customer if customer != OMIT
  @additional_properties = additional_properties
  @_field_set = {
    "name": name,
    "assistantId": assistant_id,
    "assistant": assistant,
    "assistantOverrides": assistant_overrides,
    "squadId": squad_id,
    "squad": squad,
    "phoneNumberId": phone_number_id,
    "phoneNumber": phone_number,
    "customerId": customer_id,
    "customer": customer
  }.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



47
48
49
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 47

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.



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

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.



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

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.



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

def assistant_overrides
  @assistant_overrides
end

#customerVapi::CreateCustomerDto (readonly)

Returns This is the customer that will be called. To call an existing customer, use ‘customerId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (Vapi::CreateCustomerDto)

    This is the customer that will be called. To call an existing customer, use ‘customerId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.



45
46
47
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 45

def customer
  @customer
end

#customer_idString (readonly)

Returns This is the customer that will be called. To call a transient customer , use ‘customer` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (String)

    This is the customer that will be called. To call a transient customer , use ‘customer` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.



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

def customer_id
  @customer_id
end

#nameString (readonly)

Returns This is the name of the call. This is just for your own reference.

Returns:

  • (String)

    This is the name of the call. This is just for your own reference.



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

def name
  @name
end

#phone_numberVapi::ImportTwilioPhoneNumberDto (readonly)

Returns This is the phone number that will be used for the call. To use an existing number, use ‘phoneNumberId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (Vapi::ImportTwilioPhoneNumberDto)

    This is the phone number that will be used for the call. To use an existing number, use ‘phoneNumberId` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.



37
38
39
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 37

def phone_number
  @phone_number
end

#phone_number_idString (readonly)

Returns This is the phone number that will be used for the call. To use a transient number, use ‘phoneNumber` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.

Returns:

  • (String)

    This is the phone number that will be used for the call. To use a transient number, use ‘phoneNumber` instead. Only relevant for `outboundPhoneCall` and `inboundPhoneCall` type.



33
34
35
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 33

def phone_number_id
  @phone_number_id
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.



29
30
31
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 29

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.



26
27
28
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 26

def squad_id
  @squad_id
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::CreateOutboundCallDto

Deserialize a JSON object to an instance of CreateOutboundCallDto

Parameters:

  • json_object (String)

Returns:



112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
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
156
157
158
159
160
161
162
163
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 112

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  name = parsed_json["name"]
  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
  phone_number_id = parsed_json["phoneNumberId"]
  if parsed_json["phoneNumber"].nil?
    phone_number = nil
  else
    phone_number = parsed_json["phoneNumber"].to_json
    phone_number = Vapi::ImportTwilioPhoneNumberDto.from_json(json_object: phone_number)
  end
  customer_id = parsed_json["customerId"]
  if parsed_json["customer"].nil?
    customer = nil
  else
    customer = parsed_json["customer"].to_json
    customer = Vapi::CreateCustomerDto.from_json(json_object: customer)
  end
  new(
    name: name,
    assistant_id: assistant_id,
    assistant: assistant,
    assistant_overrides: assistant_overrides,
    squad_id: squad_id,
    squad: squad,
    phone_number_id: phone_number_id,
    phone_number: phone_number,
    customer_id: customer_id,
    customer: customer,
    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)


178
179
180
181
182
183
184
185
186
187
188
189
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 178

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.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.phone_number_id&.is_a?(String) != false || raise("Passed value for field obj.phone_number_id is not the expected type, validation failed.")
  obj.phone_number.nil? || Vapi::ImportTwilioPhoneNumberDto.validate_raw(obj: obj.phone_number)
  obj.customer_id&.is_a?(String) != false || raise("Passed value for field obj.customer_id is not the expected type, validation failed.")
  obj.customer.nil? || Vapi::CreateCustomerDto.validate_raw(obj: obj.customer)
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of CreateOutboundCallDto to a JSON object

Returns:

  • (String)


168
169
170
# File 'lib/vapi_server_sdk/types/create_outbound_call_dto.rb', line 168

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