=begin
#Lists

#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: v3

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

=end

require 'cgi'

module Hubspot
  module Crm
    module Lists
      class FoldersApi
        attr_accessor :api_client

        def initialize(api_client = ApiClient.default)
          @api_client = api_client
        end
        # Creates a folder
        # Creates a folder with the given information.
        # @param list_folder_create_request [ListFolderCreateRequest] 
        # @param [Hash] opts the optional parameters
        # @return [ListFolderCreateResponse]
        def create(list_folder_create_request, opts = {})
          data, _status_code, _headers = create_with_http_info(list_folder_create_request, opts)
          data
        end

        # Creates a folder
        # Creates a folder with the given information.
        # @param list_folder_create_request [ListFolderCreateRequest] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(ListFolderCreateResponse, Integer, Hash)>] ListFolderCreateResponse data, response status code and response headers
        def create_with_http_info(list_folder_create_request, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: FoldersApi.create ...'
          end
          # verify the required parameter 'list_folder_create_request' is set
          if @api_client.config.client_side_validation && list_folder_create_request.nil?
            fail ArgumentError, "Missing the required parameter 'list_folder_create_request' when calling FoldersApi.create"
          end
          # resource path
          local_var_path = '/crm/v3/lists/folders'

          # 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', '*/*'])
          # 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(list_folder_create_request)

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

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

          new_options = opts.merge(
            :operation => :"FoldersApi.create",
            :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: FoldersApi#create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Retrieves a folder.
        # Retrieves a folder and recursively includes all folders via the childNodes attribute.  The child lists field will be empty in all child nodes. Only the folder retrieved will include the child lists in that folder.
        # @param [Hash] opts the optional parameters
        # @option opts [String] :folder_id The Id of the folder to retrieve. (default to '0')
        # @return [ListFolderFetchResponse]
        def get_all(opts = {})
          data, _status_code, _headers = get_all_with_http_info(opts)
          data
        end

        # Retrieves a folder.
        # Retrieves a folder and recursively includes all folders via the childNodes attribute.  The child lists field will be empty in all child nodes. Only the folder retrieved will include the child lists in that folder.
        # @param [Hash] opts the optional parameters
        # @option opts [String] :folder_id The Id of the folder to retrieve. (default to '0')
        # @return [Array<(ListFolderFetchResponse, Integer, Hash)>] ListFolderFetchResponse data, response status code and response headers
        def get_all_with_http_info(opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: FoldersApi.get_all ...'
          end
          # resource path
          local_var_path = '/crm/v3/lists/folders'

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

          # 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] || 'ListFolderFetchResponse'

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

          new_options = opts.merge(
            :operation => :"FoldersApi.get_all",
            :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: FoldersApi#get_all\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Moves a folder
        # This moves the folder from its current location to a new location. It updates the parent of this folder to the new Id given.
        # @param folder_id [String] 
        # @param new_parent_folder_id [String] 
        # @param [Hash] opts the optional parameters
        # @return [ListFolderFetchResponse]
        def move(folder_id, new_parent_folder_id, opts = {})
          data, _status_code, _headers = move_with_http_info(folder_id, new_parent_folder_id, opts)
          data
        end

        # Moves a folder
        # This moves the folder from its current location to a new location. It updates the parent of this folder to the new Id given.
        # @param folder_id [String] 
        # @param new_parent_folder_id [String] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(ListFolderFetchResponse, Integer, Hash)>] ListFolderFetchResponse data, response status code and response headers
        def move_with_http_info(folder_id, new_parent_folder_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: FoldersApi.move ...'
          end
          # verify the required parameter 'folder_id' is set
          if @api_client.config.client_side_validation && folder_id.nil?
            fail ArgumentError, "Missing the required parameter 'folder_id' when calling FoldersApi.move"
          end
          # verify the required parameter 'new_parent_folder_id' is set
          if @api_client.config.client_side_validation && new_parent_folder_id.nil?
            fail ArgumentError, "Missing the required parameter 'new_parent_folder_id' when calling FoldersApi.move"
          end
          # resource path
          local_var_path = '/crm/v3/lists/folders/{folderId}/move/{newParentFolderId}'.sub('{' + 'folderId' + '}', CGI.escape(folder_id.to_s)).sub('{' + 'newParentFolderId' + '}', CGI.escape(new_parent_folder_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] || 'ListFolderFetchResponse'

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

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

        # Moves a list to a given folder
        # Given a list and a folder, the list will be moved to that folder.
        # @param list_move_request [ListMoveRequest] 
        # @param [Hash] opts the optional parameters
        # @return [nil]
        def move_list(list_move_request, opts = {})
          move_list_with_http_info(list_move_request, opts)
          nil
        end

        # Moves a list to a given folder
        # Given a list and a folder, the list will be moved to that folder.
        # @param list_move_request [ListMoveRequest] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
        def move_list_with_http_info(list_move_request, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: FoldersApi.move_list ...'
          end
          # verify the required parameter 'list_move_request' is set
          if @api_client.config.client_side_validation && list_move_request.nil?
            fail ArgumentError, "Missing the required parameter 'list_move_request' when calling FoldersApi.move_list"
          end
          # resource path
          local_var_path = '/crm/v3/lists/folders/move-list'

          # 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(['*/*'])
          # 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(list_move_request)

          # return_type
          return_type = opts[:debug_return_type]

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

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

        # Deletes a folder
        # Deletes the folder with the given Id.
        # @param folder_id [String] 
        # @param [Hash] opts the optional parameters
        # @return [nil]
        def remove(folder_id, opts = {})
          remove_with_http_info(folder_id, opts)
          nil
        end

        # Deletes a folder
        # Deletes the folder with the given Id.
        # @param folder_id [String] 
        # @param [Hash] opts the optional parameters
        # @return [Array<(nil, Integer, Hash)>] nil, response status code and response headers
        def remove_with_http_info(folder_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: FoldersApi.remove ...'
          end
          # verify the required parameter 'folder_id' is set
          if @api_client.config.client_side_validation && folder_id.nil?
            fail ArgumentError, "Missing the required parameter 'folder_id' when calling FoldersApi.remove"
          end
          # resource path
          local_var_path = '/crm/v3/lists/folders/{folderId}'.sub('{' + 'folderId' + '}', CGI.escape(folder_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(['*/*'])

          # 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] || ['oauth2']

          new_options = opts.merge(
            :operation => :"FoldersApi.remove",
            :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: FoldersApi#remove\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
          end
          return data, status_code, headers
        end

        # Rename a folder
        # Renames the given folderId with a new name.
        # @param folder_id [String] 
        # @param [Hash] opts the optional parameters
        # @option opts [String] :new_folder_name 
        # @return [ListFolderFetchResponse]
        def rename(folder_id, opts = {})
          data, _status_code, _headers = rename_with_http_info(folder_id, opts)
          data
        end

        # Rename a folder
        # Renames the given folderId with a new name.
        # @param folder_id [String] 
        # @param [Hash] opts the optional parameters
        # @option opts [String] :new_folder_name 
        # @return [Array<(ListFolderFetchResponse, Integer, Hash)>] ListFolderFetchResponse data, response status code and response headers
        def rename_with_http_info(folder_id, opts = {})
          if @api_client.config.debugging
            @api_client.config.logger.debug 'Calling API: FoldersApi.rename ...'
          end
          # verify the required parameter 'folder_id' is set
          if @api_client.config.client_side_validation && folder_id.nil?
            fail ArgumentError, "Missing the required parameter 'folder_id' when calling FoldersApi.rename"
          end
          # resource path
          local_var_path = '/crm/v3/lists/folders/{folderId}/rename'.sub('{' + 'folderId' + '}', CGI.escape(folder_id.to_s))

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

          # 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] || 'ListFolderFetchResponse'

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

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