cuadra-ai-sdk 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +28 -0
  3. data/README.md +99 -0
  4. data/lib/cuadra_ai/api_helper.rb +10 -0
  5. data/lib/cuadra_ai/client.rb +91 -0
  6. data/lib/cuadra_ai/configuration.rb +105 -0
  7. data/lib/cuadra_ai/controllers/base_controller.rb +67 -0
  8. data/lib/cuadra_ai/controllers/chat_controller.rb +41 -0
  9. data/lib/cuadra_ai/controllers/embeds_controller.rb +41 -0
  10. data/lib/cuadra_ai/controllers/models_controller.rb +172 -0
  11. data/lib/cuadra_ai/controllers/oauth_authorization_controller.rb +87 -0
  12. data/lib/cuadra_ai/controllers/usage_controller.rb +70 -0
  13. data/lib/cuadra_ai/exceptions/api_exception.rb +21 -0
  14. data/lib/cuadra_ai/exceptions/error_response_exception.rb +57 -0
  15. data/lib/cuadra_ai/exceptions/oauth_provider_exception.rb +64 -0
  16. data/lib/cuadra_ai/http/api_response.rb +19 -0
  17. data/lib/cuadra_ai/http/auth/oauth_2.rb +139 -0
  18. data/lib/cuadra_ai/http/http_call_back.rb +10 -0
  19. data/lib/cuadra_ai/http/http_method_enum.rb +10 -0
  20. data/lib/cuadra_ai/http/http_request.rb +10 -0
  21. data/lib/cuadra_ai/http/http_response.rb +10 -0
  22. data/lib/cuadra_ai/logging/configuration/api_logging_configuration.rb +114 -0
  23. data/lib/cuadra_ai/logging/sdk_logger.rb +17 -0
  24. data/lib/cuadra_ai/models/base_model.rb +110 -0
  25. data/lib/cuadra_ai/models/chat.rb +102 -0
  26. data/lib/cuadra_ai/models/chat_response_ex.rb +106 -0
  27. data/lib/cuadra_ai/models/content_ex.rb +86 -0
  28. data/lib/cuadra_ai/models/embed.rb +100 -0
  29. data/lib/cuadra_ai/models/embed_response_ex.rb +85 -0
  30. data/lib/cuadra_ai/models/inline_data_ex.rb +87 -0
  31. data/lib/cuadra_ai/models/model_ex.rb +169 -0
  32. data/lib/cuadra_ai/models/oauth_provider_error.rb +45 -0
  33. data/lib/cuadra_ai/models/oauth_token.rb +96 -0
  34. data/lib/cuadra_ai/models/paginated_response_ex_list_model_ex.rb +104 -0
  35. data/lib/cuadra_ai/models/tokens_ex.rb +86 -0
  36. data/lib/cuadra_ai/models/total_usage_ex.rb +86 -0
  37. data/lib/cuadra_ai/models/usage_calculation_ex.rb +77 -0
  38. data/lib/cuadra_ai/models/usage_ex.rb +86 -0
  39. data/lib/cuadra_ai/utilities/date_time_helper.rb +11 -0
  40. data/lib/cuadra_ai/utilities/file_wrapper.rb +28 -0
  41. data/lib/cuadra_ai.rb +63 -0
  42. metadata +126 -0
@@ -0,0 +1,110 @@
1
+ # cuadra_ai
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CuadraAi
7
+ # Base model.
8
+ # rubocop:disable all
9
+ class BaseModel < CoreLibrary::BaseModel
10
+ # Returns a Hash representation of the current object.
11
+ def to_hash
12
+ # validating the model being serialized
13
+ self.class.validate(self) if self.class.respond_to?(:validate)
14
+
15
+ hash = {}
16
+ instance_variables.each do |name|
17
+ value = instance_variable_get(name)
18
+ name = name[1..]
19
+ if name == 'additional_properties'
20
+ additional_properties = process_additional_properties(value, self.class.names)
21
+ hash.merge!(additional_properties)
22
+ else
23
+ key = self.class.names.key?(name) ? self.class.names[name] : name
24
+ optional_fields = self.class.optionals
25
+ nullable_fields = self.class.nullables
26
+ if value.nil?
27
+ next unless nullable_fields.include?(name)
28
+
29
+ if !optional_fields.include?(name) && !nullable_fields.include?(name)
30
+ raise ArgumentError,
31
+ "`#{name}` cannot be nil in `#{self.class}`. Please specify a valid value."
32
+ end
33
+ end
34
+
35
+ hash[key] = nil
36
+ unless value.nil?
37
+ if respond_to?("to_custom_#{name}")
38
+ if (value.instance_of? Array) || (value.instance_of? Hash)
39
+ params = [hash, key]
40
+ hash[key] = send("to_custom_#{name}", *params)
41
+ else
42
+ hash[key] = send("to_custom_#{name}")
43
+ end
44
+ elsif respond_to?("to_union_type_#{name}")
45
+ hash[key] = send("to_union_type_#{name}")
46
+ elsif value.instance_of? Array
47
+ hash[key] = value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
48
+ elsif value.instance_of? Hash
49
+ hash[key] = {}
50
+ value.each do |k, v|
51
+ hash[key][k] = v.is_a?(BaseModel) ? v.to_hash : v
52
+ end
53
+ else
54
+ hash[key] = value.is_a?(BaseModel) ? value.to_hash : value
55
+ end
56
+ end
57
+ end
58
+ end
59
+ hash
60
+ end
61
+
62
+ # Processes additional properties, ensuring no conflicts with existing properties.
63
+ def process_additional_properties(additional_properties, existing_prop_names)
64
+ hash = {}
65
+ additional_properties.each do |name, value|
66
+ check_for_conflict(name, existing_prop_names)
67
+
68
+ hash[name] = if value.is_a?(Array)
69
+ process_array(value)
70
+ elsif value.is_a?(Hash)
71
+ process_hash(value)
72
+ else
73
+ process_basic_value(value)
74
+ end
75
+ end
76
+ hash
77
+ end
78
+
79
+ # Checks if an additional property conflicts with a model's existing property.
80
+ def check_for_conflict(name, existing_prop_names)
81
+ return unless existing_prop_names.key?(name)
82
+
83
+ raise ArgumentError, "An additional property key, '#{name}' conflicts with one of the model's properties"
84
+ end
85
+
86
+ # Processes an array of values, recursively calling `to_hash` on BaseModel objects.
87
+ def process_array(value)
88
+ value.map { |v| v.is_a?(BaseModel) ? v.to_hash : v }
89
+ end
90
+
91
+ # Processes a hash of values, recursively calling `to_hash` on BaseModel objects.
92
+ def process_hash(value)
93
+ value.transform_values do |v|
94
+ v.is_a?(BaseModel) ? v.to_hash : v
95
+ end
96
+ end
97
+
98
+ # Processes a basic value (non-array, non-hash).
99
+ def process_basic_value(value)
100
+ value.is_a?(BaseModel) ? value.to_hash : value
101
+ end
102
+
103
+ # Returns a JSON representation of the curent object.
104
+ def to_json(options = {})
105
+ hash = to_hash
106
+ hash.to_json(options)
107
+ end
108
+ end
109
+ # rubocop:enable all
110
+ end
@@ -0,0 +1,102 @@
1
+ # cuadra_ai
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CuadraAi
7
+ # Chat Model.
8
+ class Chat < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Model name
13
+ # @return [String]
14
+ attr_accessor :model
15
+
16
+ # Request content
17
+ # @return [Array[ContentEx]]
18
+ attr_accessor :content
19
+
20
+ # If you want to keep context between request, otherwise leave it empty, you
21
+ # get one with every chat you create.
22
+ # @return [String]
23
+ attr_accessor :chat_id
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['model'] = 'model'
29
+ @_hash['content'] = 'content'
30
+ @_hash['chat_id'] = 'chatId'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ %w[
37
+ chat_id
38
+ ]
39
+ end
40
+
41
+ # An array for nullable fields
42
+ def self.nullables
43
+ []
44
+ end
45
+
46
+ def initialize(model:, content:, chat_id: SKIP, additional_properties: nil)
47
+ # Add additional model properties to the instance
48
+ additional_properties = {} if additional_properties.nil?
49
+
50
+ @model = model
51
+ @content = content
52
+ @chat_id = chat_id unless chat_id == SKIP
53
+ @additional_properties = additional_properties
54
+ end
55
+
56
+ # Creates an instance of the object from a hash.
57
+ def self.from_hash(hash)
58
+ return nil unless hash
59
+
60
+ # Extract variables from the hash.
61
+ model = hash.key?('model') ? hash['model'] : nil
62
+ # Parameter is an array, so we need to iterate through it
63
+ content = nil
64
+ unless hash['content'].nil?
65
+ content = []
66
+ hash['content'].each do |structure|
67
+ content << (ContentEx.from_hash(structure) if structure)
68
+ end
69
+ end
70
+
71
+ content = nil unless hash.key?('content')
72
+ chat_id = hash.key?('chatId') ? hash['chatId'] : SKIP
73
+
74
+ # Create a new hash for additional properties, removing known properties.
75
+ new_hash = hash.reject { |k, _| names.value?(k) }
76
+
77
+ additional_properties = APIHelper.get_additional_properties(
78
+ new_hash, proc { |value| value }
79
+ )
80
+
81
+ # Create object from extracted values.
82
+ Chat.new(model: model,
83
+ content: content,
84
+ chat_id: chat_id,
85
+ additional_properties: additional_properties)
86
+ end
87
+
88
+ # Provides a human-readable string representation of the object.
89
+ def to_s
90
+ class_name = self.class.name.split('::').last
91
+ "<#{class_name} model: #{@model}, content: #{@content}, chat_id: #{@chat_id},"\
92
+ " additional_properties: #{@additional_properties}>"
93
+ end
94
+
95
+ # Provides a debugging-friendly string with detailed object information.
96
+ def inspect
97
+ class_name = self.class.name.split('::').last
98
+ "<#{class_name} model: #{@model.inspect}, content: #{@content.inspect}, chat_id:"\
99
+ " #{@chat_id.inspect}, additional_properties: #{@additional_properties}>"
100
+ end
101
+ end
102
+ end
@@ -0,0 +1,106 @@
1
+ # cuadra_ai
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CuadraAi
7
+ # ChatResponseEx Model.
8
+ class ChatResponseEx < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Output generated by the AI to resolve the request
13
+ # @return [String]
14
+ attr_accessor :output
15
+
16
+ # Confidence score of how accurate is the output regarding your request
17
+ # @return [Float]
18
+ attr_accessor :confidence_score
19
+
20
+ # Model used to resolve your query
21
+ # @return [String]
22
+ attr_accessor :model
23
+
24
+ # This is the token usage result of your request
25
+ # @return [UsageEx]
26
+ attr_accessor :usage
27
+
28
+ # A mapping from model property names to API property names.
29
+ def self.names
30
+ @_hash = {} if @_hash.nil?
31
+ @_hash['output'] = 'output'
32
+ @_hash['confidence_score'] = 'confidenceScore'
33
+ @_hash['model'] = 'model'
34
+ @_hash['usage'] = 'usage'
35
+ @_hash
36
+ end
37
+
38
+ # An array for optional fields
39
+ def self.optionals
40
+ %w[
41
+ output
42
+ confidence_score
43
+ model
44
+ usage
45
+ ]
46
+ end
47
+
48
+ # An array for nullable fields
49
+ def self.nullables
50
+ []
51
+ end
52
+
53
+ def initialize(output: SKIP, confidence_score: SKIP, model: SKIP,
54
+ usage: SKIP, additional_properties: nil)
55
+ # Add additional model properties to the instance
56
+ additional_properties = {} if additional_properties.nil?
57
+
58
+ @output = output unless output == SKIP
59
+ @confidence_score = confidence_score unless confidence_score == SKIP
60
+ @model = model unless model == SKIP
61
+ @usage = usage unless usage == SKIP
62
+ @additional_properties = additional_properties
63
+ end
64
+
65
+ # Creates an instance of the object from a hash.
66
+ def self.from_hash(hash)
67
+ return nil unless hash
68
+
69
+ # Extract variables from the hash.
70
+ output = hash.key?('output') ? hash['output'] : SKIP
71
+ confidence_score =
72
+ hash.key?('confidenceScore') ? hash['confidenceScore'] : SKIP
73
+ model = hash.key?('model') ? hash['model'] : SKIP
74
+ usage = UsageEx.from_hash(hash['usage']) if hash['usage']
75
+
76
+ # Create a new hash for additional properties, removing known properties.
77
+ new_hash = hash.reject { |k, _| names.value?(k) }
78
+
79
+ additional_properties = APIHelper.get_additional_properties(
80
+ new_hash, proc { |value| value }
81
+ )
82
+
83
+ # Create object from extracted values.
84
+ ChatResponseEx.new(output: output,
85
+ confidence_score: confidence_score,
86
+ model: model,
87
+ usage: usage,
88
+ additional_properties: additional_properties)
89
+ end
90
+
91
+ # Provides a human-readable string representation of the object.
92
+ def to_s
93
+ class_name = self.class.name.split('::').last
94
+ "<#{class_name} output: #{@output}, confidence_score: #{@confidence_score}, model:"\
95
+ " #{@model}, usage: #{@usage}, additional_properties: #{@additional_properties}>"
96
+ end
97
+
98
+ # Provides a debugging-friendly string with detailed object information.
99
+ def inspect
100
+ class_name = self.class.name.split('::').last
101
+ "<#{class_name} output: #{@output.inspect}, confidence_score: #{@confidence_score.inspect},"\
102
+ " model: #{@model.inspect}, usage: #{@usage.inspect}, additional_properties:"\
103
+ " #{@additional_properties}>"
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,86 @@
1
+ # cuadra_ai
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CuadraAi
7
+ # Request content
8
+ class ContentEx < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Text is the task you want the AI to solve.
13
+ # @return [String]
14
+ attr_accessor :text
15
+
16
+ # Input Reference is the name of the file, if you're request is from a type
17
+ # other than text, and it's required for most types. It has to contain the
18
+ # same name as the file attached in the request.
19
+ # @return [InlineDataEx]
20
+ attr_accessor :inline_data
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['text'] = 'text'
26
+ @_hash['inline_data'] = 'inlineData'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ %w[
33
+ inline_data
34
+ ]
35
+ end
36
+
37
+ # An array for nullable fields
38
+ def self.nullables
39
+ []
40
+ end
41
+
42
+ def initialize(text:, inline_data: SKIP, additional_properties: nil)
43
+ # Add additional model properties to the instance
44
+ additional_properties = {} if additional_properties.nil?
45
+
46
+ @text = text
47
+ @inline_data = inline_data unless inline_data == SKIP
48
+ @additional_properties = additional_properties
49
+ end
50
+
51
+ # Creates an instance of the object from a hash.
52
+ def self.from_hash(hash)
53
+ return nil unless hash
54
+
55
+ # Extract variables from the hash.
56
+ text = hash.key?('text') ? hash['text'] : nil
57
+ inline_data = InlineDataEx.from_hash(hash['inlineData']) if hash['inlineData']
58
+
59
+ # Create a new hash for additional properties, removing known properties.
60
+ new_hash = hash.reject { |k, _| names.value?(k) }
61
+
62
+ additional_properties = APIHelper.get_additional_properties(
63
+ new_hash, proc { |value| value }
64
+ )
65
+
66
+ # Create object from extracted values.
67
+ ContentEx.new(text: text,
68
+ inline_data: inline_data,
69
+ additional_properties: additional_properties)
70
+ end
71
+
72
+ # Provides a human-readable string representation of the object.
73
+ def to_s
74
+ class_name = self.class.name.split('::').last
75
+ "<#{class_name} text: #{@text}, inline_data: #{@inline_data}, additional_properties:"\
76
+ " #{@additional_properties}>"
77
+ end
78
+
79
+ # Provides a debugging-friendly string with detailed object information.
80
+ def inspect
81
+ class_name = self.class.name.split('::').last
82
+ "<#{class_name} text: #{@text.inspect}, inline_data: #{@inline_data.inspect},"\
83
+ " additional_properties: #{@additional_properties}>"
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,100 @@
1
+ # cuadra_ai
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CuadraAi
7
+ # Embed Model.
8
+ class Embed < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Model name
13
+ # @return [String]
14
+ attr_accessor :model
15
+
16
+ # Request content
17
+ # @return [Array[ContentEx]]
18
+ attr_accessor :content
19
+
20
+ # The purpose of the embed, it could be 'search_document', 'search_query',
21
+ # 'classification', o 'clustering'.
22
+ # @return [String]
23
+ attr_accessor :purpose
24
+
25
+ # A mapping from model property names to API property names.
26
+ def self.names
27
+ @_hash = {} if @_hash.nil?
28
+ @_hash['model'] = 'model'
29
+ @_hash['content'] = 'content'
30
+ @_hash['purpose'] = 'purpose'
31
+ @_hash
32
+ end
33
+
34
+ # An array for optional fields
35
+ def self.optionals
36
+ []
37
+ end
38
+
39
+ # An array for nullable fields
40
+ def self.nullables
41
+ []
42
+ end
43
+
44
+ def initialize(model:, content:, purpose:, additional_properties: nil)
45
+ # Add additional model properties to the instance
46
+ additional_properties = {} if additional_properties.nil?
47
+
48
+ @model = model
49
+ @content = content
50
+ @purpose = purpose
51
+ @additional_properties = additional_properties
52
+ end
53
+
54
+ # Creates an instance of the object from a hash.
55
+ def self.from_hash(hash)
56
+ return nil unless hash
57
+
58
+ # Extract variables from the hash.
59
+ model = hash.key?('model') ? hash['model'] : nil
60
+ # Parameter is an array, so we need to iterate through it
61
+ content = nil
62
+ unless hash['content'].nil?
63
+ content = []
64
+ hash['content'].each do |structure|
65
+ content << (ContentEx.from_hash(structure) if structure)
66
+ end
67
+ end
68
+
69
+ content = nil unless hash.key?('content')
70
+ purpose = hash.key?('purpose') ? hash['purpose'] : nil
71
+
72
+ # Create a new hash for additional properties, removing known properties.
73
+ new_hash = hash.reject { |k, _| names.value?(k) }
74
+
75
+ additional_properties = APIHelper.get_additional_properties(
76
+ new_hash, proc { |value| value }
77
+ )
78
+
79
+ # Create object from extracted values.
80
+ Embed.new(model: model,
81
+ content: content,
82
+ purpose: purpose,
83
+ additional_properties: additional_properties)
84
+ end
85
+
86
+ # Provides a human-readable string representation of the object.
87
+ def to_s
88
+ class_name = self.class.name.split('::').last
89
+ "<#{class_name} model: #{@model}, content: #{@content}, purpose: #{@purpose},"\
90
+ " additional_properties: #{@additional_properties}>"
91
+ end
92
+
93
+ # Provides a debugging-friendly string with detailed object information.
94
+ def inspect
95
+ class_name = self.class.name.split('::').last
96
+ "<#{class_name} model: #{@model.inspect}, content: #{@content.inspect}, purpose:"\
97
+ " #{@purpose.inspect}, additional_properties: #{@additional_properties}>"
98
+ end
99
+ end
100
+ end
@@ -0,0 +1,85 @@
1
+ # cuadra_ai
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CuadraAi
7
+ # EmbedResponseEx Model.
8
+ class EmbedResponseEx < BaseModel
9
+ SKIP = Object.new
10
+ private_constant :SKIP
11
+
12
+ # Embed id
13
+ # @return [String]
14
+ attr_accessor :id
15
+
16
+ # This is the token usage result of your request
17
+ # @return [UsageEx]
18
+ attr_accessor :usage
19
+
20
+ # A mapping from model property names to API property names.
21
+ def self.names
22
+ @_hash = {} if @_hash.nil?
23
+ @_hash['id'] = 'id'
24
+ @_hash['usage'] = 'usage'
25
+ @_hash
26
+ end
27
+
28
+ # An array for optional fields
29
+ def self.optionals
30
+ %w[
31
+ id
32
+ usage
33
+ ]
34
+ end
35
+
36
+ # An array for nullable fields
37
+ def self.nullables
38
+ []
39
+ end
40
+
41
+ def initialize(id: SKIP, usage: SKIP, additional_properties: nil)
42
+ # Add additional model properties to the instance
43
+ additional_properties = {} if additional_properties.nil?
44
+
45
+ @id = id unless id == SKIP
46
+ @usage = usage unless usage == SKIP
47
+ @additional_properties = additional_properties
48
+ end
49
+
50
+ # Creates an instance of the object from a hash.
51
+ def self.from_hash(hash)
52
+ return nil unless hash
53
+
54
+ # Extract variables from the hash.
55
+ id = hash.key?('id') ? hash['id'] : SKIP
56
+ usage = UsageEx.from_hash(hash['usage']) if hash['usage']
57
+
58
+ # Create a new hash for additional properties, removing known properties.
59
+ new_hash = hash.reject { |k, _| names.value?(k) }
60
+
61
+ additional_properties = APIHelper.get_additional_properties(
62
+ new_hash, proc { |value| value }
63
+ )
64
+
65
+ # Create object from extracted values.
66
+ EmbedResponseEx.new(id: id,
67
+ usage: usage,
68
+ additional_properties: additional_properties)
69
+ end
70
+
71
+ # Provides a human-readable string representation of the object.
72
+ def to_s
73
+ class_name = self.class.name.split('::').last
74
+ "<#{class_name} id: #{@id}, usage: #{@usage}, additional_properties:"\
75
+ " #{@additional_properties}>"
76
+ end
77
+
78
+ # Provides a debugging-friendly string with detailed object information.
79
+ def inspect
80
+ class_name = self.class.name.split('::').last
81
+ "<#{class_name} id: #{@id.inspect}, usage: #{@usage.inspect}, additional_properties:"\
82
+ " #{@additional_properties}>"
83
+ end
84
+ end
85
+ end
@@ -0,0 +1,87 @@
1
+ # cuadra_ai
2
+ #
3
+ # This file was automatically generated by APIMATIC v2.0
4
+ # ( https://apimatic.io ).
5
+
6
+ module CuadraAi
7
+ # Input Reference is the name of the file, if you're request is from a type
8
+ # other than text, and it's required for most types. It has to contain the
9
+ # same name as the file attached in the request.
10
+ class InlineDataEx < BaseModel
11
+ SKIP = Object.new
12
+ private_constant :SKIP
13
+
14
+ # TODO: Write general description for this method
15
+ # @return [String]
16
+ attr_accessor :mime_type
17
+
18
+ # TODO: Write general description for this method
19
+ # @return [String]
20
+ attr_accessor :data
21
+
22
+ # A mapping from model property names to API property names.
23
+ def self.names
24
+ @_hash = {} if @_hash.nil?
25
+ @_hash['mime_type'] = 'mimeType'
26
+ @_hash['data'] = 'data'
27
+ @_hash
28
+ end
29
+
30
+ # An array for optional fields
31
+ def self.optionals
32
+ %w[
33
+ mime_type
34
+ data
35
+ ]
36
+ end
37
+
38
+ # An array for nullable fields
39
+ def self.nullables
40
+ []
41
+ end
42
+
43
+ def initialize(mime_type: SKIP, data: SKIP, additional_properties: nil)
44
+ # Add additional model properties to the instance
45
+ additional_properties = {} if additional_properties.nil?
46
+
47
+ @mime_type = mime_type unless mime_type == SKIP
48
+ @data = data unless data == SKIP
49
+ @additional_properties = additional_properties
50
+ end
51
+
52
+ # Creates an instance of the object from a hash.
53
+ def self.from_hash(hash)
54
+ return nil unless hash
55
+
56
+ # Extract variables from the hash.
57
+ mime_type = hash.key?('mimeType') ? hash['mimeType'] : SKIP
58
+ data = hash.key?('data') ? hash['data'] : SKIP
59
+
60
+ # Create a new hash for additional properties, removing known properties.
61
+ new_hash = hash.reject { |k, _| names.value?(k) }
62
+
63
+ additional_properties = APIHelper.get_additional_properties(
64
+ new_hash, proc { |value| value }
65
+ )
66
+
67
+ # Create object from extracted values.
68
+ InlineDataEx.new(mime_type: mime_type,
69
+ data: data,
70
+ additional_properties: additional_properties)
71
+ end
72
+
73
+ # Provides a human-readable string representation of the object.
74
+ def to_s
75
+ class_name = self.class.name.split('::').last
76
+ "<#{class_name} mime_type: #{@mime_type}, data: #{@data}, additional_properties:"\
77
+ " #{@additional_properties}>"
78
+ end
79
+
80
+ # Provides a debugging-friendly string with detailed object information.
81
+ def inspect
82
+ class_name = self.class.name.split('::').last
83
+ "<#{class_name} mime_type: #{@mime_type.inspect}, data: #{@data.inspect},"\
84
+ " additional_properties: #{@additional_properties}>"
85
+ end
86
+ end
87
+ end