<commit_before>module Teamlab
  class Files

    def initialize
      @request = Teamlab::Request.new('files')
    end

    #region File Creation

    def create_txt_in_my_docs(title, content)
      @request.post(%w(@my text), title: title.to_s, content: content.to_s)
    end

    def create_html_in_my_docs(title, content)
      @request.post(%w(@my html), title: title.to_s, content: content.to_s)
    end

    def create_txt_in_common_docs(title, content)
      @request.post(%w(@common text), title: title.to_s, content: content.to_s)
    end

    def create_html_in_common_docs(title, content)
      @request.post(%w(common html), title: title.to_s, content: content.to_s)
    end

    def create_txt(folder_id, title, content)
      @request.post([folder_id.to_s, 'text'], title: title.to_s, content: content.to_s)
    end

    def create_html(folder_id, title, content)
      @request.post([folder_id.to_s, 'html'], title: title.to_s, content: content.to_s)
    end

    def create_file(folder_id, title)
      @request.post([folder_id.to_s, 'file'], title: title.to_s)
    end

    #endregion

    #region File operations

    def get_file_operations_list
      @request.get(%w(fileops))
    end

    def check_conflict(options = {})
      @request.get(%w(fileops move), options)
    end

    def check_conversion_status(fileid)
      @request.get(['fileops', fileid.to_s, 'checkconversion'])
    end

    def move_to_folder(dest_folder_id, options = {})
      @request.put(%w(fileops move), { destFolderId: dest_folder_id }.merge(options))
    end
    alias_method :move_files, :move_to_folder

    def copy_to_folder(dest_folder_id, options = {})
      @request.put(%w(fileops copy), { destFolderId: dest_folder_id }.merge(options))
    end

    def delete(options = {})
      @request.put(%w(fileops delete), options)
    end

    def finish_all
      @request.put(%w(fileops terminate))
    end

    def mark_as_read
      @request.put(%w(fileops markasread))
    end

    def clear_recycle_bin
      @request.put(%w(fileops emptytrash))
    end

    def finish_operations(options = {})
      @request.put(%w(fileops bulkdownload), options)
    end

    def start_conversion(file_id, start)
      @request.put(['file', file_id.to_s, 'checkconversion'], start: start)
    end

    #endregion

    #region Files

    def get_file_info(file_id)
      @request.get(['file', file_id.to_s])
    end

    def get_file_history(file_id)
      @request.get(['file', file_id.to_s, 'history'])
    end

    def update_file_info(file_id, title, last_version)
      @request.put(['file', file_id.to_s], title: title, lastVersion: last_version)
    end

    def delete_file(file_id)
      @request.delete(['file', file_id.to_s])
    end

    #endregion

    #region Folders

    def get_my_docs
      @request.get(['@my'])
    end
    alias_method :get_my_files, :get_my_docs

    def get_shared_docs
      @request.get(['@share'])
    end

    def get_trash
      @request.get(['@trash'])
    end

    def get_common_docs
      @request.get(['@common'])
    end

    def get_projects_folder
      @request.get(['@projects'])
    end

    def get_folder(folder_id, options = {})
      @request.get([folder_id.to_s], options)
    end

    def get_folder_info(folder_id)
      @request.get(['folder', folder_id.to_s])
    end

    def get_folder_path(folder_id)
      @request.get(['folder', folder_id.to_s, 'path'])
    end

    def new_folder(folder_id, title)
      @request.post(['folder', folder_id.to_s], title: title)
    end

    def rename_folder(folder_id, title)
      @request.put(['folder', folder_id.to_s], title: title)
    end

    def delete_folder(folder_id)
      @request.delete(['folder', folder_id.to_s])
    end

    #endregion

    #region Sharing

    def get_file_sharing(file_id)
      @request.get(['file', file_id.to_s, 'share'])
    end

    def get_folder_sharing(folder_id)
      @request.get(['folder', folder_id.to_s, 'share'])
    end

    def share_file(file_id, user_id, access_type, options = {})
      @request.put(['file', file_id.to_s, 'share'], { share: { shareTo: user_id, fileShare: access_type } }.merge(options))
    end

    def share_folder(folder_id, user_id, access_type, options = {})
      @request.put(['folder', folder_id.to_s, 'share'], { share: { shareTo: user_id, fileShare: access_type } }.merge(options))
    end

    def removes_sharing_rights(options = {})
      @request.delete(['share'], options)
    end

    #endregion

    #region Third-Party Integration

    def get_third_party
      @request.get(%w(thirdparty))
    end

    def save_third_party(options = {})
      @request.post(%w(thirdparty), options)
    end

    def remove_third_party_account(provider_id)
      @request.delete(['thirdparty', provider_id.to_s])
    end

    #endregion

    #region Uploads

    def upload_to_my_docs(file)
      @request.post(%w(@my upload), somefile: File.new(file))
    end

    def upload_to_common_docs(file)
      @request.post(%w(@common upload), somefile: File.new(file))
    end

    def upload_to_folder(folder_id, file)
      @request.post([folder_id.to_s, 'upload'], somefile: File.new(file))
    end

    def insert_file(folder_id, file, title)
      @request.post([folder_id.to_s, 'insert'], somefile: File.new(file), title: title)
    end

    def chunked_upload(folder_id, filename, file_size)
      @request.post([folder_id.to_s, 'upload', 'create_session'], fileName: filename, fileSize: file_size)
    end

    #endregion

    def search(query)
      @request.get(['@search', query.to_s])
    end

    def generate_shared_link(file_id, share)
      @request.put([file_id.to_s, 'sharedlink'], share: share)
    end

  end
end
<commit_msg>fix parameter name for sharing Files and folders<commit_after>module Teamlab
  class Files

    def initialize
      @request = Teamlab::Request.new('files')
    end

    #region File Creation

    def create_txt_in_my_docs(title, content)
      @request.post(%w(@my text), title: title.to_s, content: content.to_s)
    end

    def create_html_in_my_docs(title, content)
      @request.post(%w(@my html), title: title.to_s, content: content.to_s)
    end

    def create_txt_in_common_docs(title, content)
      @request.post(%w(@common text), title: title.to_s, content: content.to_s)
    end

    def create_html_in_common_docs(title, content)
      @request.post(%w(common html), title: title.to_s, content: content.to_s)
    end

    def create_txt(folder_id, title, content)
      @request.post([folder_id.to_s, 'text'], title: title.to_s, content: content.to_s)
    end

    def create_html(folder_id, title, content)
      @request.post([folder_id.to_s, 'html'], title: title.to_s, content: content.to_s)
    end

    def create_file(folder_id, title)
      @request.post([folder_id.to_s, 'file'], title: title.to_s)
    end

    #endregion

    #region File operations

    def get_file_operations_list
      @request.get(%w(fileops))
    end

    def check_conflict(options = {})
      @request.get(%w(fileops move), options)
    end

    def check_conversion_status(fileid)
      @request.get(['fileops', fileid.to_s, 'checkconversion'])
    end

    def move_to_folder(dest_folder_id, options = {})
      @request.put(%w(fileops move), { destFolderId: dest_folder_id }.merge(options))
    end
    alias_method :move_files, :move_to_folder

    def copy_to_folder(dest_folder_id, options = {})
      @request.put(%w(fileops copy), { destFolderId: dest_folder_id }.merge(options))
    end

    def delete(options = {})
      @request.put(%w(fileops delete), options)
    end

    def finish_all
      @request.put(%w(fileops terminate))
    end

    def mark_as_read
      @request.put(%w(fileops markasread))
    end

    def clear_recycle_bin
      @request.put(%w(fileops emptytrash))
    end

    def finish_operations(options = {})
      @request.put(%w(fileops bulkdownload), options)
    end

    def start_conversion(file_id, start)
      @request.put(['file', file_id.to_s, 'checkconversion'], start: start)
    end

    #endregion

    #region Files

    def get_file_info(file_id)
      @request.get(['file', file_id.to_s])
    end

    def get_file_history(file_id)
      @request.get(['file', file_id.to_s, 'history'])
    end

    def update_file_info(file_id, title, last_version)
      @request.put(['file', file_id.to_s], title: title, lastVersion: last_version)
    end

    def delete_file(file_id)
      @request.delete(['file', file_id.to_s])
    end

    #endregion

    #region Folders

    def get_my_docs
      @request.get(['@my'])
    end
    alias_method :get_my_files, :get_my_docs

    def get_shared_docs
      @request.get(['@share'])
    end

    def get_trash
      @request.get(['@trash'])
    end

    def get_common_docs
      @request.get(['@common'])
    end

    def get_projects_folder
      @request.get(['@projects'])
    end

    def get_folder(folder_id, options = {})
      @request.get([folder_id.to_s], options)
    end

    def get_folder_info(folder_id)
      @request.get(['folder', folder_id.to_s])
    end

    def get_folder_path(folder_id)
      @request.get(['folder', folder_id.to_s, 'path'])
    end

    def new_folder(folder_id, title)
      @request.post(['folder', folder_id.to_s], title: title)
    end

    def rename_folder(folder_id, title)
      @request.put(['folder', folder_id.to_s], title: title)
    end

    def delete_folder(folder_id)
      @request.delete(['folder', folder_id.to_s])
    end

    #endregion

    #region Sharing

    def get_file_sharing(file_id)
      @request.get(['file', file_id.to_s, 'share'])
    end

    def get_folder_sharing(folder_id)
      @request.get(['folder', folder_id.to_s, 'share'])
    end

    def share_file(file_id, user_id, access_type, options = {})
      @request.put(['file', file_id.to_s, 'share'], { share: { shareTo: user_id, Access: access_type } }.merge(options))
    end

    def share_folder(folder_id, user_id, access_type, options = {})
      @request.put(['folder', folder_id.to_s, 'share'], { share: { shareTo: user_id, Access: access_type } }.merge(options))
    end

    def removes_sharing_rights(options = {})
      @request.delete(['share'], options)
    end

    #endregion

    #region Third-Party Integration

    def get_third_party
      @request.get(%w(thirdparty))
    end

    def save_third_party(options = {})
      @request.post(%w(thirdparty), options)
    end

    def remove_third_party_account(provider_id)
      @request.delete(['thirdparty', provider_id.to_s])
    end

    #endregion

    #region Uploads

    def upload_to_my_docs(file)
      @request.post(%w(@my upload), somefile: File.new(file))
    end

    def upload_to_common_docs(file)
      @request.post(%w(@common upload), somefile: File.new(file))
    end

    def upload_to_folder(folder_id, file)
      @request.post([folder_id.to_s, 'upload'], somefile: File.new(file))
    end

    def insert_file(folder_id, file, title)
      @request.post([folder_id.to_s, 'insert'], somefile: File.new(file), title: title)
    end

    def chunked_upload(folder_id, filename, file_size)
      @request.post([folder_id.to_s, 'upload', 'create_session'], fileName: filename, fileSize: file_size)
    end

    #endregion

    def search(query)
      @request.get(['@search', query.to_s])
    end

    def generate_shared_link(file_id, share)
      @request.put([file_id.to_s, 'sharedlink'], share: share)
    end

  end
end

{'fraction_non_alphanumeric': 0.12944361953008995, 'fraction_numerical': 0.0, 'mean_word_length': 3.298048048048048, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4376371', 'n_tokens_mistral': 4013, 'n_tokens_neox': 3889, 'n_words': 777}