Skip to content

Commit

Permalink
Switch to file scoped namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
Syzuna committed Nov 18, 2023
1 parent 9e613bd commit 30d2f75
Show file tree
Hide file tree
Showing 91 changed files with 2,401 additions and 2,492 deletions.
29 changes: 14 additions & 15 deletions TwitchLib.EventSub.Core/AsyncEventHandler.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
using System;
using System.Threading.Tasks;

namespace TwitchLib.EventSub.Core
{
/// <summary>
/// Custom implementation of asynchronous event handler
/// This is useful to properly and safely handle async Tasks
/// Reference: https://medium.com/@a.lyskawa/the-hitchhiker-guide-to-asynchronous-events-in-c-e9840109fb53
/// </summary>
public delegate Task AsyncEventHandler<in TEventArgs>(object sender, TEventArgs args);
/// <summary>
/// Custom implementation of asynchronous event handler
/// This is useful to properly and safely handle async Tasks
/// Reference: https://medium.com/@a.lyskawa/the-hitchhiker-guide-to-asynchronous-events-in-c-e9840109fb53
/// </summary>
public delegate Task AsyncEventHandler(object sender, EventArgs args);
}
namespace TwitchLib.EventSub.Core;

/// <summary>
/// Custom implementation of asynchronous event handler
/// This is useful to properly and safely handle async Tasks
/// Reference: https://medium.com/@a.lyskawa/the-hitchhiker-guide-to-asynchronous-events-in-c-e9840109fb53
/// </summary>
public delegate Task AsyncEventHandler<in TEventArgs>(object sender, TEventArgs args);
/// <summary>
/// Custom implementation of asynchronous event handler
/// This is useful to properly and safely handle async Tasks
/// Reference: https://medium.com/@a.lyskawa/the-hitchhiker-guide-to-asynchronous-events-in-c-e9840109fb53
/// </summary>
public delegate Task AsyncEventHandler(object sender, EventArgs args);
19 changes: 9 additions & 10 deletions TwitchLib.EventSub.Core/Extensions/AsyncEventHandlerExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
using System;
using System.Threading.Tasks;

namespace TwitchLib.EventSub.Core.Extensions
namespace TwitchLib.EventSub.Core.Extensions;

public static class AsyncEventHandlerExtensions
{
public static class AsyncEventHandlerExtensions
public static Task InvokeAsync<TEventArgs>(this AsyncEventHandler<TEventArgs> asyncEventHandler, object sender, TEventArgs args)
{
public static Task InvokeAsync<TEventArgs>(this AsyncEventHandler<TEventArgs> asyncEventHandler, object sender, TEventArgs args)
{
return asyncEventHandler != null ? asyncEventHandler(sender, args) : Task.CompletedTask;
}
return asyncEventHandler != null ? asyncEventHandler(sender, args) : Task.CompletedTask;
}

public static Task InvokeAsync(this AsyncEventHandler asyncEventHandler, object sender, EventArgs args)
{
return asyncEventHandler != null ? asyncEventHandler(sender, args) : Task.CompletedTask;
}
public static Task InvokeAsync(this AsyncEventHandler asyncEventHandler, object sender, EventArgs args)
{
return asyncEventHandler != null ? asyncEventHandler(sender, args) : Task.CompletedTask;
}
}
95 changes: 47 additions & 48 deletions TwitchLib.EventSub.Core/Models/ChannelGoals/ChannelGoalBase.cs
Original file line number Diff line number Diff line change
@@ -1,53 +1,52 @@
using System;

namespace TwitchLib.EventSub.Core.Models.ChannelGoals
namespace TwitchLib.EventSub.Core.Models.ChannelGoals;

/// <summary>
/// Channel Goal base class
/// </summary>
public abstract class ChannelGoalBase
{
/// <summary>
/// Channel Goal base class
/// </summary>
public abstract class ChannelGoalBase
{
/// <summary>
/// An ID that identifies this event.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// An ID that uniquely identifies the broadcaster.
/// </summary>
public string BroadcasterUserId { get; set; } = string.Empty;
/// <summary>
/// The broadcaster’s display name.
/// </summary>
public string BroadcasterUserName { get; set; } = string.Empty;
/// <summary>
/// The broadcaster’s user handle.
/// </summary>
public string BroadcasterUserLogin { get; set; } = string.Empty;
/// <summary>
/// The type of goal. Possible values are: followers, subscriptions
/// </summary>
public string Type { get; set; } = string.Empty;
/// <summary>
/// A description of the goal, if specified. The description may contain a maximum of 40 characters.
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// The current value.
/// <para>If the goal is to increase followers, this field is set to the current number of followers.</para>
/// <para>This number increases with new followers and decreases if users unfollow the channel.</para>
/// <para>For subscriptions, CurrentAmount is increased and decreased by the points value associated with the subscription tier. </para>
/// <para>For example, if a tier-two subscription is worth 2 points, CurrentAmount is increased or decreased by 2, not 1.</para>
/// </summary>
public int CurrentAmount { get; set; }
/// <summary>
/// The goal’s target value.
/// <para>For example, if the broadcaster has 200 followers before creating the goal,</para>
/// <para>and their goal is to double that number, this field is set to 400.</para>
/// </summary>
public int TargetAmount { get; set; }
/// <summary>
/// The UTC timestamp in RFC 3339 format, which indicates when the broadcaster created the goal.
/// </summary>
public DateTimeOffset StartedAt { get; set; } = DateTimeOffset.MinValue;
}
/// An ID that identifies this event.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// An ID that uniquely identifies the broadcaster.
/// </summary>
public string BroadcasterUserId { get; set; } = string.Empty;
/// <summary>
/// The broadcaster’s display name.
/// </summary>
public string BroadcasterUserName { get; set; } = string.Empty;
/// <summary>
/// The broadcaster’s user handle.
/// </summary>
public string BroadcasterUserLogin { get; set; } = string.Empty;
/// <summary>
/// The type of goal. Possible values are: followers, subscriptions
/// </summary>
public string Type { get; set; } = string.Empty;
/// <summary>
/// A description of the goal, if specified. The description may contain a maximum of 40 characters.
/// </summary>
public string Description { get; set; } = string.Empty;
/// <summary>
/// The current value.
/// <para>If the goal is to increase followers, this field is set to the current number of followers.</para>
/// <para>This number increases with new followers and decreases if users unfollow the channel.</para>
/// <para>For subscriptions, CurrentAmount is increased and decreased by the points value associated with the subscription tier. </para>
/// <para>For example, if a tier-two subscription is worth 2 points, CurrentAmount is increased or decreased by 2, not 1.</para>
/// </summary>
public int CurrentAmount { get; set; }
/// <summary>
/// The goal’s target value.
/// <para>For example, if the broadcaster has 200 followers before creating the goal,</para>
/// <para>and their goal is to double that number, this field is set to 400.</para>
/// </summary>
public int TargetAmount { get; set; }
/// <summary>
/// The UTC timestamp in RFC 3339 format, which indicates when the broadcaster created the goal.
/// </summary>
public DateTimeOffset StartedAt { get; set; } = DateTimeOffset.MinValue;
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
namespace TwitchLib.EventSub.Core.Models.ChannelPoints
namespace TwitchLib.EventSub.Core.Models.ChannelPoints;

/// <summary>
/// Whether a cooldown is enabled and what the cooldown is in seconds.
/// </summary>
public sealed class GlobalCooldownSettings
{
/// <summary>
/// Whether a cooldown is enabled and what the cooldown is in seconds.
/// Whether the setting is enabled.
/// </summary>
public sealed class GlobalCooldownSettings
{
/// <summary>
/// Whether the setting is enabled.
/// </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// The cooldown in seconds.
/// </summary>
public int Seconds { get; set; }
}
public bool IsEnabled { get; set; }
/// <summary>
/// The cooldown in seconds.
/// </summary>
public int Seconds { get; set; }
}
29 changes: 14 additions & 15 deletions TwitchLib.EventSub.Core/Models/ChannelPoints/MaxAmountSettings.cs
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
namespace TwitchLib.EventSub.Core.Models.ChannelPoints
namespace TwitchLib.EventSub.Core.Models.ChannelPoints;

/// <summary>
/// Whether a maximum per stream is enabled and what the maximum is.
/// <para>or</para>
/// <para>Whether a maximum per user per stream is enabled and what the maximum is.</para>
/// </summary>
public sealed class MaxAmountSettings
{
/// <summary>
/// Whether a maximum per stream is enabled and what the maximum is.
/// <para>or</para>
/// <para>Whether a maximum per user per stream is enabled and what the maximum is.</para>
/// Whether the setting is enabled.
/// </summary>
public sealed class MaxAmountSettings
{
/// <summary>
/// Whether the setting is enabled.
/// </summary>
public bool IsEnabled { get; set; }
/// <summary>
/// The max amount per stream/per user per stream
/// </summary>
public int Value { get; set; }
}
public bool IsEnabled { get; set; }
/// <summary>
/// The max amount per stream/per user per stream
/// </summary>
public int Value { get; set; }
}
41 changes: 20 additions & 21 deletions TwitchLib.EventSub.Core/Models/ChannelPoints/RedemptionReward.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
namespace TwitchLib.EventSub.Core.Models.ChannelPoints
namespace TwitchLib.EventSub.Core.Models.ChannelPoints;

/// <summary>
/// Basic information about the reward that was redeemed, at the time it was redeemed.
/// </summary>
public sealed class RedemptionReward
{
/// <summary>
/// Basic information about the reward that was redeemed, at the time it was redeemed.
/// The reward identifier.
/// </summary>
public sealed class RedemptionReward
{
/// <summary>
/// The reward identifier.
/// </summary>
public string Id { get; set; } = string.Empty;
/// <summary>
/// The reward name.
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
/// The reward cost.
/// </summary>
public int Cost { get; set; }
/// <summary>
/// The reward description.
/// </summary>
public string Prompt { get; set; } = string.Empty;
}
public string Id { get; set; } = string.Empty;
/// <summary>
/// The reward name.
/// </summary>
public string Title { get; set; } = string.Empty;
/// <summary>
/// The reward cost.
/// </summary>
public int Cost { get; set; }
/// <summary>
/// The reward description.
/// </summary>
public string Prompt { get; set; } = string.Empty;
}
35 changes: 17 additions & 18 deletions TwitchLib.EventSub.Core/Models/Charity/CharityAmount.cs
Original file line number Diff line number Diff line change
@@ -1,24 +1,23 @@
namespace TwitchLib.EventSub.Core.Models.Charity
namespace TwitchLib.EventSub.Core.Models.Charity;

/// <summary>
/// An object that contains the amount of charity related things.
/// </summary>
public sealed class CharityAmount
{
/// <summary>
/// An object that contains the amount of charity related things.
/// The monetary amount. The amount is specified in the currency’s minor unit. For example, the minor units for USD is cents, so if the amount is $5.50 USD, value is set to 550.
/// </summary>
public sealed class CharityAmount
{
/// <summary>
/// The monetary amount. The amount is specified in the currency’s minor unit. For example, the minor units for USD is cents, so if the amount is $5.50 USD, value is set to 550.
/// </summary>
public int Value { get; set; }
public int Value { get; set; }

/// <summary>
/// The number of decimal places used by the currency. For example, USD uses two decimal places. Use this number to translate value from minor units to major units by using the formula:
/// <para>value / 10^decimal_places</para>
/// </summary>
public int DecimalPlaces { get; set; }
/// <summary>
/// The number of decimal places used by the currency. For example, USD uses two decimal places. Use this number to translate value from minor units to major units by using the formula:
/// <para>value / 10^decimal_places</para>
/// </summary>
public int DecimalPlaces { get; set; }

/// <summary>
/// The ISO-4217 three-letter currency code that identifies the type of currency in value.
/// </summary>
public string Currency { get; set; } = string.Empty;
}
/// <summary>
/// The ISO-4217 three-letter currency code that identifies the type of currency in value.
/// </summary>
public string Currency { get; set; } = string.Empty;
}
49 changes: 24 additions & 25 deletions TwitchLib.EventSub.Core/Models/Charity/CharityBase.cs
Original file line number Diff line number Diff line change
@@ -1,29 +1,28 @@
namespace TwitchLib.EventSub.Core.Models.Charity
namespace TwitchLib.EventSub.Core.Models.Charity;

/// <summary>
/// Charity base class
/// </summary>
public abstract class CharityBase
{
/// <summary>
/// Charity base class
/// An ID that uniquely identifies the broadcaster that’s running the campaign.
/// </summary>
public abstract class CharityBase
{
/// <summary>
/// An ID that uniquely identifies the broadcaster that’s running the campaign.
/// </summary>
public string BroadcasterId { get; set; } = string.Empty;
/// <summary>
/// The broadcaster’s login name.
/// </summary>
public string BroadcasterLogin { get; set; } = string.Empty;
/// <summary>
/// The broadcaster’s display name.
/// </summary>
public string BroadcasterName { get; set; } = string.Empty;
/// <summary>
/// The charity’s name.
/// </summary>
public string CharityName { get; set; } = string.Empty;
/// <summary>
/// A URL to the charity’s logo.
/// </summary>
public string CharityLogo { get; set; } = string.Empty;
}
public string BroadcasterId { get; set; } = string.Empty;
/// <summary>
/// The broadcaster’s login name.
/// </summary>
public string BroadcasterLogin { get; set; } = string.Empty;
/// <summary>
/// The broadcaster’s display name.
/// </summary>
public string BroadcasterName { get; set; } = string.Empty;
/// <summary>
/// The charity’s name.
/// </summary>
public string CharityName { get; set; } = string.Empty;
/// <summary>
/// A URL to the charity’s logo.
/// </summary>
public string CharityLogo { get; set; } = string.Empty;
}
17 changes: 8 additions & 9 deletions TwitchLib.EventSub.Core/Models/Chat/ChannelBitsBadgeTier.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
namespace TwitchLib.EventSub.Core.Models.Chat
namespace TwitchLib.EventSub.Core.Models.Chat;

/// <summary>
/// Information about the bits badge tier event. Null if notice_type is not bits_badge_tier.
/// </summary>
public sealed class ChannelBitsBadgeTier
{
/// <summary>
/// Information about the bits badge tier event. Null if notice_type is not bits_badge_tier.
/// The tier of the Bits badge the user just earned. For example, 100, 1000, or 10000.
/// </summary>
public sealed class ChannelBitsBadgeTier
{
/// <summary>
/// The tier of the Bits badge the user just earned. For example, 100, 1000, or 10000.
/// </summary>
public int Tier { get; set; }
}
public int Tier { get; set; }
}
Loading

0 comments on commit 30d2f75

Please sign in to comment.