=begin
#Daytona Toolbox API

#Daytona Toolbox API

The version of the OpenAPI document: v0.0.0-dev

Generated by: https://openapi-generator.tech
Generator version: 7.21.0

=end

require 'cgi'

module DaytonaToolboxApiClient
  class FileSystemApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Create a folder
    # Create a folder with the specified path and optional permissions
    # @param path [String] Folder path to create
    # @param mode [String] Octal permission mode (default: 0755)
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def create_folder(path, mode, opts = {})
      create_folder_with_http_info(path, mode, opts)
      nil
    end

    # Create a folder
    # Create a folder with the specified path and optional permissions
    # @param path [String] Folder path to create
    # @param mode [String] Octal permission mode (default: 0755)
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def create_folder_with_http_info(path, mode, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.create_folder ...'
      end
      # verify the required parameter 'path' is set
      if @api_client.config.client_side_validation && path.nil?
        fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.create_folder"
      end
      # verify the required parameter 'mode' is set
      if @api_client.config.client_side_validation && mode.nil?
        fail ArgumentError, "Missing the required parameter 'mode' when calling FileSystemApi.create_folder"
      end
      # resource path
      local_var_path = '/files/folder'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = path
      query_params[:'mode'] = mode

      # header parameters
      header_params = opts[:header_params] || {}

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.create_folder",
        :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 = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#create_folder\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Delete a file or directory
    # Delete a file or directory at the specified path
    # @param path [String] File or directory path to delete
    # @param [Hash] opts the optional parameters
    # @option opts [Boolean] :recursive Enable recursive deletion for directories
    # @return [nil]
    def delete_file(path, opts = {})
      delete_file_with_http_info(path, opts)
      nil
    end

    # Delete a file or directory
    # Delete a file or directory at the specified path
    # @param path [String] File or directory path to delete
    # @param [Hash] opts the optional parameters
    # @option opts [Boolean] :recursive Enable recursive deletion for directories
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def delete_file_with_http_info(path, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.delete_file ...'
      end
      # verify the required parameter 'path' is set
      if @api_client.config.client_side_validation && path.nil?
        fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.delete_file"
      end
      # resource path
      local_var_path = '/files'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = path
      query_params[:'recursive'] = opts[:'recursive'] if !opts[:'recursive'].nil?

      # header parameters
      header_params = opts[:header_params] || {}

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.delete_file",
        :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 = @api_client.call_api(:DELETE, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#delete_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Download a file
    # Download a file by providing its path
    # @param path [String] File path to download
    # @param [Hash] opts the optional parameters
    # @return [File]
    def download_file(path, opts = {})
      data, _status_code, _headers = download_file_with_http_info(path, opts)
      data
    end

    # Download a file
    # Download a file by providing its path
    # @param path [String] File path to download
    # @param [Hash] opts the optional parameters
    # @return [Array<(File, Integer, Hash)>] File data, response status code and response headers
    def download_file_with_http_info(path, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.download_file ...'
      end
      # verify the required parameter 'path' is set
      if @api_client.config.client_side_validation && path.nil?
        fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.download_file"
      end
      # resource path
      local_var_path = '/files/download'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = path

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) unless header_params['Accept']

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'File'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.download_file",
        :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 = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#download_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Download multiple files
    # Download multiple files by providing their paths. Successful files are returned as multipart parts named `file`. Per-file failures are returned as multipart parts named `error` with JSON payloads shaped like ErrorResponse.
    # @param download_files [FilesDownloadRequest] Paths of files to download
    # @param [Hash] opts the optional parameters
    # @return [Hash<String, Object>]
    def download_files(download_files, opts = {})
      data, _status_code, _headers = download_files_with_http_info(download_files, opts)
      data
    end

    # Download multiple files
    # Download multiple files by providing their paths. Successful files are returned as multipart parts named &#x60;file&#x60;. Per-file failures are returned as multipart parts named &#x60;error&#x60; with JSON payloads shaped like ErrorResponse.
    # @param download_files [FilesDownloadRequest] Paths of files to download
    # @param [Hash] opts the optional parameters
    # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
    def download_files_with_http_info(download_files, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.download_files ...'
      end
      # verify the required parameter 'download_files' is set
      if @api_client.config.client_side_validation && download_files.nil?
        fail ArgumentError, "Missing the required parameter 'download_files' when calling FileSystemApi.download_files"
      end
      # resource path
      local_var_path = '/files/bulk-download'

      # 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(['multipart/form-data']) unless header_params['Accept']
      # 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] || @api_client.object_to_http_body(download_files)

      # return_type
      return_type = opts[:debug_return_type] || 'Hash<String, Object>'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.download_files",
        :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 = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#download_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Find text in files
    # Search for text pattern within files in a directory
    # @param path [String] Directory path to search in
    # @param pattern [String] Text pattern to search for
    # @param [Hash] opts the optional parameters
    # @return [Array<Match>]
    def find_in_files(path, pattern, opts = {})
      data, _status_code, _headers = find_in_files_with_http_info(path, pattern, opts)
      data
    end

    # Find text in files
    # Search for text pattern within files in a directory
    # @param path [String] Directory path to search in
    # @param pattern [String] Text pattern to search for
    # @param [Hash] opts the optional parameters
    # @return [Array<(Array<Match>, Integer, Hash)>] Array<Match> data, response status code and response headers
    def find_in_files_with_http_info(path, pattern, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.find_in_files ...'
      end
      # verify the required parameter 'path' is set
      if @api_client.config.client_side_validation && path.nil?
        fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.find_in_files"
      end
      # verify the required parameter 'pattern' is set
      if @api_client.config.client_side_validation && pattern.nil?
        fail ArgumentError, "Missing the required parameter 'pattern' when calling FileSystemApi.find_in_files"
      end
      # resource path
      local_var_path = '/files/find'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = path
      query_params[:'pattern'] = pattern

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'Array<Match>'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.find_in_files",
        :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 = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#find_in_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Get file information
    # Get detailed information about a file or directory
    # @param path [String] File or directory path
    # @param [Hash] opts the optional parameters
    # @return [FileInfo]
    def get_file_info(path, opts = {})
      data, _status_code, _headers = get_file_info_with_http_info(path, opts)
      data
    end

    # Get file information
    # Get detailed information about a file or directory
    # @param path [String] File or directory path
    # @param [Hash] opts the optional parameters
    # @return [Array<(FileInfo, Integer, Hash)>] FileInfo data, response status code and response headers
    def get_file_info_with_http_info(path, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.get_file_info ...'
      end
      # verify the required parameter 'path' is set
      if @api_client.config.client_side_validation && path.nil?
        fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.get_file_info"
      end
      # resource path
      local_var_path = '/files/info'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = path

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'FileInfo'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.get_file_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 = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#get_file_info\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # List files and directories
    # List files and directories in the specified path
    # @param [Hash] opts the optional parameters
    # @option opts [String] :path Directory path to list (defaults to working directory)
    # @return [Array<FileInfo>]
    def list_files(opts = {})
      data, _status_code, _headers = list_files_with_http_info(opts)
      data
    end

    # List files and directories
    # List files and directories in the specified path
    # @param [Hash] opts the optional parameters
    # @option opts [String] :path Directory path to list (defaults to working directory)
    # @return [Array<(Array<FileInfo>, Integer, Hash)>] Array<FileInfo> data, response status code and response headers
    def list_files_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.list_files ...'
      end
      # resource path
      local_var_path = '/files'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = opts[:'path'] if !opts[:'path'].nil?

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'Array<FileInfo>'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.list_files",
        :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 = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#list_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Move or rename file/directory
    # Move or rename a file or directory from source to destination
    # @param source [String] Source file or directory path
    # @param destination [String] Destination file or directory path
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def move_file(source, destination, opts = {})
      move_file_with_http_info(source, destination, opts)
      nil
    end

    # Move or rename file/directory
    # Move or rename a file or directory from source to destination
    # @param source [String] Source file or directory path
    # @param destination [String] Destination file or directory path
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def move_file_with_http_info(source, destination, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.move_file ...'
      end
      # verify the required parameter 'source' is set
      if @api_client.config.client_side_validation && source.nil?
        fail ArgumentError, "Missing the required parameter 'source' when calling FileSystemApi.move_file"
      end
      # verify the required parameter 'destination' is set
      if @api_client.config.client_side_validation && destination.nil?
        fail ArgumentError, "Missing the required parameter 'destination' when calling FileSystemApi.move_file"
      end
      # resource path
      local_var_path = '/files/move'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'source'] = source
      query_params[:'destination'] = destination

      # header parameters
      header_params = opts[:header_params] || {}

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.move_file",
        :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 = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#move_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Replace text in files
    # Replace text pattern with new value in multiple files
    # @param request [ReplaceRequest] Replace request
    # @param [Hash] opts the optional parameters
    # @return [Array<ReplaceResult>]
    def replace_in_files(request, opts = {})
      data, _status_code, _headers = replace_in_files_with_http_info(request, opts)
      data
    end

    # Replace text in files
    # Replace text pattern with new value in multiple files
    # @param request [ReplaceRequest] Replace request
    # @param [Hash] opts the optional parameters
    # @return [Array<(Array<ReplaceResult>, Integer, Hash)>] Array<ReplaceResult> data, response status code and response headers
    def replace_in_files_with_http_info(request, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.replace_in_files ...'
      end
      # verify the required parameter 'request' is set
      if @api_client.config.client_side_validation && request.nil?
        fail ArgumentError, "Missing the required parameter 'request' when calling FileSystemApi.replace_in_files"
      end
      # resource path
      local_var_path = '/files/replace'

      # 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']) unless header_params['Accept']
      # 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] || @api_client.object_to_http_body(request)

      # return_type
      return_type = opts[:debug_return_type] || 'Array<ReplaceResult>'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.replace_in_files",
        :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 = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#replace_in_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Search files by pattern
    # Search for files matching a specific pattern in a directory
    # @param path [String] Directory path to search in
    # @param pattern [String] File pattern to match (e.g., *.txt, *.go)
    # @param [Hash] opts the optional parameters
    # @return [SearchFilesResponse]
    def search_files(path, pattern, opts = {})
      data, _status_code, _headers = search_files_with_http_info(path, pattern, opts)
      data
    end

    # Search files by pattern
    # Search for files matching a specific pattern in a directory
    # @param path [String] Directory path to search in
    # @param pattern [String] File pattern to match (e.g., *.txt, *.go)
    # @param [Hash] opts the optional parameters
    # @return [Array<(SearchFilesResponse, Integer, Hash)>] SearchFilesResponse data, response status code and response headers
    def search_files_with_http_info(path, pattern, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.search_files ...'
      end
      # verify the required parameter 'path' is set
      if @api_client.config.client_side_validation && path.nil?
        fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.search_files"
      end
      # verify the required parameter 'pattern' is set
      if @api_client.config.client_side_validation && pattern.nil?
        fail ArgumentError, "Missing the required parameter 'pattern' when calling FileSystemApi.search_files"
      end
      # resource path
      local_var_path = '/files/search'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = path
      query_params[:'pattern'] = pattern

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'SearchFilesResponse'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.search_files",
        :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 = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#search_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Set file permissions
    # Set file permissions, ownership, and group for a file or directory
    # @param path [String] File or directory path
    # @param [Hash] opts the optional parameters
    # @option opts [String] :owner Owner (username or UID)
    # @option opts [String] :group Group (group name or GID)
    # @option opts [String] :mode File mode in octal format (e.g., 0755)
    # @return [nil]
    def set_file_permissions(path, opts = {})
      set_file_permissions_with_http_info(path, opts)
      nil
    end

    # Set file permissions
    # Set file permissions, ownership, and group for a file or directory
    # @param path [String] File or directory path
    # @param [Hash] opts the optional parameters
    # @option opts [String] :owner Owner (username or UID)
    # @option opts [String] :group Group (group name or GID)
    # @option opts [String] :mode File mode in octal format (e.g., 0755)
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def set_file_permissions_with_http_info(path, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.set_file_permissions ...'
      end
      # verify the required parameter 'path' is set
      if @api_client.config.client_side_validation && path.nil?
        fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.set_file_permissions"
      end
      # resource path
      local_var_path = '/files/permissions'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = path
      query_params[:'owner'] = opts[:'owner'] if !opts[:'owner'].nil?
      query_params[:'group'] = opts[:'group'] if !opts[:'group'].nil?
      query_params[:'mode'] = opts[:'mode'] if !opts[:'mode'].nil?

      # header parameters
      header_params = opts[:header_params] || {}

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.set_file_permissions",
        :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 = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#set_file_permissions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Upload a file
    # Upload a file to the specified path
    # @param path [String] Destination path for the uploaded file
    # @param file [File] File to upload
    # @param [Hash] opts the optional parameters
    # @return [Hash<String, Object>]
    def upload_file(path, file, opts = {})
      data, _status_code, _headers = upload_file_with_http_info(path, file, opts)
      data
    end

    # Upload a file
    # Upload a file to the specified path
    # @param path [String] Destination path for the uploaded file
    # @param file [File] File to upload
    # @param [Hash] opts the optional parameters
    # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
    def upload_file_with_http_info(path, file, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.upload_file ...'
      end
      # verify the required parameter 'path' is set
      if @api_client.config.client_side_validation && path.nil?
        fail ArgumentError, "Missing the required parameter 'path' when calling FileSystemApi.upload_file"
      end
      # verify the required parameter 'file' is set
      if @api_client.config.client_side_validation && file.nil?
        fail ArgumentError, "Missing the required parameter 'file' when calling FileSystemApi.upload_file"
      end
      # resource path
      local_var_path = '/files/upload'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'path'] = path

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['*/*']) unless header_params['Accept']
      # HTTP header 'Content-Type'
      content_type = @api_client.select_header_content_type(['multipart/form-data'])
      if !content_type.nil?
          header_params['Content-Type'] = content_type
      end

      # form parameters
      form_params = opts[:form_params] || {}
      form_params['file'] = file

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'Hash<String, Object>'

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.upload_file",
        :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 = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#upload_file\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Upload multiple files
    # Upload multiple files with their destination paths
    # @param [Hash] opts the optional parameters
    # @return [nil]
    def upload_files(opts = {})
      upload_files_with_http_info(opts)
      nil
    end

    # Upload multiple files
    # Upload multiple files with their destination paths
    # @param [Hash] opts the optional parameters
    # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
    def upload_files_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: FileSystemApi.upload_files ...'
      end
      # resource path
      local_var_path = '/files/bulk-upload'

      # query parameters
      query_params = opts[:query_params] || {}

      # header parameters
      header_params = opts[:header_params] || {}

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type]

      # auth_names
      auth_names = opts[:debug_auth_names] || []

      new_options = opts.merge(
        :operation => :"FileSystemApi.upload_files",
        :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 = @api_client.call_api(:POST, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: FileSystemApi#upload_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
