composio 0.1.15 → 0.1.17

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +4 -4
  3. data/README.md +250 -202
  4. data/lib/composio/api/actions_api.rb +201 -6
  5. data/lib/composio/api/admin_api.rb +78 -0
  6. data/lib/composio/api/auth_api.rb +77 -0
  7. data/lib/composio/api/cli_api.rb +266 -0
  8. data/lib/composio/api/connections_api.rb +124 -6
  9. data/lib/composio/api/event_logs_api.rb +0 -318
  10. data/lib/composio/api/integrations_api.rb +8 -4
  11. data/lib/composio/api/logs_api.rb +19 -4
  12. data/lib/composio/api/triggers_api.rb +9 -2
  13. data/lib/composio/models/action_execution_req_dto.rb +31 -4
  14. data/lib/composio/models/action_get_nla_inputs_req_dto.rb +22 -4
  15. data/lib/composio/models/actions_query_dto.rb +22 -4
  16. data/lib/composio/models/app_query_dto.rb +1 -1
  17. data/lib/composio/models/client_dto.rb +374 -0
  18. data/lib/composio/models/client_dto_created_at.rb +102 -0
  19. data/lib/composio/models/client_dto_last_subscribed_at.rb +102 -0
  20. data/lib/composio/models/client_dto_updated_at.rb +102 -0
  21. data/lib/composio/models/client_info_res_dto.rb +235 -0
  22. data/lib/composio/models/connection_params.rb +15 -4
  23. data/lib/composio/models/connection_with_app_data.rb +15 -4
  24. data/lib/composio/models/create_connector_payload_dto.rb +12 -7
  25. data/lib/composio/models/expected_input_fields_dto.rb +346 -0
  26. data/lib/composio/models/get_connections_query_dto.rb +15 -4
  27. data/lib/composio/models/get_connector_info_res_dto.rb +1 -1
  28. data/lib/composio/models/get_logs_dto.rb +14 -4
  29. data/lib/composio/models/ingest_data_dto.rb +21 -1
  30. data/lib/composio/models/initiate_connection_payload_dto.rb +19 -18
  31. data/lib/composio/models/list_triggers_query_dto.rb +11 -1
  32. data/lib/composio/models/sdk_error_res_dto.rb +221 -0
  33. data/lib/composio/models/session_info_dto.rb +224 -0
  34. data/lib/composio/models/tools_execute_req_dto.rb +22 -4
  35. data/lib/composio/models/trigger_response_dto.rb +14 -4
  36. data/lib/composio/models/update_connection_labels_payload_dto.rb +222 -0
  37. data/lib/composio/version.rb +1 -1
  38. data/lib/composio.rb +12 -3
  39. data/spec/api/actions_api_spec.rb +25 -0
  40. data/spec/api/admin_api_spec.rb +11 -0
  41. data/spec/api/auth_api_spec.rb +11 -0
  42. data/spec/api/cli_api_spec.rb +63 -0
  43. data/spec/api/connections_api_spec.rb +14 -0
  44. data/spec/api/event_logs_api_spec.rb +0 -43
  45. data/spec/api/logs_api_spec.rb +1 -0
  46. data/spec/api/triggers_api_spec.rb +1 -0
  47. data/spec/models/action_execution_req_dto_spec.rb +18 -0
  48. data/spec/models/action_get_nla_inputs_req_dto_spec.rb +12 -0
  49. data/spec/models/actions_query_dto_spec.rb +12 -0
  50. data/spec/models/client_dto_created_at_spec.rb +25 -0
  51. data/spec/models/client_dto_last_subscribed_at_spec.rb +25 -0
  52. data/spec/models/client_dto_spec.rb +100 -0
  53. data/spec/models/client_dto_updated_at_spec.rb +25 -0
  54. data/spec/models/client_info_res_dto_spec.rb +34 -0
  55. data/spec/models/connection_params_spec.rb +6 -0
  56. data/spec/models/connection_with_app_data_spec.rb +6 -0
  57. data/spec/models/create_connector_payload_dto_spec.rb +6 -0
  58. data/spec/models/expected_input_fields_dto_spec.rb +82 -0
  59. data/spec/models/get_connections_query_dto_spec.rb +6 -0
  60. data/spec/models/get_logs_dto_spec.rb +6 -0
  61. data/spec/models/ingest_data_dto_spec.rb +12 -0
  62. data/spec/models/initiate_connection_payload_dto_spec.rb +6 -0
  63. data/spec/models/list_triggers_query_dto_spec.rb +6 -0
  64. data/spec/models/sdk_error_res_dto_spec.rb +28 -0
  65. data/spec/models/session_info_dto_spec.rb +34 -0
  66. data/spec/models/tools_execute_req_dto_spec.rb +12 -0
  67. data/spec/models/trigger_response_dto_spec.rb +6 -0
  68. data/spec/models/update_connection_labels_payload_dto_spec.rb +28 -0
  69. metadata +32 -4
  70. data/spec/api/payment_api_spec.rb +0 -83
@@ -0,0 +1,102 @@
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
+ # Last update timestamp
14
+ module ClientDTOUpdatedAt
15
+ class << self
16
+ # List of class defined in oneOf (OpenAPI v3)
17
+ def openapi_one_of
18
+ [
19
+ :'Date',
20
+ :'Time'
21
+ ]
22
+ end
23
+
24
+ # Builds the object
25
+ # @param [Mixed] Data to be matched against the list of oneOf items
26
+ # @return [Object] Returns the model or the data itself
27
+ def build(data)
28
+ # Go through the list of oneOf items and attempt to identify the appropriate one.
29
+ # Note:
30
+ # - We do not attempt to check whether exactly one item matches.
31
+ # - No advanced validation of types in some cases (e.g. "x: { type: string }" will happily match { x: 123 })
32
+ # due to the way the deserialization is made in the base_object template (it just casts without verifying).
33
+ # - TODO: scalar values are de facto behaving as if they were nullable.
34
+ # - TODO: logging when debugging is set.
35
+ openapi_one_of.each do |klass|
36
+ begin
37
+ next if klass == :AnyType # "nullable: true"
38
+ typed_data = find_and_cast_into_type(klass, data)
39
+ return typed_data if typed_data
40
+ rescue # rescue all errors so we keep iterating even if the current item lookup raises
41
+ end
42
+ end
43
+
44
+ openapi_one_of.include?(:AnyType) ? data : nil
45
+ end
46
+
47
+ private
48
+
49
+ SchemaMismatchError = Class.new(StandardError)
50
+
51
+ # Note: 'File' is missing here because in the regular case we get the data _after_ a call to JSON.parse.
52
+ def find_and_cast_into_type(klass, data)
53
+ return if data.nil?
54
+
55
+ case klass.to_s
56
+ when 'Boolean'
57
+ return data if data.instance_of?(TrueClass) || data.instance_of?(FalseClass)
58
+ when 'Float'
59
+ return data if data.instance_of?(Float)
60
+ when 'Integer'
61
+ return data if data.instance_of?(Integer)
62
+ when 'Time'
63
+ return Time.parse(data)
64
+ when 'Date'
65
+ return Date.parse(data)
66
+ when 'String'
67
+ return data if data.instance_of?(String)
68
+ when 'Object' # "type: object"
69
+ return data if data.instance_of?(Hash)
70
+ when /\AArray<(?<sub_type>.+)>\z/ # "type: array"
71
+ if data.instance_of?(Array)
72
+ sub_type = Regexp.last_match[:sub_type]
73
+ return data.map { |item| find_and_cast_into_type(sub_type, item) }
74
+ end
75
+ when /\AHash<String, (?<sub_type>.+)>\z/ # "type: object" with "additionalProperties: { ... }"
76
+ if data.instance_of?(Hash) && data.keys.all? { |k| k.instance_of?(Symbol) || k.instance_of?(String) }
77
+ sub_type = Regexp.last_match[:sub_type]
78
+ return data.each_with_object({}) { |(k, v), hsh| hsh[k] = find_and_cast_into_type(sub_type, v) }
79
+ end
80
+ else # model
81
+ const = Composio.const_get(klass)
82
+ if const
83
+ if const.respond_to?(:openapi_one_of) # nested oneOf model
84
+ model = const.build(data)
85
+ return model if model
86
+ else
87
+ # raise if data contains keys that are not known to the model
88
+ raise unless (data.keys - const.acceptable_attributes).empty?
89
+ model = const.build_from_hash(data)
90
+ return model if model && model.valid?
91
+ end
92
+ end
93
+ end
94
+
95
+ raise # if no match by now, raise
96
+ rescue
97
+ raise SchemaMismatchError, "#{data} doesn't match the #{klass} type"
98
+ end
99
+ end
100
+ end
101
+
102
+ end
@@ -0,0 +1,235 @@
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 ClientInfoResDTO
14
+ attr_accessor :client
15
+
16
+ # API key of the client
17
+ attr_accessor :api_key
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'client' => :'client',
23
+ :'api_key' => :'apiKey'
24
+ }
25
+ end
26
+
27
+ # Returns all the JSON keys this model knows about
28
+ def self.acceptable_attributes
29
+ attribute_map.values
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'client' => :'ClientDTO',
36
+ :'api_key' => :'String'
37
+ }
38
+ end
39
+
40
+ # List of attributes with nullable: true
41
+ def self.openapi_nullable
42
+ Set.new([
43
+ ])
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ if (!attributes.is_a?(Hash))
50
+ fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::ClientInfoResDTO` initialize method"
51
+ end
52
+
53
+ # check to see if the attribute exists and convert string to symbol for hash key
54
+ attributes = attributes.each_with_object({}) { |(k, v), h|
55
+ if (!self.class.attribute_map.key?(k.to_sym))
56
+ fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::ClientInfoResDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
57
+ end
58
+ h[k.to_sym] = v
59
+ }
60
+
61
+ if attributes.key?(:'client')
62
+ self.client = attributes[:'client']
63
+ end
64
+
65
+ if attributes.key?(:'api_key')
66
+ self.api_key = attributes[:'api_key']
67
+ end
68
+ end
69
+
70
+ # Show invalid properties with the reasons. Usually used together with valid?
71
+ # @return Array for valid properties with the reasons
72
+ def list_invalid_properties
73
+ invalid_properties = Array.new
74
+ if @client.nil?
75
+ invalid_properties.push('invalid value for "client", client cannot be nil.')
76
+ end
77
+
78
+ if @api_key.nil?
79
+ invalid_properties.push('invalid value for "api_key", api_key cannot be nil.')
80
+ end
81
+
82
+ invalid_properties
83
+ end
84
+
85
+ # Check to see if the all the properties in the model are valid
86
+ # @return true if the model is valid
87
+ def valid?
88
+ return false if @client.nil?
89
+ return false if @api_key.nil?
90
+ true
91
+ end
92
+
93
+ # Checks equality by comparing each attribute.
94
+ # @param [Object] Object to be compared
95
+ def ==(o)
96
+ return true if self.equal?(o)
97
+ self.class == o.class &&
98
+ client == o.client &&
99
+ api_key == o.api_key
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [client, api_key].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ attributes = attributes.transform_keys(&:to_sym)
127
+ self.class.openapi_types.each_pair do |key, type|
128
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
129
+ self.send("#{key}=", nil)
130
+ elsif type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :Time
151
+ Time.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :Boolean
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ # models (e.g. Pet) or oneOf
182
+ klass = Composio.const_get(type)
183
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
184
+ end
185
+ end
186
+
187
+ # Returns the string representation of the object
188
+ # @return [String] String presentation of the object
189
+ def to_s
190
+ to_hash.to_s
191
+ end
192
+
193
+ # to_body is an alias to to_hash (backward compatibility)
194
+ # @return [Hash] Returns the object in the form of hash
195
+ def to_body
196
+ to_hash
197
+ end
198
+
199
+ # Returns the object in the form of hash
200
+ # @return [Hash] Returns the object in the form of hash
201
+ def to_hash
202
+ hash = {}
203
+ self.class.attribute_map.each_pair do |attr, param|
204
+ value = self.send(attr)
205
+ if value.nil?
206
+ is_nullable = self.class.openapi_nullable.include?(attr)
207
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
208
+ end
209
+
210
+ hash[param] = _to_hash(value)
211
+ end
212
+ hash
213
+ end
214
+
215
+ # Outputs non-array value in the form of hash
216
+ # For object, use to_hash. Otherwise, just return the value
217
+ # @param [Object] value Any valid value
218
+ # @return [Hash] Returns the value in the form of hash
219
+ def _to_hash(value)
220
+ if value.is_a?(Array)
221
+ value.compact.map { |v| _to_hash(v) }
222
+ elsif value.is_a?(Hash)
223
+ {}.tap do |hash|
224
+ value.each { |k, v| hash[k] = _to_hash(v) }
225
+ end
226
+ elsif value.respond_to? :to_hash
227
+ value.to_hash
228
+ else
229
+ value
230
+ end
231
+ end
232
+
233
+ end
234
+
235
+ end
@@ -45,6 +45,8 @@ module Composio
45
45
 
46
46
  attr_accessor :member
47
47
 
48
+ attr_accessor :labels
49
+
48
50
  # Attribute mapping from ruby-style variable name to JSON key.
49
51
  def self.attribute_map
50
52
  {
@@ -64,7 +66,8 @@ module Composio
64
66
  :'app_name' => :'appName',
65
67
  :'logo' => :'logo',
66
68
  :'auth_config' => :'authConfig',
67
- :'member' => :'member'
69
+ :'member' => :'member',
70
+ :'labels' => :'labels'
68
71
  }
69
72
  end
70
73
 
@@ -92,7 +95,8 @@ module Composio
92
95
  :'app_name' => :'String',
93
96
  :'logo' => :'String',
94
97
  :'auth_config' => :'Object',
95
- :'member' => :'Array<MemberInfoResDTO>'
98
+ :'member' => :'Array<MemberInfoResDTO>',
99
+ :'labels' => :'Array<String>'
96
100
  }
97
101
  end
98
102
 
@@ -186,6 +190,12 @@ module Composio
186
190
  self.member = value
187
191
  end
188
192
  end
193
+
194
+ if attributes.key?(:'labels')
195
+ if (value = attributes[:'labels']).is_a?(Array)
196
+ self.labels = value
197
+ end
198
+ end
189
199
  end
190
200
 
191
201
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -272,7 +282,8 @@ module Composio
272
282
  app_name == o.app_name &&
273
283
  logo == o.logo &&
274
284
  auth_config == o.auth_config &&
275
- member == o.member
285
+ member == o.member &&
286
+ labels == o.labels
276
287
  end
277
288
 
278
289
  # @see the `==` method
@@ -284,7 +295,7 @@ module Composio
284
295
  # Calculates hash code according to all attributes.
285
296
  # @return [Integer] Hash code
286
297
  def hash
287
- [integration_id, connection_params, is_disabled, invocation_count, id, client_unique_user_id, status, data, deleted, enabled, created_at, updated_at, app_unique_id, app_name, logo, auth_config, member].hash
298
+ [integration_id, connection_params, is_disabled, invocation_count, id, client_unique_user_id, status, data, deleted, enabled, created_at, updated_at, app_unique_id, app_name, logo, auth_config, member, labels].hash
288
299
  end
289
300
 
290
301
  # Builds the object from hash
@@ -39,6 +39,8 @@ module Composio
39
39
 
40
40
  attr_accessor :member
41
41
 
42
+ attr_accessor :labels
43
+
42
44
  # Attribute mapping from ruby-style variable name to JSON key.
43
45
  def self.attribute_map
44
46
  {
@@ -55,7 +57,8 @@ module Composio
55
57
  :'app_name' => :'appName',
56
58
  :'logo' => :'logo',
57
59
  :'auth_config' => :'authConfig',
58
- :'member' => :'member'
60
+ :'member' => :'member',
61
+ :'labels' => :'labels'
59
62
  }
60
63
  end
61
64
 
@@ -80,7 +83,8 @@ module Composio
80
83
  :'app_name' => :'String',
81
84
  :'logo' => :'String',
82
85
  :'auth_config' => :'Object',
83
- :'member' => :'Array<MemberInfoResDTO>'
86
+ :'member' => :'Array<MemberInfoResDTO>',
87
+ :'labels' => :'Array<String>'
84
88
  }
85
89
  end
86
90
 
@@ -162,6 +166,12 @@ module Composio
162
166
  self.member = value
163
167
  end
164
168
  end
169
+
170
+ if attributes.key?(:'labels')
171
+ if (value = attributes[:'labels']).is_a?(Array)
172
+ self.labels = value
173
+ end
174
+ end
165
175
  end
166
176
 
167
177
  # Show invalid properties with the reasons. Usually used together with valid?
@@ -235,7 +245,8 @@ module Composio
235
245
  app_name == o.app_name &&
236
246
  logo == o.logo &&
237
247
  auth_config == o.auth_config &&
238
- member == o.member
248
+ member == o.member &&
249
+ labels == o.labels
239
250
  end
240
251
 
241
252
  # @see the `==` method
@@ -247,7 +258,7 @@ module Composio
247
258
  # Calculates hash code according to all attributes.
248
259
  # @return [Integer] Hash code
249
260
  def 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
261
+ [id, integration_id, client_unique_user_id, status, data, deleted, enabled, created_at, updated_at, app_unique_id, app_name, logo, auth_config, member, labels].hash
251
262
  end
252
263
 
253
264
  # Builds the object from hash
@@ -21,9 +21,12 @@ module Composio
21
21
 
22
22
  attr_accessor :use_composio_auth
23
23
 
24
- # Application ID
24
+ # Composio App UUID to be used for authentication. Either specify this or appName
25
25
  attr_accessor :app_id
26
26
 
27
+ # Name of the app to be used for authentication. Either specify this or appId
28
+ attr_accessor :app_name
29
+
27
30
  # Flag to force new integration
28
31
  attr_accessor :force_new_integration
29
32
 
@@ -35,6 +38,7 @@ module Composio
35
38
  :'auth_config' => :'authConfig',
36
39
  :'use_composio_auth' => :'useComposioAuth',
37
40
  :'app_id' => :'appId',
41
+ :'app_name' => :'appName',
38
42
  :'force_new_integration' => :'forceNewIntegration'
39
43
  }
40
44
  end
@@ -52,6 +56,7 @@ module Composio
52
56
  :'auth_config' => :'AuthConfigDTO',
53
57
  :'use_composio_auth' => :'CreateConnectorPayloadDTOUseComposioAuth',
54
58
  :'app_id' => :'String',
59
+ :'app_name' => :'String',
55
60
  :'force_new_integration' => :'Boolean'
56
61
  }
57
62
  end
@@ -97,6 +102,10 @@ module Composio
97
102
  self.app_id = attributes[:'app_id']
98
103
  end
99
104
 
105
+ if attributes.key?(:'app_name')
106
+ self.app_name = attributes[:'app_name']
107
+ end
108
+
100
109
  if attributes.key?(:'force_new_integration')
101
110
  self.force_new_integration = attributes[:'force_new_integration']
102
111
  end
@@ -110,10 +119,6 @@ module Composio
110
119
  invalid_properties.push('invalid value for "name", name cannot be nil.')
111
120
  end
112
121
 
113
- if @app_id.nil?
114
- invalid_properties.push('invalid value for "app_id", app_id cannot be nil.')
115
- end
116
-
117
122
  invalid_properties
118
123
  end
119
124
 
@@ -121,7 +126,6 @@ module Composio
121
126
  # @return true if the model is valid
122
127
  def valid?
123
128
  return false if @name.nil?
124
- return false if @app_id.nil?
125
129
  true
126
130
  end
127
131
 
@@ -135,6 +139,7 @@ module Composio
135
139
  auth_config == o.auth_config &&
136
140
  use_composio_auth == o.use_composio_auth &&
137
141
  app_id == o.app_id &&
142
+ app_name == o.app_name &&
138
143
  force_new_integration == o.force_new_integration
139
144
  end
140
145
 
@@ -147,7 +152,7 @@ module Composio
147
152
  # Calculates hash code according to all attributes.
148
153
  # @return [Integer] Hash code
149
154
  def hash
150
- [name, auth_scheme, auth_config, use_composio_auth, app_id, force_new_integration].hash
155
+ [name, auth_scheme, auth_config, use_composio_auth, app_id, app_name, force_new_integration].hash
151
156
  end
152
157
 
153
158
  # Builds the object from hash