-
Notifications
You must be signed in to change notification settings - Fork 24
/
Copy pathISoulseekClient.cs
1411 lines (1304 loc) · 96.8 KB
/
ISoulseekClient.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// <copyright file="ISoulseekClient.cs" company="JP Dillingham">
// Copyright (c) JP Dillingham. All rights reserved.
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see https://www.gnu.org/licenses/.
// </copyright>
namespace Soulseek
{
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Threading;
using System.Threading.Tasks;
using Soulseek.Diagnostics;
using Soulseek.Messaging.Messages;
/// <summary>
/// A client for the Soulseek file sharing network.
/// </summary>
public interface ISoulseekClient : IDisposable, IDiagnosticGenerator
{
/// <summary>
/// Occurs when a browse response receives data.
/// </summary>
event EventHandler<BrowseProgressUpdatedEventArgs> BrowseProgressUpdated;
/// <summary>
/// Occurs when the client connects.
/// </summary>
event EventHandler Connected;
/// <summary>
/// Occurs when the client is demoted from a branch root on the distributed network.
/// </summary>
event EventHandler DemotedFromDistributedBranchRoot;
/// <summary>
/// Occurs when the client disconnects.
/// </summary>
event EventHandler<SoulseekClientDisconnectedEventArgs> Disconnected;
/// <summary>
/// Occurs when a child connection is added.
/// </summary>
event EventHandler<DistributedChildEventArgs> DistributedChildAdded;
/// <summary>
/// Occurs when a child connection is disconnected.
/// </summary>
event EventHandler<DistributedChildEventArgs> DistributedChildDisconnected;
/// <summary>
/// Occurs when the server requests a distributed network reset.
/// </summary>
event EventHandler DistributedNetworkReset;
/// <summary>
/// Occurs when the state of the distributed network changes.
/// </summary>
event EventHandler<DistributedNetworkInfo> DistributedNetworkStateChanged;
/// <summary>
/// Occurs when a new parent is adopted.
/// </summary>
event EventHandler<DistributedParentEventArgs> DistributedParentAdopted;
/// <summary>
/// Occurs when the parent is disconnected.
/// </summary>
event EventHandler<DistributedParentEventArgs> DistributedParentDisconnected;
/// <summary>
/// Occurs when a user reports that a download has been denied.
/// </summary>
event EventHandler<DownloadDeniedEventArgs> DownloadDenied;
/// <summary>
/// Occurs when a user reports that a download has failed.
/// </summary>
event EventHandler<DownloadFailedEventArgs> DownloadFailed;
/// <summary>
/// Occurs when the server sends a list of excluded ("banned") search phrases.
/// </summary>
event EventHandler<IReadOnlyCollection<string>> ExcludedSearchPhrasesReceived;
/// <summary>
/// Occurs when a global message is received.
/// </summary>
event EventHandler<string> GlobalMessageReceived;
/// <summary>
/// Occurs when the client is logged in.
/// </summary>
event EventHandler LoggedIn;
/// <summary>
/// Occurs when a private message is received.
/// </summary>
event EventHandler<PrivateMessageReceivedEventArgs> PrivateMessageReceived;
/// <summary>
/// Occurs when the currently logged in user is granted membership to a private room.
/// </summary>
event EventHandler<string> PrivateRoomMembershipAdded;
/// <summary>
/// Occurs when the currently logged in user has membership to a private room revoked.
/// </summary>
event EventHandler<string> PrivateRoomMembershipRemoved;
/// <summary>
/// Occurs when a list of moderated users for a private room is received.
/// </summary>
event EventHandler<RoomInfo> PrivateRoomModeratedUserListReceived;
/// <summary>
/// Occurs when the currently logged in user is granted moderator status in a private room.
/// </summary>
event EventHandler<string> PrivateRoomModerationAdded;
/// <summary>
/// Occurs when the currently logged in user has moderator status removed in a private room.
/// </summary>
event EventHandler<string> PrivateRoomModerationRemoved;
/// <summary>
/// Occurs when a list of users for a private room is received.
/// </summary>
event EventHandler<RoomInfo> PrivateRoomUserListReceived;
/// <summary>
/// Occurs when the server sends a list of privileged users.
/// </summary>
event EventHandler<IReadOnlyCollection<string>> PrivilegedUserListReceived;
/// <summary>
/// Occurs when the server sends a notification of new user privileges.
/// </summary>
event EventHandler<PrivilegeNotificationReceivedEventArgs> PrivilegeNotificationReceived;
/// <summary>
/// Occurs when the client has been promoted to a branch root on the distributed network.
/// </summary>
event EventHandler PromotedToDistributedBranchRoot;
/// <summary>
/// Occurs when a public chat message is received.
/// </summary>
event EventHandler<PublicChatMessageReceivedEventArgs> PublicChatMessageReceived;
/// <summary>
/// Occurs when a user joins a chat room.
/// </summary>
event EventHandler<RoomJoinedEventArgs> RoomJoined;
/// <summary>
/// Occurs when a user leaves a chat room.
/// </summary>
event EventHandler<RoomLeftEventArgs> RoomLeft;
/// <summary>
/// Occurs when the server sends a list of chat rooms.
/// </summary>
event EventHandler<RoomList> RoomListReceived;
/// <summary>
/// Occurs when a chat room message is received.
/// </summary>
event EventHandler<RoomMessageReceivedEventArgs> RoomMessageReceived;
/// <summary>
/// Occurs when a chat room ticker is added.
/// </summary>
event EventHandler<RoomTickerAddedEventArgs> RoomTickerAdded;
/// <summary>
/// Occurs when the server sends a list of tickers for a chat room.
/// </summary>
event EventHandler<RoomTickerListReceivedEventArgs> RoomTickerListReceived;
/// <summary>
/// Occurs when a chat room ticker is removed.
/// </summary>
event EventHandler<RoomTickerRemovedEventArgs> RoomTickerRemoved;
/// <summary>
/// Occurs when a search request is received.
/// </summary>
event EventHandler<SearchRequestEventArgs> SearchRequestReceived;
/// <summary>
/// Occurs when the response to a search request is delivered.
/// </summary>
event EventHandler<SearchRequestResponseEventArgs> SearchResponseDelivered;
/// <summary>
/// Occurs when the delivery of a response to a search request fails.
/// </summary>
event EventHandler<SearchRequestResponseEventArgs> SearchResponseDeliveryFailed;
/// <summary>
/// Occurs when a new search response is received.
/// </summary>
event EventHandler<SearchResponseReceivedEventArgs> SearchResponseReceived;
/// <summary>
/// Occurs when a search changes state.
/// </summary>
event EventHandler<SearchStateChangedEventArgs> SearchStateChanged;
/// <summary>
/// Occurs when the server sends information upon login.
/// </summary>
event EventHandler<ServerInfo> ServerInfoReceived;
/// <summary>
/// Occurs when the client changes state.
/// </summary>
event EventHandler<SoulseekClientStateChangedEventArgs> StateChanged;
/// <summary>
/// Occurs when an active transfer sends or receives data.
/// </summary>
event EventHandler<TransferProgressUpdatedEventArgs> TransferProgressUpdated;
/// <summary>
/// Occurs when a transfer changes state.
/// </summary>
event EventHandler<TransferStateChangedEventArgs> TransferStateChanged;
/// <summary>
/// Occurs when a user fails to connect.
/// </summary>
event EventHandler<UserCannotConnectEventArgs> UserCannotConnect;
/// <summary>
/// Occurs when a user's statistics change.
/// </summary>
public event EventHandler<UserStatistics> UserStatisticsChanged;
/// <summary>
/// Occurs when a watched user's status changes.
/// </summary>
/// <remarks>Add a user to the server watch list with <see cref="AddUserAsync(string, CancellationToken?)"/>.</remarks>
event EventHandler<UserStatus> UserStatusChanged;
/// <summary>
/// Gets the unresolved server address.
/// </summary>
string Address { get; }
/// <summary>
/// Gets information about the distributed network.
/// </summary>
DistributedNetworkInfo DistributedNetwork { get; }
/// <summary>
/// Gets a snapshot of current downloads.
/// </summary>
IReadOnlyCollection<Transfer> Downloads { get; }
/// <summary>
/// Gets the resolved server address.
/// </summary>
IPAddress IPAddress { get; }
/// <summary>
/// Gets the resolved server endpoint.
/// </summary>
IPEndPoint IPEndPoint { get; }
/// <summary>
/// Gets the client options.
/// </summary>
SoulseekClientOptions Options { get; }
/// <summary>
/// Gets the server port.
/// </summary>
int? Port { get; }
/// <summary>
/// Gets information sent by the server upon login.
/// </summary>
ServerInfo ServerInfo { get; }
/// <summary>
/// Gets the current state of the underlying TCP connection.
/// </summary>
SoulseekClientStates State { get; }
/// <summary>
/// Gets a snapshot of current uploads.
/// </summary>
IReadOnlyCollection<Transfer> Uploads { get; }
/// <summary>
/// Gets the name of the currently signed in user.
/// </summary>
string Username { get; }
/// <summary>
/// Asynchronously sends a private message acknowledgement for the specified <paramref name="privateMessageId"/>.
/// </summary>
/// <param name="privateMessageId">The unique id of the private message to acknowledge.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">Thrown when the <paramref name="privateMessageId"/> is less than zero.</exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task AcknowledgePrivateMessageAsync(int privateMessageId, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously sends a privilege notification acknowledgement for the specified <paramref name="privilegeNotificationId"/>.
/// </summary>
/// <param name="privilegeNotificationId">The unique id of the privilege notification to acknowledge.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="privilegeNotificationId"/> is less than zero.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task AcknowledgePrivilegeNotificationAsync(int privilegeNotificationId, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously adds the specified <paramref name="username"/> to the list of members in the specified private <paramref name="roomName"/>.
/// </summary>
/// <param name="roomName">The room to which to add the user.</param>
/// <param name="username">The username of the user to add.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="roomName"/> or <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task AddPrivateRoomMemberAsync(string roomName, string username, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously adds the specified <paramref name="username"/> to the list of moderators in the specified private <paramref name="roomName"/>.
/// </summary>
/// <param name="roomName">The room to which to add the user.</param>
/// <param name="username">The username of the user to add.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="roomName"/> or <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task AddPrivateRoomModeratorAsync(string roomName, string username, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously adds the specified <paramref name="username"/> to the server watch list for the current session.
/// </summary>
/// <remarks>
/// Once a user is added the server will begin sending status updates for that user, which will generate
/// <see cref="UserStatusChanged"/> events.
/// </remarks>
/// <param name="username">The username of the user to add.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the server response.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserNotFoundException">Thrown when the specified user is not registered.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
[Obsolete("Use WatchUserAsync instead. This method will be removed in the next major version.")]
Task<UserData> AddUserAsync(string username, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches the list of files shared by the specified <paramref name="username"/> with the optionally
/// specified <paramref name="cancellationToken"/>.
/// </summary>
/// <remarks>
/// By default, this operation will not time out locally, but rather will wait until the remote connection is broken.
/// If a local timeout is desired, specify an appropriate <see cref="CancellationToken"/>.
/// </remarks>
/// <param name="username">The user to browse.</param>
/// <param name="options">The operation <see cref="BrowseOptions"/>.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the fetched list of files.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<BrowseResponse> BrowseAsync(string username, BrowseOptions options = null, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously changes the password for the currently logged in user.
/// </summary>
/// <param name="password">The new password.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="password"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task ChangePasswordAsync(string password, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously connects the client to the default server and logs in using the specified
/// <paramref name="username"/> and <paramref name="password"/>.
/// </summary>
/// <param name="username">The username with which to log in.</param>
/// <param name="password">The password with which to log in.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> or <paramref name="password"/> is null or empty.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when a connection is already in the process of being established.</exception>
/// <exception cref="InvalidOperationException">Thrown when the client is already connected.</exception>
/// <exception cref="ListenException">Thrown when binding a listener to the specified address and/or port fails.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="LoginRejectedException">Thrown when the login is rejected by the remote server.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task ConnectAsync(string username, string password, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously connects the client to the specified server <paramref name="address"/> and <paramref name="port"/>
/// and logs in using the specified <paramref name="username"/> and <paramref name="password"/>.
/// </summary>
/// <param name="address">The address of the server to which to connect.</param>
/// <param name="port">The port to which to connect.</param>
/// <param name="username">The username with which to log in.</param>
/// <param name="password">The password with which to log in.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="address"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown when the <paramref name="port"/> is not within the valid port range 0-65535.
/// </exception>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> or <paramref name="password"/> is null or empty.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when a connection is already in the process of being established.</exception>
/// <exception cref="InvalidOperationException">Thrown when the client is already connected.</exception>
/// <exception cref="AddressException">Thrown when the provided address can't be resolved.</exception>
/// <exception cref="ListenException">Thrown when binding a listener to the specified address and/or port fails.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="LoginRejectedException">Thrown when the login is rejected by the remote server.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task ConnectAsync(string address, int port, string username, string password, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously establishes and caches a connection to the specified <paramref name="username"/>. If a connection
/// is already cached, it is returned unless the <paramref name="invalidateCache"/> option is specified.
/// </summary>
/// <param name="username">The user to which to connect.</param>
/// <param name="invalidateCache">
/// A value indicating whether to establish a new connection, regardless of whether one is cached.
/// </param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task ConnectToUserAsync(string username, bool invalidateCache = false, CancellationToken? cancellationToken = null);
/// <summary>
/// Disconnects the client from the server.
/// </summary>
/// <param name="message">An optional message describing the reason the client is being disconnected.</param>
/// <param name="exception">An optional Exception causing the disconnect.</param>
void Disconnect(string message = null, Exception exception = null);
/// <summary>
/// <para>
/// Asynchronously downloads the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="username"/> using the specified unique <paramref name="token"/> and optionally specified
/// <paramref name="cancellationToken"/> to the specified <paramref name="localFilename"/>.
/// </para>
/// <para>
/// If the destination file exists and <paramref name="startOffset"/> is greater than zero, the existing file is
/// appended. Otherwise, it is overwritten.
/// </para>
/// </summary>
/// <remarks>
/// If <paramref name="size"/> is omitted, the size provided by the remote client is used. Transfers initiated without
/// specifying a size are limited to 4gb or less due to a shortcoming of the SoulseekQt client.
/// </remarks>
/// <param name="username">The user from which to download the file.</param>
/// <param name="remoteFilename">The file to download, as reported by the remote user.</param>
/// <param name="localFilename">The fully qualified filename of the destination file.</param>
/// <param name="size">The size of the file, in bytes.</param>
/// <param name="startOffset">The offset at which to start the download, in bytes.</param>
/// <param name="token">The unique download token.</param>
/// <param name="options">The operation <see cref="TransferOptions"/>.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>
/// The Task representing the asynchronous operation, including the transfer context and a byte array containing the
/// file contents.
/// </returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/>, <paramref name="remoteFilename"/>, or
/// <paramref name="localFilename"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="ArgumentNullException">
/// Thrown when <paramref name="startOffset"/> is greater than zero but <paramref name="size"/> is not specified.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown when the specified <paramref name="size"/> or <paramref name="startOffset"/> is less than zero.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="DuplicateTokenException">Thrown when the specified or generated token is already in use.</exception>
/// <exception cref="DuplicateTransferException">
/// Thrown when a download of the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="username"/> is already in progress.
/// </exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="TransferRejectedException">Thrown when the transfer is rejected.</exception>
/// <exception cref="TransferSizeMismatchException">
/// Thrown when the remote size of the transfer is different from the specified size.
/// </exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<Transfer> DownloadAsync(string username, string remoteFilename, string localFilename, long? size = null, long startOffset = 0, int? token = null, TransferOptions options = null, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously downloads the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="username"/> using the specified unique <paramref name="token"/> and optionally specified
/// <paramref name="cancellationToken"/> to the <see cref="Stream"/> created by the specified <paramref name="outputStreamFactory"/>.
/// </summary>
/// <remarks>
/// If <paramref name="size"/> is omitted, the size provided by the remote client is used. Transfers initiated without
/// specifying a size are limited to 4gb or less due to a shortcoming of the SoulseekQt client.
/// </remarks>
/// <param name="username">The user from which to download the file.</param>
/// <param name="remoteFilename">The file to download, as reported by the remote user.</param>
/// <param name="outputStreamFactory">A delegate used to create the stream to which to write the file contents.</param>
/// <param name="size">The size of the file, in bytes.</param>
/// <param name="startOffset">The offset at which to start the download, in bytes.</param>
/// <param name="token">The unique download token.</param>
/// <param name="options">The operation <see cref="TransferOptions"/>.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the transfer context.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> or <paramref name="remoteFilename"/> is null, empty, or consists only
/// of whitespace.
/// </exception>
/// <exception cref="ArgumentNullException">
/// Thrown when <paramref name="startOffset"/> is greater than zero but <paramref name="size"/> is not specified.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown when the specified <paramref name="size"/> or <paramref name="startOffset"/> is less than zero.
/// </exception>
/// <exception cref="ArgumentNullException">
/// Thrown when the specified <paramref name="outputStreamFactory"/> is null.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="DuplicateTokenException">Thrown when the specified or generated token is already in use.</exception>
/// <exception cref="DuplicateTransferException">
/// Thrown when a download of the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="username"/> is already in progress.
/// </exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="TransferRejectedException">Thrown when the transfer is rejected.</exception>
/// <exception cref="TransferSizeMismatchException">
/// Thrown when the remote size of the transfer is different from the specified size.
/// </exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<Transfer> DownloadAsync(string username, string remoteFilename, Func<Task<Stream>> outputStreamFactory, long? size = null, long startOffset = 0, int? token = null, TransferOptions options = null, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously removes the currently logged in user from the list of members in the specified private <paramref name="roomName"/>.
/// </summary>
/// <param name="roomName">The room for which the membership is to be dropped.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="roomName"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task DropPrivateRoomMembershipAsync(string roomName, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously removes the currently logged in user from the ownership of the specified private <paramref name="roomName"/>.
/// </summary>
/// <param name="roomName">The room for which the ownership is to be dropped.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="roomName"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task DropPrivateRoomOwnershipAsync(string roomName, CancellationToken? cancellationToken = null);
/// <summary>
/// <para>
/// Asynchronously enqueues a download for the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="username"/> using the specified unique <paramref name="token"/> and optionally specified
/// <paramref name="cancellationToken"/>. to the specified <paramref name="localFilename"/>.
/// </para>
/// <para>
/// If the destination file exists and <paramref name="startOffset"/> is greater than zero, the existing file is
/// appended. Otherwise, it is overwritten.
/// </para>
/// <para>
/// Functionally the same as
/// <see cref="DownloadAsync(string, string, string, long?, long, int?, TransferOptions, CancellationToken?)"/>,
/// but returns the download Task as soon as the download has been remotely enqueued.
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// If <paramref name="size"/> is omitted, the size provided by the remote client is used. Transfers initiated
/// without specifying a size are limited to 4gb or less due to a shortcoming of the SoulseekQt client.
/// </para>
/// <para>
/// The operation will be blocked if <see cref="SoulseekClientOptions.MaximumConcurrentDownloads"/> is exceeded,
/// and will not continue until the number of active downloads has decreased below the limit.
/// </para>
/// </remarks>
/// <param name="username">The user from which to download the file.</param>
/// <param name="remoteFilename">The file to download, as reported by the remote user.</param>
/// <param name="localFilename">The fully qualified filename of the destination file.</param>
/// <param name="size">The size of the file, in bytes.</param>
/// <param name="startOffset">The offset at which to start the download, in bytes.</param>
/// <param name="token">The unique download token.</param>
/// <param name="options">The operation <see cref="TransferOptions"/>.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>
/// The Task representing the asynchronous operation, including the transfer context and a byte array containing the
/// file contents.
/// </returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/>, <paramref name="remoteFilename"/>, or
/// <paramref name="localFilename"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown when the specified <paramref name="size"/> or <paramref name="startOffset"/> is less than zero.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="DuplicateTokenException">Thrown when the specified or generated token is already in use.</exception>
/// <exception cref="DuplicateTransferException">
/// Thrown when a download of the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="username"/> is already in progress.
/// </exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="TransferRejectedException">Thrown when the transfer is rejected.</exception>
/// <exception cref="TransferSizeMismatchException">
/// Thrown when the remote size of the transfer is different from the specified size.
/// </exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<Task<Transfer>> EnqueueDownloadAsync(string username, string remoteFilename, string localFilename, long? size = null, long startOffset = 0, int? token = null, TransferOptions options = null, CancellationToken? cancellationToken = null);
/// <summary>
/// <para>
/// Asynchronously enqueues a download for the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="username"/> using the specified unique <paramref name="token"/> and optionally specified
/// <paramref name="cancellationToken"/> to the <see cref="Stream"/> created by the specified <paramref name="outputStreamFactory"/>.
/// </para>
/// <para>
/// Functionally the same as
/// <see cref="DownloadAsync(string, string, Func{Task{Stream}}, long?, long, int?, TransferOptions, CancellationToken?)"/>,
/// but returns the download Task as soon as the download has been remotely enqueued.
/// </para>
/// </summary>
/// <remarks>
/// <para>
/// If <paramref name="size"/> is omitted, the size provided by the remote client is used. Transfers initiated
/// without specifying a size are limited to 4gb or less due to a shortcoming of the SoulseekQt client.
/// </para>
/// <para>
/// The operation will be blocked if <see cref="SoulseekClientOptions.MaximumConcurrentDownloads"/> is exceeded,
/// and will not continue until the number of active downloads has decreased below the limit.
/// </para>
/// </remarks>
/// <param name="username">The user from which to download the file.</param>
/// <param name="remoteFilename">The file to download, as reported by the remote user.</param>
/// <param name="outputStreamFactory">A delegate used to create the stream to which to write the file contents.</param>
/// <param name="size">The size of the file, in bytes.</param>
/// <param name="startOffset">The offset at which to start the download, in bytes.</param>
/// <param name="token">The unique download token.</param>
/// <param name="options">The operation <see cref="TransferOptions"/>.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous download operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> or <paramref name="remoteFilename"/> is null, empty, or consists only
/// of whitespace.
/// </exception>
/// <exception cref="ArgumentOutOfRangeException">
/// Thrown when the specified <paramref name="size"/> or <paramref name="startOffset"/> is less than zero.
/// </exception>
/// <exception cref="ArgumentNullException">
/// Thrown when the specified <paramref name="outputStreamFactory"/> is null.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="DuplicateTokenException">Thrown when the specified or generated token is already in use.</exception>
/// <exception cref="DuplicateTransferException">
/// Thrown when a download of the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="username"/> is already in progress.
/// </exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="TransferRejectedException">Thrown when the transfer is rejected.</exception>
/// <exception cref="TransferSizeMismatchException">
/// Thrown when the remote size of the transfer is different from the specified size.
/// </exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<Task<Transfer>> EnqueueDownloadAsync(string username, string remoteFilename, Func<Task<Stream>> outputStreamFactory, long? size = null, long startOffset = 0, int? token = null, TransferOptions options = null, CancellationToken? cancellationToken = null);
/// <summary>
/// <para>
/// Asynchronously enqueues an upload for the specified <paramref name="remoteFilename"/> from the specified
/// <paramref name="localFilename"/> to the the specified <paramref name="username"/> using the specified unique
/// <paramref name="token"/> and optionally specified <paramref name="cancellationToken"/>.
/// </para>
/// <para>
/// Functionally the same as
/// <see cref="UploadAsync(string, string, string, int?, TransferOptions, CancellationToken?)"/>, but returns the
/// upload Task as soon as the upload has been locally enqueued.
/// </para>
/// </summary>
/// <param name="username">The user to which to upload the file.</param>
/// <param name="remoteFilename">The filename of the file to upload, as requested by the remote user.</param>
/// <param name="localFilename">The fully qualified filename of the file to upload.</param>
/// <param name="token">The unique upload token.</param>
/// <param name="options">The operation <see cref="TransferOptions"/>.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous upload operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/>, <paramref name="remoteFilename"/>, or
/// <paramref name="localFilename"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="FileNotFoundException">
/// Thrown when the specified <paramref name="localFilename"/> can not be found.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="DuplicateTokenException">Thrown when the specified or generated token is already in use.</exception>
/// <exception cref="DuplicateTransferException">
/// Thrown when an upload of the specified <paramref name="remoteFilename"/> to the specified
/// <paramref name="username"/> is already in progress.
/// </exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="TransferRejectedException">Thrown when the transfer is rejected.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<Task<Transfer>> EnqueueUploadAsync(string username, string remoteFilename, string localFilename, int? token = null, TransferOptions options = null, CancellationToken? cancellationToken = null);
/// <summary>
/// <para>
/// Asynchronously enqueues an upload for the specified <paramref name="remoteFilename"/> from the
/// <see cref="Stream"/> created by the specified <paramref name="inputStreamFactory"/> to the the specified
/// <paramref name="username"/> using the specified unique <paramref name="token"/> and optionally specified <paramref name="cancellationToken"/>.
/// </para>
/// <para>
/// Functionally the same as
/// <see cref="UploadAsync(string, string, long, Func{long, Task{Stream}}, int?, TransferOptions, CancellationToken?)"/>,
/// but returns the upload Task as soon as the upload has been locally enqueued.
/// </para>
/// </summary>
/// <param name="username">The user to which to upload the file.</param>
/// <param name="remoteFilename">The filename of the file to upload, as requested by the remote user.</param>
/// <param name="size">The size of the file to upload, in bytes.</param>
/// <param name="inputStreamFactory">A delegate used to create the stream from which to retrieve the file contents.</param>
/// <param name="token">The unique upload token.</param>
/// <param name="options">The operation <see cref="TransferOptions"/>.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous upload operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> or <paramref name="remoteFilename"/> is null, empty, or consists only
/// of whitespace.
/// </exception>
/// <exception cref="ArgumentException">Thrown when the specified <paramref name="size"/> is less than 1.</exception>
/// <exception cref="ArgumentNullException">
/// Thrown when the specified <paramref name="inputStreamFactory"/> is null.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="DuplicateTokenException">Thrown when the specified or generated token is already in use.</exception>
/// <exception cref="DuplicateTransferException">
/// Thrown when an upload of the specified <paramref name="remoteFilename"/> to the specified
/// <paramref name="username"/> is already in progress.
/// </exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="TransferRejectedException">Thrown when the transfer is rejected.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<Task<Transfer>> EnqueueUploadAsync(string username, string remoteFilename, long size, Func<long, Task<Stream>> inputStreamFactory, int? token = null, TransferOptions options = null, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches the contents of the specified <paramref name="directoryName"/> from the specified <paramref name="username"/>.
/// </summary>
/// <param name="username">The user from which to fetch the directory contents.</param>
/// <param name="directoryName">The name of the directory to fetch.</param>
/// <param name="token">The unique token for the operation.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the directory contents.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> or <paramref name="directoryName"/> is null, empty, or consists only
/// of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<Directory> GetDirectoryContentsAsync(string username, string directoryName, int? token = null, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches the current place of the specified <paramref name="filename"/> in the queue of the
/// specified <paramref name="username"/>.
/// </summary>
/// <param name="username">The user whose queue to check.</param>
/// <param name="filename">The file to check.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the current place of the file in the queue.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> or <paramref name="filename"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TransferNotFoundException">Thrown when a corresponding download is not active.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<int> GetDownloadPlaceInQueueAsync(string username, string filename, CancellationToken? cancellationToken = null);
/// <summary>
/// Gets the next token for use in client operations.
/// </summary>
/// <remarks>
/// <para>Tokens are returned sequentially and the token value rolls over to 0 when it has reached <see cref="int.MaxValue"/>.</para>
/// <para>This operation is thread safe.</para>
/// </remarks>
/// <returns>The next token.</returns>
/// <threadsafety instance="true"/>
int GetNextToken();
/// <summary>
/// Asynchronously fetches the number of remaining days of privileges of the currently logged in user.
/// </summary>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<int> GetPrivilegesAsync(CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches the list of chat rooms on the server.
/// </summary>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the list of server rooms.</returns>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<RoomList> GetRoomListAsync(CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches the IP endpoint of the specified <paramref name="username"/>.
/// </summary>
/// <param name="username">The user from which to fetch the connection information.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the connection information.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="UserEndPointException">Thrown when an exception is encountered during the operation.</exception>
Task<IPEndPoint> GetUserEndPointAsync(string username, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches information about the specified <paramref name="username"/>.
/// </summary>
/// <param name="username">The user from which to fetch the information.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the information response.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<UserInfo> GetUserInfoAsync(string username, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches the status of the privileges of the specified <paramref name="username"/>.
/// </summary>
/// <param name="username">The username of the user for which to fetch privileges.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<bool> GetUserPrivilegedAsync(string username, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches statistics for the specified <paramref name="username"/>.
/// </summary>
/// <remarks>
/// Statistics are returned for any given username, regardless of online status, even if no user with that name exists
/// or has ever existed. All values are zero in the case of an unknown user, and presumably the last reported values
/// are returned when a user exists but is offline.
/// </remarks>
/// <param name="username">The username of the user for which to fetch statistics.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the server response.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<UserStatistics> GetUserStatisticsAsync(string username, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously fetches the status of the specified <paramref name="username"/>.
/// </summary>
/// <param name="username">The username of the user for which to fetch the status.</param>
/// <param name="cancellationToken">The token to monitor for cancellation requests.</param>
/// <returns>The Task representing the asynchronous operation, including the server response.</returns>
/// <exception cref="ArgumentException">
/// Thrown when the <paramref name="username"/> is null, empty, or consists only of whitespace.
/// </exception>
/// <exception cref="InvalidOperationException">Thrown when the client is not connected or logged in.</exception>
/// <exception cref="TimeoutException">Thrown when the operation has timed out.</exception>
/// <exception cref="OperationCanceledException">Thrown when the operation has been cancelled.</exception>
/// <exception cref="UserOfflineException">Thrown when the specified user is offline.</exception>
/// <exception cref="SoulseekClientException">Thrown when an exception is encountered during the operation.</exception>
Task<UserStatus> GetUserStatusAsync(string username, CancellationToken? cancellationToken = null);
/// <summary>
/// Asynchronously grants the specified <paramref name="username"/> the specified number of days
/// <paramref name="days"/> of privileged status.
/// </summary>
/// <remarks>
/// <para>
/// There is no immediate or direct response for this operation, and because error conditions may only be inferred
/// by monitoring private messages as described below, this library defers this inferrence to implementing code.
/// This method returns after the command is dispatched and does not monitor for any type of response.
/// </para>