public async Task RenewToken()
        {
            var    query        = WebUIQueryBuilder.GetToken();
            string responseHtml = await _client.GetStringAsync(query);

            _token = GetTokenFromHtml(responseHtml);
        }
        public async Task <string> AddTorrentFile(string path, int downloadDirectoryIndex = 0, string downloadPath = null)
        {
            var query   = WebUIQueryBuilder.AddTorrentFile(_token, path, downloadDirectoryIndex, downloadPath);
            var content = CreateMultipartFormDataContent(path);

            HttpResponseMessage response = await _client.PostAsync(query, content);

            response.EnsureSuccessStatusCode();
            return(await response.Content.ReadAsStringAsync());
        }
        public async Task <string> SetJobProperty(string setting, string value, string hash)
        {
            var query = WebUIQueryBuilder.SetJobProperty(_token, setting, value, hash);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> GetJobProperties(string hash)
        {
            var query = WebUIQueryBuilder.GetJobProperties(_token, hash);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> SetSetting(string setting, string value)
        {
            var query = WebUIQueryBuilder.SetSetting(_token, setting, value);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> GetSettings()
        {
            var query = WebUIQueryBuilder.GetSettings(_token);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> GetChangedTorrentsAndLabels(string cacheID)
        {
            var query = WebUIQueryBuilder.GetChangedTorrentsAndLabels(_token, cacheID);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> GetTorrentsAndLabels()
        {
            var query = WebUIQueryBuilder.GetTorrentsAndLabels(_token);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> QueueUp(IEnumerable <string> hashes)
        {
            var query = WebUIQueryBuilder.QueueUp(_token, hashes);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> SetPriority(string priority, int fileIndex, IEnumerable <string> hashes)
        {
            var query = WebUIQueryBuilder.SetPriority(_token, priority, fileIndex, hashes);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> RemoveDataAndTorrent(IEnumerable <string> hashes)
        {
            var query = WebUIQueryBuilder.RemoveDataAndTorrent(_token, hashes);

            return(await _client.GetStringAsync(query));
        }
        public async Task <string> AddTorrentURL(string url)
        {
            var query = WebUIQueryBuilder.AddTorrentURL(_token, url);

            return(await _client.GetStringAsync(query));
        }