From 89bf5efca0b50f06dea1ff8e2e20d5409caf62a9 Mon Sep 17 00:00:00 2001 From: Viswanatha Swamy Date: Wed, 23 Dec 2020 16:00:21 +0530 Subject: [PATCH] Small Refactoring --- .../Controllers/WebhooksReceivedController.cs | 7 ++----- src/Web/WebhookClient/HeaderNames.cs | 7 +------ .../HttpClientAuthorizationDelegatingHandler.cs | 2 -- src/Web/WebhookClient/Models/WebHookReceived.cs | 4 +--- src/Web/WebhookClient/Models/WebhookData.cs | 3 --- src/Web/WebhookClient/Models/WebhookResponse.cs | 3 --- .../Models/WebhookSubscriptionRequest.cs | 7 +------ src/Web/WebhookClient/Pages/Error.cshtml.cs | 6 +----- src/Web/WebhookClient/Pages/Index.cshtml.cs | 6 +----- src/Web/WebhookClient/Pages/Privacy.cshtml.cs | 7 +------ .../WebhookClient/Pages/RegisterWebhook.cshtml.cs | 14 +++++--------- src/Web/WebhookClient/Pages/WebhooksList.cshtml.cs | 5 +---- src/Web/WebhookClient/Program.cs | 9 +-------- src/Web/WebhookClient/Services/IHooksRepository.cs | 4 +--- src/Web/WebhookClient/Services/IWebhooksClient.cs | 4 +--- .../Services/InMemoryHooksRepository.cs | 3 +-- src/Web/WebhookClient/Services/WebhooksClient.cs | 1 - src/Web/WebhookClient/Settings.cs | 7 +------ 18 files changed, 19 insertions(+), 80 deletions(-) diff --git a/src/Web/WebhookClient/Controllers/WebhooksReceivedController.cs b/src/Web/WebhookClient/Controllers/WebhooksReceivedController.cs index 7746b60590..985031106b 100644 --- a/src/Web/WebhookClient/Controllers/WebhooksReceivedController.cs +++ b/src/Web/WebhookClient/Controllers/WebhooksReceivedController.cs @@ -1,9 +1,6 @@ -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; +using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using Microsoft.Extensions.Options; -using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using WebhookClient.Models; @@ -19,7 +16,7 @@ public class WebhooksReceivedController : Controller private readonly Settings _settings; private readonly ILogger _logger; private readonly IHooksRepository _hooksRepository; - + public WebhooksReceivedController(IOptions settings, ILogger logger, IHooksRepository hooksRepository) { _settings = settings.Value; diff --git a/src/Web/WebhookClient/HeaderNames.cs b/src/Web/WebhookClient/HeaderNames.cs index c84eed123d..6a7f575777 100644 --- a/src/Web/WebhookClient/HeaderNames.cs +++ b/src/Web/WebhookClient/HeaderNames.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace WebhookClient +namespace WebhookClient { static class HeaderNames { diff --git a/src/Web/WebhookClient/HttpClientAuthorizationDelegatingHandler.cs b/src/Web/WebhookClient/HttpClientAuthorizationDelegatingHandler.cs index c4333707fd..01cc290385 100644 --- a/src/Web/WebhookClient/HttpClientAuthorizationDelegatingHandler.cs +++ b/src/Web/WebhookClient/HttpClientAuthorizationDelegatingHandler.cs @@ -1,8 +1,6 @@ using Microsoft.AspNetCore.Authentication; using Microsoft.AspNetCore.Http; -using System; using System.Collections.Generic; -using System.Linq; using System.Net.Http; using System.Net.Http.Headers; using System.Threading; diff --git a/src/Web/WebhookClient/Models/WebHookReceived.cs b/src/Web/WebhookClient/Models/WebHookReceived.cs index 80cc46c4bc..3da5bae48c 100644 --- a/src/Web/WebhookClient/Models/WebHookReceived.cs +++ b/src/Web/WebhookClient/Models/WebHookReceived.cs @@ -1,13 +1,11 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace WebhookClient.Models { public class WebHookReceived { public DateTime When { get; set; } + public string Data { get; set; } public string Token { get; set; } diff --git a/src/Web/WebhookClient/Models/WebhookData.cs b/src/Web/WebhookClient/Models/WebhookData.cs index 7172d2aaae..c80a8d9800 100644 --- a/src/Web/WebhookClient/Models/WebhookData.cs +++ b/src/Web/WebhookClient/Models/WebhookData.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace WebhookClient.Models { diff --git a/src/Web/WebhookClient/Models/WebhookResponse.cs b/src/Web/WebhookClient/Models/WebhookResponse.cs index 464afe85b9..5b1aadd455 100644 --- a/src/Web/WebhookClient/Models/WebhookResponse.cs +++ b/src/Web/WebhookClient/Models/WebhookResponse.cs @@ -1,7 +1,4 @@ using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; namespace WebhookClient.Models { diff --git a/src/Web/WebhookClient/Models/WebhookSubscriptionRequest.cs b/src/Web/WebhookClient/Models/WebhookSubscriptionRequest.cs index 4e4ea2b576..c770c27eda 100644 --- a/src/Web/WebhookClient/Models/WebhookSubscriptionRequest.cs +++ b/src/Web/WebhookClient/Models/WebhookSubscriptionRequest.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace WebhookClient.Models +namespace WebhookClient.Models { public class WebhookSubscriptionRequest { diff --git a/src/Web/WebhookClient/Pages/Error.cshtml.cs b/src/Web/WebhookClient/Pages/Error.cshtml.cs index e85ff41119..607d14db17 100644 --- a/src/Web/WebhookClient/Pages/Error.cshtml.cs +++ b/src/Web/WebhookClient/Pages/Error.cshtml.cs @@ -1,10 +1,6 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; +using System.Diagnostics; namespace WebhookClient.Pages { diff --git a/src/Web/WebhookClient/Pages/Index.cshtml.cs b/src/Web/WebhookClient/Pages/Index.cshtml.cs index 0e3169f080..417913a20d 100644 --- a/src/Web/WebhookClient/Pages/Index.cshtml.cs +++ b/src/Web/WebhookClient/Pages/Index.cshtml.cs @@ -1,10 +1,6 @@ -using System; +using Microsoft.AspNetCore.Mvc.RazorPages; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; -using Microsoft.AspNetCore.Http; using WebhookClient.Models; using WebhookClient.Services; diff --git a/src/Web/WebhookClient/Pages/Privacy.cshtml.cs b/src/Web/WebhookClient/Pages/Privacy.cshtml.cs index 96aff0e9e6..8976468a97 100644 --- a/src/Web/WebhookClient/Pages/Privacy.cshtml.cs +++ b/src/Web/WebhookClient/Pages/Privacy.cshtml.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; +using Microsoft.AspNetCore.Mvc.RazorPages; namespace WebhookClient.Pages { diff --git a/src/Web/WebhookClient/Pages/RegisterWebhook.cshtml.cs b/src/Web/WebhookClient/Pages/RegisterWebhook.cshtml.cs index 3e52cda276..8ff384b418 100644 --- a/src/Web/WebhookClient/Pages/RegisterWebhook.cshtml.cs +++ b/src/Web/WebhookClient/Pages/RegisterWebhook.cshtml.cs @@ -1,16 +1,12 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Net.Http.Formatting; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using Microsoft.Extensions.Options; using Newtonsoft.Json; +using System.Net; +using System.Net.Http; +using System.Net.Http.Formatting; +using System.Threading.Tasks; using WebhookClient.Models; namespace WebhookClient.Pages diff --git a/src/Web/WebhookClient/Pages/WebhooksList.cshtml.cs b/src/Web/WebhookClient/Pages/WebhooksList.cshtml.cs index 7a523c6445..c1c8c80124 100644 --- a/src/Web/WebhookClient/Pages/WebhooksList.cshtml.cs +++ b/src/Web/WebhookClient/Pages/WebhooksList.cshtml.cs @@ -1,9 +1,6 @@ -using System; +using Microsoft.AspNetCore.Mvc.RazorPages; using System.Collections.Generic; -using System.Linq; using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; -using Microsoft.AspNetCore.Mvc.RazorPages; using WebhookClient.Models; using WebhookClient.Services; diff --git a/src/Web/WebhookClient/Program.cs b/src/Web/WebhookClient/Program.cs index ff293ce5a3..4d763f7fd8 100644 --- a/src/Web/WebhookClient/Program.cs +++ b/src/Web/WebhookClient/Program.cs @@ -1,12 +1,5 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore; +using Microsoft.AspNetCore; using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; namespace WebhookClient { diff --git a/src/Web/WebhookClient/Services/IHooksRepository.cs b/src/Web/WebhookClient/Services/IHooksRepository.cs index 35d6d73e75..73e89e8197 100644 --- a/src/Web/WebhookClient/Services/IHooksRepository.cs +++ b/src/Web/WebhookClient/Services/IHooksRepository.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Collections.Generic; using System.Threading.Tasks; using WebhookClient.Models; diff --git a/src/Web/WebhookClient/Services/IWebhooksClient.cs b/src/Web/WebhookClient/Services/IWebhooksClient.cs index 5d14077cc8..20238c0a3e 100644 --- a/src/Web/WebhookClient/Services/IWebhooksClient.cs +++ b/src/Web/WebhookClient/Services/IWebhooksClient.cs @@ -1,6 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; +using System.Collections.Generic; using System.Threading.Tasks; using WebhookClient.Models; diff --git a/src/Web/WebhookClient/Services/InMemoryHooksRepository.cs b/src/Web/WebhookClient/Services/InMemoryHooksRepository.cs index 557aa707b5..35bcd2bada 100644 --- a/src/Web/WebhookClient/Services/InMemoryHooksRepository.cs +++ b/src/Web/WebhookClient/Services/InMemoryHooksRepository.cs @@ -1,5 +1,4 @@ -using System; -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using WebhookClient.Models; diff --git a/src/Web/WebhookClient/Services/WebhooksClient.cs b/src/Web/WebhookClient/Services/WebhooksClient.cs index 379c003ad7..3293f282d7 100644 --- a/src/Web/WebhookClient/Services/WebhooksClient.cs +++ b/src/Web/WebhookClient/Services/WebhooksClient.cs @@ -1,6 +1,5 @@ using Microsoft.Extensions.Options; using Newtonsoft.Json; -using System; using System.Collections.Generic; using System.Net.Http; using System.Threading.Tasks; diff --git a/src/Web/WebhookClient/Settings.cs b/src/Web/WebhookClient/Settings.cs index 213d272e4c..3077d91b07 100644 --- a/src/Web/WebhookClient/Settings.cs +++ b/src/Web/WebhookClient/Settings.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace WebhookClient +namespace WebhookClient { public class Settings {