diff --git a/.konfig/changesets/ready-kids-retire.md b/.konfig/changesets/ready-kids-retire.md new file mode 100644 index 0000000..acf1dd6 --- /dev/null +++ b/.konfig/changesets/ready-kids-retire.md @@ -0,0 +1,5 @@ +--- +ruby: patch +--- + +Regenerate SDKs diff --git a/STATISTICS.md b/STATISTICS.md index 562bd3a..f4fb2f2 100644 --- a/STATISTICS.md +++ b/STATISTICS.md @@ -2,5 +2,5 @@ | SDK Name | Lines of Code | | -------- | ------------- | -| ruby | 59995 | -| **Total** | 59995 | +| ruby | 60824 | +| **Total** | 60824 | diff --git a/composio.json b/composio.json index 4bfa6d7..a6af8d2 100644 --- a/composio.json +++ b/composio.json @@ -1340,80 +1340,6 @@ "pageInfo" ] }, - "ToolsExecuteReqDto": { - "properties": { - "actionName": { - "type": "string" - }, - "runInSandbox": { - "type": "boolean" - }, - "input": { - "type": "object" - }, - "nlaInput": { - "type": "string" - }, - "authorizationData": { - "type": "object" - }, - "appSchema": { - "type": "object" - }, - "customDescription": { - "type": "string" - }, - "systemPrompt": { - "type": "string" - } - }, - "type": "object", - "required": [ - "actionName", - "runInSandbox", - "input" - ] - }, - "DirectExecuteReqDto": { - "properties": { - "endpoint": { - "type": "string" - }, - "base_url": { - "type": "string" - }, - "headers": { - "type": "object" - }, - "queryParams": { - "type": "object" - } - }, - "type": "object", - "required": [ - "endpoint", - "base_url", - "headers", - "queryParams" - ] - }, - "ActionExecutionResDto": { - "properties": { - "data": { - "type": "object" - }, - "error": { - "type": "string" - }, - "successfull": { - "type": "string" - } - }, - "type": "object", - "required": [ - "data" - ] - }, "ConnectionParams": { "properties": { "integrationId": { @@ -1699,13 +1625,20 @@ "Parameter": { "properties": { "name": { - "type": "string" + "type": "string", + "description": "The name of the parameter. For example, 'x-api-key', 'Content-Type', etc.," }, "in": { - "type": "string" + "enum": [ + "query", + "header" + ], + "type": "string", + "description": "The location of the parameter. Can be 'query' or 'header'." }, "value": { - "type": "string" + "type": "string", + "description": "The value of the parameter. For example, '1234567890', 'application/json', etc.," } }, "type": "object", @@ -1844,6 +1777,83 @@ "connectedAccountId" ] }, + "ToolsExecuteReqDto": { + "properties": { + "actionName": { + "type": "string" + }, + "runInSandbox": { + "type": "boolean" + }, + "input": { + "type": "object" + }, + "nlaInput": { + "type": "string" + }, + "authorizationData": { + "type": "object" + }, + "appSchema": { + "type": "object" + }, + "customDescription": { + "type": "string" + }, + "systemPrompt": { + "type": "string" + } + }, + "type": "object", + "required": [ + "actionName", + "runInSandbox", + "input" + ] + }, + "DirectExecuteReqDto": { + "properties": { + "endpoint": { + "type": "string" + }, + "base_url": { + "type": "string" + }, + "headers": { + "type": "object" + }, + "queryParams": { + "type": "object" + }, + "body": { + "type": "object" + } + }, + "type": "object", + "required": [ + "endpoint", + "base_url", + "headers", + "queryParams" + ] + }, + "ActionExecutionResDto": { + "properties": { + "data": { + "type": "object" + }, + "error": { + "type": "string" + }, + "successfull": { + "type": "string" + } + }, + "type": "object", + "required": [ + "data" + ] + }, "CustomAuthDTO": { "properties": { "base_url": { @@ -1864,6 +1874,67 @@ "parameters" ] }, + "ActionProxyRequestMethodDTO": { + "properties": { + "type": { + "enum": [ + "formData", + "urlEncoded", + "raw", + "binary", + "graphql", + "none" + ], + "type": "string", + "description": "The type of request body to use for the action. Defaults to 'none'." + }, + "data": { + "type": "string", + "description": "The data to be sent to the endpoint. This will override the body set in the connected account." + } + }, + "type": "object" + }, + "ActionProxyRequestConfigDTO": { + "properties": { + "connectedAccountId": { + "type": "string", + "description": "The connected account uuid to use for the action." + }, + "endpoint": { + "type": "string", + "description": "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." + }, + "method": { + "enum": [ + "GET", + "POST", + "PUT", + "PATCH", + "DELETE" + ], + "type": "string", + "description": "The HTTP method to use for the action." + }, + "parameters": { + "items": { + "$ref": "#/components/schemas/Parameter" + }, + "type": "array" + }, + "body": { + "type": "object", + "description": "The body to be sent to the endpoint. This can either be a JSON field or a string." + } + }, + "type": "object", + "required": [ + "connectedAccountId", + "endpoint", + "method", + "parameters" + ] + }, "SessionInfoDTO": { "properties": { "sessionId": { @@ -5614,24 +5685,17 @@ "/api/v2/actions/proxy": { "post": { "operationId": "_executeActionProxyV2", - "parameters": [ - { - "in": "query", - "name": "endpoint", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ActionProxyRequestConfigDTO" + } } }, - { - "in": "query", - "name": "connectedAccountId", - "required": true, - "schema": { - "type": "string" - } - } - ], + "description": "ActionProxyRequestConfigDTO", + "required": false + }, "responses": { "200": { "content": { diff --git a/openapi-fixed.json b/openapi-fixed.json index 14ea9ec..ebe137b 100644 --- a/openapi-fixed.json +++ b/openapi-fixed.json @@ -1819,24 +1819,17 @@ "summary": "Execute action proxy", "operationId": "ActionsControllerV2_executeActionProxy", "description": "Execute an action with direct auth.", - "parameters": [ - { - "in": "query", - "name": "endpoint", - "required": true, - "schema": { - "type": "string" + "requestBody": { + "description": "ActionProxyRequestConfigDTO", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ActionProxyRequestConfigDTO" + } } }, - { - "in": "query", - "name": "connectedAccountId", - "required": true, - "schema": { - "type": "string" - } - } - ], + "required": false + }, "responses": { "200": { "description": "", @@ -3484,80 +3477,6 @@ "pageInfo" ] }, - "ToolsExecuteReqDto": { - "properties": { - "actionName": { - "type": "string" - }, - "runInSandbox": { - "type": "boolean" - }, - "input": { - "type": "object" - }, - "nlaInput": { - "type": "string" - }, - "authorizationData": { - "type": "object" - }, - "appSchema": { - "type": "object" - }, - "customDescription": { - "type": "string" - }, - "systemPrompt": { - "type": "string" - } - }, - "type": "object", - "required": [ - "actionName", - "runInSandbox", - "input" - ] - }, - "DirectExecuteReqDto": { - "properties": { - "endpoint": { - "type": "string" - }, - "base_url": { - "type": "string" - }, - "headers": { - "type": "object" - }, - "queryParams": { - "type": "object" - } - }, - "type": "object", - "required": [ - "endpoint", - "base_url", - "headers", - "queryParams" - ] - }, - "ActionExecutionResDto": { - "properties": { - "data": { - "type": "object" - }, - "error": { - "type": "string" - }, - "successfull": { - "type": "string" - } - }, - "type": "object", - "required": [ - "data" - ] - }, "ConnectionParams": { "properties": { "integrationId": { @@ -3843,12 +3762,19 @@ "Parameter": { "properties": { "name": { + "description": "The name of the parameter. For example, 'x-api-key', 'Content-Type', etc.,", "type": "string" }, "in": { + "description": "The location of the parameter. Can be 'query' or 'header'.", + "enum": [ + "query", + "header" + ], "type": "string" }, "value": { + "description": "The value of the parameter. For example, '1234567890', 'application/json', etc.,", "type": "string" } }, @@ -3988,6 +3914,83 @@ "connectedAccountId" ] }, + "ToolsExecuteReqDto": { + "properties": { + "actionName": { + "type": "string" + }, + "runInSandbox": { + "type": "boolean" + }, + "input": { + "type": "object" + }, + "nlaInput": { + "type": "string" + }, + "authorizationData": { + "type": "object" + }, + "appSchema": { + "type": "object" + }, + "customDescription": { + "type": "string" + }, + "systemPrompt": { + "type": "string" + } + }, + "type": "object", + "required": [ + "actionName", + "runInSandbox", + "input" + ] + }, + "DirectExecuteReqDto": { + "properties": { + "endpoint": { + "type": "string" + }, + "base_url": { + "type": "string" + }, + "headers": { + "type": "object" + }, + "queryParams": { + "type": "object" + }, + "body": { + "type": "object" + } + }, + "type": "object", + "required": [ + "endpoint", + "base_url", + "headers", + "queryParams" + ] + }, + "ActionExecutionResDto": { + "properties": { + "data": { + "type": "object" + }, + "error": { + "type": "string" + }, + "successfull": { + "type": "string" + } + }, + "type": "object", + "required": [ + "data" + ] + }, "CustomAuthDTO": { "properties": { "parameters": { @@ -4008,6 +4011,67 @@ "parameters" ] }, + "ActionProxyRequestMethodDTO": { + "properties": { + "type": { + "description": "The type of request body to use for the action. Defaults to 'none'.", + "enum": [ + "formData", + "urlEncoded", + "raw", + "binary", + "graphql", + "none" + ], + "type": "string" + }, + "data": { + "description": "The data to be sent to the endpoint. This will override the body set in the connected account.", + "type": "string" + } + }, + "type": "object" + }, + "ActionProxyRequestConfigDTO": { + "properties": { + "parameters": { + "items": { + "$ref": "#/components/schemas/Parameter" + }, + "type": "array" + }, + "connectedAccountId": { + "description": "The connected account uuid to use for the action.", + "type": "string" + }, + "endpoint": { + "description": "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.", + "type": "string" + }, + "method": { + "description": "The HTTP method to use for the action.", + "enum": [ + "GET", + "POST", + "PUT", + "PATCH", + "DELETE" + ], + "type": "string" + }, + "body": { + "description": "The body to be sent to the endpoint. This can either be a JSON field or a string.", + "type": "object" + } + }, + "type": "object", + "required": [ + "connectedAccountId", + "endpoint", + "method", + "parameters" + ] + }, "SessionInfoDTO": { "properties": { "sessionId": { diff --git a/ruby/.konfig/generate-id.txt b/ruby/.konfig/generate-id.txt index b499cec..80582e3 100644 --- a/ruby/.konfig/generate-id.txt +++ b/ruby/.konfig/generate-id.txt @@ -1 +1 @@ -52cc0a55-5b7c-4f51-9eaf-41a352c8865c \ No newline at end of file +62bb70ee-59a5-4cf6-8fa7-1945ff82b6fb \ No newline at end of file diff --git a/ruby/README.md b/ruby/README.md index caa45ad..70e2d36 100644 --- a/ruby/README.md +++ b/ruby/README.md @@ -214,7 +214,7 @@ result = composio.actions.execute( "parameters" => [ { "name" => "name_example", - "_in" => "_in_example", + "_in" => "query", "value" => "value_example", } ], @@ -260,16 +260,38 @@ Execute an action with direct auth. ```ruby result = composio.actions.execute_action_proxy( - endpoint: "endpoint_example", - connected_account_id: "connectedAccountId_example", + parameters: [ + { + "name" => "name_example", + "_in" => "query", + "value" => "value_example", + } + ], + connected_account_id: "string_example", + endpoint: "string_example", + method: "GET", + body: {}, ) p result ``` #### ⚙️ Parameters +##### parameters: Array<[`Parameter`](./lib/composio/models/parameter.rb)> +##### connectedAccountId: `String` +The connected account uuid to use for the action. + ##### endpoint: `String` -##### connected_account_id: `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. + +##### method: [`Method`](./lib/composio/models/method.rb) +The HTTP method to use for the action. + +##### body: `Object` +The body to be sent to the endpoint. This can either be a JSON field or a +string. + #### 🔄 Return [ActionExecutionResDto](./lib/composio/models/action_execution_res_dto.rb) diff --git a/ruby/lib/composio.rb b/ruby/lib/composio.rb index 5686e97..e49e6ab 100644 --- a/ruby/lib/composio.rb +++ b/ruby/lib/composio.rb @@ -27,6 +27,8 @@ require 'composio/models/action_log_data' require 'composio/models/action_metadata' require 'composio/models/action_metadata_type' +require 'composio/models/action_proxy_request_config_dto' +require 'composio/models/action_proxy_request_method_dto' require 'composio/models/actions_controller_v1' require 'composio/models/actions_list_response_dto' require 'composio/models/actions_minimal_list_response_dto' @@ -91,6 +93,7 @@ require 'composio/models/get_connector_list_res_dto' require 'composio/models/get_logs_dto' require 'composio/models/get_logs_dto_status' +require 'composio/models/get_logs_dto_type' require 'composio/models/get_logs_query_dto' require 'composio/models/get_trigger_params_dto' require 'composio/models/get_trigger_response_dto' @@ -118,6 +121,8 @@ require 'composio/models/meta_app' require 'composio/models/metadata_query_dto' require 'composio/models/metadata_req_dto' +require 'composio/models/method' +require 'composio/models/model_in' require 'composio/models/o_auth2_callback_query_dto' require 'composio/models/open_api_spec_list_res_dto' require 'composio/models/page_info' diff --git a/ruby/lib/composio/api/actions_api.rb b/ruby/lib/composio/api/actions_api.rb index 5f12e65..3f1d492 100644 --- a/ruby/lib/composio/api/actions_api.rb +++ b/ruby/lib/composio/api/actions_api.rb @@ -163,11 +163,22 @@ def execute_with_http_info(action_id:, connected_account_id: SENTINEL, app_name: # # Execute an action with direct auth. # - # @param endpoint [String] - # @param connected_account_id [String] + # @param parameters [Array] + # @param connected_account_id [String] The connected account uuid to use for the action. + # @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. + # @param method [Method] The HTTP method to use for the action. + # @param body [Object] The body to be sent to the endpoint. This can either be a JSON field or a string. + # @param body [ActionProxyRequestConfigDTO] # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name - def execute_action_proxy(endpoint:, connected_account_id:, extra: {}) - api_response = execute_action_proxy_with_http_info_impl(endpoint, connected_account_id, extra) + def execute_action_proxy(parameters:, connected_account_id:, endpoint:, method:, body: SENTINEL, extra: {}) + _body = {} + _body[:parameters] = parameters if parameters != SENTINEL + _body[:connectedAccountId] = connected_account_id if connected_account_id != SENTINEL + _body[:endpoint] = endpoint if endpoint != SENTINEL + _body[:method] = method if method != SENTINEL + _body[:body] = body if body != SENTINEL + extra[:action_proxy_request_config_dto] = _body if !_body.empty? + api_response = execute_action_proxy_with_http_info_impl(extra) api_response.data end @@ -175,60 +186,64 @@ def execute_action_proxy(endpoint:, connected_account_id:, extra: {}) # # Execute an action with direct auth. # - # @param endpoint [String] - # @param connected_account_id [String] + # @param parameters [Array] + # @param connected_account_id [String] The connected account uuid to use for the action. + # @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. + # @param method [Method] The HTTP method to use for the action. + # @param body [Object] The body to be sent to the endpoint. This can either be a JSON field or a string. + # @param body [ActionProxyRequestConfigDTO] # @param [Hash] extra additional parameters to pass along through :header_params, :query_params, or parameter name - def execute_action_proxy_with_http_info(endpoint:, connected_account_id:, extra: {}) - execute_action_proxy_with_http_info_impl(endpoint, connected_account_id, extra) + def execute_action_proxy_with_http_info(parameters:, connected_account_id:, endpoint:, method:, body: SENTINEL, extra: {}) + _body = {} + _body[:parameters] = parameters if parameters != SENTINEL + _body[:connectedAccountId] = connected_account_id if connected_account_id != SENTINEL + _body[:endpoint] = endpoint if endpoint != SENTINEL + _body[:method] = method if method != SENTINEL + _body[:body] = body if body != SENTINEL + extra[:action_proxy_request_config_dto] = _body if !_body.empty? + execute_action_proxy_with_http_info_impl(extra) end # Execute action proxy # Execute an action with direct auth. - # @param endpoint [String] - # @param connected_account_id [String] # @param [Hash] opts the optional parameters + # @option opts [ActionProxyRequestConfigDTO] :action_proxy_request_config_dto ActionProxyRequestConfigDTO # @return [ActionExecutionResDto] - private def execute_action_proxy_impl(endpoint, connected_account_id, opts = {}) - data, _status_code, _headers = execute_action_proxy_with_http_info(endpoint, connected_account_id, opts) + private def execute_action_proxy_impl(opts = {}) + data, _status_code, _headers = execute_action_proxy_with_http_info(opts) data end # Execute action proxy # Execute an action with direct auth. - # @param endpoint [String] - # @param connected_account_id [String] # @param [Hash] opts the optional parameters + # @option opts [ActionProxyRequestConfigDTO] :action_proxy_request_config_dto ActionProxyRequestConfigDTO # @return [APIResponse] data is ActionExecutionResDto, status code, headers and response - private def execute_action_proxy_with_http_info_impl(endpoint, connected_account_id, opts = {}) + private def execute_action_proxy_with_http_info_impl(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: ActionsApi.execute_action_proxy ...' end - # verify the required parameter 'endpoint' is set - if @api_client.config.client_side_validation && endpoint.nil? - fail ArgumentError, "Missing the required parameter 'endpoint' when calling ActionsApi.execute_action_proxy" - 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 ActionsApi.execute_action_proxy" - end # resource path local_var_path = '/api/v2/actions/proxy' # query parameters query_params = opts[:query_params] || {} - query_params[:'endpoint'] = endpoint - query_params[:'connectedAccountId'] = connected_account_id # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) + # HTTP header 'Content-Type' + content_type = @api_client.select_header_content_type(['application/json']) + if !content_type.nil? + header_params['Content-Type'] = content_type + end # form parameters form_params = opts[:form_params] || {} # http body (model) - post_body = opts[:debug_body] + post_body = opts[:debug_body] || @api_client.object_to_http_body(opts[:'action_proxy_request_config_dto']) # return_type return_type = opts[:debug_return_type] || 'ActionExecutionResDto' diff --git a/ruby/lib/composio/models/action_proxy_request_config_dto.rb b/ruby/lib/composio/models/action_proxy_request_config_dto.rb new file mode 100644 index 0000000..8f87b12 --- /dev/null +++ b/ruby/lib/composio/models/action_proxy_request_config_dto.rb @@ -0,0 +1,277 @@ +=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 ActionProxyRequestConfigDTO + attr_accessor :parameters + + # The connected account uuid to use for the action. + attr_accessor :connected_account_id + + # 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. + attr_accessor :endpoint + + # The HTTP method to use for the action. + attr_accessor :method + + # The body to be sent to the endpoint. This can either be a JSON field or a string. + attr_accessor :body + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'parameters' => :'parameters', + :'connected_account_id' => :'connectedAccountId', + :'endpoint' => :'endpoint', + :'method' => :'method', + :'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', + :'connected_account_id' => :'String', + :'endpoint' => :'String', + :'method' => :'Method', + :'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::ActionProxyRequestConfigDTO` 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::ActionProxyRequestConfigDTO`. 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?(:'connected_account_id') + self.connected_account_id = attributes[:'connected_account_id'] + end + + if attributes.key?(:'endpoint') + self.endpoint = attributes[:'endpoint'] + end + + if attributes.key?(:'method') + self.method = attributes[:'method'] + 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 @connected_account_id.nil? + invalid_properties.push('invalid value for "connected_account_id", connected_account_id cannot be nil.') + end + + if @endpoint.nil? + invalid_properties.push('invalid value for "endpoint", endpoint cannot be nil.') + end + + if @method.nil? + invalid_properties.push('invalid value for "method", method 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 @connected_account_id.nil? + return false if @endpoint.nil? + return false if @method.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 && + connected_account_id == o.connected_account_id && + endpoint == o.endpoint && + method == o.method && + 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, connected_account_id, endpoint, method, 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/action_proxy_request_method_dto.rb b/ruby/lib/composio/models/action_proxy_request_method_dto.rb new file mode 100644 index 0000000..0bff068 --- /dev/null +++ b/ruby/lib/composio/models/action_proxy_request_method_dto.rb @@ -0,0 +1,226 @@ +=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 ActionProxyRequestMethodDTO + # The type of request body to use for the action. Defaults to 'none'. + attr_accessor :type + + # The data to be sent to the endpoint. This will override the body set in the connected account. + attr_accessor :data + + # Attribute mapping from ruby-style variable name to JSON key. + def self.attribute_map + { + :'type' => :'type', + :'data' => :'data' + } + 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 + { + :'type' => :'Type', + :'data' => :'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::ActionProxyRequestMethodDTO` 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::ActionProxyRequestMethodDTO`. 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?(:'type') + self.type = attributes[:'type'] + end + + if attributes.key?(:'data') + self.data = attributes[:'data'] + 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 + 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? + 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 && + type == o.type && + data == o.data + 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 + [type, data].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/direct_execute_req_dto.rb b/ruby/lib/composio/models/direct_execute_req_dto.rb index 50bf9e0..f39fb9a 100644 --- a/ruby/lib/composio/models/direct_execute_req_dto.rb +++ b/ruby/lib/composio/models/direct_execute_req_dto.rb @@ -19,13 +19,16 @@ class DirectExecuteReqDto attr_accessor :_query_params + attr_accessor :body + # Attribute mapping from ruby-style variable name to JSON key. def self.attribute_map { :'endpoint' => :'endpoint', :'base_url' => :'base_url', :'headers' => :'headers', - :'_query_params' => :'queryParams' + :'_query_params' => :'queryParams', + :'body' => :'body' } end @@ -40,7 +43,8 @@ def self.openapi_types :'endpoint' => :'String', :'base_url' => :'String', :'headers' => :'Object', - :'_query_params' => :'Object' + :'_query_params' => :'Object', + :'body' => :'Object' } end @@ -80,6 +84,10 @@ def initialize(attributes = {}) if attributes.key?(:'_query_params') self._query_params = attributes[:'_query_params'] end + + if attributes.key?(:'body') + self.body = attributes[:'body'] + end end # Show invalid properties with the reasons. Usually used together with valid? @@ -123,7 +131,8 @@ def ==(o) endpoint == o.endpoint && base_url == o.base_url && headers == o.headers && - _query_params == o._query_params + _query_params == o._query_params && + body == o.body end # @see the `==` method @@ -135,7 +144,7 @@ def eql?(o) # Calculates hash code according to all attributes. # @return [Integer] Hash code def hash - [endpoint, base_url, headers, _query_params].hash + [endpoint, base_url, headers, _query_params, body].hash end # Builds the object from hash diff --git a/ruby/lib/composio/models/get_logs_dto.rb b/ruby/lib/composio/models/get_logs_dto.rb index 3c294cb..68be2f6 100644 --- a/ruby/lib/composio/models/get_logs_dto.rb +++ b/ruby/lib/composio/models/get_logs_dto.rb @@ -65,7 +65,7 @@ def self.acceptable_attributes # Attribute type mapping. def self.openapi_types { - :'type' => :'Type', + :'type' => :'GetLogsDtoType', :'time' => :'Time', :'status' => :'GetLogsDtoStatus', :'search' => :'String', diff --git a/ruby/lib/composio/models/get_logs_dto_type.rb b/ruby/lib/composio/models/get_logs_dto_type.rb new file mode 100644 index 0000000..8d6d8dd --- /dev/null +++ b/ruby/lib/composio/models/get_logs_dto_type.rb @@ -0,0 +1,37 @@ +=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 GetLogsDtoType + ERROR = "error".freeze + INFO = "info".freeze + DEBUG = "debug".freeze + + def self.all_vars + @all_vars ||= [ERROR, INFO, DEBUG].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if GetLogsDtoType.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #GetLogsDtoType" + end + end +end diff --git a/ruby/lib/composio/models/method.rb b/ruby/lib/composio/models/method.rb new file mode 100644 index 0000000..8859736 --- /dev/null +++ b/ruby/lib/composio/models/method.rb @@ -0,0 +1,39 @@ +=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 Method + GET = "GET".freeze + POST = "POST".freeze + PUT = "PUT".freeze + PATCH = "PATCH".freeze + DELETE = "DELETE".freeze + + def self.all_vars + @all_vars ||= [GET, POST, PUT, PATCH, DELETE].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if Method.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #Method" + end + end +end diff --git a/ruby/lib/composio/models/model_in.rb b/ruby/lib/composio/models/model_in.rb new file mode 100644 index 0000000..f13f4c8 --- /dev/null +++ b/ruby/lib/composio/models/model_in.rb @@ -0,0 +1,36 @@ +=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 ModelIn + QUERY = "query".freeze + HEADER = "header".freeze + + def self.all_vars + @all_vars ||= [QUERY, HEADER].freeze + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def self.build_from_hash(value) + new.build_from_hash(value) + end + + # Builds the enum from string + # @param [String] The enum value in the form of the string + # @return [String] The enum value + def build_from_hash(value) + return value if ModelIn.all_vars.include?(value) + raise "Invalid ENUM value #{value} for class #ModelIn" + end + end +end diff --git a/ruby/lib/composio/models/parameter.rb b/ruby/lib/composio/models/parameter.rb index b47f216..2eabdbb 100644 --- a/ruby/lib/composio/models/parameter.rb +++ b/ruby/lib/composio/models/parameter.rb @@ -11,10 +11,13 @@ module Composio class Parameter + # The name of the parameter. For example, 'x-api-key', 'Content-Type', etc., attr_accessor :name + # The location of the parameter. Can be 'query' or 'header'. attr_accessor :_in + # The value of the parameter. For example, '1234567890', 'application/json', etc., attr_accessor :value # Attribute mapping from ruby-style variable name to JSON key. @@ -35,7 +38,7 @@ def self.acceptable_attributes def self.openapi_types { :'name' => :'String', - :'_in' => :'String', + :'_in' => :'ModelIn', :'value' => :'String' } end diff --git a/ruby/lib/composio/models/type.rb b/ruby/lib/composio/models/type.rb index 5e44252..d240d71 100644 --- a/ruby/lib/composio/models/type.rb +++ b/ruby/lib/composio/models/type.rb @@ -11,12 +11,15 @@ module Composio class Type - ERROR = "error".freeze - INFO = "info".freeze - DEBUG = "debug".freeze + FORM_DATA = "formData".freeze + URL_ENCODED = "urlEncoded".freeze + RAW = "raw".freeze + BINARY = "binary".freeze + GRAPHQL = "graphql".freeze + NONE = "none".freeze def self.all_vars - @all_vars ||= [ERROR, INFO, DEBUG].freeze + @all_vars ||= [FORM_DATA, URL_ENCODED, RAW, BINARY, GRAPHQL, NONE].freeze end # Builds the enum from string diff --git a/ruby/spec/api/actions_api_spec.rb b/ruby/spec/api/actions_api_spec.rb index 300424a..841ccac 100644 --- a/ruby/spec/api/actions_api_spec.rb +++ b/ruby/spec/api/actions_api_spec.rb @@ -42,9 +42,8 @@ # unit tests for execute_action_proxy # Execute action proxy # Execute an action with direct auth. - # @param endpoint - # @param connected_account_id # @param [Hash] opts the optional parameters + # @option opts [ActionProxyRequestConfigDTO] :action_proxy_request_config_dto ActionProxyRequestConfigDTO # @return [ActionExecutionResDto] describe 'execute_action_proxy test' do it 'should work' do diff --git a/ruby/spec/models/action_proxy_request_config_dto_spec.rb b/ruby/spec/models/action_proxy_request_config_dto_spec.rb new file mode 100644 index 0000000..baaa2c2 --- /dev/null +++ b/ruby/spec/models/action_proxy_request_config_dto_spec.rb @@ -0,0 +1,52 @@ +=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::ActionProxyRequestConfigDTO +describe Composio::ActionProxyRequestConfigDTO do + let(:instance) { Composio::ActionProxyRequestConfigDTO.new } + + describe 'test an instance of ActionProxyRequestConfigDTO' do + it 'should create an instance of ActionProxyRequestConfigDTO' do + expect(instance).to be_instance_of(Composio::ActionProxyRequestConfigDTO) + 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 "connected_account_id"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "endpoint"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "method"' 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/action_proxy_request_method_dto_spec.rb b/ruby/spec/models/action_proxy_request_method_dto_spec.rb new file mode 100644 index 0000000..daf4226 --- /dev/null +++ b/ruby/spec/models/action_proxy_request_method_dto_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::ActionProxyRequestMethodDTO +describe Composio::ActionProxyRequestMethodDTO do + let(:instance) { Composio::ActionProxyRequestMethodDTO.new } + + describe 'test an instance of ActionProxyRequestMethodDTO' do + it 'should create an instance of ActionProxyRequestMethodDTO' do + expect(instance).to be_instance_of(Composio::ActionProxyRequestMethodDTO) + end + end + describe 'test attribute "type"' do + it 'should work' do + # assertion here. ref: https://www.relishapp.com/rspec/rspec-expectations/docs/built-in-matchers + end + end + + describe 'test attribute "data"' 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/direct_execute_req_dto_spec.rb b/ruby/spec/models/direct_execute_req_dto_spec.rb index 317f38e..0193938 100644 --- a/ruby/spec/models/direct_execute_req_dto_spec.rb +++ b/ruby/spec/models/direct_execute_req_dto_spec.rb @@ -43,4 +43,10 @@ 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/get_logs_dto_type_spec.rb b/ruby/spec/models/get_logs_dto_type_spec.rb new file mode 100644 index 0000000..3bf86c5 --- /dev/null +++ b/ruby/spec/models/get_logs_dto_type_spec.rb @@ -0,0 +1,22 @@ +=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::GetLogsDtoType +describe Composio::GetLogsDtoType do + let(:instance) { Composio::GetLogsDtoType.new } + + describe 'test an instance of GetLogsDtoType' do + it 'should create an instance of GetLogsDtoType' do + expect(instance).to be_instance_of(Composio::GetLogsDtoType) + end + end +end diff --git a/ruby/spec/models/method_spec.rb b/ruby/spec/models/method_spec.rb new file mode 100644 index 0000000..f0b17c7 --- /dev/null +++ b/ruby/spec/models/method_spec.rb @@ -0,0 +1,22 @@ +=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::Method +describe Composio::Method do + let(:instance) { Composio::Method.new } + + describe 'test an instance of Method' do + it 'should create an instance of Method' do + expect(instance).to be_instance_of(Composio::Method) + end + end +end diff --git a/ruby/spec/models/model_in_spec.rb b/ruby/spec/models/model_in_spec.rb new file mode 100644 index 0000000..02c3b85 --- /dev/null +++ b/ruby/spec/models/model_in_spec.rb @@ -0,0 +1,22 @@ +=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::ModelIn +describe Composio::ModelIn do + let(:instance) { Composio::ModelIn.new } + + describe 'test an instance of ModelIn' do + it 'should create an instance of ModelIn' do + expect(instance).to be_instance_of(Composio::ModelIn) + end + end +end