Class: Vapi::ClientMessageTranscript

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

Constant Summary collapse

OMIT =
Object.new

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role:, transcript_type:, transcript:, additional_properties: nil) ⇒ Vapi::ClientMessageTranscript

Parameters:



29
30
31
32
33
34
35
# File 'lib/vapi_server_sdk/types/client_message_transcript.rb', line 29

def initialize(role:, transcript_type:, transcript:, additional_properties: nil)
  @role = role
  @transcript_type = transcript_type
  @transcript = transcript
  @additional_properties = additional_properties
  @_field_set = { "role": role, "transcriptType": transcript_type, "transcript": transcript }
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



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

def additional_properties
  @additional_properties
end

#roleVapi::ClientMessageTranscriptRole (readonly)

Returns This is the role for which the transcript is for.

Returns:



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

def role
  @role
end

#transcriptString (readonly)

Returns This is the transcript content.

Returns:

  • (String)

    This is the transcript content.



15
16
17
# File 'lib/vapi_server_sdk/types/client_message_transcript.rb', line 15

def transcript
  @transcript
end

#transcript_typeVapi::ClientMessageTranscriptTranscriptType (readonly)

Returns This is the type of the transcript.

Returns:



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

def transcript_type
  @transcript_type
end

Class Method Details

.from_json(json_object:) ⇒ Vapi::ClientMessageTranscript

Deserialize a JSON object to an instance of ClientMessageTranscript

Parameters:

  • json_object (String)

Returns:



41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'lib/vapi_server_sdk/types/client_message_transcript.rb', line 41

def self.from_json(json_object:)
  struct = JSON.parse(json_object, object_class: OpenStruct)
  parsed_json = JSON.parse(json_object)
  role = parsed_json["role"]
  transcript_type = parsed_json["transcriptType"]
  transcript = parsed_json["transcript"]
  new(
    role: role,
    transcript_type: transcript_type,
    transcript: transcript,
    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)


68
69
70
71
72
# File 'lib/vapi_server_sdk/types/client_message_transcript.rb', line 68

def self.validate_raw(obj:)
  obj.role.is_a?(Vapi::ClientMessageTranscriptRole) != false || raise("Passed value for field obj.role is not the expected type, validation failed.")
  obj.transcript_type.is_a?(Vapi::ClientMessageTranscriptTranscriptType) != false || raise("Passed value for field obj.transcript_type is not the expected type, validation failed.")
  obj.transcript.is_a?(String) != false || raise("Passed value for field obj.transcript is not the expected type, validation failed.")
end

Instance Method Details

#to_json(*_args) ⇒ String

Serialize an instance of ClientMessageTranscript to a JSON object

Returns:

  • (String)


58
59
60
# File 'lib/vapi_server_sdk/types/client_message_transcript.rb', line 58

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