Skip to content

Commit c9b65d8

Browse files
authored
Merge pull request #42 from AoshiW/props-and-typos-and-comments
new props, fixed typos, fixed default value for (non)nullable props, XML comments
2 parents e4631fd + c89d257 commit c9b65d8

11 files changed

+114
-39
lines changed

TwitchLib.EventSub.Core/Extensions/AsyncEventHandlerExtensions.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ namespace TwitchLib.EventSub.Core.Extensions;
55

66
public static class AsyncEventHandlerExtensions
77
{
8-
public static Task InvokeAsync<TEventArgs>(this AsyncEventHandler<TEventArgs> asyncEventHandler, object sender, TEventArgs args)
8+
public static Task InvokeAsync<TEventArgs>(this AsyncEventHandler<TEventArgs>? asyncEventHandler, object sender, TEventArgs args)
99
{
1010
return asyncEventHandler != null ? asyncEventHandler(sender, args) : Task.CompletedTask;
1111
}
1212

13-
public static Task InvokeAsync(this AsyncEventHandler asyncEventHandler, object sender, EventArgs args)
13+
public static Task InvokeAsync(this AsyncEventHandler? asyncEventHandler, object sender, EventArgs args)
1414
{
1515
return asyncEventHandler != null ? asyncEventHandler(sender, args) : Task.CompletedTask;
1616
}
Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
namespace TwitchLib.EventSub.Core.Models.Chat
1+
namespace TwitchLib.EventSub.Core.Models.Chat;
2+
3+
public sealed class ChatCheer
24
{
3-
public sealed class ChatCheer
4-
{
5-
public int Bits { get; set; }
6-
}
5+
/// <summary>
6+
/// The amount of Bits the user cheered.
7+
/// </summary>
8+
public int Bits { get; set; }
79
}
Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,41 @@
1-
namespace TwitchLib.EventSub.Core.Models.Chat
1+
namespace TwitchLib.EventSub.Core.Models.Chat;
2+
3+
public sealed class ChatReply
24
{
3-
public sealed class ChatReply
4-
{
5-
public string ParentMessageId { get; set; } = string.Empty;
6-
public string ParentMessageBody { get; set; } = string.Empty;
7-
public string ParentUserId { get; set; } = string.Empty;
8-
public string ParentUserName { get; set; } = string.Empty;
9-
public string ParentUserLogin { get; set; } = string.Empty;
10-
public string ThreadMessageId { get; set; } = string.Empty;
11-
public string ThreadUserId { get; set; } = string.Empty;
12-
public string ThreadUserName { get; set; } = string.Empty;
13-
public string ThreadUserLogin { get; set; } = string.Empty;
14-
}
5+
/// <summary>
6+
/// An ID that uniquely identifies the parent message that this message is replying to.
7+
/// </summary>
8+
public string ParentMessageId { get; set; } = string.Empty;
9+
/// <summary>
10+
/// The message body of the parent message.
11+
/// </summary>
12+
public string ParentMessageBody { get; set; } = string.Empty;
13+
/// <summary>
14+
/// User ID of the sender of the parent message.
15+
/// </summary>
16+
public string ParentUserId { get; set; } = string.Empty;
17+
/// <summary>
18+
/// User name of the sender of the parent message.
19+
/// </summary>
20+
public string ParentUserName { get; set; } = string.Empty;
21+
/// <summary>
22+
/// User login of the sender of the parent message.
23+
/// </summary>
24+
public string ParentUserLogin { get; set; } = string.Empty;
25+
/// <summary>
26+
/// An ID that identifies the parent message of the reply thread.
27+
/// </summary>
28+
public string ThreadMessageId { get; set; } = string.Empty;
29+
/// <summary>
30+
/// User ID of the sender of the thread’s parent message.
31+
/// </summary>
32+
public string ThreadUserId { get; set; } = string.Empty;
33+
/// <summary>
34+
/// User name of the sender of the thread’s parent message.
35+
/// </summary>
36+
public string ThreadUserName { get; set; } = string.Empty;
37+
/// <summary>
38+
/// User login of the sender of the thread’s parent message.
39+
/// </summary>
40+
public string ThreadUserLogin { get; set; } = string.Empty;
1541
}

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelChatMessage.cs

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@
44

55
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel
66
{
7+
/// <summary>
8+
/// Channel Chat Message subscription type model
9+
/// <para>Description:</para>
10+
/// <para>Any user sends a message to a channel’s chat room.</para>
11+
/// </summary>
712
public sealed class ChannelChatMessage
813
{
914
/// <summary>
@@ -61,39 +66,47 @@ public sealed class ChannelChatMessage
6166
/// </summary>
6267
public ChatCheer? Cheer { get; set; }
6368

64-
/// <summary>Metadata if this message is a reply.</summary>
69+
/// <summary>
70+
/// Metadata if this message is a reply.
71+
/// </summary>
6572
public ChatReply? Reply { get; set; }
6673

6774
/// <summary>
6875
/// Optional. The ID of a channel points custom reward that was redeemed.
6976
/// </summary>
70-
public string? ChannelPointsCustomRewardId { get; set; } = string.Empty;
77+
public string? ChannelPointsCustomRewardId { get; set; }
7178

7279
/// <summary>
7380
/// Optional. The broadcaster user ID of the channel the message was sent from.
7481
/// </summary>
75-
public string? SourceBroadcasterUserId { get; set; } = string.Empty;
82+
public string? SourceBroadcasterUserId { get; set; }
7683

7784
/// <summary>
7885
/// Optional. The user name of the broadcaster of the channel the message was sent from.
7986
/// </summary>
80-
public string? SourceBroadcasterUserName { get; set; } = string.Empty;
87+
public string? SourceBroadcasterUserName { get; set; }
8188

8289
/// <summary>
8390
/// Optional. The login of the broadcaster of the channel the message was sent from.
8491
/// </summary>
85-
public string? SourceBroadcasterUserLogin { get; set; } = string.Empty;
92+
public string? SourceBroadcasterUserLogin { get; set; }
8693

8794
/// <summary>
8895
/// Optional. The UUID that identifies the source message from the channel the message was sent from.
8996
/// </summary>
90-
public string? SourceMessageId { get; set; } = string.Empty;
97+
public string? SourceMessageId { get; set; }
9198

9299
/// <summary>
93100
/// Optional. The list of chat badges for the chatter in the channel the message was sent from.
94101
/// </summary>
95-
public ChatBadge[]? SourceBadges { get; set; } = [];
102+
public ChatBadge[]? SourceBadges { get; set; }
96103

104+
/// <summary>
105+
/// Optional. Determines if a message delivered during a shared chat session is only sent to the source channel.
106+
/// Has no effect if the message is not sent during a shared chat session.
107+
/// </summary>
108+
public bool? IsSourceOnly { get; set; }
109+
97110
/// <summary>
98111
/// Returns true if viewer is a subscriber
99112
/// </summary>

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelGuestStarGuestUpdate.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ public sealed class ChannelGuestStarGuestUpdate : ChannelGuestStarBase
1212
/// <summary>
1313
/// User ID of the host channel.
1414
/// </summary>
15-
public string HostUserId { get; set; }
15+
public string HostUserId { get; set; } = string.Empty;
1616
/// <summary>
1717
/// The host display name.
1818
/// </summary>
19-
public string HostUserName { get; set; }
19+
public string HostUserName { get; set; } = string.Empty;
2020
/// <summary>
2121
/// The host login.
2222
/// </summary>
23-
public string HostUserLogin { get; set; }
23+
public string HostUserLogin { get; set; } = string.Empty;
2424
/// <summary>
2525
/// The current state of the user after the update has taken place. Can be one of the following:
2626
/// <para>

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelGuestStarSessionEnd.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@ public sealed class ChannelGuestStarSessionEnd : ChannelGuestStarSessionBase
2121
/// <summary>
2222
/// User ID of the host channel.
2323
/// </summary>
24-
public string HostUserId { get; set; }
24+
public string HostUserId { get; set; } = string.Empty;
2525
/// <summary>
2626
/// The host display name.
2727
/// </summary>
28-
public string HostUserName { get; set; }
28+
public string HostUserName { get; set; } = string.Empty;
2929
/// <summary>
3030
/// The host login.
3131
/// </summary>
32-
public string HostUserLogin { get; set; }
33-
}
32+
public string HostUserLogin { get; set; } = string.Empty;
33+
}

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelShoutoutReceive.cs

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
using TwitchLib.EventSub.Core.Models.Shoutouts;
1+
using System;
2+
using TwitchLib.EventSub.Core.Models.Shoutouts;
23

34
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;
45

@@ -12,13 +13,28 @@ public sealed class ChannelShoutoutReceive : ShoutoutBase
1213
/// <summary>
1314
/// An ID that identifies the broadcaster that received the Shoutout.
1415
/// </summary>
16+
[Obsolete("This property is a typo, please use: FromBroadcasterUserId")]
1517
public string ToBroadcasterUserId { get; set; } = string.Empty;
1618
/// <summary>
1719
/// The receiving broadcaster’s display name.
1820
/// </summary>
21+
[Obsolete("This property is a typo, please use: FromBroadcasterUserName")]
1922
public string ToBroadcasterUserName { get; set; } = string.Empty;
2023
/// <summary>
2124
/// The receiving broadcaster’s login name.
2225
/// </summary>
26+
[Obsolete("This property is a typo, please use: FromBroadcasterUserLogin")]
2327
public string ToBroadcasterUserLogin { get; set; } = string.Empty;
28+
/// <summary>
29+
/// An ID that identifies the broadcaster that sent the Shoutout.
30+
/// </summary>
31+
public string FromBroadcasterUserId { get; set; } = string.Empty;
32+
/// <summary>
33+
/// The broadcaster’s display name.
34+
/// </summary>
35+
public string FromBroadcasterUserName { get; set; } = string.Empty;
36+
/// <summary>
37+
/// The broadcaster’s login name.
38+
/// </summary>
39+
public string FromBroadcasterUserLogin { get; set; } = string.Empty;
2440
}

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelSuspiciousUserMessage.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;
44

5+
/// <summary>
6+
/// Channel Suspicious User Message subscription type model
7+
/// <para>Description:</para>
8+
/// <para>A notification when a chat message has been sent from a suspicious user.</para>
9+
/// </summary>
510
public sealed class ChannelSuspiciousUserMessage : ChannelSuspiciousUserBase
611
{
712
/// <summary>

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelSuspiciousUserUpdate.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22

33
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;
44

5+
/// <summary>
6+
/// Channel Suspicious User Message subscription type model
7+
/// <para>Description:</para>
8+
/// <para>A notification when a suspicious user has been updated.</para>
9+
/// </summary>
510
public sealed class ChannelSuspiciousUserUpdate : ChannelSuspiciousUserBase
611
{
712
/// <summary>

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelUpdate.cs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;
1+
using System;
2+
3+
namespace TwitchLib.EventSub.Core.SubscriptionTypes.Channel;
24

35
/// <summary>
46
/// Channel Update subscription type model
@@ -38,5 +40,11 @@ public sealed class ChannelUpdate
3840
/// <summary>
3941
/// A boolean identifying whether the channel is flagged as mature.
4042
/// </summary>
43+
[Obsolete("Removed 2023‑06‑29, please use: ContentClassificationLabels")]
4144
public bool IsMature { get; set; }
45+
/// <summary>
46+
/// Array of content classification label IDs currently applied on the Channel.
47+
/// To retrieve a list of all possible IDs, use the <see href="https://dev.twitch.tv/docs/api/reference/#get-content-classification-labels">Get Content Classification Labels</see> API endpoint.
48+
/// </summary>
49+
public string[] ContentClassificationLabels { get; set; } = [];
4250
}

TwitchLib.EventSub.Core/SubscriptionTypes/Channel/ChannelWarningSend.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@ public sealed class ChannelWarningSend
4646
/// <summary>
4747
/// Optional. The reason given for the warning.
4848
/// </summary>
49-
public string Reason { get; set; } = string.Empty;
49+
public string? Reason { get; set; }
5050
/// <summary>
5151
/// Optional. The chat rules cited for the warning.
5252
/// </summary>
53-
public string[] ChatRulesCited { get; set; } = [string.Empty];
54-
}
53+
public string[]? ChatRulesCited { get; set; }
54+
}

0 commit comments

Comments
 (0)