<commit_before>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using Duplicati.Library.Utility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Duplicati.Library.Backend
{
	public class DropboxHelper : OAuthHelper
    {
        private const string API_URL = "https://api.dropboxapi.com/2";
        private const string CONTENT_API_URL = "https://content.dropboxapi.com/2";
        private const int DROPBOX_MAX_CHUNK_UPLOAD = 10 * 1024 * 1024; // 1 MB max upload
        private const string API_ARG_HEADER = "DROPBOX-API-arg";

        public DropboxHelper(string accessToken)
			: base(accessToken, "dropbox")
        {
        }

        public ListFolderResult ListFiles(string path)
        {
            var pa = new PathArg();
            pa.path = path;

            var url = string.Format("{0}/files/list_folder", API_URL);

            try
            {
                return PostAndGetJSONData<ListFolderResult>(url, pa);
            }
            catch (Exception ex)
            {
                handleDropboxException(ex);
                throw;
            }
        }

        public ListFolderResult ListFilesContinue(string cursor)<commit_msg>Ensure that Auth token is always added to API calls in DropBox.<commit_after>﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using Duplicati.Library.Utility;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;

namespace Duplicati.Library.Backend
{
	public class DropboxHelper : OAuthHelper
    {
        private const string API_URL = "https://api.dropboxapi.com/2";
        private const string CONTENT_API_URL = "https://content.dropboxapi.com/2";
        private const int DROPBOX_MAX_CHUNK_UPLOAD = 10 * 1024 * 1024; // 1 MB max upload
        private const string API_ARG_HEADER = "DROPBOX-API-arg";

        public DropboxHelper(string accessToken)
			: base(accessToken, "dropbox")
        {
			base.AutoAuthHeader = true;
        }

        public ListFolderResult ListFiles(string path)
        {
            var pa = new PathArg();
            pa.path = path;

            var url = string.Format("{0}/files/list_folder", API_URL);

            try
            {
                return PostAndGetJSONData<ListFolderResult>(url, pa);
            }
            catch (Exception ex)
            {
                handleDropboxException(ex);
                throw;
            }
        }

        public ListFolderResult ListFilesContinue(string cursor)
{'fraction_non_alphanumeric': 0.0878775990584543, 'fraction_numerical': 0.010984699882306787, 'mean_word_length': 2.1954887218045114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4434870', 'n_tokens_mistral': 744, 'n_tokens_neox': 709, 'n_words': 172}