示例#1
0
        /// <summary>
        /// Gets the specified fields of all recently-active torrents.
        /// </summary>
        /// <param name="fields">fields to get, multiple fields can be combined with "|"</param>
        public Task <TorrentGetResponse> TorrentGetRecentAsync(TorrentFields fields)
        {
            var request = new TorrentGetRequest <string> {
                Fields = fields.ToStringRepresentation(), IDs = "recently-active"
            };

            return(GetResponseAsync <TorrentGetResponse, TorrentGetRequest <string> >(request));
        }
示例#2
0
        /// <summary>
        /// Gets the specified fields for torrents matching any type of torrent-identifier (see supported values in transmission-rpc spec or <paramref name="ids"/>).
        /// </summary>
        /// <typeparam name="T">type of IDs</typeparam>
        /// <param name="fields">fields to get, multiple fields can be combined with "|"</param>
        /// <param name="ids">any type of supported value as ID (list of ints, hashstrings, or both in one list, int, (the string "recently-active" is a valid argument, but is handled in <see cref="TorrentGetRecentAsync"/>, because it causes the result to have a new array with recently-deleted IDs))</param>
        private async Task <Torrent[]> TorrentGetAsync <T>(TorrentFields fields, T ids)
        {
            var request = new TorrentGetRequest <T> {
                Fields = fields.ToStringRepresentation(), IDs = ids
            };
            var response = await GetResponseAsync <TorrentGetResponse, TorrentGetRequest <T> >(request);

            return(response.Torrents);
        }