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