composio 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +462 -4
  4. data/lib/composio/api/actions_api.rb +107 -0
  5. data/lib/composio/api/analytics_api.rb +181 -0
  6. data/lib/composio/api/apps_api.rb +257 -0
  7. data/lib/composio/api/event_logs_api.rb +427 -0
  8. data/lib/composio/api/logs_api.rb +127 -9
  9. data/lib/composio/api/payment_api.rb +430 -0
  10. data/lib/composio/models/action_analytics_dto.rb +250 -0
  11. data/lib/composio/models/action_by_app_dto.rb +237 -0
  12. data/lib/composio/models/action_by_status_dto.rb +237 -0
  13. data/lib/composio/models/action_get_nla_inputs_req_dto.rb +220 -0
  14. data/lib/composio/models/analytics_data_req_dto.rb +250 -0
  15. data/lib/composio/models/analytics_data_res_dto.rb +282 -0
  16. data/lib/composio/models/analytics_entity_data_dto.rb +257 -0
  17. data/lib/composio/models/api_key_res_dto.rb +61 -4
  18. data/lib/composio/models/app_name_count_dto.rb +267 -0
  19. data/lib/composio/models/client_unique_user_id_count_dto.rb +237 -0
  20. data/lib/composio/models/connected_account_response_dto.rb +10 -1
  21. data/lib/composio/models/connection_params.rb +22 -6
  22. data/lib/composio/models/connection_with_app_data.rb +22 -6
  23. data/lib/composio/models/connector_list_item_dto.rb +16 -1
  24. data/lib/composio/models/create_checkout_session_req_dto.rb +220 -0
  25. data/lib/composio/models/entity_query_req_dto.rb +216 -0
  26. data/lib/composio/models/fetch_query_dto.rb +278 -0
  27. data/lib/composio/models/get_connector_list_res_dto.rb +0 -1
  28. data/lib/composio/models/get_logs_dto.rb +10 -10
  29. data/lib/composio/models/{job_status.rb → get_logs_dto_status.rb} +6 -6
  30. data/lib/composio/models/ingest_data_dto.rb +298 -0
  31. data/lib/composio/models/ingest_data_response_dto.rb +220 -0
  32. data/lib/composio/models/integrations_with_counts_dto.rb +297 -0
  33. data/lib/composio/models/invite_member_req_dto.rb +14 -4
  34. data/lib/composio/models/last_time_period.rb +40 -0
  35. data/lib/composio/models/member_info_res_dto.rb +324 -0
  36. data/lib/composio/models/{connection_with_app_data_created_at.rb → member_info_res_dto_created_at.rb} +1 -1
  37. data/lib/composio/models/member_res_dto.rb +16 -1
  38. data/lib/composio/models/member_res_dto_role.rb +36 -0
  39. data/lib/composio/models/open_api_spec_list_res_dto.rb +17 -74
  40. data/lib/composio/models/plan.rb +38 -0
  41. data/lib/composio/models/role.rb +36 -0
  42. data/lib/composio/models/state.rb +41 -0
  43. data/lib/composio/models/status.rb +7 -4
  44. data/lib/composio/models/t_connection_count_dto.rb +236 -0
  45. data/lib/composio/models/time_period_req_dto.rb +216 -0
  46. data/lib/composio/models/top_entities_res_dto.rb +223 -0
  47. data/lib/composio/models/update_member_req_dto.rb +236 -0
  48. data/lib/composio/models/update_member_req_dto_role.rb +36 -0
  49. data/lib/composio/models/webhook_req_dto.rb +221 -0
  50. data/lib/composio/models/webhook_secret_res_dto.rb +221 -0
  51. data/lib/composio/version.rb +1 -1
  52. data/lib/composio.rb +39 -2
  53. data/spec/api/actions_api_spec.rb +13 -0
  54. data/spec/api/analytics_api_spec.rb +51 -0
  55. data/spec/api/apps_api_spec.rb +34 -0
  56. data/spec/api/event_logs_api_spec.rb +83 -0
  57. data/spec/api/logs_api_spec.rb +13 -1
  58. data/spec/api/payment_api_spec.rb +83 -0
  59. data/spec/models/action_analytics_dto_spec.rb +40 -0
  60. data/spec/models/action_by_app_dto_spec.rb +34 -0
  61. data/spec/models/action_by_status_dto_spec.rb +34 -0
  62. data/spec/models/action_get_nla_inputs_req_dto_spec.rb +28 -0
  63. data/spec/models/analytics_data_req_dto_spec.rb +32 -0
  64. data/spec/models/analytics_data_res_dto_spec.rb +52 -0
  65. data/spec/models/analytics_entity_data_dto_spec.rb +40 -0
  66. data/spec/models/api_key_res_dto_spec.rb +18 -0
  67. data/spec/models/app_name_count_dto_spec.rb +46 -0
  68. data/spec/models/client_unique_user_id_count_dto_spec.rb +34 -0
  69. data/spec/models/connected_account_response_dto_spec.rb +6 -0
  70. data/spec/models/connection_params_spec.rb +6 -0
  71. data/spec/models/connection_with_app_data_spec.rb +6 -0
  72. data/spec/models/connector_list_item_dto_spec.rb +6 -0
  73. data/spec/models/create_checkout_session_req_dto_spec.rb +28 -0
  74. data/spec/models/entity_query_req_dto_spec.rb +28 -0
  75. data/spec/models/fetch_query_dto_spec.rb +34 -0
  76. data/spec/models/get_logs_dto_spec.rb +1 -1
  77. data/spec/models/get_logs_dto_status_spec.rb +22 -0
  78. data/spec/models/ingest_data_dto_spec.rb +64 -0
  79. data/spec/models/ingest_data_response_dto_spec.rb +28 -0
  80. data/spec/models/integrations_with_counts_dto_spec.rb +58 -0
  81. data/spec/models/invite_member_req_dto_spec.rb +6 -0
  82. data/spec/models/last_time_period_spec.rb +22 -0
  83. data/spec/models/{connection_with_app_data_created_at_spec.rb → member_info_res_dto_created_at_spec.rb} +2 -2
  84. data/spec/models/member_info_res_dto_spec.rb +76 -0
  85. data/spec/models/member_res_dto_role_spec.rb +22 -0
  86. data/spec/models/member_res_dto_spec.rb +6 -0
  87. data/spec/models/open_api_spec_list_res_dto_spec.rb +5 -29
  88. data/spec/models/plan_spec.rb +22 -0
  89. data/spec/models/role_spec.rb +22 -0
  90. data/spec/models/state_spec.rb +22 -0
  91. data/spec/models/t_connection_count_dto_spec.rb +34 -0
  92. data/spec/models/time_period_req_dto_spec.rb +28 -0
  93. data/spec/models/top_entities_res_dto_spec.rb +28 -0
  94. data/spec/models/update_member_req_dto_role_spec.rb +22 -0
  95. data/spec/models/update_member_req_dto_spec.rb +34 -0
  96. data/spec/models/webhook_req_dto_spec.rb +28 -0
  97. data/spec/models/webhook_secret_res_dto_spec.rb +28 -0
  98. metadata +201 -108
  99. data/spec/models/job_status_spec.rb +0 -22
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #Composio OpenAPI
3
+
4
+ #Composio SDK: Equip your agent with high-quality tools and build your real-world usecase
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Composio
13
+ # Action counts by app
14
+ class ActionByAppDTO
15
+ # Name of the app
16
+ attr_accessor :app_name
17
+
18
+ # Total count of actions for the app
19
+ attr_accessor :total_count
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'app_name' => :'appName',
25
+ :'total_count' => :'totalCount'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'app_name' => :'String',
38
+ :'total_count' => :'Float'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::ActionByAppDTO` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::ActionByAppDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'app_name')
64
+ self.app_name = attributes[:'app_name']
65
+ end
66
+
67
+ if attributes.key?(:'total_count')
68
+ self.total_count = attributes[:'total_count']
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ if @app_name.nil?
77
+ invalid_properties.push('invalid value for "app_name", app_name cannot be nil.')
78
+ end
79
+
80
+ if @total_count.nil?
81
+ invalid_properties.push('invalid value for "total_count", total_count cannot be nil.')
82
+ end
83
+
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ return false if @app_name.nil?
91
+ return false if @total_count.nil?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ app_name == o.app_name &&
101
+ total_count == o.total_count
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [app_name, total_count].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
+ self.send("#{key}=", nil)
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = Composio.const_get(type)
185
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end
@@ -0,0 +1,237 @@
1
+ =begin
2
+ #Composio OpenAPI
3
+
4
+ #Composio SDK: Equip your agent with high-quality tools and build your real-world usecase
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Composio
13
+ # Action counts by status
14
+ class ActionByStatusDTO
15
+ # Count of failed actions
16
+ attr_accessor :failed
17
+
18
+ # Count of successful actions
19
+ attr_accessor :success
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'failed' => :'failed',
25
+ :'success' => :'success'
26
+ }
27
+ end
28
+
29
+ # Returns all the JSON keys this model knows about
30
+ def self.acceptable_attributes
31
+ attribute_map.values
32
+ end
33
+
34
+ # Attribute type mapping.
35
+ def self.openapi_types
36
+ {
37
+ :'failed' => :'Float',
38
+ :'success' => :'Float'
39
+ }
40
+ end
41
+
42
+ # List of attributes with nullable: true
43
+ def self.openapi_nullable
44
+ Set.new([
45
+ ])
46
+ end
47
+
48
+ # Initializes the object
49
+ # @param [Hash] attributes Model attributes in the form of hash
50
+ def initialize(attributes = {})
51
+ if (!attributes.is_a?(Hash))
52
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::ActionByStatusDTO` initialize method"
53
+ end
54
+
55
+ # check to see if the attribute exists and convert string to symbol for hash key
56
+ attributes = attributes.each_with_object({}) { |(k, v), h|
57
+ if (!self.class.attribute_map.key?(k.to_sym))
58
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::ActionByStatusDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
59
+ end
60
+ h[k.to_sym] = v
61
+ }
62
+
63
+ if attributes.key?(:'failed')
64
+ self.failed = attributes[:'failed']
65
+ end
66
+
67
+ if attributes.key?(:'success')
68
+ self.success = attributes[:'success']
69
+ end
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properties with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ if @failed.nil?
77
+ invalid_properties.push('invalid value for "failed", failed cannot be nil.')
78
+ end
79
+
80
+ if @success.nil?
81
+ invalid_properties.push('invalid value for "success", success cannot be nil.')
82
+ end
83
+
84
+ invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ return false if @failed.nil?
91
+ return false if @success.nil?
92
+ true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ failed == o.failed &&
101
+ success == o.success
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Integer] Hash code
112
+ def hash
113
+ [failed, success].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def self.build_from_hash(attributes)
120
+ new.build_from_hash(attributes)
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ attributes = attributes.transform_keys(&:to_sym)
129
+ self.class.openapi_types.each_pair do |key, type|
130
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
131
+ self.send("#{key}=", nil)
132
+ elsif type =~ /\AArray<(.*)>/i
133
+ # check to ensure the input is an array given that the attribute
134
+ # is documented as an array but the input is not
135
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
136
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
137
+ end
138
+ elsif !attributes[self.class.attribute_map[key]].nil?
139
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
140
+ end
141
+ end
142
+
143
+ self
144
+ end
145
+
146
+ # Deserializes the data based on type
147
+ # @param string type Data type
148
+ # @param string value Value to be deserialized
149
+ # @return [Object] Deserialized data
150
+ def _deserialize(type, value)
151
+ case type.to_sym
152
+ when :Time
153
+ Time.parse(value)
154
+ when :Date
155
+ Date.parse(value)
156
+ when :String
157
+ value.to_s
158
+ when :Integer
159
+ value.to_i
160
+ when :Float
161
+ value.to_f
162
+ when :Boolean
163
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
164
+ true
165
+ else
166
+ false
167
+ end
168
+ when :Object
169
+ # generic object (usually a Hash), return directly
170
+ value
171
+ when /\AArray<(?<inner_type>.+)>\z/
172
+ inner_type = Regexp.last_match[:inner_type]
173
+ value.map { |v| _deserialize(inner_type, v) }
174
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
175
+ k_type = Regexp.last_match[:k_type]
176
+ v_type = Regexp.last_match[:v_type]
177
+ {}.tap do |hash|
178
+ value.each do |k, v|
179
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
180
+ end
181
+ end
182
+ else # model
183
+ # models (e.g. Pet) or oneOf
184
+ klass = Composio.const_get(type)
185
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
186
+ end
187
+ end
188
+
189
+ # Returns the string representation of the object
190
+ # @return [String] String presentation of the object
191
+ def to_s
192
+ to_hash.to_s
193
+ end
194
+
195
+ # to_body is an alias to to_hash (backward compatibility)
196
+ # @return [Hash] Returns the object in the form of hash
197
+ def to_body
198
+ to_hash
199
+ end
200
+
201
+ # Returns the object in the form of hash
202
+ # @return [Hash] Returns the object in the form of hash
203
+ def to_hash
204
+ hash = {}
205
+ self.class.attribute_map.each_pair do |attr, param|
206
+ value = self.send(attr)
207
+ if value.nil?
208
+ is_nullable = self.class.openapi_nullable.include?(attr)
209
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
210
+ end
211
+
212
+ hash[param] = _to_hash(value)
213
+ end
214
+ hash
215
+ end
216
+
217
+ # Outputs non-array value in the form of hash
218
+ # For object, use to_hash. Otherwise, just return the value
219
+ # @param [Object] value Any valid value
220
+ # @return [Hash] Returns the value in the form of hash
221
+ def _to_hash(value)
222
+ if value.is_a?(Array)
223
+ value.compact.map { |v| _to_hash(v) }
224
+ elsif value.is_a?(Hash)
225
+ {}.tap do |hash|
226
+ value.each { |k, v| hash[k] = _to_hash(v) }
227
+ end
228
+ elsif value.respond_to? :to_hash
229
+ value.to_hash
230
+ else
231
+ value
232
+ end
233
+ end
234
+
235
+ end
236
+
237
+ end
@@ -0,0 +1,220 @@
1
+ =begin
2
+ #Composio OpenAPI
3
+
4
+ #Composio SDK: Equip your agent with high-quality tools and build your real-world usecase
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ =end
8
+
9
+ require 'date'
10
+ require 'time'
11
+
12
+ module Composio
13
+ class ActionGetNLAInputsReqDTO
14
+ attr_accessor :text
15
+
16
+ # Attribute mapping from ruby-style variable name to JSON key.
17
+ def self.attribute_map
18
+ {
19
+ :'text' => :'text'
20
+ }
21
+ end
22
+
23
+ # Returns all the JSON keys this model knows about
24
+ def self.acceptable_attributes
25
+ attribute_map.values
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.openapi_types
30
+ {
31
+ :'text' => :'String'
32
+ }
33
+ end
34
+
35
+ # List of attributes with nullable: true
36
+ def self.openapi_nullable
37
+ Set.new([
38
+ ])
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::ActionGetNLAInputsReqDTO` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::ActionGetNLAInputsReqDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'text')
57
+ self.text = attributes[:'text']
58
+ end
59
+ end
60
+
61
+ # Show invalid properties with the reasons. Usually used together with valid?
62
+ # @return Array for valid properties with the reasons
63
+ def list_invalid_properties
64
+ invalid_properties = Array.new
65
+ if @text.nil?
66
+ invalid_properties.push('invalid value for "text", text cannot be nil.')
67
+ end
68
+
69
+ invalid_properties
70
+ end
71
+
72
+ # Check to see if the all the properties in the model are valid
73
+ # @return true if the model is valid
74
+ def valid?
75
+ return false if @text.nil?
76
+ true
77
+ end
78
+
79
+ # Checks equality by comparing each attribute.
80
+ # @param [Object] Object to be compared
81
+ def ==(o)
82
+ return true if self.equal?(o)
83
+ self.class == o.class &&
84
+ text == o.text
85
+ end
86
+
87
+ # @see the `==` method
88
+ # @param [Object] Object to be compared
89
+ def eql?(o)
90
+ self == o
91
+ end
92
+
93
+ # Calculates hash code according to all attributes.
94
+ # @return [Integer] Hash code
95
+ def hash
96
+ [text].hash
97
+ end
98
+
99
+ # Builds the object from hash
100
+ # @param [Hash] attributes Model attributes in the form of hash
101
+ # @return [Object] Returns the model itself
102
+ def self.build_from_hash(attributes)
103
+ new.build_from_hash(attributes)
104
+ end
105
+
106
+ # Builds the object from hash
107
+ # @param [Hash] attributes Model attributes in the form of hash
108
+ # @return [Object] Returns the model itself
109
+ def build_from_hash(attributes)
110
+ return nil unless attributes.is_a?(Hash)
111
+ attributes = attributes.transform_keys(&:to_sym)
112
+ self.class.openapi_types.each_pair do |key, type|
113
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
114
+ self.send("#{key}=", nil)
115
+ elsif type =~ /\AArray<(.*)>/i
116
+ # check to ensure the input is an array given that the attribute
117
+ # is documented as an array but the input is not
118
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
119
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
120
+ end
121
+ elsif !attributes[self.class.attribute_map[key]].nil?
122
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
123
+ end
124
+ end
125
+
126
+ self
127
+ end
128
+
129
+ # Deserializes the data based on type
130
+ # @param string type Data type
131
+ # @param string value Value to be deserialized
132
+ # @return [Object] Deserialized data
133
+ def _deserialize(type, value)
134
+ case type.to_sym
135
+ when :Time
136
+ Time.parse(value)
137
+ when :Date
138
+ Date.parse(value)
139
+ when :String
140
+ value.to_s
141
+ when :Integer
142
+ value.to_i
143
+ when :Float
144
+ value.to_f
145
+ when :Boolean
146
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
147
+ true
148
+ else
149
+ false
150
+ end
151
+ when :Object
152
+ # generic object (usually a Hash), return directly
153
+ value
154
+ when /\AArray<(?<inner_type>.+)>\z/
155
+ inner_type = Regexp.last_match[:inner_type]
156
+ value.map { |v| _deserialize(inner_type, v) }
157
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
158
+ k_type = Regexp.last_match[:k_type]
159
+ v_type = Regexp.last_match[:v_type]
160
+ {}.tap do |hash|
161
+ value.each do |k, v|
162
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
163
+ end
164
+ end
165
+ else # model
166
+ # models (e.g. Pet) or oneOf
167
+ klass = Composio.const_get(type)
168
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
169
+ end
170
+ end
171
+
172
+ # Returns the string representation of the object
173
+ # @return [String] String presentation of the object
174
+ def to_s
175
+ to_hash.to_s
176
+ end
177
+
178
+ # to_body is an alias to to_hash (backward compatibility)
179
+ # @return [Hash] Returns the object in the form of hash
180
+ def to_body
181
+ to_hash
182
+ end
183
+
184
+ # Returns the object in the form of hash
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_hash
187
+ hash = {}
188
+ self.class.attribute_map.each_pair do |attr, param|
189
+ value = self.send(attr)
190
+ if value.nil?
191
+ is_nullable = self.class.openapi_nullable.include?(attr)
192
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
193
+ end
194
+
195
+ hash[param] = _to_hash(value)
196
+ end
197
+ hash
198
+ end
199
+
200
+ # Outputs non-array value in the form of hash
201
+ # For object, use to_hash. Otherwise, just return the value
202
+ # @param [Object] value Any valid value
203
+ # @return [Hash] Returns the value in the form of hash
204
+ def _to_hash(value)
205
+ if value.is_a?(Array)
206
+ value.compact.map { |v| _to_hash(v) }
207
+ elsif value.is_a?(Hash)
208
+ {}.tap do |hash|
209
+ value.each { |k, v| hash[k] = _to_hash(v) }
210
+ end
211
+ elsif value.respond_to? :to_hash
212
+ value.to_hash
213
+ else
214
+ value
215
+ end
216
+ end
217
+
218
+ end
219
+
220
+ end