The great stylecop update

Beware those that read into this commit. Here there be style conformance...

Closes #1252
This commit is contained in:
Jordan Brown
2021-05-09 19:27:09 -04:00
parent d25f016316
commit b9586c7fee
609 changed files with 10032 additions and 8923 deletions
+5
View File
@@ -2,15 +2,20 @@
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.cs]
charset = utf-8-bom
indent_style = tab
indent_size = 4
[*.csproj]
indent_style = space
indent_size = 2
[*.dm]
indent_style = tab
indent_size = 4
[*.yml]
indent_style = space
indent_size = 2
+5 -16
View File
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="myrules" Description="My rule set" ToolsVersion="15.0">
<RuleSet Name="myrules" Description="My rule set" ToolsVersion="16.0">
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
<Rule Id="UseConfigureAwait" Action="Warning" />
</Rules>
@@ -30,7 +30,6 @@
<Rule Id="CA1027" Action="Warning" />
<Rule Id="CA1028" Action="Warning" />
<Rule Id="CA1030" Action="Warning" />
<Rule Id="CA1031" Action="None" />
<Rule Id="CA1032" Action="Warning" />
<Rule Id="CA1033" Action="Warning" />
<Rule Id="CA1034" Action="Warning" />
@@ -66,7 +65,6 @@
<Rule Id="CA1300" Action="Warning" />
<Rule Id="CA1301" Action="Warning" />
<Rule Id="CA1302" Action="Warning" />
<Rule Id="CA1303" Action="None" />
<Rule Id="CA1304" Action="Warning" />
<Rule Id="CA1305" Action="Warning" />
<Rule Id="CA1306" Action="Warning" />
@@ -1025,31 +1023,22 @@
<Rule Id="SF1002" Action="Warning" />
</Rules>
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1000" Action="None" />
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1116" Action="None" />
<Rule Id="SA1117" Action="None" />
<Rule Id="SA1118" Action="None" />
<Rule Id="SA1121" Action="None" />
<Rule Id="SA1127" Action="None" />
<Rule Id="SA1128" Action="None" />
<Rule Id="SA1200" Action="None" />
<Rule Id="SA1201" Action="None" />
<Rule Id="SA1202" Action="None" />
<Rule Id="SA1208" Action="None" />
<Rule Id="SA1312" Action="None" />
<Rule Id="SA1400" Action="None" />
<Rule Id="SA1413" Action="None" />
<Rule Id="SA1501" Action="None" />
<Rule Id="SA1502" Action="None" />
<Rule Id="SA1412" Action="Warning" />
<Rule Id="SA1503" Action="None" />
<Rule Id="SA1516" Action="None" />
<Rule Id="SA1519" Action="None" />
<Rule Id="SA1520" Action="None" />
<Rule Id="SA1623" Action="None" />
<Rule Id="SA1629" Action="None" />
<Rule Id="SA1628" Action="Warning" />
<Rule Id="SA1633" Action="None" />
<Rule Id="SA1642" Action="None" />
<Rule Id="SA1644" Action="Warning" />
<Rule Id="SX1101" Action="Warning" />
</Rules>
<Rules AnalyzerId="Text.CSharp.Analyzers" RuleNamespace="Text.CSharp.Analyzers">
<Rule Id="CA1704" Action="Warning" />
+30
View File
@@ -1,8 +1,38 @@
{
"settings": {
"documentationRules": {
"documentPrivateElements": true,
"documentPrivateFields": true,
"excludeFromPunctuationCheck": [
"remarks"
]
},
"indentation": {
"tabSize": 4,
"useTabs": true
},
"layoutRules": {
"newlineAtEndOfFile": "require"
},
"maintainabilityRules": {
"topLevelTypes": [
"class",
"delegate",
"enum",
"interface",
"struct"
]
},
"orderingRules": {
"blankLinesBetweenUsingGroups": "require",
"elementOrder": [
"constant",
"kind",
"static",
"readonly",
"accessibility"
],
"usingDirectivesPlacement": "outsideNamespace"
}
}
}
+45 -43
View File
@@ -1,20 +1,22 @@
using Microsoft.AspNetCore.Http.Headers;
using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http.Headers;
using System.Net.Mime;
using System.Reflection;
using System.Text;
using Microsoft.AspNetCore.Http.Headers;
using Microsoft.Extensions.Primitives;
using Microsoft.Net.Http.Headers;
using Tgstation.Server.Api.Models;
using Tgstation.Server.Api.Properties;
namespace Tgstation.Server.Api
{
/// <summary>
/// Represents the header that must be present for every server request
/// Represents the header that must be present for every server request.
/// </summary>
public sealed class ApiHeaders
{
@@ -34,62 +36,62 @@ namespace Tgstation.Server.Api
public const string OAuthProviderHeader = "OAuthProvider";
/// <summary>
/// The JWT authentication header scheme
/// The JWT authentication header scheme.
/// </summary>
public const string BearerAuthenticationScheme = "Bearer";
/// <summary>
/// The JWT authentication header scheme
/// The JWT authentication header scheme.
/// </summary>
public const string BasicAuthenticationScheme = "Basic";
/// <summary>
/// The JWT authentication header scheme
/// The JWT authentication header scheme.
/// </summary>
public const string OAuthAuthenticationScheme = "OAuth";
/// <summary>
/// The current <see cref="System.Reflection.AssemblyName"/>
/// </summary>
static readonly AssemblyName AssemblyName = Assembly.GetExecutingAssembly().GetName();
/// <summary>
/// Get the version of the <see cref="Api"/> the caller is using
/// Get the version of the <see cref="Api"/> the caller is using.
/// </summary>
public static readonly Version Version = Version.Parse(ApiVersionAttribute.Instance.RawApiVersion);
/// <summary>
/// The instance <see cref="EntityId.Id"/> being accessed
/// The current <see cref="System.Reflection.AssemblyName"/>.
/// </summary>
static readonly AssemblyName AssemblyName = Assembly.GetExecutingAssembly().GetName();
/// <summary>
/// The instance <see cref="EntityId.Id"/> being accessed.
/// </summary>
public long? InstanceId { get; set; }
/// <summary>
/// The client's user agent as a <see cref="ProductHeaderValue"/> if valid
/// The client's user agent as a <see cref="ProductHeaderValue"/> if valid.
/// </summary>
public ProductHeaderValue? UserAgent => ProductInfoHeaderValue.TryParse(RawUserAgent, out var userAgent) ? userAgent.Product : null;
/// <summary>
/// The client's raw user agent
/// The client's raw user agent.
/// </summary>
public string? RawUserAgent { get; }
/// <summary>
/// The client's API version
/// The client's API version.
/// </summary>
public Version ApiVersion { get; }
/// <summary>
/// The client's JWT
/// The client's JWT.
/// </summary>
public string? Token { get; }
/// <summary>
/// The client's username
/// The client's username.
/// </summary>
public string? Username { get; }
/// <summary>
/// The client's password
/// The client's password.
/// </summary>
public string? Password { get; }
@@ -104,17 +106,17 @@ namespace Tgstation.Server.Api
public bool IsTokenAuthentication => Token != null && !OAuthProvider.HasValue;
/// <summary>
/// Checks if a given <paramref name="otherVersion"/> is compatible with our own
/// Checks if a given <paramref name="otherVersion"/> is compatible with our own.
/// </summary>
/// <param name="otherVersion">The <see cref="Version"/> to test</param>
/// <returns><see langword="true"/> if the given version is compatible with the API. <see langword="false"/> otherwise</returns>
/// <param name="otherVersion">The <see cref="Version"/> to test.</param>
/// <returns><see langword="true"/> if the given version is compatible with the API. <see langword="false"/> otherwise.</returns>
public static bool CheckCompatibility(Version otherVersion) => Version.Major == (otherVersion?.Major ?? throw new ArgumentNullException(nameof(otherVersion)));
/// <summary>
/// Construct <see cref="ApiHeaders"/> for JWT authentication
/// Initializes a new instance of the <see cref="ApiHeaders"/> class. Used for token authentication.
/// </summary>
/// <param name="userAgent">The value of <see cref="UserAgent"/></param>
/// <param name="token">The value of <see cref="Token"/></param>
/// <param name="userAgent">The value of <see cref="UserAgent"/>.</param>
/// <param name="token">The value of <see cref="Token"/>.</param>
/// <param name="oauthProvider">The value of <see cref="OAuthProvider"/>.</param>
public ApiHeaders(ProductHeaderValue userAgent, string token, OAuthProvider? oauthProvider = null) : this(userAgent, token, null, null)
{
@@ -127,11 +129,11 @@ namespace Tgstation.Server.Api
}
/// <summary>
/// Construct <see cref="ApiHeaders"/> for password authentication
/// Initializes a new instance of the <see cref="ApiHeaders"/> class. Used for password authentication.
/// </summary>
/// <param name="userAgent">The value of <see cref="UserAgent"/></param>
/// <param name="username">The value of <see cref="Username"/></param>
/// <param name="password">The value of <see cref="Password"/></param>
/// <param name="userAgent">The value of <see cref="UserAgent"/>.</param>
/// <param name="username">The value of <see cref="Username"/>.</param>
/// <param name="password">The value of <see cref="Password"/>.</param>
public ApiHeaders(ProductHeaderValue userAgent, string username, string password) : this(userAgent, null, username, password)
{
if (userAgent == null)
@@ -143,9 +145,9 @@ namespace Tgstation.Server.Api
}
/// <summary>
/// Construct and validates <see cref="ApiHeaders"/> from a set of <paramref name="requestHeaders"/>
/// Initializes a new instance of the <see cref="ApiHeaders"/> class.
/// </summary>
/// <param name="requestHeaders">The <see cref="RequestHeaders"/> containing the <see cref="ApiHeaders"/></param>
/// <param name="requestHeaders">The <see cref="RequestHeaders"/> containing the serialized <see cref="ApiHeaders"/>.</param>
/// <param name="ignoreMissingAuth">If a missing <see cref="HeaderNames.Authorization"/> should be ignored.</param>
/// <exception cref="HeadersException">Thrown if the <paramref name="requestHeaders"/> constitue invalid <see cref="ApiHeaders"/>.</exception>
#pragma warning disable CA1502
@@ -270,12 +272,12 @@ namespace Tgstation.Server.Api
#pragma warning restore CA1502
/// <summary>
/// Construct <see cref="ApiHeaders"/>
/// Initializes a new instance of the <see cref="ApiHeaders"/> class.
/// </summary>
/// <param name="userAgent">The value of <see cref="UserAgent"/></param>
/// <param name="token">The value of <see cref="Token"/></param>
/// <param name="username">The value of <see cref="Username"/></param>
/// <param name="password">The value of <see cref="Password"/></param>
/// <param name="userAgent">The value of <see cref="UserAgent"/>.</param>
/// <param name="token">The value of <see cref="Token"/>.</param>
/// <param name="username">The value of <see cref="Username"/>.</param>
/// <param name="password">The value of <see cref="Password"/>.</param>
ApiHeaders(ProductHeaderValue userAgent, string? token, string? username, string? password)
{
RawUserAgent = userAgent?.ToString();
@@ -286,16 +288,16 @@ namespace Tgstation.Server.Api
}
/// <summary>
/// Checks if the <see cref="ApiVersion"/> is compatible with <see cref="Version"/>
/// Checks if the <see cref="ApiVersion"/> is compatible with <see cref="Version"/>.
/// </summary>
/// <returns><see langword="true"/> if the API is compatible, <see langword="false"/> otherwise</returns>
/// <returns><see langword="true"/> if the API is compatible, <see langword="false"/> otherwise.</returns>
public bool Compatible() => CheckCompatibility(ApiVersion);
/// <summary>
/// Set <see cref="HttpRequestHeaders"/> using the <see cref="ApiHeaders"/>. This initially clears <paramref name="headers"/>
/// Set <see cref="HttpRequestHeaders"/> using the <see cref="ApiHeaders"/>. This initially clears <paramref name="headers"/>.
/// </summary>
/// <param name="headers">The <see cref="HttpRequestHeaders"/> to set</param>
/// <param name="instanceId">The instance <see cref="EntityId.Id"/> for the request</param>
/// <param name="headers">The <see cref="HttpRequestHeaders"/> to set.</param>
/// <param name="instanceId">The instance <see cref="EntityId.Id"/> for the request.</param>
public void SetRequestHeaders(HttpRequestHeaders headers, long? instanceId = null)
{
if (headers == null)
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api
namespace Tgstation.Server.Api
{
/// <summary>
/// Represents initial credentials used by the server.
@@ -6,12 +6,12 @@ namespace Tgstation.Server.Api
public static class DefaultCredentials
{
/// <summary>
/// The name of the default admin user
/// The name of the default admin user.
/// </summary>
public static readonly string AdminUserName = "Admin";
/// <summary>
/// The default admin password
/// The default admin password.
/// </summary>
public static readonly string DefaultAdminUserPassword = "ISolemlySwearToDeleteTheDataDirectory";
}
+1 -1
View File
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api
{
+5 -5
View File
@@ -13,7 +13,7 @@ namespace Tgstation.Server.Api
public HeaderTypes MissingOrMalformedHeaders { get; }
/// <summary>
/// Initializes a new instance of the <see cref="HeadersException"/> <see langword="class"/>.
/// Initializes a new instance of the <see cref="HeadersException"/> class.
/// </summary>
/// <param name="missingOrMalformedHeaders">The value of <see cref="MissingOrMalformedHeaders"/>.</param>
/// <param name="message">The error message.</param>
@@ -23,14 +23,14 @@ namespace Tgstation.Server.Api
}
/// <summary>
/// Initializes a new instance of the <see cref="HeadersException"/> <see langword="class"/>.
/// Initializes a new instance of the <see cref="HeadersException"/> class.
/// </summary>
public HeadersException()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="HeadersException"/> <see langword="class"/>.
/// Initializes a new instance of the <see cref="HeadersException"/> class.
/// </summary>
/// <param name="message">The error message.</param>
public HeadersException(string message) : base(message)
@@ -38,10 +38,10 @@ namespace Tgstation.Server.Api
}
/// <summary>
/// Initializes a new instance of the <see cref="HeadersException"/> <see langword="class"/>.
/// Initializes a new instance of the <see cref="HeadersException"/> class.
/// </summary>
/// <param name="message">The error message.</param>
/// <param name="innerException">The inner <see cref="Exception"/> for the base <see cref="Exception"/></param>
/// <param name="innerException">The inner <see cref="Exception"/> for the base <see cref="Exception"/>.</param>
public HeadersException(string message, Exception innerException) : base(message, innerException)
{
}
@@ -1,9 +1,9 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Indicates a chat channel
/// Indicates a chat channel.
/// </summary>
public class ChatChannel
{
@@ -16,31 +16,31 @@ namespace Tgstation.Server.Api.Models
public string? IrcChannel { get; set; }
/// <summary>
/// The Discord channel ID
/// The Discord channel ID.
/// </summary>
[ResponseOptions]
public ulong? DiscordChannelId { get; set; }
/// <summary>
/// If the <see cref="ChatChannel"/> is an admin channel
/// If the <see cref="ChatChannel"/> is an admin channel.
/// </summary>
[Required]
public bool? IsAdminChannel { get; set; }
/// <summary>
/// If the <see cref="ChatChannel"/> is a watchdog channel
/// If the <see cref="ChatChannel"/> is a watchdog channel.
/// </summary>
[Required]
public bool? IsWatchdogChannel { get; set; }
/// <summary>
/// If the <see cref="ChatChannel"/> is an updates channel
/// If the <see cref="ChatChannel"/> is an updates channel.
/// </summary>
[Required]
public bool? IsUpdatesChannel { get; set; }
/// <summary>
/// A custom tag users can define to group channels together
/// A custom tag users can define to group channels together.
/// </summary>
[ResponseOptions]
[StringLength(Limits.MaximumStringLength)]
@@ -1,18 +1,18 @@
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Represents a chat service provider
/// Represents a chat service provider.
/// </summary>
public enum ChatProvider
{
/// <summary>
/// Internet relay chat
/// Internet relay chat.
/// </summary>
Irc,
/// <summary>
/// Superior chat service
/// Superior chat service.
/// </summary>
Discord
Discord,
}
}
@@ -1,23 +1,23 @@
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// The type of configuration allowed on an <see cref="Instance"/>
/// The type of configuration allowed on an <see cref="Instance"/>.
/// </summary>
public enum ConfigurationType
{
/// <summary>
/// Configuration editing is not allowed
/// Configuration editing is not allowed.
/// </summary>
Disallowed,
/// <summary>
/// Configuration editing is allowed by all users on all files
/// Configuration editing is allowed by all users on all files.
/// </summary>
HostWrite,
/// <summary>
/// Co
/// Configuration editing is allowed by only by system identity users and uses their filesystem ACLs.
/// </summary>
SystemIdentityWrite
SystemIdentityWrite,
}
}
@@ -1,11 +1,12 @@
using System;
using System;
using System.Linq;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// <see cref="ChatConnectionStringBuilder"/> for <see cref="ChatProvider.Discord"/>
/// <see cref="ChatConnectionStringBuilder"/> for <see cref="ChatProvider.Discord"/>.
/// </summary>
public sealed class DiscordConnectionStringBuilder : ChatConnectionStringBuilder
{
@@ -29,7 +30,7 @@ namespace Tgstation.Server.Api.Models
public DiscordDMOutputDisplayType DMOutputDisplay { get; set; }
/// <summary>
/// Construct a <see cref="DiscordConnectionStringBuilder"/>
/// Initializes a new instance of the <see cref="DiscordConnectionStringBuilder"/> class.
/// </summary>
public DiscordConnectionStringBuilder()
{
@@ -37,12 +38,12 @@ namespace Tgstation.Server.Api.Models
}
/// <summary>
/// Construct a <see cref="DiscordConnectionStringBuilder"/> from a <paramref name="connectionString"/>
/// Initializes a new instance of the <see cref="DiscordConnectionStringBuilder"/> class.
/// </summary>
/// <param name="connectionString">The connection string</param>
/// <param name="connectionString">The connection string.</param>
public DiscordConnectionStringBuilder(string connectionString)
{
if(connectionString == null)
if (connectionString == null)
throw new ArgumentNullException(nameof(connectionString));
var splits = connectionString.Split(';');
@@ -56,7 +57,7 @@ namespace Tgstation.Server.Api.Models
}
else
{
BasedMeme = true; // Oranges said this needs to be true by default :pensive:
BasedMeme = true; // oranges said this needs to be true by default :pensive:
}
}
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// When the DM output section of Discord deployment embeds should be shown.
@@ -18,6 +18,6 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// Never show.
/// </summary>
Never
Never,
}
}
@@ -1,23 +1,23 @@
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// DreamDaemon's security level
/// DreamDaemon's security level.
/// </summary>
public enum DreamDaemonSecurity
{
/// <summary>
/// Server is unrestricted in terms of file access and shell commands
/// Server is unrestricted in terms of file access and shell commands.
/// </summary>
Trusted,
/// <summary>
/// Server will not be able to run shell commands or access files outside it's working directory
/// Server will not be able to run shell commands or access files outside it's working directory.
/// </summary>
Safe,
/// <summary>
/// Server will not be able to run shell commands or access anything but temporary files. Currently unsupported!
/// Server will not be able to run shell commands or access anything but temporary files.
/// </summary>
Ultrasafe
Ultrasafe,
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Common base of entities with IDs.
+1 -1
View File
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel;
namespace Tgstation.Server.Api.Models
@@ -23,4 +23,4 @@ namespace Tgstation.Server.Api.Models
return attributes?.FirstOrDefault()?.Description;
}
}
}
}
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Indicates whether a request field is <see cref="Required"/> or <see cref="Ignored"/>.
@@ -18,6 +18,6 @@ namespace Tgstation.Server.Api.Models
/// <summary>
/// The field is ignored or should not appear.
/// </summary>
Ignored
Ignored,
}
}
@@ -1,9 +1,9 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Represents a game configuration file. Create and delete actions uncerimonuously overwrite/delete files
/// Represents a game configuration file. Create and delete actions uncerimonuously overwrite/delete files.
/// </summary>
public interface IConfigurationFile
{
@@ -14,7 +14,7 @@ namespace Tgstation.Server.Api.Models
public string? Path { get; set; }
/// <summary>
/// The MD5 hash of the file when last read by the user. If this doesn't match during update actions, the write will be denied with <see cref="System.Net.HttpStatusCode.Conflict"/>
/// The MD5 hash of the file when last read by the user. If this doesn't match during update actions, the write will be denied with <see cref="System.Net.HttpStatusCode.Conflict"/>.
/// </summary>
[ResponseOptions]
public string? LastReadHash { get; set; }
+6 -6
View File
@@ -1,35 +1,35 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Metadata about a server instance
/// Metadata about a server instance.
/// </summary>
public abstract class Instance : NamedEntity
{
/// <summary>
/// The path to where the <see cref="Instance"/> is located. Can only be changed while the <see cref="Instance"/> is offline. Must not exist when the instance is created
/// The path to where the <see cref="Instance"/> is located. Can only be changed while the <see cref="Instance"/> is offline. Must not exist when the instance is created.
/// </summary>
[Required]
[RequestOptions(FieldPresence.Required, PutOnly = true)]
public string? Path { get; set; }
/// <summary>
/// If the <see cref="Instance"/> is online
/// If the <see cref="Instance"/> is online.
/// </summary>
[Required]
[RequestOptions(FieldPresence.Ignored, PutOnly = true)]
public bool? Online { get; set; }
/// <summary>
/// If <see cref="IConfigurationFile"/>s can be used on the <see cref="Instance"/>
/// If <see cref="IConfigurationFile"/>s can be used on the <see cref="Instance"/>.
/// </summary>
[Required]
[EnumDataType(typeof(ConfigurationType))]
public ConfigurationType? ConfigurationType { get; set; }
/// <summary>
/// The time interval in minutes the repository is automatically pulled and compiles. 0 disables
/// The time interval in minutes the repository is automatically pulled and compiles. 0 disables.
/// </summary>
[Required]
public uint? AutoUpdateInterval { get; set; }
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -8,14 +8,14 @@ namespace Tgstation.Server.Api.Models.Internal
public abstract class ChatBotApiBase : ChatBotSettings
{
/// <summary>
/// Channels the Discord bot should listen/announce in
/// Channels the Discord bot should listen/announce in.
/// </summary>
public ICollection<ChatChannel>? Channels { get; set; }
/// <summary>
/// Validates <see cref="Channels"/> are correct for the <see cref="ChatBotSettings.Provider"/>
/// Validates <see cref="Channels"/> are correct for the <see cref="ChatBotSettings.Provider"/>.
/// </summary>
/// <returns><see langword="true"/> if the <see cref="Channels"/> are valid for the <see cref="ChatBotSettings.Provider"/>, <see langword="false"/> otherwise</returns>
/// <returns><see langword="true"/> if the <see cref="Channels"/> are valid for the <see cref="ChatBotSettings.Provider"/>, <see langword="false"/> otherwise.</returns>
public bool ValidateProviderChannelTypes()
{
if (!Provider.HasValue)
@@ -1,15 +1,15 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Manage the server chat bots
/// Manage the server chat bots.
/// </summary>
public abstract class ChatBotSettings : NamedEntity
{
/// <summary>
/// If the connection is enabled
/// If the connection is enabled.
/// </summary>
public bool? Enabled { get; set; }
@@ -27,7 +27,7 @@ namespace Tgstation.Server.Api.Models.Internal
public ushort? ChannelLimit { get; set; }
/// <summary>
/// The <see cref="ChatProvider"/> used for the connection
/// The <see cref="ChatProvider"/> used for the connection.
/// </summary>
[Required]
[RequestOptions(FieldPresence.Required, PutOnly = true)]
@@ -35,7 +35,7 @@ namespace Tgstation.Server.Api.Models.Internal
public ChatProvider? Provider { get; set; }
/// <summary>
/// The information used to connect to the <see cref="Provider"/>
/// The information used to connect to the <see cref="Provider"/>.
/// </summary>
[Required]
[RequestOptions(FieldPresence.Required, PutOnly = true)]
@@ -1,19 +1,19 @@
namespace Tgstation.Server.Api.Models.Internal
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Helper for building <see cref="ChatBotSettings.ConnectionString"/>s
/// Helper for building <see cref="ChatBotSettings.ConnectionString"/>s.
/// </summary>
public abstract class ChatConnectionStringBuilder
{
/// <summary>
/// If the <see cref="ChatConnectionStringBuilder"/> evaluates to a valid <see cref="ChatBotSettings.ConnectionString"/>
/// If the <see cref="ChatConnectionStringBuilder"/> evaluates to a valid <see cref="ChatBotSettings.ConnectionString"/>.
/// </summary>
public abstract bool Valid { get; }
/// <summary>
/// Gets the <see cref="ChatBotSettings.ConnectionString"/> associated with the <see cref="ChatConnectionStringBuilder"/>
/// Gets the <see cref="ChatBotSettings.ConnectionString"/> associated with the <see cref="ChatConnectionStringBuilder"/>.
/// </summary>
/// <returns>The <see cref="ChatBotSettings.ConnectionString"/> associated with the <see cref="ChatConnectionStringBuilder"/></returns>
/// <returns>The <see cref="ChatBotSettings.ConnectionString"/> associated with the <see cref="ChatConnectionStringBuilder"/>.</returns>
public abstract override string ToString();
}
}
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
@@ -10,19 +10,19 @@ namespace Tgstation.Server.Api.Models.Internal
public abstract class CompileJob : EntityId
{
/// <summary>
/// The .dme file used for compilation
/// The .dme file used for compilation.
/// </summary>
[Required]
public string? DmeName { get; set; }
/// <summary>
/// Textual output of DM
/// Textual output of DM.
/// </summary>
[Required]
public string? Output { get; set; }
/// <summary>
/// The Game folder the results were compiled into
/// The Game folder the results were compiled into.
/// </summary>
[Required]
public Guid? DirectoryName { get; set; }
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Internal
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Base class for DreamDaemon API models.
@@ -6,13 +6,13 @@ namespace Tgstation.Server.Api.Models.Internal
public abstract class DreamDaemonApiBase : DreamDaemonSettings
{
/// <summary>
/// If the server is undergoing a soft reset. This may be automatically set by changes to other fields
/// If the server is undergoing a soft reset. This may be automatically set by changes to other fields.
/// </summary>
[ResponseOptions]
public bool? SoftRestart { get; set; }
/// <summary>
/// If the server is undergoing a soft shutdown
/// If the server is undergoing a soft shutdown.
/// </summary>
[ResponseOptions]
public bool? SoftShutdown { get; set; }
@@ -1,15 +1,15 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Launch settings for DreamDaemon
/// Launch settings for DreamDaemon.
/// </summary>
public class DreamDaemonLaunchParameters
{
/// <summary>
/// If the BYOND web client can be used to connect to the game server
/// If the BYOND web client can be used to connect to the game server.
/// </summary>
[Required]
[ResponseOptions]
@@ -32,7 +32,7 @@ namespace Tgstation.Server.Api.Models.Internal
public ushort? Port { get; set; }
/// <summary>
/// The DreamDaemon startup timeout in seconds
/// The DreamDaemon startup timeout in seconds.
/// </summary>
[Required]
[ResponseOptions]
@@ -65,8 +65,8 @@ namespace Tgstation.Server.Api.Models.Internal
/// <summary>
/// Check if we match a given set of <paramref name="otherParameters"/>. <see cref="StartupTimeout"/> is excluded.
/// </summary>
/// <param name="otherParameters">The <see cref="DreamDaemonLaunchParameters"/> to compare against</param>
/// <returns><see langword="true"/> if they match, <see langword="false"/> otherwise</returns>
/// <param name="otherParameters">The <see cref="DreamDaemonLaunchParameters"/> to compare against.</param>
/// <returns><see langword="true"/> if they match, <see langword="false"/> otherwise.</returns>
public bool CanApplyWithoutReboot(DreamDaemonLaunchParameters otherParameters) =>
AllowWebClient == (otherParameters?.AllowWebClient ?? throw new ArgumentNullException(nameof(otherParameters)))
&& SecurityLevel == otherParameters.SecurityLevel
@@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
@@ -8,7 +8,7 @@ namespace Tgstation.Server.Api.Models.Internal
public class DreamDaemonSettings : DreamDaemonLaunchParameters
{
/// <summary>
/// If the watchdog starts when it's <see cref="Instance"/> starts
/// If the watchdog starts when it's <see cref="Instance"/> starts.
/// </summary>
[Required]
[ResponseOptions]
@@ -1,9 +1,9 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents the state of the DreamMaker compiler. Create action starts a new compile. Delete action cancels the current compile
/// Represents the state of the DreamMaker compiler. Create action starts a new compile. Delete action cancels the current compile.
/// </summary>
public abstract class DreamMakerSettings
{
@@ -15,14 +15,14 @@ namespace Tgstation.Server.Api.Models.Internal
public string? ProjectName { get; set; }
/// <summary>
/// The port used during compilation to validate the DMAPI
/// The port used during compilation to validate the DMAPI.
/// </summary>
[Required]
[Range(1, 65535)]
public ushort? ApiValidationPort { get; set; }
/// <summary>
/// The <see cref="DreamDaemonSecurity"/> level used to validate the DMAPI
/// The <see cref="DreamDaemonSecurity"/> level used to validate the DMAPI.
/// </summary>
[Required]
public DreamDaemonSecurity? ApiValidationSecurityLevel { get; set; }
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Internal
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Provides information about remote providers.
@@ -11,12 +11,12 @@ namespace Tgstation.Server.Api.Models.Internal
public RemoteGitProvider? RemoteGitProvider { get; }
/// <summary>
/// If <see cref="RemoteGitProvider"/> is not <see cref="RemoteGitProvider.Unknown"/> this will be set with the owner of the repository
/// If <see cref="RemoteGitProvider"/> is not <see cref="RemoteGitProvider.Unknown"/> this will be set with the owner of the repository.
/// </summary>
public string? RemoteRepositoryOwner { get; }
/// <summary>
/// If <see cref="RemoteGitProvider"/> is not <see cref="RemoteGitProvider.Unknown"/> this will be set with the name of the repository
/// If <see cref="RemoteGitProvider"/> is not <see cref="RemoteGitProvider.Unknown"/> this will be set with the name of the repository.
/// </summary>
public string? RemoteRepositoryName { get; }
}
@@ -1,57 +1,58 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Rights;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents a <see cref="PermissionSet"/>s permissions in an <see cref="Instance"/>
/// Represents a <see cref="PermissionSet"/>s permissions in an <see cref="Instance"/>.
/// </summary>
public abstract class InstancePermissionSet
{
/// <summary>
/// The <see cref="EntityId.Id"/> of the <see cref="PermissionSet"/> the <see cref="InstancePermissionSet"/> belongs to
/// The <see cref="EntityId.Id"/> of the <see cref="PermissionSet"/> the <see cref="InstancePermissionSet"/> belongs to.
/// </summary>
[RequestOptions(FieldPresence.Required)]
public long PermissionSetId { get; set; }
/// <summary>
/// The <see cref="Rights.InstancePermissionSetRights"/> of the <see cref="InstancePermissionSet"/>
/// The <see cref="Rights.InstancePermissionSetRights"/> of the <see cref="InstancePermissionSet"/>.
/// </summary>
[Required]
public InstancePermissionSetRights? InstancePermissionSetRights { get; set; }
/// <summary>
/// The <see cref="Rights.ByondRights"/> of the <see cref="InstancePermissionSet"/>
/// The <see cref="Rights.ByondRights"/> of the <see cref="InstancePermissionSet"/>.
/// </summary>
[Required]
public ByondRights? ByondRights { get; set; }
/// <summary>
/// The <see cref="Rights.DreamDaemonRights"/> of the <see cref="InstancePermissionSet"/>
/// The <see cref="Rights.DreamDaemonRights"/> of the <see cref="InstancePermissionSet"/>.
/// </summary>
[Required]
public DreamDaemonRights? DreamDaemonRights { get; set; }
/// <summary>
/// The <see cref="Rights.DreamMakerRights"/> of the <see cref="InstancePermissionSet"/>
/// The <see cref="Rights.DreamMakerRights"/> of the <see cref="InstancePermissionSet"/>.
/// </summary>
[Required]
public DreamMakerRights? DreamMakerRights { get; set; }
/// <summary>
/// The <see cref="Rights.RepositoryRights"/> of the <see cref="InstancePermissionSet"/>
/// The <see cref="Rights.RepositoryRights"/> of the <see cref="InstancePermissionSet"/>.
/// </summary>
[Required]
public RepositoryRights? RepositoryRights { get; set; }
/// <summary>
/// The <see cref="Rights.ChatBotRights"/> of the <see cref="InstancePermissionSet"/>
/// The <see cref="Rights.ChatBotRights"/> of the <see cref="InstancePermissionSet"/>.
/// </summary>
[Required]
public ChatBotRights? ChatBotRights { get; set; }
/// <summary>
/// The <see cref="Rights.ConfigurationRights"/> of the <see cref="InstancePermissionSet"/>
/// The <see cref="Rights.ConfigurationRights"/> of the <see cref="InstancePermissionSet"/>.
/// </summary>
[Required]
public ConfigurationRights? ConfigurationRights { get; set; }
@@ -1,16 +1,17 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Rights;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents a long running job
/// Represents a long running job.
/// </summary>
public class Job : EntityId
{
/// <summary>
/// English description of the <see cref="Job"/>
/// English description of the <see cref="Job"/>.
/// </summary>
[Required]
public string? Description { get; set; }
@@ -22,37 +23,37 @@ namespace Tgstation.Server.Api.Models.Internal
public ErrorCode? ErrorCode { get; set; }
/// <summary>
/// Details of any exceptions caught during the <see cref="Job"/>
/// Details of any exceptions caught during the <see cref="Job"/>.
/// </summary>
[ResponseOptions]
public string? ExceptionDetails { get; set; }
/// <summary>
/// When the <see cref="Job"/> was started
/// When the <see cref="Job"/> was started.
/// </summary>
[Required]
public DateTimeOffset? StartedAt { get; set; }
/// <summary>
/// When the <see cref="Job"/> stopped
/// When the <see cref="Job"/> stopped.
/// </summary>
[ResponseOptions]
public DateTimeOffset? StoppedAt { get; set; }
/// <summary>
/// If the <see cref="Job"/> was cancelled
/// If the <see cref="Job"/> was cancelled.
/// </summary>
[Required]
public bool? Cancelled { get; set; }
/// <summary>
/// The <see cref="RightsType"/> of <see cref="CancelRight"/> if it can be cancelled
/// The <see cref="RightsType"/> of <see cref="CancelRight"/> if it can be cancelled.
/// </summary>
[ResponseOptions]
public RightsType? CancelRightsType { get; set; }
/// <summary>
/// The <see cref="Rights"/> required to cancel the <see cref="Job"/>
/// The <see cref="Rights"/> required to cancel the <see cref="Job"/>.
/// </summary>
[ResponseOptions]
public ulong? CancelRight { get; set; }
@@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
@@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
@@ -8,14 +8,14 @@ namespace Tgstation.Server.Api.Models.Internal
public class RepositorySettings
{
/// <summary>
/// The name of the committer
/// The name of the committer.
/// </summary>
[Required]
[StringLength(Limits.MaximumStringLength)]
public string? CommitterName { get; set; }
/// <summary>
/// The e-mail of the committer
/// The e-mail of the committer.
/// </summary>
[Required]
[StringLength(Limits.MaximumStringLength)]
@@ -23,14 +23,14 @@ namespace Tgstation.Server.Api.Models.Internal
public string? CommitterEmail { get; set; }
/// <summary>
/// The username to access the git repository with
/// The username to access the git repository with.
/// </summary>
[StringLength(Limits.MaximumStringLength)]
[ResponseOptions]
public string? AccessUser { get; set; }
/// <summary>
/// The token/password to access the git repository with
/// The token/password to access the git repository with.
/// </summary>
[StringLength(Limits.MaximumStringLength)]
[ResponseOptions(Presence = FieldPresence.Ignored)]
@@ -49,13 +49,13 @@ namespace Tgstation.Server.Api.Models.Internal
public bool? CreateGitHubDeployments { get; set; }
/// <summary>
/// If test merge commits are signed with the username of the person who merged it. Note this only affects future commits
/// If test merge commits are signed with the username of the person who merged it. Note this only affects future commits.
/// </summary>
[Required]
public bool? ShowTestMergeCommitters { get; set; }
/// <summary>
/// If test merge commits should be kept when auto updating. May cause merge conflicts which will block the update
/// If test merge commits should be kept when auto updating. May cause merge conflicts which will block the update.
/// </summary>
[Required]
public bool? AutoUpdatesKeepTestMerges { get; set; }
@@ -1,10 +1,10 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents information about a current git revison
/// Represents information about a current git revison.
/// </summary>
public class RevisionInformation
{
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace Tgstation.Server.Api.Models.Internal
{
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Request
namespace Tgstation.Server.Api.Models.Request
{
/// <inheritdoc />
public sealed class ServerUpdateRequest : ServerUpdate
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
@@ -1,20 +1,20 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents a test merge of a remote "pull request".
/// Represents a test merge of a remote commit source.
/// </summary>
public class TestMergeApiBase : TestMergeModelBase
{
/// <summary>
/// The ID of the <see cref="TestMergeApiBase"/>
/// The ID of the <see cref="TestMergeApiBase"/>.
/// </summary>
public long Id { get; set; }
/// <summary>
/// When the <see cref="TestMergeApiBase"/> was created
/// When the <see cref="TestMergeApiBase"/> was created.
/// </summary>
[Required]
public DateTimeOffset MergedAt { get; set; }
@@ -1,10 +1,10 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Layer of test merge data required internally
/// Layer of test merge data required internally.
/// </summary>
public abstract class TestMergeModelBase : TestMergeParameters
{
@@ -35,14 +35,16 @@ namespace Tgstation.Server.Api.Models.Internal
public string? Author { get; set; }
/// <summary>
/// Construct a <see cref="TestMergeModelBase"/>
/// Initializes a new instance of the <see cref="TestMergeModelBase"/> class.
/// </summary>
protected TestMergeModelBase() { }
protected TestMergeModelBase()
{
}
/// <summary>
/// Construct a <see cref="TestMergeModelBase"/> from a <paramref name="copy"/>
/// Initializes a new instance of the <see cref="TestMergeModelBase"/> class.
/// </summary>
/// <param name="copy">The <see cref="TestMergeModelBase"/> to copy data from</param>
/// <param name="copy">The <see cref="TestMergeModelBase"/> to copy data from.</param>
protected TestMergeModelBase(TestMergeModelBase copy)
{
if (copy == null)
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace Tgstation.Server.Api.Models.Internal
{
@@ -1,11 +1,11 @@
namespace Tgstation.Server.Api.Models.Internal
namespace Tgstation.Server.Api.Models.Internal
{
/// <summary>
/// Represents a group of users.
/// </summary>
public class UserGroup : NamedEntity
{
/// <inheridoc />
/// <inheritdoc />
[RequestOptions(FieldPresence.Required)]
public override long? Id
{
@@ -1,4 +1,4 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
@@ -9,20 +9,20 @@ namespace Tgstation.Server.Api.Models.Internal
public abstract class UserModelBase : UserName
{
/// <summary>
/// If the <see cref="UserModelBase"/> is enabled since users cannot be deleted. System users cannot be disabled
/// If the <see cref="UserModelBase"/> is enabled since users cannot be deleted. System users cannot be disabled.
/// </summary>
[Required]
public bool? Enabled { get; set; }
/// <summary>
/// When the <see cref="UserModelBase"/> was created
/// When the <see cref="UserModelBase"/> was created.
/// </summary>
[Required]
[RequestOptions(FieldPresence.Ignored)]
public DateTimeOffset? CreatedAt { get; set; }
/// <summary>
/// The SID/UID of the <see cref="UserModelBase"/> on Windows/POSIX respectively
/// The SID/UID of the <see cref="UserModelBase"/> on Windows/POSIX respectively.
/// </summary>
[ResponseOptions]
[StringLength(Limits.MaximumIndexableStringLength, MinimumLength = 1)]
@@ -1,12 +1,13 @@
using System;
using System.Collections.Generic;
using System.Text;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// <see cref="ChatConnectionStringBuilder"/> for <see cref="ChatProvider.Irc"/>
/// <see cref="ChatConnectionStringBuilder"/> for <see cref="ChatProvider.Irc"/>.
/// </summary>
public sealed class IrcConnectionStringBuilder : ChatConnectionStringBuilder
{
@@ -14,44 +15,46 @@ namespace Tgstation.Server.Api.Models
public override bool Valid => Address != null && Port.HasValue && Port != 0 && UseSsl.HasValue && (PasswordType.HasValue ^ Password == null);
/// <summary>
/// The IP address or URL of the IRC server
/// The IP address or URL of the IRC server.
/// </summary>
public string? Address { get; set; }
/// <summary>
/// The port the server runs on
/// The port the server runs on.
/// </summary>
public ushort? Port { get; set; }
/// <summary>
/// The nickname for the bot to use
/// The nickname for the bot to use.
/// </summary>
public string? Nickname { get; set; }
/// <summary>
/// If the connection should be made using SSL
/// If the connection should be made using SSL.
/// </summary>
public bool? UseSsl { get; set; }
/// <summary>
/// The optional <see cref="IrcPasswordType"/> to use
/// The optional <see cref="IrcPasswordType"/> to use.
/// </summary>
public IrcPasswordType? PasswordType { get; set; }
/// <summary>
/// The optional password to use
/// The optional password to use.
/// </summary>
public string? Password { get; set; }
/// <summary>
/// Construct an <see cref="IrcConnectionStringBuilder"/>
/// Initializes a new instance of the <see cref="IrcConnectionStringBuilder"/> class.
/// </summary>
public IrcConnectionStringBuilder() { }
public IrcConnectionStringBuilder()
{
}
/// <summary>
/// Construct a <see cref="DiscordConnectionStringBuilder"/> from a <paramref name="connectionString"/>
/// Initializes a new instance of the <see cref="IrcConnectionStringBuilder"/> class.
/// </summary>
/// <param name="connectionString">The connection string</param>
/// <param name="connectionString">The connection string.</param>
public IrcConnectionStringBuilder(string connectionString)
{
if (connectionString == null)
@@ -109,8 +112,10 @@ namespace Tgstation.Server.Api.Models
sb.Append(';');
sb.Append(Nickname);
sb.Append(';');
if(UseSsl.HasValue)
if (UseSsl.HasValue)
sb.Append(Convert.ToInt32(UseSsl.Value));
if (PasswordType.HasValue)
{
sb.Append(';');
@@ -1,7 +1,7 @@
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Represents the type of a password for a <see cref="ChatProvider.Irc"/>
/// Represents the type of a password for a <see cref="ChatProvider.Irc"/>.
/// </summary>
public enum IrcPasswordType
{
@@ -18,6 +18,6 @@
/// <summary>
/// Use NickServ authentication
/// </summary>
NickServ
NickServ,
}
}
+2 -2
View File
@@ -1,9 +1,9 @@
using System;
using System;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Sanity limits to prevent users from overloading
/// Sanity limits to prevent users from overloading.
/// </summary>
public static class Limits
{
@@ -1,4 +1,4 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models
{
@@ -1,5 +1,6 @@
using System.ComponentModel.DataAnnotations;
using Newtonsoft.Json;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models
{
@@ -1,10 +1,10 @@
using Newtonsoft.Json;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// List of OAuth providers supported by TGS
/// List of OAuth providers supported by TGS.
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum OAuthProvider
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models
{
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Rights;
namespace Tgstation.Server.Api.Models
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Indicates the remote git host.
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models.Request
{
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
{
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
{
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Request
namespace Tgstation.Server.Api.Models.Request
{
/// <summary>
/// Represents a request to update a configuration file.
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
{
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
{
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Request
namespace Tgstation.Server.Api.Models.Request
{
/// <summary>
/// A request to create an <see cref="Instance"/>.
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
{
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Request
namespace Tgstation.Server.Api.Models.Request
{
/// <summary>
/// A request to update an <see cref="Instance"/>.
@@ -1,4 +1,5 @@
using System;
using System;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
@@ -1,5 +1,6 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
@@ -16,12 +17,12 @@ namespace Tgstation.Server.Api.Models.Request
public string? CheckoutSha { get; set; }
/// <summary>
/// Do the equivalent of a git pull. Will attempt to merge unless <see cref="RepositoryApiBase.Reference"/> is also specified in which case a hard reset will be performed after checking out
/// Do the equivalent of a git pull. Will attempt to merge unless <see cref="RepositoryApiBase.Reference"/> is also specified in which case a hard reset will be performed after checking out.
/// </summary>
public bool? UpdateFromOrigin { get; set; }
/// <summary>
/// <see cref="TestMergeParameters"/> for new <see cref="TestMerge"/>s. Note that merges that conflict will not be performed
/// <see cref="TestMergeParameters"/> for new <see cref="TestMerge"/>s. Note that merges that conflict will not be performed.
/// </summary>
public ICollection<TestMergeParameters>? NewTestMerges { get; set; }
}
@@ -1,9 +1,9 @@
namespace Tgstation.Server.Api.Models.Request
namespace Tgstation.Server.Api.Models.Request
{
/// <summary>
/// For creating a user.
/// </summary>
#pragma warning disable CA1501
#pragma warning disable CA1501
public sealed class UserCreateRequest : UserUpdateRequest
{
}
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Request
namespace Tgstation.Server.Api.Models.Request
{
/// <summary>
/// Request to create a user group.
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
{
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Request
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models
{
@@ -19,7 +19,7 @@ namespace Tgstation.Server.Api.Models
public bool PutOnly { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="RequestOptionsAttribute"/> <see langword="class"/>.
/// Initializes a new instance of the <see cref="RequestOptionsAttribute"/> class.
/// </summary>
/// <param name="presence">The value of <see cref="Presence"/>.</param>
public RequestOptionsAttribute(FieldPresence presence)
@@ -1,19 +1,19 @@
using System;
using System;
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Represents administrative server information
/// Represents administrative server information.
/// </summary>
public sealed class AdministrationResponse
{
/// <summary>
/// The GitHub repository the server is built to recieve updates from
/// The GitHub repository the server is built to recieve updates from.
/// </summary>
public Uri? TrackedRepositoryUrl { get; set; }
/// <summary>
/// The latest available version of the Tgstation.Server.Host assembly from the upstream repository. If <see cref="Version.Major"/> is not equal to 4 the update cannot be applied due to API changes
/// The latest available version of the Tgstation.Server.Host assembly from the upstream repository. If <see cref="Version.Major"/> is not equal to 4 the update cannot be applied due to API changes.
/// </summary>
public Version? LatestVersion { get; set; }
}
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models.Response
{
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models.Response
{
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Response
{
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models.Response
{
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Response
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Response when reading configuration files.
@@ -13,12 +13,12 @@ namespace Tgstation.Server.Api.Models.Response
public string? LastReadHash { get; set; }
/// <summary>
/// If <see cref="Path"/> represents a directory
/// If <see cref="Path"/> represents a directory.
/// </summary>
public bool? IsDirectory { get; set; }
/// <summary>
/// If access to the <see cref="IConfigurationFile"/> file was denied for the operation
/// If access to the <see cref="IConfigurationFile"/> file was denied for the operation.
/// </summary>
[ResponseOptions]
public bool? AccessDenied { get; set; }
@@ -1,10 +1,11 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Represents an instance of BYOND's DreamDaemon game server. Create action starts the server. Delete action shuts down the server
/// Represents an instance of BYOND's DreamDaemon game server. Create action starts the server. Delete action shuts down the server.
/// </summary>
public sealed class DreamDaemonResponse : DreamDaemonApiBase
{
@@ -28,20 +29,20 @@ namespace Tgstation.Server.Api.Models.Response
public WatchdogStatus? Status { get; set; }
/// <summary>
/// The current <see cref="DreamDaemonSecurity"/> of <see cref="DreamDaemonResponse"/>. May be downgraded due to requirements of <see cref="ActiveCompileJob"/>
/// The current <see cref="DreamDaemonSecurity"/> of <see cref="DreamDaemonResponse"/>. May be downgraded due to requirements of <see cref="ActiveCompileJob"/>.
/// </summary>
[EnumDataType(typeof(DreamDaemonSecurity))]
[ResponseOptions]
public DreamDaemonSecurity? CurrentSecurity { get; set; }
/// <summary>
/// The port the running <see cref="DreamDaemonResponse"/> instance is set to
/// The port the running <see cref="DreamDaemonResponse"/> instance is set to.
/// </summary>
[ResponseOptions]
public ushort? CurrentPort { get; set; }
/// <summary>
/// The webclient status the running <see cref="DreamDaemonResponse"/> instance is set to
/// The webclient status the running <see cref="DreamDaemonResponse"/> instance is set to.
/// </summary>
[ResponseOptions]
public bool? CurrentAllowWebclient { get; set; }
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Response
{
@@ -1,20 +1,20 @@
using System;
using System;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Represents an error message returned by the server
/// Represents an error message returned by the server.
/// </summary>
public sealed class ErrorMessageResponse
{
/// <summary>
/// The version of the API the server is using
/// The version of the API the server is using.
/// </summary>
public Version? ServerApiVersion { get; set; }
/// <summary>
/// A human readable description of the error
/// A human readable description of the error.
/// </summary>
public string? Message { get; set; }
@@ -31,12 +31,14 @@ namespace Tgstation.Server.Api.Models.Response
public ErrorCode ErrorCode { get; set; }
/// <summary>
/// Initializes a new instance of the <see cref="ErrorMessageResponse"/> <see langword="class"/>.
/// Initializes a new instance of the <see cref="ErrorMessageResponse"/> class.
/// </summary>
public ErrorMessageResponse() { }
public ErrorMessageResponse()
{
}
/// <summary>
/// Initializes a new instance of the <see cref="ErrorMessageResponse"/> <see langword="class"/>.
/// Initializes a new instance of the <see cref="ErrorMessageResponse"/> class.
/// </summary>
/// <param name="errorCode">The <see cref="ErrorMessageResponse"/>.</param>
public ErrorMessageResponse(ErrorCode errorCode)
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Response
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Response for when file transfers are necessary.
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Response
{
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Response
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Server response for <see cref="Instance"/>s.
@@ -1,23 +1,23 @@
namespace Tgstation.Server.Api.Models.Response
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Represents a long running job on the server. Model is read-only, updates attempt to cancel the job
/// Represents a long running job on the server. Model is read-only, updates attempt to cancel the job.
/// </summary>
public sealed class JobResponse : Internal.Job
{
/// <summary>
/// The <see cref="UserResponse"/> that started the job
/// The <see cref="UserResponse"/> that started the job.
/// </summary>
public UserName? StartedBy { get; set; }
/// <summary>
/// The <see cref="UserResponse"/> that cancelled the job
/// The <see cref="UserResponse"/> that cancelled the job.
/// </summary>
[ResponseOptions]
public UserName? CancelledBy { get; set; }
/// <summary>
/// Optional progress between 0 and 100 inclusive
/// Optional progress between 0 and 100 inclusive.
/// </summary>
[ResponseOptions]
public int? Progress { get; set; }
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models.Response
{
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Response
@@ -1,10 +1,11 @@
using System;
using System;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Represents a git repository
/// Represents a git repository.
/// </summary>
public sealed class RepositoryResponse : RepositoryApiBase, IGitRemoteInformation
{
@@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Generic;
namespace Tgstation.Server.Api.Models.Response
@@ -9,12 +9,12 @@ namespace Tgstation.Server.Api.Models.Response
public sealed class ServerInformationResponse : Internal.ServerInformationBase
{
/// <summary>
/// The version of the host
/// The version of the host.
/// </summary>
public Version? Version { get; set; }
/// <summary>
/// The <see cref="Api"/> version of the host
/// The <see cref="Api"/> version of the host.
/// </summary>
public Version? ApiVersion { get; set; }
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models.Response
namespace Tgstation.Server.Api.Models.Response
{
/// <inheritdoc />
public sealed class ServerUpdateResponse : ServerUpdate
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Response
{
@@ -1,19 +1,19 @@
using System;
using System;
namespace Tgstation.Server.Api.Models.Response
{
/// <summary>
/// Represents a JWT returned by the API
/// Represents a JWT returned by the API.
/// </summary>
public sealed class TokenResponse
{
/// <summary>
/// The value of the JWT
/// The value of the JWT.
/// </summary>
public string? Bearer { get; set; }
/// <summary>
/// When the <see cref="TokenResponse"/> expires
/// When the <see cref="TokenResponse"/> expires.
/// </summary>
public DateTimeOffset ExpiresAt { get; set; }
}
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System.Collections.Generic;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Response
@@ -7,7 +8,7 @@ namespace Tgstation.Server.Api.Models.Response
public sealed class UserGroupResponse : UserGroup
{
/// <summary>
/// The <see cref="NamedEntity"/>s the <see cref="UserGroupResponse"/> has.
/// The <see cref="UserName"/>s the <see cref="UserGroupResponse"/> has.
/// </summary>
public ICollection<UserName>? Users { get; set; }
}
@@ -1,4 +1,5 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models.Response
@@ -7,7 +8,7 @@ namespace Tgstation.Server.Api.Models.Response
public class UserResponse : UserApiBase
{
/// <summary>
/// The <see cref="UserResponse"/> who created this <see cref="UserResponse"/>
/// The <see cref="UserResponse"/> who created this <see cref="UserResponse"/>.
/// </summary>
[Required]
public UserName? CreatedBy { get; set; }
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models
{
@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
namespace Tgstation.Server.Api.Models
{
@@ -6,18 +6,18 @@ namespace Tgstation.Server.Api.Models
public sealed class RevisionInformation : Internal.RevisionInformation
{
/// <summary>
/// The <see cref="TestMerge"/> that was created with this <see cref="RevisionInformation"/>
/// The <see cref="TestMerge"/> that was created with this <see cref="RevisionInformation"/>.
/// </summary>
[ResponseOptions]
public TestMerge? PrimaryTestMerge { get; set; }
/// <summary>
/// The <see cref="TestMerge"/>s active in the <see cref="RevisionInformation"/>
/// The <see cref="TestMerge"/>s active in the <see cref="RevisionInformation"/>.
/// </summary>
public ICollection<TestMerge>? ActiveTestMerges { get; set; }
/// <summary>
/// The <see cref="Internal.CompileJob"/>s made from the <see cref="RevisionInformation"/>
/// The <see cref="Internal.CompileJob"/>s made from the <see cref="RevisionInformation"/>.
/// </summary>
public ICollection<EntityId>? CompileJobs { get; set; }
}
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Models
{
+1 -1
View File
@@ -1,4 +1,4 @@
using Tgstation.Server.Api.Models.Internal;
using Tgstation.Server.Api.Models.Internal;
namespace Tgstation.Server.Api.Models
{
@@ -1,9 +1,9 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Parameters for creating a <see cref="TestMerge"/>
/// Parameters for creating a <see cref="TestMerge"/>.
/// </summary>
public class TestMergeParameters
{
@@ -13,14 +13,14 @@ namespace Tgstation.Server.Api.Models
public int Number { get; set; }
/// <summary>
/// The sha of the test merge revision to merge. If not specified, the latest commit shall be used (semi-unsafe)
/// The sha of the test merge revision to merge. If not specified, the latest commit from the source will be used.
/// </summary>
[Required]
[StringLength(40)]
public virtual string? TargetCommitSha { get; set; }
/// <summary>
/// Optional comment about the test
/// Optional comment about the test.
/// </summary>
[ResponseOptions]
[StringLength(Limits.MaximumStringLength)]
+8 -8
View File
@@ -1,4 +1,4 @@
namespace Tgstation.Server.Api.Models
namespace Tgstation.Server.Api.Models
{
/// <summary>
/// Base class for user names.
@@ -13,6 +13,12 @@ namespace Tgstation.Server.Api.Models
set => base.Name = value;
}
/// <summary>
/// Create a copy of the <see cref="UserName"/>.
/// </summary>
/// <returns>A new <see cref="UserName"/> copied from <see langword="this"/>.</returns>
public UserName CreateUserName() => CreateUserName<UserName>();
/// <summary>
/// Create a copy of the <see cref="UserName"/> as a given <typeparamref name="TResultType"/>.
/// </summary>
@@ -21,13 +27,7 @@ namespace Tgstation.Server.Api.Models
protected virtual TResultType CreateUserName<TResultType>() where TResultType : UserName, new() => new TResultType
{
Id = Id,
Name = Name
Name = Name,
};
/// <summary>
/// Create a copy of the <see cref="UserName"/>.
/// </summary>
/// <returns>A new <see cref="UserName"/> copied from <see langword="this"/>.</returns>
public UserName CreateUserName() => CreateUserName<UserName>();
}
}
@@ -25,4 +25,4 @@
/// </summary>
DelayedRestart,
}
}
}
@@ -1,4 +1,4 @@
using System;
using System;
using System.Reflection;
namespace Tgstation.Server.Api.Properties
@@ -22,7 +22,7 @@ namespace Tgstation.Server.Api.Properties
public string RawApiVersion { get; }
/// <summary>
/// Initializes a new instance of the <see cref="ApiVersionAttribute"/> <see langword="class"/>.
/// Initializes a new instance of the <see cref="ApiVersionAttribute"/> class.
/// </summary>
/// <param name="rawApiVersion">The value of <see cref="RawApiVersion"/>.</param>
public ApiVersionAttribute(
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Rights
{
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Rights
{
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Rights
{
@@ -1,4 +1,4 @@
using System;
using System;
namespace Tgstation.Server.Api.Rights
{
@@ -31,6 +31,6 @@ namespace Tgstation.Server.Api.Rights
/// <summary>
/// User may delete empty folders if the <see cref="Models.Instance"/> allows it.
/// </summary>
Delete = 8
Delete = 8,
}
}

Some files were not shown because too many files have changed in this diff Show More