/// <summary> /// Changes the torrent priority. /// </summary> /// <param name="client">An <see cref="IQBittorrentClient"/> instance.</param> /// <param name="hash">The torrent hash.</param> /// <param name="change">The priority change.</param> /// <param name="token">The cancellation token.</param> /// <returns></returns> public static Task ChangeTorrentPriorityAsync( [NotNull] this IQBittorrentClient client, [NotNull] string hash, TorrentPriorityChange change, CancellationToken token = default) { ValidateHash(hash); return(client.ChangeTorrentPriorityAsync(new[] { hash }, change, token)); }
public Task ChangeTorrentPriorityAsync( TorrentPriorityChange change, CancellationToken token = default) { switch (change) { case TorrentPriorityChange.Minimal: return(PostAsync(p => p.MinTorrentPriority(All), token, ApiLevel.V2)); case TorrentPriorityChange.Increase: return(PostAsync(p => p.IncTorrentPriority(All), token, ApiLevel.V2)); case TorrentPriorityChange.Decrease: return(PostAsync(p => p.DecTorrentPriority(All), token, ApiLevel.V2)); case TorrentPriorityChange.Maximal: return(PostAsync(p => p.MaxTorrentPriority(All), token, ApiLevel.V2)); default: throw new ArgumentOutOfRangeException(nameof(change), change, null); } }