class Vellum::ScenarioInputRequest
def self.from_json(json_object:)
-
(ScenarioInputRequest)-
Parameters:
-
json_object(JSON) --
def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) key = struct.key type = SCENARIO_INPUT_TYPE_ENUM.key(parsed_json["type"]) || parsed_json["type"] value = struct.value chat_history = parsed_json["chat_history"].map do |v| v = v.to_json ChatMessageRequest.from_json(json_object: v) end new(key: key, type: type, value: value, chat_history: chat_history, additional_properties: struct) end
def self.validate_raw(obj:)
-
(Void)-
Parameters:
-
obj(Object) --
def self.validate_raw(obj:) obj.key.is_a?(String) != false || raise("Passed value for field obj.key is not the expected type, validation failed.") obj.type&.is_a?(SCENARIO_INPUT_TYPE_ENUM) != false || raise("Passed value for field obj.type is not the expected type, validation failed.") obj.value&.is_a?(String) != false || raise("Passed value for field obj.value is not the expected type, validation failed.") obj.chat_history&.is_a?(Array) != false || raise("Passed value for field obj.chat_history is not the expected type, validation failed.") end
def initialize(key:, type: nil, value: nil, chat_history: nil, additional_properties: nil)
-
(ScenarioInputRequest)-
Parameters:
-
additional_properties(OpenStruct) -- Additional properties unmapped to the current class definition -
chat_history(Array) -- -
value(String) -- -
type(SCENARIO_INPUT_TYPE_ENUM) -- -
key(String) --
def initialize(key:, type: nil, value: nil, chat_history: nil, additional_properties: nil) # @type [String] @key = key # @type [SCENARIO_INPUT_TYPE_ENUM] @type = type # @type [String] @value = value # @type [Array<ChatMessageRequest>] @chat_history = chat_history # @type [OpenStruct] Additional properties unmapped to the current class definition @additional_properties = additional_properties end
def to_json(*_args)
-
(JSON)-
def to_json(*_args) { "key": @key, "type": SCENARIO_INPUT_TYPE_ENUM[@type] || @type, "value": @value, "chat_history": @chat_history }.to_json end