composio 0.1.16 → 0.1.18

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e1f673010f5983ed84f65eb441b2466f317d07d77244b511894e6f2e40f80681
4
- data.tar.gz: dcd7f748a3c92eb6692e44fd9d5229aecc568b6a7a98adff7bcfa34454b37f6d
3
+ metadata.gz: 7e159e04da778db5183ba972a5bcddcec90b4a285b9a458f387b78665f54f72c
4
+ data.tar.gz: 6d044064e6b05b7fa669c46ac11955677f525cb50b14aa1f7460d384113e0ef7
5
5
  SHA512:
6
- metadata.gz: 71fdf691f8a7ea5f93450f047588b68f88ba47c03bec389fcf0f70a4bf81f58be822a1371366ab824a0dd352cbad7629e66d91f963c897fcea423a021f7be513
7
- data.tar.gz: 1772b5d2c93f09c8f83cdf8d798adcdb682d3035b6cf841400bc6c78f7c76ad9090d35874441a706b7190e7eda5830bb03d0dac347bcf8f6286907c68e95b180
6
+ metadata.gz: 3998260f127abb9d6e74165619c208e82405e3981cb765f76523fb1fc2c4f18aeb37c9dbfb07eb44ed2c9a177b1eb1a798b57a3603288a6cd5a8198a1c339c50
7
+ data.tar.gz: e1054a76db9bc3fc4fdd95070991abf618e4691660f997cc1531bd095db11345ea3382ec40dcdcf832323990fe9c3981488d783c78f4a84451e46c407847c94d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- composio (0.1.16)
4
+ composio (0.1.18)
5
5
  faraday (>= 1.0.1, < 3.0)
6
6
  faraday-multipart (~> 1.0, >= 1.0.4)
7
7
 
@@ -67,7 +67,7 @@ GEM
67
67
  rubocop-ast (>= 1.2.0, < 2.0)
68
68
  ruby-progressbar (~> 1.7)
69
69
  unicode-display_width (>= 1.4.0, < 3.0)
70
- rubocop-ast (1.34.1)
70
+ rubocop-ast (1.36.1)
71
71
  parser (>= 3.3.1.0)
72
72
  ruby-progressbar (1.13.0)
73
73
  ruby2_keywords (0.0.5)
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  Composio SDK: Equip your agent with high-quality tools and build your real-world usecase
8
8
 
9
- [![npm](https://img.shields.io/badge/gem-v0.1.16-blue)](https://rubygems.org/gems/composio/versions/0.1.16)
9
+ [![npm](https://img.shields.io/badge/gem-v0.1.18-blue)](https://rubygems.org/gems/composio/versions/0.1.18)
10
10
  [![More Info](https://img.shields.io/badge/More%20Info-Click%20Here-orange)](https://composio.dev)
11
11
 
12
12
  </div>
@@ -77,7 +77,7 @@ Composio SDK: Equip your agent with high-quality tools and build your real-world
77
77
  Add to Gemfile:
78
78
 
79
79
  ```ruby
80
- gem 'composio', '~> 0.1.16'
80
+ gem 'composio', '~> 0.1.18'
81
81
  ```
82
82
 
83
83
  ## Getting Started<a id="getting-started"></a>
@@ -214,7 +214,7 @@ result = composio.actions.execute(
214
214
  "parameters" => [
215
215
  {
216
216
  "name" => "name_example",
217
- "_in" => "_in_example",
217
+ "_in" => "query",
218
218
  "value" => "value_example",
219
219
  }
220
220
  ],
@@ -260,16 +260,38 @@ Execute an action with direct auth.
260
260
 
261
261
  ```ruby
262
262
  result = composio.actions.execute_action_proxy(
263
- endpoint: "endpoint_example",
264
- connected_account_id: "connectedAccountId_example",
263
+ parameters: [
264
+ {
265
+ "name" => "name_example",
266
+ "_in" => "query",
267
+ "value" => "value_example",
268
+ }
269
+ ],
270
+ connected_account_id: "string_example",
271
+ endpoint: "string_example",
272
+ method: "GET",
273
+ body: {},
265
274
  )
266
275
  p result
267
276
  ```
268
277
 
269
278
  #### ⚙️ Parameters<a id="⚙️-parameters"></a>
270
279
 
280
+ ##### parameters: Array<[`Parameter`](./lib/composio/models/parameter.rb)><a id="parameters-array"></a>
281
+ ##### connectedAccountId: `String`<a id="connectedaccountid-string"></a>
282
+ The connected account uuid to use for the action.
283
+
271
284
  ##### endpoint: `String`<a id="endpoint-string"></a>
272
- ##### connected_account_id: `String`<a id="connected_account_id-string"></a>
285
+ The endpoint to call for the action. If the given url is relative, it will be
286
+ resolved relative to the base_url set in the connected account info.
287
+
288
+ ##### method: [`Method`](./lib/composio/models/method.rb)<a id="method-methodlibcomposiomodelsmethodrb"></a>
289
+ The HTTP method to use for the action.
290
+
291
+ ##### body: `Object`<a id="body-object"></a>
292
+ The body to be sent to the endpoint. This can either be a JSON field or a
293
+ string.
294
+
273
295
  #### 🔄 Return<a id="🔄-return"></a>
274
296
 
275
297
  [ActionExecutionResDto](./lib/composio/models/action_execution_res_dto.rb)
@@ -322,6 +344,8 @@ Get the inputs for an action with NLA
322
344
  result = composio.actions.get_action_inputs(
323
345
  text: "string_example",
324
346
  action_id: "'+j>6",
347
+ custom_description: "string_example",
348
+ system_prompt: "string_example",
325
349
  )
326
350
  p result
327
351
  ```
@@ -330,6 +354,8 @@ p result
330
354
 
331
355
  ##### text: `String`<a id="text-string"></a>
332
356
  ##### action_id: `String`<a id="action_id-string"></a>
357
+ ##### customDescription: `String`<a id="customdescription-string"></a>
358
+ ##### systemPrompt: `String`<a id="systemprompt-string"></a>
333
359
  #### 🌐 Endpoint<a id="🌐-endpoint"></a>
334
360
 
335
361
  `/api/v2/actions/{actionId}/execute/get.inputs` `POST`
@@ -163,11 +163,22 @@ module Composio
163
163
  #
164
164
  # Execute an action with direct auth.
165
165
  #
166
- # @param endpoint [String]
167
- # @param connected_account_id [String]
166
+ # @param parameters [Array<Parameter>]
167
+ # @param connected_account_id [String] The connected account uuid to use for the action.
168
+ # @param endpoint [String] The endpoint to call for the action. If the given url is relative, it will be resolved relative to the base_url set in the connected account info.
169
+ # @param method [Method] The HTTP method to use for the action.
170
+ # @param body [Object] The body to be sent to the endpoint. This can either be a JSON field or a string.
171
+ # @param body [ActionProxyRequestConfigDTO]
168
172
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
169
- def execute_action_proxy(endpoint:, connected_account_id:, extra: {})
170
- api_response = execute_action_proxy_with_http_info_impl(endpoint, connected_account_id, extra)
173
+ def execute_action_proxy(parameters:, connected_account_id:, endpoint:, method:, body: SENTINEL, extra: {})
174
+ _body = {}
175
+ _body[:parameters] = parameters if parameters != SENTINEL
176
+ _body[:connectedAccountId] = connected_account_id if connected_account_id != SENTINEL
177
+ _body[:endpoint] = endpoint if endpoint != SENTINEL
178
+ _body[:method] = method if method != SENTINEL
179
+ _body[:body] = body if body != SENTINEL
180
+ extra[:action_proxy_request_config_dto] = _body if !_body.empty?
181
+ api_response = execute_action_proxy_with_http_info_impl(extra)
171
182
  api_response.data
172
183
  end
173
184
 
@@ -175,60 +186,64 @@ module Composio
175
186
  #
176
187
  # Execute an action with direct auth.
177
188
  #
178
- # @param endpoint [String]
179
- # @param connected_account_id [String]
189
+ # @param parameters [Array<Parameter>]
190
+ # @param connected_account_id [String] The connected account uuid to use for the action.
191
+ # @param endpoint [String] The endpoint to call for the action. If the given url is relative, it will be resolved relative to the base_url set in the connected account info.
192
+ # @param method [Method] The HTTP method to use for the action.
193
+ # @param body [Object] The body to be sent to the endpoint. This can either be a JSON field or a string.
194
+ # @param body [ActionProxyRequestConfigDTO]
180
195
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
181
- def execute_action_proxy_with_http_info(endpoint:, connected_account_id:, extra: {})
182
- execute_action_proxy_with_http_info_impl(endpoint, connected_account_id, extra)
196
+ def execute_action_proxy_with_http_info(parameters:, connected_account_id:, endpoint:, method:, body: SENTINEL, extra: {})
197
+ _body = {}
198
+ _body[:parameters] = parameters if parameters != SENTINEL
199
+ _body[:connectedAccountId] = connected_account_id if connected_account_id != SENTINEL
200
+ _body[:endpoint] = endpoint if endpoint != SENTINEL
201
+ _body[:method] = method if method != SENTINEL
202
+ _body[:body] = body if body != SENTINEL
203
+ extra[:action_proxy_request_config_dto] = _body if !_body.empty?
204
+ execute_action_proxy_with_http_info_impl(extra)
183
205
  end
184
206
 
185
207
  # Execute action proxy
186
208
  # Execute an action with direct auth.
187
- # @param endpoint [String]
188
- # @param connected_account_id [String]
189
209
  # @param [Hash] opts the optional parameters
210
+ # @option opts [ActionProxyRequestConfigDTO] :action_proxy_request_config_dto ActionProxyRequestConfigDTO
190
211
  # @return [ActionExecutionResDto]
191
- private def execute_action_proxy_impl(endpoint, connected_account_id, opts = {})
192
- data, _status_code, _headers = execute_action_proxy_with_http_info(endpoint, connected_account_id, opts)
212
+ private def execute_action_proxy_impl(opts = {})
213
+ data, _status_code, _headers = execute_action_proxy_with_http_info(opts)
193
214
  data
194
215
  end
195
216
 
196
217
  # Execute action proxy
197
218
  # Execute an action with direct auth.
198
- # @param endpoint [String]
199
- # @param connected_account_id [String]
200
219
  # @param [Hash] opts the optional parameters
220
+ # @option opts [ActionProxyRequestConfigDTO] :action_proxy_request_config_dto ActionProxyRequestConfigDTO
201
221
  # @return [APIResponse] data is ActionExecutionResDto, status code, headers and response
202
- private def execute_action_proxy_with_http_info_impl(endpoint, connected_account_id, opts = {})
222
+ private def execute_action_proxy_with_http_info_impl(opts = {})
203
223
  if @api_client.config.debugging
204
224
  @api_client.config.logger.debug 'Calling API: ActionsApi.execute_action_proxy ...'
205
225
  end
206
- # verify the required parameter 'endpoint' is set
207
- if @api_client.config.client_side_validation && endpoint.nil?
208
- fail ArgumentError, "Missing the required parameter 'endpoint' when calling ActionsApi.execute_action_proxy"
209
- end
210
- # verify the required parameter 'connected_account_id' is set
211
- if @api_client.config.client_side_validation && connected_account_id.nil?
212
- fail ArgumentError, "Missing the required parameter 'connected_account_id' when calling ActionsApi.execute_action_proxy"
213
- end
214
226
  # resource path
215
227
  local_var_path = '/api/v2/actions/proxy'
216
228
 
217
229
  # query parameters
218
230
  query_params = opts[:query_params] || {}
219
- query_params[:'endpoint'] = endpoint
220
- query_params[:'connectedAccountId'] = connected_account_id
221
231
 
222
232
  # header parameters
223
233
  header_params = opts[:header_params] || {}
224
234
  # HTTP header 'Accept' (if needed)
225
235
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
236
+ # HTTP header 'Content-Type'
237
+ content_type = @api_client.select_header_content_type(['application/json'])
238
+ if !content_type.nil?
239
+ header_params['Content-Type'] = content_type
240
+ end
226
241
 
227
242
  # form parameters
228
243
  form_params = opts[:form_params] || {}
229
244
 
230
245
  # http body (model)
231
- post_body = opts[:debug_body]
246
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'action_proxy_request_config_dto'])
232
247
 
233
248
  # return_type
234
249
  return_type = opts[:debug_return_type] || 'ActionExecutionResDto'
@@ -350,11 +365,15 @@ module Composio
350
365
  #
351
366
  # @param text [String]
352
367
  # @param action_id [String]
368
+ # @param custom_description [String]
369
+ # @param system_prompt [String]
353
370
  # @param body [ActionGetNLAInputsReqDTO]
354
371
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
355
- def get_action_inputs(text:, action_id:, extra: {})
372
+ def get_action_inputs(text:, action_id:, custom_description: SENTINEL, system_prompt: SENTINEL, extra: {})
356
373
  _body = {}
357
374
  _body[:text] = text if text != SENTINEL
375
+ _body[:customDescription] = custom_description if custom_description != SENTINEL
376
+ _body[:systemPrompt] = system_prompt if system_prompt != SENTINEL
358
377
  extra[:action_get_nla_inputs_req_dto] = _body if !_body.empty?
359
378
  api_response = get_action_inputs_with_http_info_impl(action_id, extra)
360
379
  api_response.data
@@ -366,11 +385,15 @@ module Composio
366
385
  #
367
386
  # @param text [String]
368
387
  # @param action_id [String]
388
+ # @param custom_description [String]
389
+ # @param system_prompt [String]
369
390
  # @param body [ActionGetNLAInputsReqDTO]
370
391
  # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name
371
- def get_action_inputs_with_http_info(text:, action_id:, extra: {})
392
+ def get_action_inputs_with_http_info(text:, action_id:, custom_description: SENTINEL, system_prompt: SENTINEL, extra: {})
372
393
  _body = {}
373
394
  _body[:text] = text if text != SENTINEL
395
+ _body[:customDescription] = custom_description if custom_description != SENTINEL
396
+ _body[:systemPrompt] = system_prompt if system_prompt != SENTINEL
374
397
  extra[:action_get_nla_inputs_req_dto] = _body if !_body.empty?
375
398
  get_action_inputs_with_http_info_impl(action_id, extra)
376
399
  end
@@ -13,10 +13,16 @@ module Composio
13
13
  class ActionGetNLAInputsReqDTO
14
14
  attr_accessor :text
15
15
 
16
+ attr_accessor :custom_description
17
+
18
+ attr_accessor :system_prompt
19
+
16
20
  # Attribute mapping from ruby-style variable name to JSON key.
17
21
  def self.attribute_map
18
22
  {
19
- :'text' => :'text'
23
+ :'text' => :'text',
24
+ :'custom_description' => :'customDescription',
25
+ :'system_prompt' => :'systemPrompt'
20
26
  }
21
27
  end
22
28
 
@@ -28,7 +34,9 @@ module Composio
28
34
  # Attribute type mapping.
29
35
  def self.openapi_types
30
36
  {
31
- :'text' => :'String'
37
+ :'text' => :'String',
38
+ :'custom_description' => :'String',
39
+ :'system_prompt' => :'String'
32
40
  }
33
41
  end
34
42
 
@@ -56,6 +64,14 @@ module Composio
56
64
  if attributes.key?(:'text')
57
65
  self.text = attributes[:'text']
58
66
  end
67
+
68
+ if attributes.key?(:'custom_description')
69
+ self.custom_description = attributes[:'custom_description']
70
+ end
71
+
72
+ if attributes.key?(:'system_prompt')
73
+ self.system_prompt = attributes[:'system_prompt']
74
+ end
59
75
  end
60
76
 
61
77
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -81,7 +97,9 @@ module Composio
81
97
  def ==(o)
82
98
  return true if self.equal?(o)
83
99
  self.class == o.class &&
84
- text == o.text
100
+ text == o.text &&
101
+ custom_description == o.custom_description &&
102
+ system_prompt == o.system_prompt
85
103
  end
86
104
 
87
105
  # @see the `==` method
@@ -93,7 +111,7 @@ module Composio
93
111
  # Calculates hash code according to all attributes.
94
112
  # @return [Integer] Hash code
95
113
  def hash
96
- [text].hash
114
+ [text, custom_description, system_prompt].hash
97
115
  end
98
116
 
99
117
  # Builds the object from hash
@@ -0,0 +1,277 @@
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 ActionProxyRequestConfigDTO
14
+ attr_accessor :parameters
15
+
16
+ # The connected account uuid to use for the action.
17
+ attr_accessor :connected_account_id
18
+
19
+ # The endpoint to call for the action. If the given url is relative, it will be resolved relative to the base_url set in the connected account info.
20
+ attr_accessor :endpoint
21
+
22
+ # The HTTP method to use for the action.
23
+ attr_accessor :method
24
+
25
+ # The body to be sent to the endpoint. This can either be a JSON field or a string.
26
+ attr_accessor :body
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'parameters' => :'parameters',
32
+ :'connected_account_id' => :'connectedAccountId',
33
+ :'endpoint' => :'endpoint',
34
+ :'method' => :'method',
35
+ :'body' => :'body'
36
+ }
37
+ end
38
+
39
+ # Returns all the JSON keys this model knows about
40
+ def self.acceptable_attributes
41
+ attribute_map.values
42
+ end
43
+
44
+ # Attribute type mapping.
45
+ def self.openapi_types
46
+ {
47
+ :'parameters' => :'Array<Parameter>',
48
+ :'connected_account_id' => :'String',
49
+ :'endpoint' => :'String',
50
+ :'method' => :'Method',
51
+ :'body' => :'Object'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::ActionProxyRequestConfigDTO` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::ActionProxyRequestConfigDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'parameters')
77
+ if (value = attributes[:'parameters']).is_a?(Array)
78
+ self.parameters = value
79
+ end
80
+ end
81
+
82
+ if attributes.key?(:'connected_account_id')
83
+ self.connected_account_id = attributes[:'connected_account_id']
84
+ end
85
+
86
+ if attributes.key?(:'endpoint')
87
+ self.endpoint = attributes[:'endpoint']
88
+ end
89
+
90
+ if attributes.key?(:'method')
91
+ self.method = attributes[:'method']
92
+ end
93
+
94
+ if attributes.key?(:'body')
95
+ self.body = attributes[:'body']
96
+ end
97
+ end
98
+
99
+ # Show invalid properties with the reasons. Usually used together with valid?
100
+ # @return Array for valid properties with the reasons
101
+ def list_invalid_properties
102
+ invalid_properties = Array.new
103
+ if @parameters.nil?
104
+ invalid_properties.push('invalid value for "parameters", parameters cannot be nil.')
105
+ end
106
+
107
+ if @connected_account_id.nil?
108
+ invalid_properties.push('invalid value for "connected_account_id", connected_account_id cannot be nil.')
109
+ end
110
+
111
+ if @endpoint.nil?
112
+ invalid_properties.push('invalid value for "endpoint", endpoint cannot be nil.')
113
+ end
114
+
115
+ if @method.nil?
116
+ invalid_properties.push('invalid value for "method", method cannot be nil.')
117
+ end
118
+
119
+ invalid_properties
120
+ end
121
+
122
+ # Check to see if the all the properties in the model are valid
123
+ # @return true if the model is valid
124
+ def valid?
125
+ return false if @parameters.nil?
126
+ return false if @connected_account_id.nil?
127
+ return false if @endpoint.nil?
128
+ return false if @method.nil?
129
+ true
130
+ end
131
+
132
+ # Checks equality by comparing each attribute.
133
+ # @param [Object] Object to be compared
134
+ def ==(o)
135
+ return true if self.equal?(o)
136
+ self.class == o.class &&
137
+ parameters == o.parameters &&
138
+ connected_account_id == o.connected_account_id &&
139
+ endpoint == o.endpoint &&
140
+ method == o.method &&
141
+ body == o.body
142
+ end
143
+
144
+ # @see the `==` method
145
+ # @param [Object] Object to be compared
146
+ def eql?(o)
147
+ self == o
148
+ end
149
+
150
+ # Calculates hash code according to all attributes.
151
+ # @return [Integer] Hash code
152
+ def hash
153
+ [parameters, connected_account_id, endpoint, method, body].hash
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def self.build_from_hash(attributes)
160
+ new.build_from_hash(attributes)
161
+ end
162
+
163
+ # Builds the object from hash
164
+ # @param [Hash] attributes Model attributes in the form of hash
165
+ # @return [Object] Returns the model itself
166
+ def build_from_hash(attributes)
167
+ return nil unless attributes.is_a?(Hash)
168
+ attributes = attributes.transform_keys(&:to_sym)
169
+ self.class.openapi_types.each_pair do |key, type|
170
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
171
+ self.send("#{key}=", nil)
172
+ elsif type =~ /\AArray<(.*)>/i
173
+ # check to ensure the input is an array given that the attribute
174
+ # is documented as an array but the input is not
175
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
176
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
177
+ end
178
+ elsif !attributes[self.class.attribute_map[key]].nil?
179
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
180
+ end
181
+ end
182
+
183
+ self
184
+ end
185
+
186
+ # Deserializes the data based on type
187
+ # @param string type Data type
188
+ # @param string value Value to be deserialized
189
+ # @return [Object] Deserialized data
190
+ def _deserialize(type, value)
191
+ case type.to_sym
192
+ when :Time
193
+ Time.parse(value)
194
+ when :Date
195
+ Date.parse(value)
196
+ when :String
197
+ value.to_s
198
+ when :Integer
199
+ value.to_i
200
+ when :Float
201
+ value.to_f
202
+ when :Boolean
203
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
204
+ true
205
+ else
206
+ false
207
+ end
208
+ when :Object
209
+ # generic object (usually a Hash), return directly
210
+ value
211
+ when /\AArray<(?<inner_type>.+)>\z/
212
+ inner_type = Regexp.last_match[:inner_type]
213
+ value.map { |v| _deserialize(inner_type, v) }
214
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
215
+ k_type = Regexp.last_match[:k_type]
216
+ v_type = Regexp.last_match[:v_type]
217
+ {}.tap do |hash|
218
+ value.each do |k, v|
219
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
220
+ end
221
+ end
222
+ else # model
223
+ # models (e.g. Pet) or oneOf
224
+ klass = Composio.const_get(type)
225
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
226
+ end
227
+ end
228
+
229
+ # Returns the string representation of the object
230
+ # @return [String] String presentation of the object
231
+ def to_s
232
+ to_hash.to_s
233
+ end
234
+
235
+ # to_body is an alias to to_hash (backward compatibility)
236
+ # @return [Hash] Returns the object in the form of hash
237
+ def to_body
238
+ to_hash
239
+ end
240
+
241
+ # Returns the object in the form of hash
242
+ # @return [Hash] Returns the object in the form of hash
243
+ def to_hash
244
+ hash = {}
245
+ self.class.attribute_map.each_pair do |attr, param|
246
+ value = self.send(attr)
247
+ if value.nil?
248
+ is_nullable = self.class.openapi_nullable.include?(attr)
249
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
250
+ end
251
+
252
+ hash[param] = _to_hash(value)
253
+ end
254
+ hash
255
+ end
256
+
257
+ # Outputs non-array value in the form of hash
258
+ # For object, use to_hash. Otherwise, just return the value
259
+ # @param [Object] value Any valid value
260
+ # @return [Hash] Returns the value in the form of hash
261
+ def _to_hash(value)
262
+ if value.is_a?(Array)
263
+ value.compact.map { |v| _to_hash(v) }
264
+ elsif value.is_a?(Hash)
265
+ {}.tap do |hash|
266
+ value.each { |k, v| hash[k] = _to_hash(v) }
267
+ end
268
+ elsif value.respond_to? :to_hash
269
+ value.to_hash
270
+ else
271
+ value
272
+ end
273
+ end
274
+
275
+ end
276
+
277
+ end