composio 0.1.6 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (109) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +3 -3
  3. data/README.md +492 -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/connections_api.rb +84 -0
  8. data/lib/composio/api/event_logs_api.rb +427 -0
  9. data/lib/composio/api/logs_api.rb +127 -9
  10. data/lib/composio/api/payment_api.rb +430 -0
  11. data/lib/composio/models/action_analytics_dto.rb +250 -0
  12. data/lib/composio/models/action_by_app_dto.rb +237 -0
  13. data/lib/composio/models/action_by_status_dto.rb +237 -0
  14. data/lib/composio/models/action_get_nla_inputs_req_dto.rb +220 -0
  15. data/lib/composio/models/additional_info.rb +220 -0
  16. data/lib/composio/models/analytics_data_req_dto.rb +250 -0
  17. data/lib/composio/models/analytics_data_res_dto.rb +282 -0
  18. data/lib/composio/models/analytics_entity_data_dto.rb +257 -0
  19. data/lib/composio/models/api_key_res_dto.rb +61 -4
  20. data/lib/composio/models/app_name_count_dto.rb +267 -0
  21. data/lib/composio/models/client_unique_user_id_count_dto.rb +237 -0
  22. data/lib/composio/models/connected_account_response_dto.rb +10 -1
  23. data/lib/composio/models/connection_params.rb +22 -6
  24. data/lib/composio/models/connection_with_app_data.rb +22 -6
  25. data/lib/composio/models/connector_list_item_dto.rb +16 -1
  26. data/lib/composio/models/create_checkout_session_req_dto.rb +220 -0
  27. data/lib/composio/models/data.rb +234 -0
  28. data/lib/composio/models/entity_query_req_dto.rb +216 -0
  29. data/lib/composio/models/fetch_query_dto.rb +278 -0
  30. data/lib/composio/models/get_connection_info_response_dto.rb +250 -0
  31. data/lib/composio/models/get_connector_list_res_dto.rb +0 -1
  32. data/lib/composio/models/get_logs_dto.rb +10 -10
  33. data/lib/composio/models/{job_status.rb → get_logs_dto_status.rb} +6 -6
  34. data/lib/composio/models/ingest_data_dto.rb +298 -0
  35. data/lib/composio/models/ingest_data_response_dto.rb +220 -0
  36. data/lib/composio/models/integrations_with_counts_dto.rb +297 -0
  37. data/lib/composio/models/invite_member_req_dto.rb +14 -4
  38. data/lib/composio/models/last_time_period.rb +40 -0
  39. data/lib/composio/models/member_info_res_dto.rb +324 -0
  40. data/lib/composio/models/{connection_with_app_data_created_at.rb → member_info_res_dto_created_at.rb} +1 -1
  41. data/lib/composio/models/member_res_dto.rb +16 -1
  42. data/lib/composio/models/member_res_dto_role.rb +36 -0
  43. data/lib/composio/models/open_api_spec_list_res_dto.rb +17 -74
  44. data/lib/composio/models/parameter.rb +248 -0
  45. data/lib/composio/models/plan.rb +38 -0
  46. data/lib/composio/models/role.rb +36 -0
  47. data/lib/composio/models/state.rb +41 -0
  48. data/lib/composio/models/status.rb +7 -4
  49. data/lib/composio/models/t_connection_count_dto.rb +236 -0
  50. data/lib/composio/models/time_period_req_dto.rb +216 -0
  51. data/lib/composio/models/top_entities_res_dto.rb +223 -0
  52. data/lib/composio/models/update_member_req_dto.rb +236 -0
  53. data/lib/composio/models/update_member_req_dto_role.rb +36 -0
  54. data/lib/composio/models/webhook_req_dto.rb +221 -0
  55. data/lib/composio/models/webhook_secret_res_dto.rb +221 -0
  56. data/lib/composio/version.rb +1 -1
  57. data/lib/composio.rb +43 -2
  58. data/spec/api/actions_api_spec.rb +13 -0
  59. data/spec/api/analytics_api_spec.rb +51 -0
  60. data/spec/api/apps_api_spec.rb +34 -0
  61. data/spec/api/connections_api_spec.rb +11 -0
  62. data/spec/api/event_logs_api_spec.rb +83 -0
  63. data/spec/api/logs_api_spec.rb +13 -1
  64. data/spec/api/payment_api_spec.rb +83 -0
  65. data/spec/models/action_analytics_dto_spec.rb +40 -0
  66. data/spec/models/action_by_app_dto_spec.rb +34 -0
  67. data/spec/models/action_by_status_dto_spec.rb +34 -0
  68. data/spec/models/action_get_nla_inputs_req_dto_spec.rb +28 -0
  69. data/spec/models/additional_info_spec.rb +28 -0
  70. data/spec/models/analytics_data_req_dto_spec.rb +32 -0
  71. data/spec/models/analytics_data_res_dto_spec.rb +52 -0
  72. data/spec/models/analytics_entity_data_dto_spec.rb +40 -0
  73. data/spec/models/api_key_res_dto_spec.rb +18 -0
  74. data/spec/models/app_name_count_dto_spec.rb +46 -0
  75. data/spec/models/client_unique_user_id_count_dto_spec.rb +34 -0
  76. data/spec/models/connected_account_response_dto_spec.rb +6 -0
  77. data/spec/models/connection_params_spec.rb +6 -0
  78. data/spec/models/connection_with_app_data_spec.rb +6 -0
  79. data/spec/models/connector_list_item_dto_spec.rb +6 -0
  80. data/spec/models/create_checkout_session_req_dto_spec.rb +28 -0
  81. data/spec/models/data_spec.rb +34 -0
  82. data/spec/models/entity_query_req_dto_spec.rb +28 -0
  83. data/spec/models/fetch_query_dto_spec.rb +34 -0
  84. data/spec/models/get_connection_info_response_dto_spec.rb +40 -0
  85. data/spec/models/get_logs_dto_spec.rb +1 -1
  86. data/spec/models/get_logs_dto_status_spec.rb +22 -0
  87. data/spec/models/ingest_data_dto_spec.rb +64 -0
  88. data/spec/models/ingest_data_response_dto_spec.rb +28 -0
  89. data/spec/models/integrations_with_counts_dto_spec.rb +58 -0
  90. data/spec/models/invite_member_req_dto_spec.rb +6 -0
  91. data/spec/models/last_time_period_spec.rb +22 -0
  92. data/spec/models/{connection_with_app_data_created_at_spec.rb → member_info_res_dto_created_at_spec.rb} +2 -2
  93. data/spec/models/member_info_res_dto_spec.rb +76 -0
  94. data/spec/models/member_res_dto_role_spec.rb +22 -0
  95. data/spec/models/member_res_dto_spec.rb +6 -0
  96. data/spec/models/open_api_spec_list_res_dto_spec.rb +5 -29
  97. data/spec/models/parameter_spec.rb +40 -0
  98. data/spec/models/plan_spec.rb +22 -0
  99. data/spec/models/role_spec.rb +22 -0
  100. data/spec/models/state_spec.rb +22 -0
  101. data/spec/models/t_connection_count_dto_spec.rb +34 -0
  102. data/spec/models/time_period_req_dto_spec.rb +28 -0
  103. data/spec/models/top_entities_res_dto_spec.rb +28 -0
  104. data/spec/models/update_member_req_dto_role_spec.rb +22 -0
  105. data/spec/models/update_member_req_dto_spec.rb +34 -0
  106. data/spec/models/webhook_req_dto_spec.rb +28 -0
  107. data/spec/models/webhook_secret_res_dto_spec.rb +28 -0
  108. metadata +215 -110
  109. data/spec/models/job_status_spec.rb +0 -22
@@ -0,0 +1,250 @@
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 GetConnectionInfoResponseDTO
14
+ attr_accessor :parameters
15
+
16
+ attr_accessor :base_url
17
+
18
+ attr_accessor :body
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'parameters' => :'parameters',
24
+ :'base_url' => :'base_url',
25
+ :'body' => :'body'
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
+ :'parameters' => :'Array<Parameter>',
38
+ :'base_url' => :'String',
39
+ :'body' => :'Object'
40
+ }
41
+ end
42
+
43
+ # List of attributes with nullable: true
44
+ def self.openapi_nullable
45
+ Set.new([
46
+ ])
47
+ end
48
+
49
+ # Initializes the object
50
+ # @param [Hash] attributes Model attributes in the form of hash
51
+ def initialize(attributes = {})
52
+ if (!attributes.is_a?(Hash))
53
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::GetConnectionInfoResponseDTO` initialize method"
54
+ end
55
+
56
+ # check to see if the attribute exists and convert string to symbol for hash key
57
+ attributes = attributes.each_with_object({}) { |(k, v), h|
58
+ if (!self.class.attribute_map.key?(k.to_sym))
59
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::GetConnectionInfoResponseDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
60
+ end
61
+ h[k.to_sym] = v
62
+ }
63
+
64
+ if attributes.key?(:'parameters')
65
+ if (value = attributes[:'parameters']).is_a?(Array)
66
+ self.parameters = value
67
+ end
68
+ end
69
+
70
+ if attributes.key?(:'base_url')
71
+ self.base_url = attributes[:'base_url']
72
+ end
73
+
74
+ if attributes.key?(:'body')
75
+ self.body = attributes[:'body']
76
+ end
77
+ end
78
+
79
+ # Show invalid properties with the reasons. Usually used together with valid?
80
+ # @return Array for valid properties with the reasons
81
+ def list_invalid_properties
82
+ invalid_properties = Array.new
83
+ if @parameters.nil?
84
+ invalid_properties.push('invalid value for "parameters", parameters cannot be nil.')
85
+ end
86
+
87
+ if @base_url.nil?
88
+ invalid_properties.push('invalid value for "base_url", base_url cannot be nil.')
89
+ end
90
+
91
+ if @body.nil?
92
+ invalid_properties.push('invalid value for "body", body cannot be nil.')
93
+ end
94
+
95
+ invalid_properties
96
+ end
97
+
98
+ # Check to see if the all the properties in the model are valid
99
+ # @return true if the model is valid
100
+ def valid?
101
+ return false if @parameters.nil?
102
+ return false if @base_url.nil?
103
+ return false if @body.nil?
104
+ true
105
+ end
106
+
107
+ # Checks equality by comparing each attribute.
108
+ # @param [Object] Object to be compared
109
+ def ==(o)
110
+ return true if self.equal?(o)
111
+ self.class == o.class &&
112
+ parameters == o.parameters &&
113
+ base_url == o.base_url &&
114
+ body == o.body
115
+ end
116
+
117
+ # @see the `==` method
118
+ # @param [Object] Object to be compared
119
+ def eql?(o)
120
+ self == o
121
+ end
122
+
123
+ # Calculates hash code according to all attributes.
124
+ # @return [Integer] Hash code
125
+ def hash
126
+ [parameters, base_url, body].hash
127
+ end
128
+
129
+ # Builds the object from hash
130
+ # @param [Hash] attributes Model attributes in the form of hash
131
+ # @return [Object] Returns the model itself
132
+ def self.build_from_hash(attributes)
133
+ new.build_from_hash(attributes)
134
+ end
135
+
136
+ # Builds the object from hash
137
+ # @param [Hash] attributes Model attributes in the form of hash
138
+ # @return [Object] Returns the model itself
139
+ def build_from_hash(attributes)
140
+ return nil unless attributes.is_a?(Hash)
141
+ attributes = attributes.transform_keys(&:to_sym)
142
+ self.class.openapi_types.each_pair do |key, type|
143
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
144
+ self.send("#{key}=", nil)
145
+ elsif type =~ /\AArray<(.*)>/i
146
+ # check to ensure the input is an array given that the attribute
147
+ # is documented as an array but the input is not
148
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
149
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
150
+ end
151
+ elsif !attributes[self.class.attribute_map[key]].nil?
152
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
153
+ end
154
+ end
155
+
156
+ self
157
+ end
158
+
159
+ # Deserializes the data based on type
160
+ # @param string type Data type
161
+ # @param string value Value to be deserialized
162
+ # @return [Object] Deserialized data
163
+ def _deserialize(type, value)
164
+ case type.to_sym
165
+ when :Time
166
+ Time.parse(value)
167
+ when :Date
168
+ Date.parse(value)
169
+ when :String
170
+ value.to_s
171
+ when :Integer
172
+ value.to_i
173
+ when :Float
174
+ value.to_f
175
+ when :Boolean
176
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
177
+ true
178
+ else
179
+ false
180
+ end
181
+ when :Object
182
+ # generic object (usually a Hash), return directly
183
+ value
184
+ when /\AArray<(?<inner_type>.+)>\z/
185
+ inner_type = Regexp.last_match[:inner_type]
186
+ value.map { |v| _deserialize(inner_type, v) }
187
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
188
+ k_type = Regexp.last_match[:k_type]
189
+ v_type = Regexp.last_match[:v_type]
190
+ {}.tap do |hash|
191
+ value.each do |k, v|
192
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
193
+ end
194
+ end
195
+ else # model
196
+ # models (e.g. Pet) or oneOf
197
+ klass = Composio.const_get(type)
198
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
199
+ end
200
+ end
201
+
202
+ # Returns the string representation of the object
203
+ # @return [String] String presentation of the object
204
+ def to_s
205
+ to_hash.to_s
206
+ end
207
+
208
+ # to_body is an alias to to_hash (backward compatibility)
209
+ # @return [Hash] Returns the object in the form of hash
210
+ def to_body
211
+ to_hash
212
+ end
213
+
214
+ # Returns the object in the form of hash
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_hash
217
+ hash = {}
218
+ self.class.attribute_map.each_pair do |attr, param|
219
+ value = self.send(attr)
220
+ if value.nil?
221
+ is_nullable = self.class.openapi_nullable.include?(attr)
222
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
223
+ end
224
+
225
+ hash[param] = _to_hash(value)
226
+ end
227
+ hash
228
+ end
229
+
230
+ # Outputs non-array value in the form of hash
231
+ # For object, use to_hash. Otherwise, just return the value
232
+ # @param [Object] value Any valid value
233
+ # @return [Hash] Returns the value in the form of hash
234
+ def _to_hash(value)
235
+ if value.is_a?(Array)
236
+ value.compact.map { |v| _to_hash(v) }
237
+ elsif value.is_a?(Hash)
238
+ {}.tap do |hash|
239
+ value.each { |k, v| hash[k] = _to_hash(v) }
240
+ end
241
+ elsif value.respond_to? :to_hash
242
+ value.to_hash
243
+ else
244
+ value
245
+ end
246
+ end
247
+
248
+ end
249
+
250
+ end
@@ -11,7 +11,6 @@ require 'time'
11
11
 
12
12
  module Composio
13
13
  class GetConnectorListResDTO
14
- # List of connectors
15
14
  attr_accessor :items
16
15
 
17
16
  # Total number of pages available
@@ -26,7 +26,7 @@ module Composio
26
26
  # Integration UUID
27
27
  attr_accessor :integration_id
28
28
 
29
- # Entity UUID
29
+ # Entity id
30
30
  attr_accessor :entity_id
31
31
 
32
32
  # Limit of the logs
@@ -35,8 +35,8 @@ module Composio
35
35
  # Cursor for pagination
36
36
  attr_accessor :cursor
37
37
 
38
- # Connection ID of the log
39
- attr_accessor :connection_id
38
+ # Type of the log
39
+ attr_accessor :logs_type
40
40
 
41
41
  # Attribute mapping from ruby-style variable name to JSON key.
42
42
  def self.attribute_map
@@ -49,7 +49,7 @@ module Composio
49
49
  :'entity_id' => :'entityId',
50
50
  :'limit' => :'limit',
51
51
  :'cursor' => :'cursor',
52
- :'connection_id' => :'connectionId'
52
+ :'logs_type' => :'logsType'
53
53
  }
54
54
  end
55
55
 
@@ -63,13 +63,13 @@ module Composio
63
63
  {
64
64
  :'type' => :'Type',
65
65
  :'time' => :'Time',
66
- :'status' => :'Status',
66
+ :'status' => :'GetLogsDtoStatus',
67
67
  :'search' => :'String',
68
68
  :'integration_id' => :'String',
69
69
  :'entity_id' => :'String',
70
70
  :'limit' => :'Float',
71
71
  :'cursor' => :'String',
72
- :'connection_id' => :'String'
72
+ :'logs_type' => :'String'
73
73
  }
74
74
  end
75
75
 
@@ -128,8 +128,8 @@ module Composio
128
128
  self.cursor = attributes[:'cursor']
129
129
  end
130
130
 
131
- if attributes.key?(:'connection_id')
132
- self.connection_id = attributes[:'connection_id']
131
+ if attributes.key?(:'logs_type')
132
+ self.logs_type = attributes[:'logs_type']
133
133
  end
134
134
  end
135
135
 
@@ -159,7 +159,7 @@ module Composio
159
159
  entity_id == o.entity_id &&
160
160
  limit == o.limit &&
161
161
  cursor == o.cursor &&
162
- connection_id == o.connection_id
162
+ logs_type == o.logs_type
163
163
  end
164
164
 
165
165
  # @see the `==` method
@@ -171,7 +171,7 @@ module Composio
171
171
  # Calculates hash code according to all attributes.
172
172
  # @return [Integer] Hash code
173
173
  def hash
174
- [type, time, status, search, integration_id, entity_id, limit, cursor, connection_id].hash
174
+ [type, time, status, search, integration_id, entity_id, limit, cursor, logs_type].hash
175
175
  end
176
176
 
177
177
  # Builds the object from hash
@@ -10,13 +10,13 @@ require 'date'
10
10
  require 'time'
11
11
 
12
12
  module Composio
13
- class JobStatus
14
- RUNNING = "running".freeze
13
+ class GetLogsDtoStatus
14
+ ALL = "all".freeze
15
15
  SUCCESS = "success".freeze
16
- FAILED = "failed".freeze
16
+ ERROR = "error".freeze
17
17
 
18
18
  def self.all_vars
19
- @all_vars ||= [RUNNING, SUCCESS, FAILED].freeze
19
+ @all_vars ||= [ALL, SUCCESS, ERROR].freeze
20
20
  end
21
21
 
22
22
  # Builds the enum from string
@@ -30,8 +30,8 @@ module Composio
30
30
  # @param [String] The enum value in the form of the string
31
31
  # @return [String] The enum value
32
32
  def build_from_hash(value)
33
- return value if JobStatus.all_vars.include?(value)
34
- raise "Invalid ENUM value #{value} for class #JobStatus"
33
+ return value if GetLogsDtoStatus.all_vars.include?(value)
34
+ raise "Invalid ENUM value #{value} for class #GetLogsDtoStatus"
35
35
  end
36
36
  end
37
37
  end
@@ -0,0 +1,298 @@
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 IngestDataDTO
14
+ # Connection ID of the log
15
+ attr_accessor :connection_id
16
+
17
+ # Entity ID of the log
18
+ attr_accessor :entity_id
19
+
20
+ # Provider name of the log
21
+ attr_accessor :provider_name
22
+
23
+ # Action name of the log
24
+ attr_accessor :action_name
25
+
26
+ attr_accessor :request
27
+
28
+ attr_accessor :response
29
+
30
+ attr_accessor :is_error
31
+
32
+ # Attribute mapping from ruby-style variable name to JSON key.
33
+ def self.attribute_map
34
+ {
35
+ :'connection_id' => :'connectionId',
36
+ :'entity_id' => :'entityId',
37
+ :'provider_name' => :'providerName',
38
+ :'action_name' => :'actionName',
39
+ :'request' => :'request',
40
+ :'response' => :'response',
41
+ :'is_error' => :'isError'
42
+ }
43
+ end
44
+
45
+ # Returns all the JSON keys this model knows about
46
+ def self.acceptable_attributes
47
+ attribute_map.values
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.openapi_types
52
+ {
53
+ :'connection_id' => :'String',
54
+ :'entity_id' => :'String',
55
+ :'provider_name' => :'String',
56
+ :'action_name' => :'String',
57
+ :'request' => :'Object',
58
+ :'response' => :'Object',
59
+ :'is_error' => :'Boolean'
60
+ }
61
+ end
62
+
63
+ # List of attributes with nullable: true
64
+ def self.openapi_nullable
65
+ Set.new([
66
+ ])
67
+ end
68
+
69
+ # Initializes the object
70
+ # @param [Hash] attributes Model attributes in the form of hash
71
+ def initialize(attributes = {})
72
+ if (!attributes.is_a?(Hash))
73
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::IngestDataDTO` initialize method"
74
+ end
75
+
76
+ # check to see if the attribute exists and convert string to symbol for hash key
77
+ attributes = attributes.each_with_object({}) { |(k, v), h|
78
+ if (!self.class.attribute_map.key?(k.to_sym))
79
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::IngestDataDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
80
+ end
81
+ h[k.to_sym] = v
82
+ }
83
+
84
+ if attributes.key?(:'connection_id')
85
+ self.connection_id = attributes[:'connection_id']
86
+ end
87
+
88
+ if attributes.key?(:'entity_id')
89
+ self.entity_id = attributes[:'entity_id']
90
+ end
91
+
92
+ if attributes.key?(:'provider_name')
93
+ self.provider_name = attributes[:'provider_name']
94
+ end
95
+
96
+ if attributes.key?(:'action_name')
97
+ self.action_name = attributes[:'action_name']
98
+ end
99
+
100
+ if attributes.key?(:'request')
101
+ self.request = attributes[:'request']
102
+ end
103
+
104
+ if attributes.key?(:'response')
105
+ self.response = attributes[:'response']
106
+ end
107
+
108
+ if attributes.key?(:'is_error')
109
+ self.is_error = attributes[:'is_error']
110
+ end
111
+ end
112
+
113
+ # Show invalid properties with the reasons. Usually used together with valid?
114
+ # @return Array for valid properties with the reasons
115
+ def list_invalid_properties
116
+ invalid_properties = Array.new
117
+ if @provider_name.nil?
118
+ invalid_properties.push('invalid value for "provider_name", provider_name cannot be nil.')
119
+ end
120
+
121
+ if @action_name.nil?
122
+ invalid_properties.push('invalid value for "action_name", action_name cannot be nil.')
123
+ end
124
+
125
+ if @request.nil?
126
+ invalid_properties.push('invalid value for "request", request cannot be nil.')
127
+ end
128
+
129
+ if @response.nil?
130
+ invalid_properties.push('invalid value for "response", response cannot be nil.')
131
+ end
132
+
133
+ if @is_error.nil?
134
+ invalid_properties.push('invalid value for "is_error", is_error cannot be nil.')
135
+ end
136
+
137
+ invalid_properties
138
+ end
139
+
140
+ # Check to see if the all the properties in the model are valid
141
+ # @return true if the model is valid
142
+ def valid?
143
+ return false if @provider_name.nil?
144
+ return false if @action_name.nil?
145
+ return false if @request.nil?
146
+ return false if @response.nil?
147
+ return false if @is_error.nil?
148
+ true
149
+ end
150
+
151
+ # Checks equality by comparing each attribute.
152
+ # @param [Object] Object to be compared
153
+ def ==(o)
154
+ return true if self.equal?(o)
155
+ self.class == o.class &&
156
+ connection_id == o.connection_id &&
157
+ entity_id == o.entity_id &&
158
+ provider_name == o.provider_name &&
159
+ action_name == o.action_name &&
160
+ request == o.request &&
161
+ response == o.response &&
162
+ is_error == o.is_error
163
+ end
164
+
165
+ # @see the `==` method
166
+ # @param [Object] Object to be compared
167
+ def eql?(o)
168
+ self == o
169
+ end
170
+
171
+ # Calculates hash code according to all attributes.
172
+ # @return [Integer] Hash code
173
+ def hash
174
+ [connection_id, entity_id, provider_name, action_name, request, response, is_error].hash
175
+ end
176
+
177
+ # Builds the object from hash
178
+ # @param [Hash] attributes Model attributes in the form of hash
179
+ # @return [Object] Returns the model itself
180
+ def self.build_from_hash(attributes)
181
+ new.build_from_hash(attributes)
182
+ end
183
+
184
+ # Builds the object from hash
185
+ # @param [Hash] attributes Model attributes in the form of hash
186
+ # @return [Object] Returns the model itself
187
+ def build_from_hash(attributes)
188
+ return nil unless attributes.is_a?(Hash)
189
+ attributes = attributes.transform_keys(&:to_sym)
190
+ self.class.openapi_types.each_pair do |key, type|
191
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
192
+ self.send("#{key}=", nil)
193
+ elsif type =~ /\AArray<(.*)>/i
194
+ # check to ensure the input is an array given that the attribute
195
+ # is documented as an array but the input is not
196
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
197
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
198
+ end
199
+ elsif !attributes[self.class.attribute_map[key]].nil?
200
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
201
+ end
202
+ end
203
+
204
+ self
205
+ end
206
+
207
+ # Deserializes the data based on type
208
+ # @param string type Data type
209
+ # @param string value Value to be deserialized
210
+ # @return [Object] Deserialized data
211
+ def _deserialize(type, value)
212
+ case type.to_sym
213
+ when :Time
214
+ Time.parse(value)
215
+ when :Date
216
+ Date.parse(value)
217
+ when :String
218
+ value.to_s
219
+ when :Integer
220
+ value.to_i
221
+ when :Float
222
+ value.to_f
223
+ when :Boolean
224
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
225
+ true
226
+ else
227
+ false
228
+ end
229
+ when :Object
230
+ # generic object (usually a Hash), return directly
231
+ value
232
+ when /\AArray<(?<inner_type>.+)>\z/
233
+ inner_type = Regexp.last_match[:inner_type]
234
+ value.map { |v| _deserialize(inner_type, v) }
235
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
236
+ k_type = Regexp.last_match[:k_type]
237
+ v_type = Regexp.last_match[:v_type]
238
+ {}.tap do |hash|
239
+ value.each do |k, v|
240
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
241
+ end
242
+ end
243
+ else # model
244
+ # models (e.g. Pet) or oneOf
245
+ klass = Composio.const_get(type)
246
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
247
+ end
248
+ end
249
+
250
+ # Returns the string representation of the object
251
+ # @return [String] String presentation of the object
252
+ def to_s
253
+ to_hash.to_s
254
+ end
255
+
256
+ # to_body is an alias to to_hash (backward compatibility)
257
+ # @return [Hash] Returns the object in the form of hash
258
+ def to_body
259
+ to_hash
260
+ end
261
+
262
+ # Returns the object in the form of hash
263
+ # @return [Hash] Returns the object in the form of hash
264
+ def to_hash
265
+ hash = {}
266
+ self.class.attribute_map.each_pair do |attr, param|
267
+ value = self.send(attr)
268
+ if value.nil?
269
+ is_nullable = self.class.openapi_nullable.include?(attr)
270
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
271
+ end
272
+
273
+ hash[param] = _to_hash(value)
274
+ end
275
+ hash
276
+ end
277
+
278
+ # Outputs non-array value in the form of hash
279
+ # For object, use to_hash. Otherwise, just return the value
280
+ # @param [Object] value Any valid value
281
+ # @return [Hash] Returns the value in the form of hash
282
+ def _to_hash(value)
283
+ if value.is_a?(Array)
284
+ value.compact.map { |v| _to_hash(v) }
285
+ elsif value.is_a?(Hash)
286
+ {}.tap do |hash|
287
+ value.each { |k, v| hash[k] = _to_hash(v) }
288
+ end
289
+ elsif value.respond_to? :to_hash
290
+ value.to_hash
291
+ else
292
+ value
293
+ end
294
+ end
295
+
296
+ end
297
+
298
+ end