Clean up Tgstation.Server.Common

- Move classes to `Http` namespace.
- Give it a unique package version.
- Comment to make me not rage update Nuget libs to .NET 6.
This commit is contained in:
Dominion
2023-06-10 16:29:51 -04:00
parent 41c33684f6
commit e596110018
29 changed files with 34 additions and 33 deletions
+1
View File
@@ -6,6 +6,7 @@
<TgsCoreVersion>5.12.5</TgsCoreVersion>
<TgsConfigVersion>4.6.0</TgsConfigVersion>
<TgsApiVersion>9.10.2</TgsApiVersion>
<TgsCommonLibraryVersion>6.0.0</TgsCommonLibraryVersion>
<TgsApiLibraryVersion>11.0.0</TgsApiLibraryVersion>
<TgsClientVersion>12.0.0</TgsClientVersion>
<TgsDmapiVersion>6.5.0</TgsDmapiVersion>
+1 -1
View File
@@ -20,7 +20,7 @@ using Newtonsoft.Json.Serialization;
using Tgstation.Server.Api;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Models.Response;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
namespace Tgstation.Server.Client
{
@@ -1,7 +1,7 @@
using System;
using Tgstation.Server.Api;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
namespace Tgstation.Server.Client
{
@@ -3,7 +3,7 @@ using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
namespace Tgstation.Server.Common
namespace Tgstation.Server.Common.Http
{
/// <summary>
/// Caches the <see cref="Stream"/> from a <see cref="HttpResponseMessage"/> for later use.
@@ -36,9 +36,9 @@ namespace Tgstation.Server.Common
response.Content = null;
try
{
return new CachedResponseStream(
content,
await content.ReadAsStreamAsync().ConfigureAwait(false));
// don't cry about the missing CancellationToken overload: https://github.com/dotnet/runtime/issues/916
var responseStream = await content.ReadAsStreamAsync().ConfigureAwait(false);
return new CachedResponseStream(content, responseStream);
}
catch
{
@@ -4,7 +4,7 @@ using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
namespace Tgstation.Server.Common
namespace Tgstation.Server.Common.Http
{
/// <inheritdoc />
public sealed class HttpClient : IHttpClient
@@ -1,7 +1,7 @@
using System;
using System.Net.Http.Headers;
namespace Tgstation.Server.Common
namespace Tgstation.Server.Common.Http
{
/// <summary>
/// <see cref="IAbstractHttpClientFactory"/> that creates <see cref="HttpClient"/>s.
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Common
namespace Tgstation.Server.Common.Http
{
/// <summary>
/// Creates <see cref="IHttpClient"/>s.
@@ -4,7 +4,7 @@ using System.Net.Http.Headers;
using System.Threading;
using System.Threading.Tasks;
namespace Tgstation.Server.Common
namespace Tgstation.Server.Common.Http
{
/// <summary>
/// For sending HTTP requests.
@@ -3,10 +3,10 @@
<PropertyGroup>
<TargetFramework>$(TgsNugetNetVersion)</TargetFramework>
<Version>$(TgsCoreVersion)</Version>
<Version>$(TgsCommonLibraryVersion)</Version>
<Description>Common functions for tgstation-server.</Description>
<PackageTags>web tgstation-server tgstation ss13 byond client http</PackageTags>
<PackageReleaseNotes>Initial release.</PackageReleaseNotes>
<PackageReleaseNotes>Added CachedResponseStream.</PackageReleaseNotes>
<EnableNETAnalyzers>true</EnableNETAnalyzers>
<CodeAnalysisRuleSet>../../build/analyzers.ruleset</CodeAnalysisRuleSet>
<DocumentationFile>bin/$(Configuration)/$(TargetFramework)/$(AssemblyName).xml</DocumentationFile>
@@ -26,7 +26,7 @@ using Serilog.Events;
using Serilog.Formatting.Display;
using Tgstation.Server.Api;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Components;
using Tgstation.Server.Host.Components.Byond;
using Tgstation.Server.Host.Components.Chat;
@@ -5,7 +5,7 @@ using System.Net.Http.Headers;
using Microsoft.Extensions.Logging;
using Tgstation.Server.Api;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
namespace Tgstation.Server.Host.IO
{
@@ -4,7 +4,7 @@ using System.Net.Http;
using System.Threading;
using System.Threading.Tasks;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
namespace Tgstation.Server.Host.IO
{
@@ -3,7 +3,7 @@
using Microsoft.Extensions.Logging;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Security.OAuth
@@ -13,7 +13,7 @@ using Newtonsoft.Json.Serialization;
using Tgstation.Server.Api;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Security.OAuth
@@ -3,7 +3,7 @@
using Microsoft.Extensions.Logging;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Security.OAuth
@@ -3,7 +3,7 @@
using Microsoft.Extensions.Logging;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Security.OAuth
@@ -8,7 +8,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
using Tgstation.Server.Host.Utils.GitHub;
@@ -3,7 +3,7 @@
using Microsoft.Extensions.Logging;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
namespace Tgstation.Server.Host.Security.OAuth
@@ -16,7 +16,7 @@ using Microsoft.Extensions.Options;
using Newtonsoft.Json;
using Tgstation.Server.Api.Models.Response;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
using Tgstation.Server.Host.Core;
using Tgstation.Server.Host.Database;
@@ -3,7 +3,7 @@ using System.Net.Http;
using Microsoft.Extensions.Logging;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.System;
namespace Tgstation.Server.Host.Utils
@@ -51,7 +51,7 @@ namespace Tgstation.Server.Host.Utils
var innerClient = httpClientFactory.CreateClient();
try
{
var client = new Tgstation.Server.Common.HttpClient(innerClient);
var client = new Tgstation.Server.Common.Http.HttpClient(innerClient);
innerClient = null;
try
{
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
using Tgstation.Server.Api;
using Tgstation.Server.Api.Models.Response;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
namespace Tgstation.Server.Client.Tests
{
@@ -8,7 +8,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.System;
namespace Tgstation.Server.Host.IO.Tests
@@ -9,7 +9,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Moq;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Extensions;
namespace Tgstation.Server.Host.IO.Tests
@@ -21,7 +21,7 @@ using Moq;
using Newtonsoft.Json;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
using Tgstation.Server.Host.Controllers;
using Tgstation.Server.Host.Transfer;
@@ -14,7 +14,7 @@ using Moq;
using Moq.Language.Flow;
using Tgstation.Server.Api.Models.Response;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Configuration;
using Tgstation.Server.Host.Controllers;
using Tgstation.Server.Host.Core;
@@ -7,7 +7,7 @@ using System.Threading.Tasks;
using Microsoft.Extensions.Logging;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.Extensions;
using Tgstation.Server.Host.IO;
using Tgstation.Server.Host.System;
@@ -7,7 +7,7 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
using Tgstation.Server.Api;
using Tgstation.Server.Client;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
namespace Tgstation.Server.Tests.Live
{
@@ -2,7 +2,7 @@
using Tgstation.Server.Api;
using Tgstation.Server.Client;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
namespace Tgstation.Server.Tests.Live
{
+1 -1
View File
@@ -21,7 +21,7 @@ using Octokit;
using Tgstation.Server.Api;
using Tgstation.Server.Client;
using Tgstation.Server.Common;
using Tgstation.Server.Common.Http;
using Tgstation.Server.Host.IO;
using Tgstation.Server.Host.Setup;