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