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,248 @@
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 Parameter
14
+ attr_accessor :name
15
+
16
+ attr_accessor :_in
17
+
18
+ attr_accessor :value
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'name' => :'name',
24
+ :'_in' => :'in',
25
+ :'value' => :'value'
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
+ :'name' => :'String',
38
+ :'_in' => :'String',
39
+ :'value' => :'String'
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::Parameter` 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::Parameter`. 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?(:'name')
65
+ self.name = attributes[:'name']
66
+ end
67
+
68
+ if attributes.key?(:'_in')
69
+ self._in = attributes[:'_in']
70
+ end
71
+
72
+ if attributes.key?(:'value')
73
+ self.value = attributes[:'value']
74
+ end
75
+ end
76
+
77
+ # Show invalid properties with the reasons. Usually used together with valid?
78
+ # @return Array for valid properties with the reasons
79
+ def list_invalid_properties
80
+ invalid_properties = Array.new
81
+ if @name.nil?
82
+ invalid_properties.push('invalid value for "name", name cannot be nil.')
83
+ end
84
+
85
+ if @_in.nil?
86
+ invalid_properties.push('invalid value for "_in", _in cannot be nil.')
87
+ end
88
+
89
+ if @value.nil?
90
+ invalid_properties.push('invalid value for "value", value cannot be nil.')
91
+ end
92
+
93
+ invalid_properties
94
+ end
95
+
96
+ # Check to see if the all the properties in the model are valid
97
+ # @return true if the model is valid
98
+ def valid?
99
+ return false if @name.nil?
100
+ return false if @_in.nil?
101
+ return false if @value.nil?
102
+ true
103
+ end
104
+
105
+ # Checks equality by comparing each attribute.
106
+ # @param [Object] Object to be compared
107
+ def ==(o)
108
+ return true if self.equal?(o)
109
+ self.class == o.class &&
110
+ name == o.name &&
111
+ _in == o._in &&
112
+ value == o.value
113
+ end
114
+
115
+ # @see the `==` method
116
+ # @param [Object] Object to be compared
117
+ def eql?(o)
118
+ self == o
119
+ end
120
+
121
+ # Calculates hash code according to all attributes.
122
+ # @return [Integer] Hash code
123
+ def hash
124
+ [name, _in, value].hash
125
+ end
126
+
127
+ # Builds the object from hash
128
+ # @param [Hash] attributes Model attributes in the form of hash
129
+ # @return [Object] Returns the model itself
130
+ def self.build_from_hash(attributes)
131
+ new.build_from_hash(attributes)
132
+ end
133
+
134
+ # Builds the object from hash
135
+ # @param [Hash] attributes Model attributes in the form of hash
136
+ # @return [Object] Returns the model itself
137
+ def build_from_hash(attributes)
138
+ return nil unless attributes.is_a?(Hash)
139
+ attributes = attributes.transform_keys(&:to_sym)
140
+ self.class.openapi_types.each_pair do |key, type|
141
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
142
+ self.send("#{key}=", nil)
143
+ elsif type =~ /\AArray<(.*)>/i
144
+ # check to ensure the input is an array given that the attribute
145
+ # is documented as an array but the input is not
146
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
147
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
148
+ end
149
+ elsif !attributes[self.class.attribute_map[key]].nil?
150
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
151
+ end
152
+ end
153
+
154
+ self
155
+ end
156
+
157
+ # Deserializes the data based on type
158
+ # @param string type Data type
159
+ # @param string value Value to be deserialized
160
+ # @return [Object] Deserialized data
161
+ def _deserialize(type, value)
162
+ case type.to_sym
163
+ when :Time
164
+ Time.parse(value)
165
+ when :Date
166
+ Date.parse(value)
167
+ when :String
168
+ value.to_s
169
+ when :Integer
170
+ value.to_i
171
+ when :Float
172
+ value.to_f
173
+ when :Boolean
174
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
175
+ true
176
+ else
177
+ false
178
+ end
179
+ when :Object
180
+ # generic object (usually a Hash), return directly
181
+ value
182
+ when /\AArray<(?<inner_type>.+)>\z/
183
+ inner_type = Regexp.last_match[:inner_type]
184
+ value.map { |v| _deserialize(inner_type, v) }
185
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
186
+ k_type = Regexp.last_match[:k_type]
187
+ v_type = Regexp.last_match[:v_type]
188
+ {}.tap do |hash|
189
+ value.each do |k, v|
190
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
191
+ end
192
+ end
193
+ else # model
194
+ # models (e.g. Pet) or oneOf
195
+ klass = Composio.const_get(type)
196
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
197
+ end
198
+ end
199
+
200
+ # Returns the string representation of the object
201
+ # @return [String] String presentation of the object
202
+ def to_s
203
+ to_hash.to_s
204
+ end
205
+
206
+ # to_body is an alias to to_hash (backward compatibility)
207
+ # @return [Hash] Returns the object in the form of hash
208
+ def to_body
209
+ to_hash
210
+ end
211
+
212
+ # Returns the object in the form of hash
213
+ # @return [Hash] Returns the object in the form of hash
214
+ def to_hash
215
+ hash = {}
216
+ self.class.attribute_map.each_pair do |attr, param|
217
+ value = self.send(attr)
218
+ if value.nil?
219
+ is_nullable = self.class.openapi_nullable.include?(attr)
220
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
221
+ end
222
+
223
+ hash[param] = _to_hash(value)
224
+ end
225
+ hash
226
+ end
227
+
228
+ # Outputs non-array value in the form of hash
229
+ # For object, use to_hash. Otherwise, just return the value
230
+ # @param [Object] value Any valid value
231
+ # @return [Hash] Returns the value in the form of hash
232
+ def _to_hash(value)
233
+ if value.is_a?(Array)
234
+ value.compact.map { |v| _to_hash(v) }
235
+ elsif value.is_a?(Hash)
236
+ {}.tap do |hash|
237
+ value.each { |k, v| hash[k] = _to_hash(v) }
238
+ end
239
+ elsif value.respond_to? :to_hash
240
+ value.to_hash
241
+ else
242
+ value
243
+ end
244
+ end
245
+
246
+ end
247
+
248
+ end
@@ -0,0 +1,38 @@
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 Plan
14
+ HOBBY = "HOBBY".freeze
15
+ STARTER = "STARTER".freeze
16
+ GROWTH = "GROWTH".freeze
17
+ ENTERPRISE = "ENTERPRISE".freeze
18
+
19
+ def self.all_vars
20
+ @all_vars ||= [HOBBY, STARTER, GROWTH, ENTERPRISE].freeze
21
+ end
22
+
23
+ # Builds the enum from string
24
+ # @param [String] The enum value in the form of the string
25
+ # @return [String] The enum value
26
+ def self.build_from_hash(value)
27
+ new.build_from_hash(value)
28
+ end
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ return value if Plan.all_vars.include?(value)
35
+ raise "Invalid ENUM value #{value} for class #Plan"
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,36 @@
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 Role
14
+ ADMIN = "admin".freeze
15
+ DEVELOPER = "developer".freeze
16
+
17
+ def self.all_vars
18
+ @all_vars ||= [ADMIN, DEVELOPER].freeze
19
+ end
20
+
21
+ # Builds the enum from string
22
+ # @param [String] The enum value in the form of the string
23
+ # @return [String] The enum value
24
+ def self.build_from_hash(value)
25
+ new.build_from_hash(value)
26
+ end
27
+
28
+ # Builds the enum from string
29
+ # @param [String] The enum value in the form of the string
30
+ # @return [String] The enum value
31
+ def build_from_hash(value)
32
+ return value if Role.all_vars.include?(value)
33
+ raise "Invalid ENUM value #{value} for class #Role"
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,41 @@
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 State
14
+ PREPROCESS = "preprocess".freeze
15
+ VALIDATE = "validate".freeze
16
+ PREPARE = "prepare".freeze
17
+ BUILD = "build".freeze
18
+ PUSH = "push".freeze
19
+ LOAD = "load".freeze
20
+ FINISH = "finish".freeze
21
+
22
+ def self.all_vars
23
+ @all_vars ||= [PREPROCESS, VALIDATE, PREPARE, BUILD, PUSH, LOAD, FINISH].freeze
24
+ end
25
+
26
+ # Builds the enum from string
27
+ # @param [String] The enum value in the form of the string
28
+ # @return [String] The enum value
29
+ def self.build_from_hash(value)
30
+ new.build_from_hash(value)
31
+ end
32
+
33
+ # Builds the enum from string
34
+ # @param [String] The enum value in the form of the string
35
+ # @return [String] The enum value
36
+ def build_from_hash(value)
37
+ return value if State.all_vars.include?(value)
38
+ raise "Invalid ENUM value #{value} for class #State"
39
+ end
40
+ end
41
+ end
@@ -11,12 +11,15 @@ require 'time'
11
11
 
12
12
  module Composio
13
13
  class Status
14
- ALL = "all".freeze
15
- SUCCESS = "success".freeze
16
- ERROR = "error".freeze
14
+ INITIALIZED = "initialized".freeze
15
+ RUNNING = "running".freeze
16
+ CACHING = "caching".freeze
17
+ CANCELLED = "cancelled".freeze
18
+ FINISHED = "finished".freeze
19
+ EXITED = "exited".freeze
17
20
 
18
21
  def self.all_vars
19
- @all_vars ||= [ALL, SUCCESS, ERROR].freeze
22
+ @all_vars ||= [INITIALIZED, RUNNING, CACHING, CANCELLED, FINISHED, EXITED].freeze
20
23
  end
21
24
 
22
25
  # Builds the enum from string
@@ -0,0 +1,236 @@
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 TConnectionCountDTO
14
+ # Name of the entity
15
+ attr_accessor :client_unique_user_id
16
+
17
+ # Count of connections for the entity
18
+ attr_accessor :count
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'client_unique_user_id' => :'clientUniqueUserId',
24
+ :'count' => :'count'
25
+ }
26
+ end
27
+
28
+ # Returns all the JSON keys this model knows about
29
+ def self.acceptable_attributes
30
+ attribute_map.values
31
+ end
32
+
33
+ # Attribute type mapping.
34
+ def self.openapi_types
35
+ {
36
+ :'client_unique_user_id' => :'String',
37
+ :'count' => :'Float'
38
+ }
39
+ end
40
+
41
+ # List of attributes with nullable: true
42
+ def self.openapi_nullable
43
+ Set.new([
44
+ ])
45
+ end
46
+
47
+ # Initializes the object
48
+ # @param [Hash] attributes Model attributes in the form of hash
49
+ def initialize(attributes = {})
50
+ if (!attributes.is_a?(Hash))
51
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::TConnectionCountDTO` initialize method"
52
+ end
53
+
54
+ # check to see if the attribute exists and convert string to symbol for hash key
55
+ attributes = attributes.each_with_object({}) { |(k, v), h|
56
+ if (!self.class.attribute_map.key?(k.to_sym))
57
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::TConnectionCountDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
58
+ end
59
+ h[k.to_sym] = v
60
+ }
61
+
62
+ if attributes.key?(:'client_unique_user_id')
63
+ self.client_unique_user_id = attributes[:'client_unique_user_id']
64
+ end
65
+
66
+ if attributes.key?(:'count')
67
+ self.count = attributes[:'count']
68
+ end
69
+ end
70
+
71
+ # Show invalid properties with the reasons. Usually used together with valid?
72
+ # @return Array for valid properties with the reasons
73
+ def list_invalid_properties
74
+ invalid_properties = Array.new
75
+ if @client_unique_user_id.nil?
76
+ invalid_properties.push('invalid value for "client_unique_user_id", client_unique_user_id cannot be nil.')
77
+ end
78
+
79
+ if @count.nil?
80
+ invalid_properties.push('invalid value for "count", count cannot be nil.')
81
+ end
82
+
83
+ invalid_properties
84
+ end
85
+
86
+ # Check to see if the all the properties in the model are valid
87
+ # @return true if the model is valid
88
+ def valid?
89
+ return false if @client_unique_user_id.nil?
90
+ return false if @count.nil?
91
+ true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ client_unique_user_id == o.client_unique_user_id &&
100
+ count == o.count
101
+ end
102
+
103
+ # @see the `==` method
104
+ # @param [Object] Object to be compared
105
+ def eql?(o)
106
+ self == o
107
+ end
108
+
109
+ # Calculates hash code according to all attributes.
110
+ # @return [Integer] Hash code
111
+ def hash
112
+ [client_unique_user_id, count].hash
113
+ end
114
+
115
+ # Builds the object from hash
116
+ # @param [Hash] attributes Model attributes in the form of hash
117
+ # @return [Object] Returns the model itself
118
+ def self.build_from_hash(attributes)
119
+ new.build_from_hash(attributes)
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ attributes = attributes.transform_keys(&:to_sym)
128
+ self.class.openapi_types.each_pair do |key, type|
129
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
130
+ self.send("#{key}=", nil)
131
+ elsif type =~ /\AArray<(.*)>/i
132
+ # check to ensure the input is an array given that the attribute
133
+ # is documented as an array but the input is not
134
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
135
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
136
+ end
137
+ elsif !attributes[self.class.attribute_map[key]].nil?
138
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
139
+ end
140
+ end
141
+
142
+ self
143
+ end
144
+
145
+ # Deserializes the data based on type
146
+ # @param string type Data type
147
+ # @param string value Value to be deserialized
148
+ # @return [Object] Deserialized data
149
+ def _deserialize(type, value)
150
+ case type.to_sym
151
+ when :Time
152
+ Time.parse(value)
153
+ when :Date
154
+ Date.parse(value)
155
+ when :String
156
+ value.to_s
157
+ when :Integer
158
+ value.to_i
159
+ when :Float
160
+ value.to_f
161
+ when :Boolean
162
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
163
+ true
164
+ else
165
+ false
166
+ end
167
+ when :Object
168
+ # generic object (usually a Hash), return directly
169
+ value
170
+ when /\AArray<(?<inner_type>.+)>\z/
171
+ inner_type = Regexp.last_match[:inner_type]
172
+ value.map { |v| _deserialize(inner_type, v) }
173
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
174
+ k_type = Regexp.last_match[:k_type]
175
+ v_type = Regexp.last_match[:v_type]
176
+ {}.tap do |hash|
177
+ value.each do |k, v|
178
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
179
+ end
180
+ end
181
+ else # model
182
+ # models (e.g. Pet) or oneOf
183
+ klass = Composio.const_get(type)
184
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
185
+ end
186
+ end
187
+
188
+ # Returns the string representation of the object
189
+ # @return [String] String presentation of the object
190
+ def to_s
191
+ to_hash.to_s
192
+ end
193
+
194
+ # to_body is an alias to to_hash (backward compatibility)
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_body
197
+ to_hash
198
+ end
199
+
200
+ # Returns the object in the form of hash
201
+ # @return [Hash] Returns the object in the form of hash
202
+ def to_hash
203
+ hash = {}
204
+ self.class.attribute_map.each_pair do |attr, param|
205
+ value = self.send(attr)
206
+ if value.nil?
207
+ is_nullable = self.class.openapi_nullable.include?(attr)
208
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
209
+ end
210
+
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map { |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end