diff --git a/.konfig/changesets/eight-pugs-lay.md b/.konfig/changesets/eight-pugs-lay.md new file mode 100644 index 0000000..acf1dd6 --- /dev/null +++ b/.konfig/changesets/eight-pugs-lay.md @@ -0,0 +1,5 @@ +--- +ruby: patch +--- + +Regenerate SDKs diff --git a/.konfig/progress.yaml b/.konfig/progress.yaml index 084d6d1..6a75160 100644 --- a/.konfig/progress.yaml +++ b/.konfig/progress.yaml @@ -140,6 +140,8 @@ operationIds: post: Connections_disable /api/v1/connectedAccounts/{connectedAccountId}/enable: post: Connections_enable + /api/v1/connectedAccounts/{connectedAccountId}/info: + get: Connections_getInfo /api/v1/event_logs/get/events: get: EventLogs_getEvents /api/v1/event_logs/get/webhook: diff --git a/STATISTICS.md b/STATISTICS.md index afc9de9..12f0ab7 100644 --- a/STATISTICS.md +++ b/STATISTICS.md @@ -2,5 +2,5 @@ | SDK Name | Lines of Code | | -------- | ------------- | -| ruby | 55073 | -| **Total** | 55073 | +| ruby | 56296 | +| **Total** | 56296 | diff --git a/composio.json b/composio.json index 99f7a7d..1579032 100644 --- a/composio.json +++ b/composio.json @@ -1750,6 +1750,73 @@ "page" ] }, + "GetConnectionInfoResponseDTO": { + "properties": { + "base_url": { + "type": "string" + }, + "parameters": { + "items": { + "$ref": "#/components/schemas/Parameter" + }, + "type": "array" + }, + "body": { + "type": "object" + } + }, + "type": "object", + "required": [ + "base_url", + "parameters", + "body" + ] + }, + "Parameter": { + "properties": { + "name": { + "type": "string" + }, + "in": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object", + "required": [ + "name", + "in", + "value" + ] + }, + "Data": { + "properties": { + "field1": { + "type": "string" + }, + "field2": { + "type": "string" + } + }, + "type": "object", + "required": [ + "field1", + "field2" + ] + }, + "AdditionalInfo": { + "properties": { + "meta": { + "type": "string" + } + }, + "type": "object", + "required": [ + "meta" + ] + }, "GetConnectionsQueryDto": { "properties": { "page": { @@ -3982,6 +4049,38 @@ ] } }, + "/api/v1/connectedAccounts/{connectedAccountId}/info": { + "get": { + "operationId": "getConnectionInfo", + "parameters": [ + { + "in": "path", + "name": "connectedAccountId", + "required": true, + "schema": { + "pattern": "[^\\/#\\?]+?", + "type": "string" + } + } + ], + "responses": { + "200": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetConnectionInfoResponseDTO" + } + } + }, + "description": "" + } + }, + "summary": "Get connection info", + "tags": [ + "Connections" + ] + } + }, "/api/v1/connectedAccounts/{connectedAccountId}/disable": { "post": { "operationId": "disableConnection", diff --git a/openapi-fixed.json b/openapi-fixed.json index e9d3948..8082392 100644 --- a/openapi-fixed.json +++ b/openapi-fixed.json @@ -18,10 +18,10 @@ "name": "Triggers" }, { - "name": "Apps" + "name": "Connections" }, { - "name": "Connections" + "name": "Apps" }, { "name": "Integrations" @@ -698,6 +698,38 @@ } } }, + "/api/v1/connectedAccounts/{connectedAccountId}/info": { + "get": { + "tags": [ + "Connections" + ], + "summary": "Get connection info", + "operationId": "Connections_getInfo", + "parameters": [ + { + "in": "path", + "name": "connectedAccountId", + "required": true, + "schema": { + "pattern": "[^\\/#\\?]+?", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/GetConnectionInfoResponseDTO" + } + } + } + } + } + } + }, "/api/v1/connectedAccounts/{connectedAccountId}/disable": { "post": { "tags": [ @@ -3722,6 +3754,73 @@ "page" ] }, + "GetConnectionInfoResponseDTO": { + "properties": { + "parameters": { + "items": { + "$ref": "#/components/schemas/Parameter" + }, + "type": "array" + }, + "base_url": { + "type": "string" + }, + "body": { + "type": "object" + } + }, + "type": "object", + "required": [ + "base_url", + "parameters", + "body" + ] + }, + "Parameter": { + "properties": { + "name": { + "type": "string" + }, + "in": { + "type": "string" + }, + "value": { + "type": "string" + } + }, + "type": "object", + "required": [ + "name", + "in", + "value" + ] + }, + "Data": { + "properties": { + "field1": { + "type": "string" + }, + "field2": { + "type": "string" + } + }, + "type": "object", + "required": [ + "field1", + "field2" + ] + }, + "AdditionalInfo": { + "properties": { + "meta": { + "type": "string" + } + }, + "type": "object", + "required": [ + "meta" + ] + }, "GetConnectionsQueryDto": { "properties": { "page": { diff --git a/ruby/.konfig/generate-id.txt b/ruby/.konfig/generate-id.txt index 2a865e6..efc16d8 100644 --- a/ruby/.konfig/generate-id.txt +++ b/ruby/.konfig/generate-id.txt @@ -1 +1 @@ -bad5a01f-0956-4796-afce-df6b6fee1c71 \ No newline at end of file +be19308b-de07-478b-85e8-6f20a85bcf3c \ No newline at end of file diff --git a/ruby/README.md b/ruby/README.md index 4981a01..bc1bd68 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -40,6 +40,7 @@ Composio SDK: Equip your agent with high-quality tools and build your real-world * [`composio.connections.disable`](#composioconnectionsdisable) * [`composio.connections.enable`](#composioconnectionsenable) * [`composio.connections.get`](#composioconnectionsget) + * [`composio.connections.get_info`](#composioconnectionsget_info) * [`composio.connections.initiate`](#composioconnectionsinitiate) * [`composio.connections.list`](#composioconnectionslist) * [`composio.event_logs.get_events`](#composioevent_logsget_events) @@ -738,6 +739,35 @@ p result --- +### `composio.connections.get_info` + +Get connection info + +#### 🛠️ Usage + +```ruby +result = composio.connections.get_info( + connected_account_id: "'+j>6", +) +p result +``` + +#### ⚙️ Parameters + +##### connected_account_id: `String` +#### 🔄 Return + +[GetConnectionInfoResponseDTO](./lib/composio/models/get_connection_info_response_dto.rb) + +#### 🌐 Endpoint + +`/api/v1/connectedAccounts/{connectedAccountId}/info` `GET` + +[🔙 **Back to Table of Contents**](#table-of-contents) + +--- + + ### `composio.connections.initiate` Initiate connection diff --git a/ruby/lib/composio.rb b/ruby/lib/composio.rb index bfd6f3b..4478bd3 100644 --- a/ruby/lib/composio.rb +++ b/ruby/lib/composio.rb @@ -37,6 +37,7 @@ require 'composio/models/add_repo_url_res_dto' require 'composio/models/add_tools_req_dto' require 'composio/models/add_tools_request_dto' +require 'composio/models/additional_info' require 'composio/models/analytics_data_req_dto' require 'composio/models/analytics_data_res_dto' require 'composio/models/analytics_entity_data_dto' @@ -58,6 +59,7 @@ require 'composio/models/create_checkout_session_req_dto' require 'composio/models/create_connector_payload_dto' require 'composio/models/create_connector_payload_dto_use_composio_auth' +require 'composio/models/data' require 'composio/models/delete_api_key_req_dto' require 'composio/models/delete_api_key_response_dto' require 'composio/models/delete_row_apidto' @@ -74,6 +76,7 @@ require 'composio/models/generate_cli_session_res_dto' require 'composio/models/get_active_triggers_query_dto' require 'composio/models/get_cli_session_res_dto' +require 'composio/models/get_connection_info_response_dto' require 'composio/models/get_connections_query_dto' require 'composio/models/get_connections_response_dto' require 'composio/models/get_connections_result' @@ -112,6 +115,7 @@ require 'composio/models/open_api_spec_list_res_dto' require 'composio/models/page_info' require 'composio/models/page_info_dto' +require 'composio/models/parameter' require 'composio/models/patch_connector_req_dto' require 'composio/models/patch_connector_res_dto' require 'composio/models/plan' diff --git a/ruby/lib/composio/api/connections_api.rb b/ruby/lib/composio/api/connections_api.rb index 818dcdb..53a90a4 100644 --- a/ruby/lib/composio/api/connections_api.rb +++ b/ruby/lib/composio/api/connections_api.rb @@ -352,6 +352,90 @@ def get_with_http_info(connected_account_id:, extra: {}) end + # Get connection info + # + # @param connected_account_id [String] + # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name + def get_info(connected_account_id:, extra: {}) + api_response = get_info_with_http_info_impl(connected_account_id, extra) + api_response.data + end + + # Get connection info + # + # @param connected_account_id [String] + # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name + def get_info_with_http_info(connected_account_id:, extra: {}) + get_info_with_http_info_impl(connected_account_id, extra) + end + + # Get connection info + # @param connected_account_id [String] + # @param [Hash] opts the optional parameters + # @return [GetConnectionInfoResponseDTO] + private def get_info_impl(connected_account_id, opts = {}) + data, _status_code, _headers = get_info_with_http_info(connected_account_id, opts) + data + end + + # Get connection info + # @param connected_account_id [String] + # @param [Hash] opts the optional parameters + # @return [APIResponse] data is GetConnectionInfoResponseDTO, status code, headers and response + private def get_info_with_http_info_impl(connected_account_id, opts = {}) + if @api_client.config.debugging + @api_client.config.logger.debug 'Calling API: ConnectionsApi.get_info ...' + end + # verify the required parameter 'connected_account_id' is set + if @api_client.config.client_side_validation && connected_account_id.nil? + fail ArgumentError, "Missing the required parameter 'connected_account_id' when calling ConnectionsApi.get_info" + end + pattern = Regexp.new(/[^\/#\?]+?/) + if @api_client.config.client_side_validation && connected_account_id !~ pattern + fail ArgumentError, "invalid value for 'connected_account_id' when calling ConnectionsApi.get_info, must conform to the pattern #{pattern}." + end + + # resource path + local_var_path = '/api/v1/connectedAccounts/{connectedAccountId}/info'.sub('{' + 'connectedAccountId' + '}', CGI.escape(connected_account_id.to_s)) + + # query parameters + query_params = opts[:query_params] || {} + + # header parameters + header_params = opts[:header_params] || {} + # HTTP header 'Accept' (if needed) + header_params['Accept'] = @api_client.select_header_accept(['application/json']) + + # form parameters + form_params = opts[:form_params] || {} + + # http body (model) + post_body = opts[:debug_body] + + # return_type + return_type = opts[:debug_return_type] || 'GetConnectionInfoResponseDTO' + + # auth_names + auth_names = opts[:debug_auth_names] || ['api_key'] + + new_options = opts.merge( + :operation => :"ConnectionsApi.get_info", + :header_params => header_params, + :query_params => query_params, + :form_params => form_params, + :body => post_body, + :auth_names => auth_names, + :return_type => return_type + ) + + data, status_code, headers, response = @api_client.call_api(:GET, local_var_path, new_options) + if @api_client.config.debugging + @api_client.config.logger.debug "API called: ConnectionsApi#get_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" + end + APIResponse::new(data, status_code, headers, response) + end + + # Initiate connection # # @param integration_id [String] diff --git a/ruby/lib/composio/models/additional_info.rb b/ruby/lib/composio/models/additional_info.rb new file mode 100644 index 0000000..0925158 --- /dev/null +++ b/ruby/lib/composio/models/additional_info.rb @@ -0,0 +1,220 @@ +=begin +#Composio OpenAPI + +#Composio SDK: Equip your agent with high-quality tools and build your real-world usecase + +The version of the OpenAPI document: 1.0.0 +=end + +require 'date' +require 'time' + +module Composio + class AdditionalInfo + attr_accessor :meta + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'meta' => :'meta' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'meta' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::AdditionalInfo` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::AdditionalInfo`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'meta') + self.meta = attributes[:'meta'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @meta.nil? + invalid_properties.push('invalid value for "meta", meta cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @meta.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + meta == o.meta + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [meta].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Composio.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/ruby/lib/composio/models/data.rb b/ruby/lib/composio/models/data.rb new file mode 100644 index 0000000..3c9c18b --- /dev/null +++ b/ruby/lib/composio/models/data.rb @@ -0,0 +1,234 @@ +=begin +#Composio OpenAPI + +#Composio SDK: Equip your agent with high-quality tools and build your real-world usecase + +The version of the OpenAPI document: 1.0.0 +=end + +require 'date' +require 'time' + +module Composio + class Data + attr_accessor :field1 + + attr_accessor :field2 + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'field1' => :'field1', + :'field2' => :'field2' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'field1' => :'String', + :'field2' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::Data` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + 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 + end + h[k.to_sym] = v + } + + if attributes.key?(:'field1') + self.field1 = attributes[:'field1'] + end + + if attributes.key?(:'field2') + self.field2 = attributes[:'field2'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @field1.nil? + invalid_properties.push('invalid value for "field1", field1 cannot be nil.') + end + + if @field2.nil? + invalid_properties.push('invalid value for "field2", field2 cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @field1.nil? + return false if @field2.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + field1 == o.field1 && + field2 == o.field2 + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [field1, field2].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Composio.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/ruby/lib/composio/models/get_connection_info_response_dto.rb b/ruby/lib/composio/models/get_connection_info_response_dto.rb new file mode 100644 index 0000000..f326cba --- /dev/null +++ b/ruby/lib/composio/models/get_connection_info_response_dto.rb @@ -0,0 +1,250 @@ +=begin +#Composio OpenAPI + +#Composio SDK: Equip your agent with high-quality tools and build your real-world usecase + +The version of the OpenAPI document: 1.0.0 +=end + +require 'date' +require 'time' + +module Composio + class GetConnectionInfoResponseDTO + attr_accessor :parameters + + attr_accessor :base_url + + attr_accessor :body + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'parameters' => :'parameters', + :'base_url' => :'base_url', + :'body' => :'body' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'parameters' => :'Array', + :'base_url' => :'String', + :'body' => :'Object' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::GetConnectionInfoResponseDTO` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + fail ArgumentError, "`#{k}` is not a valid attribute in `Composio::GetConnectionInfoResponseDTO`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect + end + h[k.to_sym] = v + } + + if attributes.key?(:'parameters') + if (value = attributes[:'parameters']).is_a?(Array) + self.parameters = value + end + end + + if attributes.key?(:'base_url') + self.base_url = attributes[:'base_url'] + end + + if attributes.key?(:'body') + self.body = attributes[:'body'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @parameters.nil? + invalid_properties.push('invalid value for "parameters", parameters cannot be nil.') + end + + if @base_url.nil? + invalid_properties.push('invalid value for "base_url", base_url cannot be nil.') + end + + if @body.nil? + invalid_properties.push('invalid value for "body", body cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @parameters.nil? + return false if @base_url.nil? + return false if @body.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + parameters == o.parameters && + base_url == o.base_url && + body == o.body + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [parameters, base_url, body].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Composio.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/ruby/lib/composio/models/parameter.rb b/ruby/lib/composio/models/parameter.rb new file mode 100644 index 0000000..b47f216 --- /dev/null +++ b/ruby/lib/composio/models/parameter.rb @@ -0,0 +1,248 @@ +=begin +#Composio OpenAPI + +#Composio SDK: Equip your agent with high-quality tools and build your real-world usecase + +The version of the OpenAPI document: 1.0.0 +=end + +require 'date' +require 'time' + +module Composio + class Parameter + attr_accessor :name + + attr_accessor :_in + + attr_accessor :value + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'name' => :'name', + :'_in' => :'in', + :'value' => :'value' + } + end + + # Returns all the JSON keys this model knows about + def self.acceptable_attributes + attribute_map.values + end + + # Attribute type mapping. + def self.openapi_types + { + :'name' => :'String', + :'_in' => :'String', + :'value' => :'String' + } + end + + # List of attributes with nullable: true + def self.openapi_nullable + Set.new([ + ]) + end + + # Initializes the object + # @param [Hash] attributes Model attributes in the form of hash + def initialize(attributes = {}) + if (!attributes.is_a?(Hash)) + fail ArgumentError, "The input argument (attributes) must be a hash in `Composio::Parameter` initialize method" + end + + # check to see if the attribute exists and convert string to symbol for hash key + attributes = attributes.each_with_object({}) { |(k, v), h| + if (!self.class.attribute_map.key?(k.to_sym)) + 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 + end + h[k.to_sym] = v + } + + if attributes.key?(:'name') + self.name = attributes[:'name'] + end + + if attributes.key?(:'_in') + self._in = attributes[:'_in'] + end + + if attributes.key?(:'value') + self.value = attributes[:'value'] + end + end + + # Show invalid properties with the reasons. Usually used together with valid? + # @return Array for valid properties with the reasons + def list_invalid_properties + invalid_properties = Array.new + if @name.nil? + invalid_properties.push('invalid value for "name", name cannot be nil.') + end + + if @_in.nil? + invalid_properties.push('invalid value for "_in", _in cannot be nil.') + end + + if @value.nil? + invalid_properties.push('invalid value for "value", value cannot be nil.') + end + + invalid_properties + end + + # Check to see if the all the properties in the model are valid + # @return true if the model is valid + def valid? + return false if @name.nil? + return false if @_in.nil? + return false if @value.nil? + true + end + + # Checks equality by comparing each attribute. + # @param [Object] Object to be compared + def ==(o) + return true if self.equal?(o) + self.class == o.class && + name == o.name && + _in == o._in && + value == o.value + end + + # @see the `==` method + # @param [Object] Object to be compared + def eql?(o) + self == o + end + + # Calculates hash code according to all attributes. + # @return [Integer] Hash code + def hash + [name, _in, value].hash + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def self.build_from_hash(attributes) + new.build_from_hash(attributes) + end + + # Builds the object from hash + # @param [Hash] attributes Model attributes in the form of hash + # @return [Object] Returns the model itself + def build_from_hash(attributes) + return nil unless attributes.is_a?(Hash) + attributes = attributes.transform_keys(&:to_sym) + self.class.openapi_types.each_pair do |key, type| + if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) + self.send("#{key}=", nil) + elsif type =~ /\AArray<(.*)>/i + # check to ensure the input is an array given that the attribute + # is documented as an array but the input is not + if attributes[self.class.attribute_map[key]].is_a?(Array) + self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) }) + end + elsif !attributes[self.class.attribute_map[key]].nil? + self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]])) + end + end + + self + end + + # Deserializes the data based on type + # @param string type Data type + # @param string value Value to be deserialized + # @return [Object] Deserialized data + def _deserialize(type, value) + case type.to_sym + when :Time + Time.parse(value) + when :Date + Date.parse(value) + when :String + value.to_s + when :Integer + value.to_i + when :Float + value.to_f + when :Boolean + if value.to_s =~ /\A(true|t|yes|y|1)\z/i + true + else + false + end + when :Object + # generic object (usually a Hash), return directly + value + when /\AArray<(?.+)>\z/ + inner_type = Regexp.last_match[:inner_type] + value.map { |v| _deserialize(inner_type, v) } + when /\AHash<(?.+?), (?.+)>\z/ + k_type = Regexp.last_match[:k_type] + v_type = Regexp.last_match[:v_type] + {}.tap do |hash| + value.each do |k, v| + hash[_deserialize(k_type, k)] = _deserialize(v_type, v) + end + end + else # model + # models (e.g. Pet) or oneOf + klass = Composio.const_get(type) + klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value) + end + end + + # Returns the string representation of the object + # @return [String] String presentation of the object + def to_s + to_hash.to_s + end + + # to_body is an alias to to_hash (backward compatibility) + # @return [Hash] Returns the object in the form of hash + def to_body + to_hash + end + + # Returns the object in the form of hash + # @return [Hash] Returns the object in the form of hash + def to_hash + hash = {} + self.class.attribute_map.each_pair do |attr, param| + value = self.send(attr) + if value.nil? + is_nullable = self.class.openapi_nullable.include?(attr) + next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) + end + + hash[param] = _to_hash(value) + end + hash + end + + # Outputs non-array value in the form of hash + # For object, use to_hash. Otherwise, just return the value + # @param [Object] value Any valid value + # @return [Hash] Returns the value in the form of hash + def _to_hash(value) + if value.is_a?(Array) + value.compact.map { |v| _to_hash(v) } + elsif value.is_a?(Hash) + {}.tap do |hash| + value.each { |k, v| hash[k] = _to_hash(v) } + end + elsif value.respond_to? :to_hash + value.to_hash + else + value + end + end + + end + +end diff --git a/ruby/spec/api/connections_api_spec.rb b/ruby/spec/api/connections_api_spec.rb index 03e82dd..b587ab6 100644 --- a/ruby/spec/api/connections_api_spec.rb +++ b/ruby/spec/api/connections_api_spec.rb @@ -70,6 +70,17 @@ end end + # unit tests for get_info + # Get connection info + # @param connected_account_id + # @param [Hash] opts the optional parameters + # @return [GetConnectionInfoResponseDTO] + describe 'get_info test' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + # unit tests for initiate # Initiate connection # @param [Hash] opts the optional parameters diff --git a/ruby/spec/models/additional_info_spec.rb b/ruby/spec/models/additional_info_spec.rb new file mode 100644 index 0000000..55c56bb --- /dev/null +++ b/ruby/spec/models/additional_info_spec.rb @@ -0,0 +1,28 @@ +=begin +#Composio OpenAPI + +#Composio SDK: Equip your agent with high-quality tools and build your real-world usecase + +The version of the OpenAPI document: 1.0.0 +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Composio::AdditionalInfo +describe Composio::AdditionalInfo do + let(:instance) { Composio::AdditionalInfo.new } + + describe 'test an instance of AdditionalInfo' do + it 'should create an instance of AdditionalInfo' do + expect(instance).to be_instance_of(Composio::AdditionalInfo) + end + end + describe 'test attribute "meta"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/ruby/spec/models/data_spec.rb b/ruby/spec/models/data_spec.rb new file mode 100644 index 0000000..55c09ed --- /dev/null +++ b/ruby/spec/models/data_spec.rb @@ -0,0 +1,34 @@ +=begin +#Composio OpenAPI + +#Composio SDK: Equip your agent with high-quality tools and build your real-world usecase + +The version of the OpenAPI document: 1.0.0 +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Composio::Data +describe Composio::Data do + let(:instance) { Composio::Data.new } + + describe 'test an instance of Data' do + it 'should create an instance of Data' do + expect(instance).to be_instance_of(Composio::Data) + end + end + describe 'test attribute "field1"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "field2"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/ruby/spec/models/get_connection_info_response_dto_spec.rb b/ruby/spec/models/get_connection_info_response_dto_spec.rb new file mode 100644 index 0000000..97e435b --- /dev/null +++ b/ruby/spec/models/get_connection_info_response_dto_spec.rb @@ -0,0 +1,40 @@ +=begin +#Composio OpenAPI + +#Composio SDK: Equip your agent with high-quality tools and build your real-world usecase + +The version of the OpenAPI document: 1.0.0 +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Composio::GetConnectionInfoResponseDTO +describe Composio::GetConnectionInfoResponseDTO do + let(:instance) { Composio::GetConnectionInfoResponseDTO.new } + + describe 'test an instance of GetConnectionInfoResponseDTO' do + it 'should create an instance of GetConnectionInfoResponseDTO' do + expect(instance).to be_instance_of(Composio::GetConnectionInfoResponseDTO) + end + end + describe 'test attribute "parameters"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "base_url"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "body"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end diff --git a/ruby/spec/models/parameter_spec.rb b/ruby/spec/models/parameter_spec.rb new file mode 100644 index 0000000..f07b50f --- /dev/null +++ b/ruby/spec/models/parameter_spec.rb @@ -0,0 +1,40 @@ +=begin +#Composio OpenAPI + +#Composio SDK: Equip your agent with high-quality tools and build your real-world usecase + +The version of the OpenAPI document: 1.0.0 +=end + +require 'spec_helper' +require 'json' +require 'date' + +# Unit tests for Composio::Parameter +describe Composio::Parameter do + let(:instance) { Composio::Parameter.new } + + describe 'test an instance of Parameter' do + it 'should create an instance of Parameter' do + expect(instance).to be_instance_of(Composio::Parameter) + end + end + describe 'test attribute "name"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "_in"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "value"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + +end