1
+ using Nullinside . Api . Common . Twitch . Json ;
2
+
3
+ using TwitchLib . Api . Helix . Models . Chat . GetChatters ;
4
+ using TwitchLib . Api . Helix . Models . Moderation . BanUser ;
5
+ using TwitchLib . Api . Helix . Models . Moderation . GetModerators ;
6
+
7
+ namespace Nullinside . Api . Common . Twitch ;
8
+
9
+ /// <summary>
10
+ /// The proxy for handling communication with Twitch.
11
+ /// </summary>
12
+ public interface ITwitchApiProxy {
13
+ /// <summary>
14
+ /// The Twitch access token. These are the credentials used for all requests.
15
+ /// </summary>
16
+ TwitchAccessToken ? OAuth { get ; set ; }
17
+
18
+ /// <summary>
19
+ /// Creates a new access token from a code using Twitch's OAuth workflow.
20
+ /// </summary>
21
+ /// <param name="code">The code from twitch to send back to twitch to generate a new access token.</param>
22
+ /// <param name="token">The cancellation token.</param>
23
+ /// <remarks>The object will have its <see cref="OAuth" /> updated with the new settings for the token.</remarks>
24
+ /// <returns>The OAuth details if successful, null otherwise.</returns>
25
+ Task < TwitchAccessToken ? > CreateAccessToken ( string code , CancellationToken token = new ( ) ) ;
26
+
27
+ /// <summary>
28
+ /// Refreshes the access token.
29
+ /// </summary>
30
+ /// <param name="token">The cancellation token.</param>
31
+ /// <remarks>The object will have its <see cref="OAuth" /> updated with the new settings for the token.</remarks>
32
+ /// <returns>The OAuth details if successful, null otherwise.</returns>
33
+ Task < TwitchAccessToken ? > RefreshAccessToken ( CancellationToken token = new ( ) ) ;
34
+
35
+ /// <summary>
36
+ /// Determines if the <see cref="OAuth" /> is valid.
37
+ /// </summary>
38
+ /// <param name="token">The cancellation token.</param>
39
+ /// <returns>True if valid, false otherwise.</returns>
40
+ Task < bool > GetAccessTokenIsValid ( CancellationToken token = new ( ) ) ;
41
+
42
+ /// <summary>
43
+ /// Gets the twitch id and username of the owner of the <see cref="OAuth" />.
44
+ /// </summary>
45
+ /// <param name="token">The cancellation token.</param>
46
+ /// <returns>The twitch username if successful, null otherwise.</returns>
47
+ Task < ( string ? id , string ? username ) > GetUser ( CancellationToken token = new ( ) ) ;
48
+
49
+ /// <summary>
50
+ /// Gets the email address of the owner of the <see cref="OAuth" />.
51
+ /// </summary>
52
+ /// <param name="token">The cancellation token.</param>
53
+ /// <returns>The email address if successful, null otherwise.</returns>
54
+ Task < string ? > GetUserEmail ( CancellationToken token = new ( ) ) ;
55
+
56
+ /// <summary>
57
+ /// Gets the list of channels the user moderates for.
58
+ /// </summary>
59
+ /// <param name="userId">The twitch id to scan.</param>
60
+ /// <returns>The list of channels the user moderates for.</returns>
61
+ Task < IEnumerable < TwitchModeratedChannel > > GetUserModChannels ( string userId ) ;
62
+
63
+ /// <summary>
64
+ /// Bans a list of users from a channel.
65
+ /// </summary>
66
+ /// <param name="channelId">The twitch id of the channel to ban the users from.</param>
67
+ /// <param name="botId">The twitch id of the bot user, the one banning the users.</param>
68
+ /// <param name="users">The list of users to ban.</param>
69
+ /// <param name="reason">The reason for the ban.</param>
70
+ /// <param name="token">The stopping token.</param>
71
+ /// <returns>The users with confirmed bans.</returns>
72
+ Task < IEnumerable < BannedUser > > BanChannelUsers ( string channelId , string botId ,
73
+ IEnumerable < ( string Id , string Username ) > users , string reason , CancellationToken token = new ( ) ) ;
74
+
75
+ /// <summary>
76
+ /// Gets the list of mods for the channel.
77
+ /// </summary>
78
+ /// <param name="channelId">The twitch id of the channel to get mods for.</param>
79
+ /// <param name="token">The cancellation token.</param>
80
+ /// <returns>The collection of moderators.</returns>
81
+ Task < IEnumerable < Moderator > > GetChannelMods ( string channelId , CancellationToken token = new ( ) ) ;
82
+
83
+ /// <summary>
84
+ /// Gets the chatters currently in a channel.
85
+ /// </summary>
86
+ /// <param name="channelId">The twitch id of the channel that we are moderating.</param>
87
+ /// <param name="botId">The twitch id of the bot.</param>
88
+ /// <param name="token">The cancellation token.</param>
89
+ /// <returns>The collection of chatters.</returns>
90
+ Task < IEnumerable < Chatter > > GetChannelUsers ( string channelId , string botId , CancellationToken token = new ( ) ) ;
91
+
92
+ /// <summary>
93
+ /// Checks if the supplied channels are live.
94
+ /// </summary>
95
+ /// <param name="userIds">The twitch ids of the channels.</param>
96
+ /// <returns>The list of twitch channels that are currently live.</returns>
97
+ Task < IEnumerable < string > > GetChannelsLive ( IEnumerable < string > userIds ) ;
98
+
99
+ /// <summary>
100
+ /// Makes a user a moderator in a channel.
101
+ /// </summary>
102
+ /// <param name="channelId">The twitch id of the channel to add the mod to.</param>
103
+ /// <param name="userId">The twitch id to give the moderator role.</param>
104
+ /// <param name="token">The cancellation token.</param>
105
+ /// <returns>True if successful, false otherwise.</returns>
106
+ Task < bool > AddChannelMod ( string channelId , string userId , CancellationToken token = new ( ) ) ;
107
+ }
0 commit comments