diff --git a/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/Request/WarnChatUserRequest.cs b/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/Request/WarnChatUserRequest.cs
new file mode 100644
index 00000000..977d439c
--- /dev/null
+++ b/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/Request/WarnChatUserRequest.cs
@@ -0,0 +1,21 @@
+using Newtonsoft.Json;
+
+namespace TwitchLib.Api.Helix.Models.Moderation.WarnChatUser.Request;
+
+///
+/// Request that contains information about the warning.
+///
+public class WarnChatUserRequest
+{
+ ///
+ /// The ID of the twitch user to be warned.
+ ///
+ [JsonProperty(PropertyName = "user_id")]
+ public string UserId { get; set; }
+
+ ///
+ /// A custom reason for the warning. Max 500 chars.
+ ///
+ [JsonProperty(PropertyName = "reason")]
+ public string Reason { get; set; } = string.Empty;
+}
\ No newline at end of file
diff --git a/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/WarnChatUserResponse.cs b/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/WarnChatUserResponse.cs
new file mode 100644
index 00000000..8d19341b
--- /dev/null
+++ b/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/WarnChatUserResponse.cs
@@ -0,0 +1,16 @@
+using Newtonsoft.Json;
+
+namespace TwitchLib.Api.Helix.Models.Moderation.WarnChatUser;
+
+///
+/// Warn chat user response object.
+///
+public class WarnChatUserResponse
+{
+ ///
+ /// A list that contains information about the warning.
+ ///
+ [JsonProperty(PropertyName = "data")]
+ public WarnedChatUser[] Data { get; protected set; }
+}
+
diff --git a/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/WarnedChatUser.cs b/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/WarnedChatUser.cs
new file mode 100644
index 00000000..16e5574d
--- /dev/null
+++ b/TwitchLib.Api.Helix.Models/Moderation/WarnChatUser/WarnedChatUser.cs
@@ -0,0 +1,34 @@
+using Newtonsoft.Json;
+
+namespace TwitchLib.Api.Helix.Models.Moderation.WarnChatUser;
+
+///
+/// Contains information about the warning.
+///
+public class WarnedChatUser
+{
+ ///
+ /// The ID of the channel in which the warning will take effect.
+ ///
+ [JsonProperty(PropertyName = "broadcaster_id")]
+ public string BroadcasterId { get; protected set; }
+
+ ///
+ /// The ID of the warned user.
+ ///
+ [JsonProperty(PropertyName = "user_id")]
+ public string UserId { get; protected set; }
+
+ ///
+ /// The ID of the user who applied the warning.
+ ///
+ [JsonProperty(PropertyName = "moderator_id")]
+ public string ModeratorId { get; protected set; }
+
+ ///
+ /// The reason provided for warning.
+ ///
+ [JsonProperty(PropertyName = "reason")]
+ public string Reason { get; protected set; }
+}
+
diff --git a/TwitchLib.Api.Helix/Moderation.cs b/TwitchLib.Api.Helix/Moderation.cs
index a629c6a2..4c96c7c2 100644
--- a/TwitchLib.Api.Helix/Moderation.cs
+++ b/TwitchLib.Api.Helix/Moderation.cs
@@ -26,6 +26,8 @@
using TwitchLib.Api.Helix.Models.Moderation.UnbanRequests;
using TwitchLib.Api.Helix.Models.Moderation.UnbanRequests.GetUnbanRequests;
using TwitchLib.Api.Helix.Models.Moderation.UnbanRequests.ResolveUnbanRequests;
+using TwitchLib.Api.Helix.Models.Moderation.WarnChatUser;
+using TwitchLib.Api.Helix.Models.Moderation.WarnChatUser.Request;
namespace TwitchLib.Api.Helix
{
@@ -810,5 +812,51 @@ public Task GetModeratedChannelsAsync(string userI
}
#endregion
+
+ #region WarnChatUser
+ ///
+ /// Warns a user in the specified broadcaster’s chat room, preventing them from chat interaction until the warning is acknowledged.
+ /// New warnings can be issued to a user when they already have a warning in the channel (new warning will replace old warning).
+ /// Requires a user access token that includes the moderator:manage:warnings scope.
+ /// Query parameter moderator_id must match the user_id in the user access token.
+ ///
+ /// The ID of the channel in which the warning will take effect.
+ /// The ID of the twitch user who requested the warning.
+ /// request object contains information about the warning.
+ /// optional access token to override the one used while creating the TwitchAPI object
+ ///
+ ///
+ public Task WarnChatUserAsync(string broadcasterId, string moderatorId, WarnChatUserRequest warnChatUserRequest, string accessToken = null)
+ {
+ if (string.IsNullOrEmpty(broadcasterId))
+ throw new BadParameterException("broadcasterId must be set");
+
+ if (string.IsNullOrEmpty(moderatorId))
+ throw new BadParameterException("moderatorId must be set");
+
+ if (warnChatUserRequest == null)
+ throw new BadParameterException("warnChatUserRequest cannot be null");
+
+ if (string.IsNullOrWhiteSpace(warnChatUserRequest.UserId))
+ throw new BadParameterException("warnChatUserRequest.UserId must be set");
+
+ if (warnChatUserRequest.Reason.Length > 500)
+ throw new BadParameterException("warnChatUserRequest.Reason can't be greater then 500 characters.");
+
+ var getParams = new List>
+ {
+ new KeyValuePair("broadcaster_id", broadcasterId),
+ new KeyValuePair("moderator_id", moderatorId)
+ };
+
+ var body = new
+ {
+ data = warnChatUserRequest
+ };
+
+ return TwitchPostGenericAsync("/moderation/warnings", ApiVersion.Helix, JsonConvert.SerializeObject(body), getParams, accessToken);
+ }
+
+ #endregion
}
}