public Uri GetTorrentList(
            TorrentListFilter filter,
            string category,
            string sort,
            bool reverse,
            int?limit,
            int?offset,
            IEnumerable <string> hashes,
            string tag)
        {
            var hashesString = hashes != null?string.Join("|", hashes) : null;

            return(Create("/api/v2/torrents/info",
                          ("filter", GetFilterString()),
                          ("category", category),
                          ("sort", sort),
                          ("reverse", reverse.ToLowerString()),
                          ("limit", limit?.ToString()),
                          ("offset", offset?.ToString()),
                          ("hashes", hashesString),
                          ("tag", tag)));

            string GetFilterString() => filter switch
            {
                TorrentListFilter.StalledDownloading => "stalled_downloading",
                TorrentListFilter.StalledUploading => "stalled_uploading",
                _ => filter.ToString().ToLowerInvariant()
            };
        }
Ejemplo n.º 2
0
 public Uri GetTorrentList(TorrentListFilter filter, string category, string sort, bool reverse, int?limit, int?offset, IEnumerable <string> hashes)
 {
     return(Create("/api/v2/torrents/info",
                   ("filter", filter.ToString().ToLowerInvariant()),
                   ("category", category),
                   ("sort", sort),
                   ("reverse", reverse.ToLowerString()),
                   ("limit", limit?.ToString()),
                   ("offset", offset?.ToString()),
                   ("hashes", hashes == null ? null : string.Join("|", hashes))));
 }
 public Uri GetTorrentList(
     TorrentListFilter filter,
     string category,
     string sort,
     bool reverse,
     int?limit,
     int?offset,
     IEnumerable <string> hashes,
     string tag)
 {
     return(Create("/query/torrents",
                   ("filter", filter.ToString().ToLowerInvariant()),
                   ("category", category),
                   ("sort", sort),
                   ("reverse", reverse.ToLowerString()),
                   ("limit", limit?.ToString()),
                   ("offset", offset?.ToString())));
 }