refactor: clean up usings
This commit is contained in:
@@ -1,5 +1,3 @@
|
||||
using StevesBot.Library.Discord.Common;
|
||||
|
||||
var builder = WebApplication.CreateBuilder(args);
|
||||
|
||||
builder.Services
|
||||
@@ -43,18 +41,16 @@ builder.Services.AddSingleton(TimeProvider.System);
|
||||
builder.Services.AddSingleton<ConcurrentQueue<SubscribeTask>>();
|
||||
builder.Services.AddHostedService<SubscriptionWorker>();
|
||||
|
||||
// TODO: This probably should be
|
||||
// moved into the AddDiscordRestClient extension method.
|
||||
// and we should probably just take the dependency
|
||||
// on IOptions<DiscordClientOptions> in DiscordRestClient
|
||||
builder.Services.AddOptionsWithValidateOnStart<DiscordNotificationOptions>()
|
||||
.BindConfiguration(nameof(DiscordNotificationOptions))
|
||||
.ValidateDataAnnotations();
|
||||
|
||||
builder.Services.AddOptions<DiscordClientOptions>()
|
||||
.BindConfiguration(nameof(DiscordClientOptions));
|
||||
|
||||
builder.Services.AddSingleton(static sp =>
|
||||
{
|
||||
var options = sp.GetRequiredService<IOptions<DiscordClientOptions>>().Value;
|
||||
return options;
|
||||
});
|
||||
builder.Services.AddSingleton(
|
||||
static sp => sp.GetRequiredService<IOptions<DiscordClientOptions>>().Value
|
||||
);
|
||||
|
||||
builder.Services.AddDiscordRestClient();
|
||||
|
||||
@@ -66,6 +62,7 @@ if (app.Environment.IsDevelopment())
|
||||
}
|
||||
|
||||
const string ytCallback = "yt-callback";
|
||||
|
||||
app.MapGet(ytCallback, VerifySubscriptionHandler.HandleAsync);
|
||||
app.MapPost(ytCallback, NotificationHandler.HandleAsync);
|
||||
|
||||
|
||||
@@ -1,13 +1,18 @@
|
||||
global using System.Collections.Concurrent;
|
||||
global using System.ComponentModel.DataAnnotations;
|
||||
global using System.Globalization;
|
||||
global using System.Text.Json.Serialization;
|
||||
global using System.Text.RegularExpressions;
|
||||
|
||||
global using Microsoft.AspNetCore.Mvc;
|
||||
global using Microsoft.AspNetCore.WebUtilities;
|
||||
global using Microsoft.Extensions.Options;
|
||||
|
||||
global using StevesBot.Library.Discord;
|
||||
global using StevesBot.Webhook.Handlers;
|
||||
global using StevesBot.Library.Discord.Common;
|
||||
global using StevesBot.Library.Discord.Rest;
|
||||
global using StevesBot.Library.Discord.Rest.Requests;
|
||||
global using StevesBot.Webhook.YouTube;
|
||||
global using StevesBot.Webhook.YouTube.Data;
|
||||
global using StevesBot.Webhook.YouTube.Handlers;
|
||||
global using StevesBot.Webhook.YouTube.Tasks;
|
||||
@@ -1,5 +1,3 @@
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
|
||||
namespace StevesBot.Webhook.YouTube.Data;
|
||||
|
||||
internal sealed class YouTubeDataApiClient(
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StevesBot.Webhook.YouTube.Data;
|
||||
|
||||
internal sealed record YouTubeLiveStreamingDetails
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StevesBot.Webhook.YouTube.Data;
|
||||
|
||||
internal sealed record YouTubePageInfo
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace StevesBot.Webhook.YouTube.Data;
|
||||
|
||||
internal sealed record YouTubeVideoListResponse
|
||||
|
||||
Reference in New Issue
Block a user