diff --git a/build/Version.props b/build/Version.props
index 9e803532ab..14e8e4286c 100644
--- a/build/Version.props
+++ b/build/Version.props
@@ -3,14 +3,14 @@
- 4.9.2
+ 4.10.03.0.0
- 8.3.0
- 9.2.0
+ 9.0.0
+ 9.0.0
+ 10.0.06.0.25.3.01.1.11.2.0
-
diff --git a/src/Tgstation.Server.Api/ApiHeaders.cs b/src/Tgstation.Server.Api/ApiHeaders.cs
index 9ec9c575b1..aa44cc9c84 100644
--- a/src/Tgstation.Server.Api/ApiHeaders.cs
+++ b/src/Tgstation.Server.Api/ApiHeaders.cs
@@ -9,6 +9,7 @@ using System.Net.Mime;
using System.Reflection;
using System.Text;
using Tgstation.Server.Api.Models;
+using Tgstation.Server.Api.Properties;
namespace Tgstation.Server.Api
{
@@ -55,7 +56,7 @@ namespace Tgstation.Server.Api
///
/// Get the version of the the caller is using
///
- public static readonly Version Version = AssemblyName.Version.Semver();
+ public static readonly Version Version = Version.Parse(ApiVersionAttribute.Instance.RawApiVersion);
///
/// The instance being accessed
diff --git a/src/Tgstation.Server.Api/DefaultCredentials.cs b/src/Tgstation.Server.Api/DefaultCredentials.cs
new file mode 100644
index 0000000000..d816f24739
--- /dev/null
+++ b/src/Tgstation.Server.Api/DefaultCredentials.cs
@@ -0,0 +1,18 @@
+namespace Tgstation.Server.Api
+{
+ ///
+ /// Represents initial credentials used by the server.
+ ///
+ public static class DefaultCredentials
+ {
+ ///
+ /// The name of the default admin user
+ ///
+ public static readonly string AdminUserName = "Admin";
+
+ ///
+ /// The default admin password
+ ///
+ public static readonly string DefaultAdminUserPassword = "ISolemlySwearToDeleteTheDataDirectory";
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Byond.cs b/src/Tgstation.Server.Api/Models/Byond.cs
deleted file mode 100644
index 6241e28948..0000000000
--- a/src/Tgstation.Server.Api/Models/Byond.cs
+++ /dev/null
@@ -1,25 +0,0 @@
-using System;
-
-namespace Tgstation.Server.Api.Models
-{
- ///
- /// Represents a BYOND installation. is used to upload custom BYOND version zip files, though must still be set.
- ///
- public sealed class Byond : FileTicketResult
- {
- ///
- /// The of the installation used for new compiles. Will be if the user does not have permission to view it or there is no BYOND version installed. Only considers the and numbers.
- ///
- public Version? Version { get; set; }
-
- ///
- /// The being used to install a new
- ///
- public Job? InstallJob { get; set; }
-
- ///
- /// If a custom BYOND version is to be uploaded.
- ///
- public bool? UploadCustomZip { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/ChatChannel.cs b/src/Tgstation.Server.Api/Models/ChatChannel.cs
index b3490556eb..549c9678b4 100644
--- a/src/Tgstation.Server.Api/Models/ChatChannel.cs
+++ b/src/Tgstation.Server.Api/Models/ChatChannel.cs
@@ -11,12 +11,14 @@ namespace Tgstation.Server.Api.Models
/// The IRC channel name. Also potentially contains the channel passsword (if separated by a colon).
/// If multiple copies of the same channel with different keys are added to the server, the one that will be used is undefined.
///
+ [ResponseOptions]
[StringLength(Limits.MaximumIndexableStringLength, MinimumLength = 1)]
public string? IrcChannel { get; set; }
///
/// The Discord channel ID
///
+ [ResponseOptions]
public ulong? DiscordChannelId { get; set; }
///
@@ -40,6 +42,7 @@ namespace Tgstation.Server.Api.Models
///
/// A custom tag users can define to group channels together
///
+ [ResponseOptions]
[StringLength(Limits.MaximumStringLength)]
public string? Tag { get; set; }
}
diff --git a/src/Tgstation.Server.Api/Models/DreamDaemon.cs b/src/Tgstation.Server.Api/Models/DreamDaemon.cs
deleted file mode 100644
index d7d0567fe4..0000000000
--- a/src/Tgstation.Server.Api/Models/DreamDaemon.cs
+++ /dev/null
@@ -1,58 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-using Tgstation.Server.Api.Models.Internal;
-
-namespace Tgstation.Server.Api.Models
-{
- ///
- /// Represents an instance of BYOND's DreamDaemon game server. Create action starts the server. Delete action shuts down the server
- ///
- public sealed class DreamDaemon : DreamDaemonSettings
- {
- ///
- /// The live revision
- ///
- public CompileJob? ActiveCompileJob { get; set; }
-
- ///
- /// The next revision to go live
- ///
- public CompileJob? StagedCompileJob { get; set; }
-
- ///
- /// The current .
- ///
- [EnumDataType(typeof(WatchdogStatus))]
- public WatchdogStatus? Status { get; set; }
-
- ///
- /// The current of . May be downgraded due to requirements of
- ///
- [EnumDataType(typeof(DreamDaemonSecurity))]
- public DreamDaemonSecurity? CurrentSecurity { get; set; }
-
- ///
- /// The port the running instance is set to
- ///
- public ushort? CurrentPort { get; set; }
-
- ///
- /// The webclient status the running instance is set to
- ///
- public bool? CurrentAllowWebclient { get; set; }
-
- ///
- /// If the server is undergoing a soft reset. This may be automatically set by changes to other fields
- ///
- public bool? SoftRestart { get; set; }
-
- ///
- /// If the server is undergoing a soft shutdown
- ///
- public bool? SoftShutdown { get; set; }
-
- ///
- /// If a dump of the active DreamDaemon executable should be created.
- ///
- public bool? CreateDump { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/EntityId.cs b/src/Tgstation.Server.Api/Models/EntityId.cs
index 85d5cd0487..a33d3f294c 100644
--- a/src/Tgstation.Server.Api/Models/EntityId.cs
+++ b/src/Tgstation.Server.Api/Models/EntityId.cs
@@ -1,13 +1,15 @@
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models
{
///
- /// Common base of s, s, and s.
+ /// Common base of entities with IDs.
///
public class EntityId
{
///
/// The ID of the entity.
///
- public long Id { get; set; }
+ [RequestOptions(FieldPresence.Required)]
+ [RequestOptions(FieldPresence.Ignored, PutOnly = true)]
+ public virtual long? Id { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/ErrorCode.cs b/src/Tgstation.Server.Api/Models/ErrorCode.cs
index 60e03b909d..311afec346 100644
--- a/src/Tgstation.Server.Api/Models/ErrorCode.cs
+++ b/src/Tgstation.Server.Api/Models/ErrorCode.cs
@@ -4,7 +4,7 @@ using System.ComponentModel;
namespace Tgstation.Server.Api.Models
{
///
- /// Types of s that the API may return.
+ /// Types of s that the API may return.
///
/// Entries marked with the are no longer in use but kept for reference.
public enum ErrorCode : uint
@@ -40,7 +40,7 @@ namespace Tgstation.Server.Api.Models
BadHeaders,
///
- /// Attempted to request a with an existing .
+ /// Attempted to request a with an existing .
///
[Description("Cannot generate a bearer token using a bearer token!")]
TokenWithToken,
@@ -76,43 +76,43 @@ namespace Tgstation.Server.Api.Models
ServerUpdateInProgress,
///
- /// Attempted to change something other than the capitalization of a .
+ /// Attempted to change something other than the capitalization of a for a user.
///
[Description("Can only change the capitalization of a user's name!")]
UserNameChange,
///
- /// Attempted to change a .
+ /// Attempted to change a .
///
[Description("Cannot change a user's systemIdentifier!")]
UserSidChange,
///
- /// Attempted to create a with a and .
+ /// Attempted to create a user with a and .
///
[Description("A user cannot have both a name and systemIdentifier!")]
UserMismatchNameSid,
///
- /// Attempted to create a with a and .
+ /// Attempted to create a user with a and .
///
[Description("A user cannot have both a password and systemIdentifier!")]
UserMismatchPasswordSid,
///
- /// The given length was less than the server's configured minimum.
+ /// The given length was less than the server's configured minimum.
///
[Description("The given password is less than the server's configured minimum password length!")]
UserPasswordLength,
///
- /// Attempted to create a with a ':' in the .
+ /// Attempted to create a user with a ':' character in the .
///
[Description("User names cannot contain the ':' character!")]
UserColonInName,
///
- /// Attempted to create a with a or whitespace .
+ /// Attempted to create a user with a or whitespace .
///
[Description("User's name is missing or invalid whitespace!")]
UserMissingName,
@@ -148,7 +148,7 @@ namespace Tgstation.Server.Api.Models
InstanceLimitReached,
///
- /// Attempted to create an with a whitespace .
+ /// Attempted to create an with a whitespace .
///
[Description("Instance names cannot be whitespace!")]
InstanceWhitespaceName,
@@ -166,7 +166,7 @@ namespace Tgstation.Server.Api.Models
RequiresPosixSystemIdentity,
///
- /// A was updated.
+ /// A was updated.
///
[Description("This existing file hash does not match, the file has beeen updated!")]
ConfigurationFileUpdated,
@@ -178,10 +178,11 @@ namespace Tgstation.Server.Api.Models
ConfigurationDirectoryNotEmpty,
///
- /// Tried to clone a repository with a missing property.
+ /// Currently unused.
///
- [Description("Cannot clone repository with missing origin field!")]
- RepoMissingOrigin,
+ [Obsolete("Unused", true)]
+ [Description("Unknown error code.")]
+ UnusedErrorCode1,
///
/// One of and is set while the other isn't.
@@ -214,25 +215,26 @@ namespace Tgstation.Server.Api.Models
RepoMissing,
///
- /// Attempted to and set at the same time.
+ /// Attempted to and set at the same time.
///
[Description("Cannot checkoutSha and set reference at the same time!")]
RepoMismatchShaAndReference,
///
- /// Attempted to and at the same time.
+ /// Attempted to and at the same time.
///
[Description("Cannot checkoutSha and updateFromOrigin at the same time!")]
RepoMismatchShaAndUpdate,
///
- /// Attempted to change the origin of an existing repository.
+ /// Currently unused.
///
- [Description("Cannot change the origin of an existing repository, delete and recreate it instead!")]
- RepoCantChangeOrigin,
+ [Obsolete("Unused", true)]
+ [Description("Unknown error code.")]
+ UnusedErrorCode2,
///
- /// contained duplicate s.
+ /// contained duplicate s.
///
[Description("The same test merge was present more than once or is already merged!")]
RepoDuplicateTestMerge,
@@ -262,43 +264,44 @@ namespace Tgstation.Server.Api.Models
ApiInvalidPageOrPageSize,
///
- /// A requested 's data does not match with its .
+ /// A requested 's data does not match with its .
///
[Description("One or more of the channels for one or more of the provided chat bots do not have the correct channel data for their provider!")]
ChatBotWrongChannelType,
///
- /// was whitespace.
+ /// was whitespace.
///
[Description("A chat bot's connection string cannot be whitespace!")]
ChatBotWhitespaceConnectionString,
///
- /// was whitespace.
+ /// Chat bot was whitespace.
///
[Description("A chat bot's name cannot be whitespace!")]
ChatBotWhitespaceName,
///
- /// was during creation.
+ /// was during creation.
///
[Description("Missing chat bot provider!")]
ChatBotProviderMissing,
///
- /// Tried to edit membership using .
+ /// Currently unused.
///
- [Description("The " + Routes.UserGroup + " endpoint cannot edit group members. Please update each member user individually.")]
- UserGroupControllerCantEditMembers,
+ [Obsolete("Unused", true)]
+ [Description("Unknown error code.")]
+ UnusedErrorCode3,
///
- /// Attempted to add a when at or above the or it was set to something lower than the existing amount of .
+ /// Attempted to add a chat bot when at or above the or it was set to something lower than the existing amount of chat bots.
///
[Description("Performing this operation would violate the instance's configured chatBotLimit!")]
ChatBotMax,
///
- /// Attempted to configure a with more s than the configured limit
+ /// Attempted to configure a chat bot with more s than the configured .
///
[Description("Set amount of chatChannels exceeds the configured channelLimit!")]
ChatBotMaxChannels,
@@ -334,7 +337,7 @@ namespace Tgstation.Server.Api.Models
DreamMakerInvalidValidation,
///
- /// Tried to remove the last for a passwordless .
+ /// Tried to remove the last for a passwordless user.
///
[Description("This user is passwordless and removing their oAuthConnections would leave them with no authentication method!")]
CannotRemoveLastAuthenticationOption,
@@ -364,19 +367,19 @@ namespace Tgstation.Server.Api.Models
DreamMakerCompileJobInProgress,
///
- /// Missing settings in database.
+ /// Missing in database.
///
[Description("Could not retrieve DreamDaemon settings from the database!")]
InstanceMissingDreamDaemonSettings,
///
- /// Missing settings in database.
+ /// Missing in database.
///
[Description("Could not retrieve DreamMaker settings from the database!")]
InstanceMissingDreamMakerSettings,
///
- /// Missing settings in database.
+ /// Missing in database.
///
[Description("Could not retrieve Repository settings from the database!")]
InstanceMissingRepositorySettings,
@@ -400,7 +403,7 @@ namespace Tgstation.Server.Api.Models
RepoCannotAuthenticate,
///
- /// Cannot perform operation while not on a .
+ /// Cannot perform operation while not on a .
///
[Description("This git operation requires the repository HEAD to currently be on a tracked reference!")]
RepoReferenceRequired,
@@ -412,7 +415,7 @@ namespace Tgstation.Server.Api.Models
WatchdogRunning,
///
- /// Attempted to start the watchdog with a corrupted .
+ /// Attempted to start the watchdog with a corrupted .
///
[Description("Cannot launch active compile job as it is missing or corrupted!")]
WatchdogCompileJobCorrupted,
@@ -436,7 +439,7 @@ namespace Tgstation.Server.Api.Models
RepoUnsupportedTestMergeRemote,
///
- /// Either or was in one when it should have been the other.
+ /// Either or was in one when it should have been the other.
///
[Description("The value set for checkoutSha or reference should be in the other field!")]
RepoSwappedShaOrReference,
@@ -448,7 +451,7 @@ namespace Tgstation.Server.Api.Models
RepoMergeConflict,
///
- /// The current does not track a remote reference.
+ /// The current does not track a remote reference.
///
[Description("The repository's current reference is unsuitable for this operation as it does not track a remote reference!")]
RepoReferenceNotTracking,
@@ -460,13 +463,13 @@ namespace Tgstation.Server.Api.Models
RepoTestMergeConflict,
///
- /// Attempted to create an instance outside of the .
+ /// Attempted to create an instance outside of the .
///
[Description("The new instance's path is not under a white-listed path.")]
InstanceNotAtWhitelistedPath,
///
- /// Attempted to make a DreamDaemon update with both and set.
+ /// Attempted to make a DreamDaemon update with both and set.
///
[Description("Cannot set both softShutdown and softReboot at once!")]
DreamDaemonDoubleSoft,
@@ -580,7 +583,7 @@ namespace Tgstation.Server.Api.Models
PortNotAvailable,
///
- /// Attempted to set for the admin user.
+ /// Attempted to set for the admin user.
///
[Description("The admin user cannot use OAuth connections!")]
AdminUserCannotOAuth,
@@ -592,31 +595,31 @@ namespace Tgstation.Server.Api.Models
OAuthProviderDisabled,
///
- /// A requiring a file upload did not receive it before timing out.
+ /// A job requiring a file upload did not receive it before timing out.
///
[Description("The job did not receive a required upload before timing out!")]
FileUploadExpired,
///
- /// Tried to update a to have both a and
+ /// Tried to update a user to have both a and
///
[Description("A user may not have both a permissionSet and group!")]
UserGroupAndPermissionSet,
///
- /// Tried to delete a non-empty .
+ /// Tried to delete a non-empty user group.
///
[Description("Cannot delete the user group as it is not empty!")]
UserGroupNotEmpty,
///
- /// Attempted to create an but the configured limit has been reached.
+ /// Attempted to create a user but the configured limit has been reached.
///
[Description("The user cannot be created because the configured limit has been reached!")]
UserLimitReached,
///
- /// Attempted to create an but the configured limit has been reached.
+ /// Attempted to create a user group but the configured limit has been reached.
///
[Description("The user group cannot be created because the configured limit has been reached!")]
UserGroupLimitReached,
diff --git a/src/Tgstation.Server.Api/Models/FieldPresence.cs b/src/Tgstation.Server.Api/Models/FieldPresence.cs
new file mode 100644
index 0000000000..4817b8965a
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/FieldPresence.cs
@@ -0,0 +1,23 @@
+namespace Tgstation.Server.Api.Models
+{
+ ///
+ /// Indicates whether a request field is or .
+ ///
+ public enum FieldPresence
+ {
+ ///
+ /// The field is optional
+ ///
+ Optional,
+
+ ///
+ /// The field is required.
+ ///
+ Required,
+
+ ///
+ /// The field is ignored or should not appear.
+ ///
+ Ignored
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/ConfigurationFile.cs b/src/Tgstation.Server.Api/Models/IConfigurationFile.cs
similarity index 59%
rename from src/Tgstation.Server.Api/Models/ConfigurationFile.cs
rename to src/Tgstation.Server.Api/Models/IConfigurationFile.cs
index 7d5e0168e9..a1c59c0449 100644
--- a/src/Tgstation.Server.Api/Models/ConfigurationFile.cs
+++ b/src/Tgstation.Server.Api/Models/IConfigurationFile.cs
@@ -5,27 +5,18 @@ namespace Tgstation.Server.Api.Models
///
/// Represents a game configuration file. Create and delete actions uncerimonuously overwrite/delete files
///
- public sealed class ConfigurationFile : FileTicketResult
+ public interface IConfigurationFile
{
///
- /// The path to the file
+ /// The path to the file.
///
[StringLength(Limits.MaximumStringLength)]
public string? Path { get; set; }
- ///
- /// If access to the file was denied for the operation
- ///
- public bool? AccessDenied { get; set; }
-
- ///
- /// If represents a directory
- ///
- public bool? IsDirectory { get; set; }
-
///
/// 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
///
+ [ResponseOptions]
public string? LastReadHash { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/Instance.cs b/src/Tgstation.Server.Api/Models/Instance.cs
index 60856b07ea..2f5ad89701 100644
--- a/src/Tgstation.Server.Api/Models/Instance.cs
+++ b/src/Tgstation.Server.Api/Models/Instance.cs
@@ -1,34 +1,28 @@
-using System.ComponentModel.DataAnnotations;
-using System.ComponentModel.DataAnnotations.Schema;
+using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models
{
///
/// Metadata about a server instance
///
- public class Instance : EntityId
+ public abstract class Instance : NamedEntity
{
- ///
- /// The name of the
- ///
- [Required]
- [StringLength(Limits.MaximumStringLength)]
- public string? Name { get; set; }
-
///
/// The path to where the is located. Can only be changed while the is offline. Must not exist when the instance is created
///
[Required]
+ [RequestOptions(FieldPresence.Required, PutOnly = true)]
public string? Path { get; set; }
///
/// If the is online
///
[Required]
+ [RequestOptions(FieldPresence.Ignored, PutOnly = true)]
public bool? Online { get; set; }
///
- /// If can be used on the
+ /// If s can be used on the
///
[Required]
[EnumDataType(typeof(ConfigurationType))]
@@ -41,30 +35,9 @@ namespace Tgstation.Server.Api.Models
public uint? AutoUpdateInterval { get; set; }
///
- /// The maximum number of s the may contain.
+ /// The maximum number of chat bots the may contain.
///
[Required]
public ushort? ChatBotLimit { get; set; }
-
- ///
- /// The representing a change of
- ///
- /// Due to how s are children of s but moving one requires the to be offline, interactions with this are performed in a non-standard fashion. The is read by querying the again (either via list or ID lookup) and cancelled by making any sort of update to the . Once the comes back it can be queried like a normal job
- [NotMapped]
- public Job? MoveJob { get; set; }
-
- ///
- /// Create a clone of the essential metadata
- ///
- /// A clone of the essential metadata
- public Instance CloneMetadata() => new Instance
- {
- Id = Id,
- Name = Name,
- Path = Path,
- Online = Online,
- ConfigurationType = ConfigurationType,
- AutoUpdateInterval = AutoUpdateInterval
- };
}
}
diff --git a/src/Tgstation.Server.Api/Models/ChatBot.cs b/src/Tgstation.Server.Api/Models/Internal/ChatBotApiBase.cs
similarity index 76%
rename from src/Tgstation.Server.Api/Models/ChatBot.cs
rename to src/Tgstation.Server.Api/Models/Internal/ChatBotApiBase.cs
index c0034d32bb..0ec152ab06 100644
--- a/src/Tgstation.Server.Api/Models/ChatBot.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/ChatBotApiBase.cs
@@ -1,11 +1,11 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Internal
{
///
- public sealed class ChatBot : Internal.ChatBot
+ public abstract class ChatBotApiBase : ChatBotSettings
{
///
/// Channels the Discord bot should listen/announce in
@@ -13,9 +13,9 @@ namespace Tgstation.Server.Api.Models
public ICollection? Channels { get; set; }
///
- /// Validates are correct for the
+ /// Validates are correct for the
///
- /// if the are valid for the , otherwise
+ /// if the are valid for the , otherwise
public bool ValidateProviderChannelTypes()
{
if (!Provider.HasValue)
diff --git a/src/Tgstation.Server.Api/Models/Internal/ChatBot.cs b/src/Tgstation.Server.Api/Models/Internal/ChatBotSettings.cs
similarity index 85%
rename from src/Tgstation.Server.Api/Models/Internal/ChatBot.cs
rename to src/Tgstation.Server.Api/Models/Internal/ChatBotSettings.cs
index 626a526b6d..0a29dd84ae 100644
--- a/src/Tgstation.Server.Api/Models/Internal/ChatBot.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/ChatBotSettings.cs
@@ -6,15 +6,8 @@ namespace Tgstation.Server.Api.Models.Internal
///
/// Manage the server chat bots
///
- public class ChatBot : EntityId
+ public abstract class ChatBotSettings : NamedEntity
{
- ///
- /// The name of the connection
- ///
- [Required]
- [StringLength(Limits.MaximumIndexableStringLength, MinimumLength = 1)]
- public string? Name { get; set; }
-
///
/// If the connection is enabled
///
@@ -28,7 +21,7 @@ namespace Tgstation.Server.Api.Models.Internal
public uint? ReconnectionInterval { get; set; }
///
- /// The maximum number of s the may contain.
+ /// The maximum number of s the may contain.
///
[Required]
public ushort? ChannelLimit { get; set; }
@@ -37,6 +30,7 @@ namespace Tgstation.Server.Api.Models.Internal
/// The used for the connection
///
[Required]
+ [RequestOptions(FieldPresence.Required, PutOnly = true)]
[EnumDataType(typeof(ChatProvider))]
public ChatProvider? Provider { get; set; }
@@ -44,13 +38,15 @@ namespace Tgstation.Server.Api.Models.Internal
/// The information used to connect to the
///
[Required]
+ [RequestOptions(FieldPresence.Required, PutOnly = true)]
+ [ResponseOptions]
[StringLength(Limits.MaximumStringLength)]
public string? ConnectionString { get; set; }
///
/// Get the which maps to the .
///
- /// A for the .
+ /// A for the .
public ChatConnectionStringBuilder? CreateConnectionStringBuilder()
{
if (ConnectionString == null)
@@ -64,7 +60,7 @@ namespace Tgstation.Server.Api.Models.Internal
}
///
- /// Set the for the . Also updates the .
+ /// Set the for the . Also updates the .
///
/// The optional .
public void SetConnectionStringBuilder(ChatConnectionStringBuilder stringBuilder)
diff --git a/src/Tgstation.Server.Api/Models/Internal/ChatConnectionStringBuilder.cs b/src/Tgstation.Server.Api/Models/Internal/ChatConnectionStringBuilder.cs
index 51d8025f73..36c1f202aa 100644
--- a/src/Tgstation.Server.Api/Models/Internal/ChatConnectionStringBuilder.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/ChatConnectionStringBuilder.cs
@@ -1,19 +1,19 @@
-namespace Tgstation.Server.Api.Models.Internal
+namespace Tgstation.Server.Api.Models.Internal
{
///
- /// Helper for building s
+ /// Helper for building s
///
public abstract class ChatConnectionStringBuilder
{
///
- /// If the evaluates to a valid
+ /// If the evaluates to a valid
///
public abstract bool Valid { get; }
///
- /// Gets the associated with the
+ /// Gets the associated with the
///
- /// The associated with the
+ /// The associated with the
public abstract override string ToString();
}
-}
\ No newline at end of file
+}
diff --git a/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs b/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs
index e57bc17784..425d63eec2 100644
--- a/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/CompileJob.cs
@@ -5,9 +5,9 @@ using System.ComponentModel.DataAnnotations.Schema;
namespace Tgstation.Server.Api.Models.Internal
{
///
- /// Represents a run of
+ /// Represents a deployment run.
///
- public class CompileJob : EntityId
+ public abstract class CompileJob : EntityId
{
///
/// The .dme file used for compilation
@@ -28,14 +28,16 @@ namespace Tgstation.Server.Api.Models.Internal
public Guid? DirectoryName { get; set; }
///
- /// The minimum required to run the 's output
+ /// The minimum required to run the 's output.
///
+ [ResponseOptions]
public DreamDaemonSecurity? MinimumSecurityLevel { get; set; }
///
/// The DMAPI .
///
[NotMapped]
+ [ResponseOptions]
public virtual Version? DMApiVersion { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonApiBase.cs b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonApiBase.cs
new file mode 100644
index 0000000000..4f31e79760
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonApiBase.cs
@@ -0,0 +1,20 @@
+namespace Tgstation.Server.Api.Models.Internal
+{
+ ///
+ /// Base class for DreamDaemon API models.
+ ///
+ public abstract class DreamDaemonApiBase : DreamDaemonSettings
+ {
+ ///
+ /// If the server is undergoing a soft reset. This may be automatically set by changes to other fields
+ ///
+ [ResponseOptions]
+ public bool? SoftRestart { get; set; }
+
+ ///
+ /// If the server is undergoing a soft shutdown
+ ///
+ [ResponseOptions]
+ public bool? SoftShutdown { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonLaunchParameters.cs b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonLaunchParameters.cs
index f57e215e8a..9ef1614383 100644
--- a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonLaunchParameters.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonLaunchParameters.cs
@@ -12,19 +12,22 @@ namespace Tgstation.Server.Api.Models.Internal
/// If the BYOND web client can be used to connect to the game server
///
[Required]
+ [ResponseOptions]
public bool? AllowWebClient { get; set; }
///
- /// The level of
+ /// The level of DreamDaemon.
///
[Required]
+ [ResponseOptions]
[EnumDataType(typeof(DreamDaemonSecurity))]
public DreamDaemonSecurity? SecurityLevel { get; set; }
///
- /// The first port uses. This should be the publically advertised port
+ /// The port DreamDaemon uses. This should be publically accessible.
///
[Required]
+ [ResponseOptions]
[Range(1, UInt16.MaxValue)]
public ushort? Port { get; set; }
@@ -32,6 +35,7 @@ namespace Tgstation.Server.Api.Models.Internal
/// The DreamDaemon startup timeout in seconds
///
[Required]
+ [ResponseOptions]
[Range(1, UInt32.MaxValue)]
public uint? StartupTimeout { get; set; }
@@ -39,12 +43,14 @@ namespace Tgstation.Server.Api.Models.Internal
/// The number of seconds between each watchdog heartbeat. 0 disables.
///
[Required]
+ [ResponseOptions]
public uint? HeartbeatSeconds { get; set; }
///
/// The timeout for sending and receiving BYOND topics in milliseconds.
///
[Required]
+ [ResponseOptions]
[Range(1, UInt32.MaxValue)]
public uint? TopicRequestTimeout { get; set; }
@@ -52,6 +58,7 @@ namespace Tgstation.Server.Api.Models.Internal
/// Parameters string for DreamDaemon.
///
[Required]
+ [ResponseOptions]
[StringLength(Limits.MaximumStringLength)]
public string? AdditionalParameters { get; set; }
diff --git a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs
index fb90af9a8c..5d00f5852b 100644
--- a/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/DreamDaemonSettings.cs
@@ -1,16 +1,17 @@
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
///
- /// Configurable settings for
+ /// Configurable settings for DreamDaemon.
///
public class DreamDaemonSettings : DreamDaemonLaunchParameters
{
///
- /// If starts when it's starts
+ /// If the watchdog starts when it's starts
///
[Required]
+ [ResponseOptions]
public bool? AutoStart { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/DreamMaker.cs b/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs
similarity index 77%
rename from src/Tgstation.Server.Api/Models/DreamMaker.cs
rename to src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs
index 9d1ca2aac3..32655f3574 100644
--- a/src/Tgstation.Server.Api/Models/DreamMaker.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/DreamMakerSettings.cs
@@ -1,16 +1,17 @@
-using System.ComponentModel.DataAnnotations;
+using System.ComponentModel.DataAnnotations;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Internal
{
///
/// Represents the state of the DreamMaker compiler. Create action starts a new compile. Delete action cancels the current compile
///
- public class DreamMaker
+ public abstract class DreamMakerSettings
{
///
- /// The .dme file tries to compile with without the extension
+ /// The name of the .dme file the server tries to compile with without the extension.
///
[StringLength(Limits.MaximumStringLength)]
+ [ResponseOptions]
public string? ProjectName { get; set; }
///
diff --git a/src/Tgstation.Server.Api/Models/InstancePermissionSet.cs b/src/Tgstation.Server.Api/Models/Internal/InstancePermissionSet.cs
similarity index 93%
rename from src/Tgstation.Server.Api/Models/InstancePermissionSet.cs
rename to src/Tgstation.Server.Api/Models/Internal/InstancePermissionSet.cs
index eb1a5b80f9..ff2c24fa4a 100644
--- a/src/Tgstation.Server.Api/Models/InstancePermissionSet.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/InstancePermissionSet.cs
@@ -1,16 +1,17 @@
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Rights;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Internal
{
///
/// Represents a s permissions in an
///
- public class InstancePermissionSet
+ public abstract class InstancePermissionSet
{
///
/// The of the the belongs to
///
+ [RequestOptions(FieldPresence.Required)]
public long PermissionSetId { get; set; }
///
diff --git a/src/Tgstation.Server.Api/Models/Internal/Job.cs b/src/Tgstation.Server.Api/Models/Internal/Job.cs
index ac3b00f1b8..254be63dc3 100644
--- a/src/Tgstation.Server.Api/Models/Internal/Job.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/Job.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.ComponentModel.DataAnnotations;
using Tgstation.Server.Api.Rights;
@@ -18,11 +18,13 @@ namespace Tgstation.Server.Api.Models.Internal
///
/// The associated with the if any.
///
+ [ResponseOptions]
public ErrorCode? ErrorCode { get; set; }
///
/// Details of any exceptions caught during the
///
+ [ResponseOptions]
public string? ExceptionDetails { get; set; }
///
@@ -34,6 +36,7 @@ namespace Tgstation.Server.Api.Models.Internal
///
/// When the stopped
///
+ [ResponseOptions]
public DateTimeOffset? StoppedAt { get; set; }
///
@@ -45,11 +48,13 @@ namespace Tgstation.Server.Api.Models.Internal
///
/// The of if it can be cancelled
///
+ [ResponseOptions]
public RightsType? CancelRightsType { get; set; }
///
/// The required to cancel the
///
+ [ResponseOptions]
public ulong? CancelRight { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Tgstation.Server.Api/Models/Internal/RepositoryApiBase.cs b/src/Tgstation.Server.Api/Models/Internal/RepositoryApiBase.cs
new file mode 100644
index 0000000000..2a52068888
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Internal/RepositoryApiBase.cs
@@ -0,0 +1,17 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Tgstation.Server.Api.Models.Internal
+{
+ ///
+ /// Base for repository models.
+ ///
+ public class RepositoryApiBase : RepositorySettings
+ {
+ ///
+ /// The branch or tag HEAD points to.
+ ///
+ [StringLength(Limits.MaximumStringLength)]
+ [ResponseOptions]
+ public string? Reference { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs b/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs
index 4a852a901b..de0ff3ff23 100644
--- a/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/RepositorySettings.cs
@@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
///
- /// Represents configurable settings for a
+ /// Represents configurable settings for a git repository.
///
public class RepositorySettings
{
@@ -26,12 +26,14 @@ namespace Tgstation.Server.Api.Models.Internal
/// The username to access the git repository with
///
[StringLength(Limits.MaximumStringLength)]
+ [ResponseOptions]
public string? AccessUser { get; set; }
///
/// The token/password to access the git repository with
///
[StringLength(Limits.MaximumStringLength)]
+ [ResponseOptions(Presence = FieldPresence.Ignored)]
public string? AccessToken { get; set; }
///
diff --git a/src/Tgstation.Server.Api/Models/Internal/ServerInformation.cs b/src/Tgstation.Server.Api/Models/Internal/ServerInformationBase.cs
similarity index 75%
rename from src/Tgstation.Server.Api/Models/Internal/ServerInformation.cs
rename to src/Tgstation.Server.Api/Models/Internal/ServerInformationBase.cs
index 21f4ed26eb..f1c486214c 100644
--- a/src/Tgstation.Server.Api/Models/Internal/ServerInformation.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/ServerInformationBase.cs
@@ -3,9 +3,9 @@ using System.Collections.Generic;
namespace Tgstation.Server.Api.Models.Internal
{
///
- /// Base class for .
+ /// Base class for .
///
- public abstract class ServerInformation
+ public abstract class ServerInformationBase
{
///
/// Minimum length of database user passwords.
@@ -18,18 +18,19 @@ namespace Tgstation.Server.Api.Models.Internal
public uint InstanceLimit { get; set; }
///
- /// The maximum number of s allowed.
+ /// The maximum number of users allowed.
///
public uint UserLimit { get; set; }
///
- /// The maximum number of s allowed.
+ /// The maximum number of user groups allowed.
///
public uint UserGroupLimit { get; set; }
///
/// Limits the locations instances may be created or attached from.
///
+ [ResponseOptions]
public ICollection? ValidInstancePaths { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/Internal/ServerUpdateRequest.cs b/src/Tgstation.Server.Api/Models/Internal/ServerUpdateRequest.cs
new file mode 100644
index 0000000000..1090f47f16
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Internal/ServerUpdateRequest.cs
@@ -0,0 +1,7 @@
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ public sealed class ServerUpdateRequest : ServerUpdate
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs b/src/Tgstation.Server.Api/Models/Internal/TestMergeApiBase.cs
similarity index 69%
rename from src/Tgstation.Server.Api/Models/Internal/TestMerge.cs
rename to src/Tgstation.Server.Api/Models/Internal/TestMergeApiBase.cs
index 76ee553023..4c2556d4e6 100644
--- a/src/Tgstation.Server.Api/Models/Internal/TestMerge.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/TestMergeApiBase.cs
@@ -6,15 +6,15 @@ namespace Tgstation.Server.Api.Models.Internal
///
/// Represents a test merge of a remote "pull request".
///
- public class TestMerge : TestMergeBase
+ public class TestMergeApiBase : TestMergeModelBase
{
///
- /// The ID of the
+ /// The ID of the
///
public long Id { get; set; }
///
- /// When the was created
+ /// When the was created
///
[Required]
public DateTimeOffset MergedAt { get; set; }
diff --git a/src/Tgstation.Server.Api/Models/Internal/TestMergeBase.cs b/src/Tgstation.Server.Api/Models/Internal/TestMergeModelBase.cs
similarity index 76%
rename from src/Tgstation.Server.Api/Models/Internal/TestMergeBase.cs
rename to src/Tgstation.Server.Api/Models/Internal/TestMergeModelBase.cs
index c8b87ee4d2..fadd01d1e2 100644
--- a/src/Tgstation.Server.Api/Models/Internal/TestMergeBase.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/TestMergeModelBase.cs
@@ -6,7 +6,7 @@ namespace Tgstation.Server.Api.Models.Internal
///
/// Layer of test merge data required internally
///
- public abstract class TestMergeBase : TestMergeParameters
+ public abstract class TestMergeModelBase : TestMergeParameters
{
///
/// The title of the test merge source.
@@ -35,15 +35,15 @@ namespace Tgstation.Server.Api.Models.Internal
public string? Author { get; set; }
///
- /// Construct a
+ /// Construct a
///
- protected TestMergeBase() { }
+ protected TestMergeModelBase() { }
///
- /// Construct a from a
+ /// Construct a from a
///
- /// The to copy data from
- protected TestMergeBase(TestMergeBase copy)
+ /// The to copy data from
+ protected TestMergeModelBase(TestMergeModelBase copy)
{
if (copy == null)
throw new ArgumentNullException(nameof(copy));
diff --git a/src/Tgstation.Server.Api/Models/Internal/UserApiBase.cs b/src/Tgstation.Server.Api/Models/Internal/UserApiBase.cs
new file mode 100644
index 0000000000..ab1d096417
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Internal/UserApiBase.cs
@@ -0,0 +1,25 @@
+using System.Collections.Generic;
+
+namespace Tgstation.Server.Api.Models.Internal
+{
+ ///
+ public abstract class UserApiBase : UserModelBase
+ {
+ ///
+ /// List of s associated with the user.
+ ///
+ public ICollection? OAuthConnections { get; set; }
+
+ ///
+ /// The directly associated with the user.
+ ///
+ [ResponseOptions]
+ public PermissionSet? PermissionSet { get; set; }
+
+ ///
+ /// The asociated with the user, if any.
+ ///
+ [ResponseOptions]
+ public UserGroup? Group { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Internal/UserBase.cs b/src/Tgstation.Server.Api/Models/Internal/UserBase.cs
deleted file mode 100644
index a2301ddd08..0000000000
--- a/src/Tgstation.Server.Api/Models/Internal/UserBase.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-
-namespace Tgstation.Server.Api.Models.Internal
-{
- ///
- /// Base class for .
- ///
- public class UserBase
- {
- ///
- /// The ID of the
- ///
- [Required]
- public long? Id { get; set; }
-
- ///
- /// The name of the
- ///
- [Required]
- [StringLength(Limits.MaximumIndexableStringLength, MinimumLength = 1)]
- public string? Name { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/Internal/UserGroup.cs b/src/Tgstation.Server.Api/Models/Internal/UserGroup.cs
index 25c9520ba1..11fc1b5e89 100644
--- a/src/Tgstation.Server.Api/Models/Internal/UserGroup.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/UserGroup.cs
@@ -1,9 +1,9 @@
namespace Tgstation.Server.Api.Models.Internal
{
///
- /// Represents a group of s.
+ /// Represents a group of users.
///
- public class UserGroup : UserGroupBase
+ public class UserGroup : NamedEntity
{
///
/// The of the .
diff --git a/src/Tgstation.Server.Api/Models/Internal/UserGroupBase.cs b/src/Tgstation.Server.Api/Models/Internal/UserGroupBase.cs
deleted file mode 100644
index 0f144dc95d..0000000000
--- a/src/Tgstation.Server.Api/Models/Internal/UserGroupBase.cs
+++ /dev/null
@@ -1,17 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-
-namespace Tgstation.Server.Api.Models.Internal
-{
- ///
- /// Base class for .
- ///
- public abstract class UserGroupBase : EntityId
- {
- ///
- /// The name of the .
- ///
- [Required]
- [StringLength(Limits.MaximumIndexableStringLength, MinimumLength = 1)]
- public string? Name { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/Internal/User.cs b/src/Tgstation.Server.Api/Models/Internal/UserModelBase.cs
similarity index 55%
rename from src/Tgstation.Server.Api/Models/Internal/User.cs
rename to src/Tgstation.Server.Api/Models/Internal/UserModelBase.cs
index ac37d2e28f..f30e5f84d3 100644
--- a/src/Tgstation.Server.Api/Models/Internal/User.cs
+++ b/src/Tgstation.Server.Api/Models/Internal/UserModelBase.cs
@@ -4,25 +4,27 @@ using System.ComponentModel.DataAnnotations;
namespace Tgstation.Server.Api.Models.Internal
{
///
- /// Represents a server
+ /// Represents a server user.
///
- public abstract class User : UserBase
+ public abstract class UserModelBase : UserName
{
///
- /// If the is enabled since users cannot be deleted. System users cannot be disabled
+ /// If the is enabled since users cannot be deleted. System users cannot be disabled
///
[Required]
public bool? Enabled { get; set; }
///
- /// When the was created
+ /// When the was created
///
[Required]
+ [RequestOptions(FieldPresence.Ignored)]
public DateTimeOffset? CreatedAt { get; set; }
///
- /// The SID/UID of the on Windows/POSIX respectively
+ /// The SID/UID of the on Windows/POSIX respectively
///
+ [ResponseOptions]
[StringLength(Limits.MaximumIndexableStringLength, MinimumLength = 1)]
public string? SystemIdentifier { get; set; }
}
diff --git a/src/Tgstation.Server.Api/Models/Job.cs b/src/Tgstation.Server.Api/Models/Job.cs
deleted file mode 100644
index 9869be84ab..0000000000
--- a/src/Tgstation.Server.Api/Models/Job.cs
+++ /dev/null
@@ -1,23 +0,0 @@
-namespace Tgstation.Server.Api.Models
-{
- ///
- /// Represents a long running job on the server. Model is read-only, updates attempt to cancel the job
- ///
- public sealed class Job : Internal.Job
- {
- ///
- /// The that started the job
- ///
- public User? StartedBy { get; set; }
-
- ///
- /// The that cancelled the job
- ///
- public User? CancelledBy { get; set; }
-
- ///
- /// Optional progress between 0 and 100 inclusive
- ///
- public int? Progress { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/Limits.cs b/src/Tgstation.Server.Api/Models/Limits.cs
index 6acd8a35bf..d485dc42ce 100644
--- a/src/Tgstation.Server.Api/Models/Limits.cs
+++ b/src/Tgstation.Server.Api/Models/Limits.cs
@@ -13,7 +13,7 @@ namespace Tgstation.Server.Api.Models
public const int MaximumStringLength = 10000;
///
- /// Length limit for s.
+ /// Length limit for s.
///
public const int MaximumIndexableStringLength = 100;
diff --git a/src/Tgstation.Server.Api/Models/NamedEntity.cs b/src/Tgstation.Server.Api/Models/NamedEntity.cs
new file mode 100644
index 0000000000..42dc14d95c
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/NamedEntity.cs
@@ -0,0 +1,18 @@
+using System.ComponentModel.DataAnnotations;
+
+namespace Tgstation.Server.Api.Models
+{
+ ///
+ /// Base class for named entities.
+ ///
+ public abstract class NamedEntity : EntityId
+ {
+ ///
+ /// The name of the entity represented by the .
+ ///
+ [Required]
+ [RequestOptions(FieldPresence.Required, PutOnly = true)]
+ [StringLength(Limits.MaximumIndexableStringLength, MinimumLength = 1)]
+ public virtual string? Name { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/OAuthConnection.cs b/src/Tgstation.Server.Api/Models/OAuthConnection.cs
index 678846bbe9..1e6072feb1 100644
--- a/src/Tgstation.Server.Api/Models/OAuthConnection.cs
+++ b/src/Tgstation.Server.Api/Models/OAuthConnection.cs
@@ -18,6 +18,7 @@ namespace Tgstation.Server.Api.Models
/// The ID of the user in the .
///
[Required]
+ [RequestOptions(FieldPresence.Required)]
[StringLength(Limits.MaximumIndexableStringLength, MinimumLength = 1)]
public string? ExternalUserId { get; set; }
}
diff --git a/src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs b/src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs
index 6163e445f4..61dd8f04d7 100644
--- a/src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs
+++ b/src/Tgstation.Server.Api/Models/OAuthProviderInfo.cs
@@ -20,6 +20,7 @@ namespace Tgstation.Server.Api.Models
///
/// The server URL.
///
+ [ResponseOptions]
public Uri? ServerUrl { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/PermissionSet.cs b/src/Tgstation.Server.Api/Models/PermissionSet.cs
index a84ae1d27b..0ffb6801f2 100644
--- a/src/Tgstation.Server.Api/Models/PermissionSet.cs
+++ b/src/Tgstation.Server.Api/Models/PermissionSet.cs
@@ -6,22 +6,24 @@ namespace Tgstation.Server.Api.Models
///
/// Represents a set of server permissions.
///
- public class PermissionSet
+ public class PermissionSet : EntityId
{
- ///
- /// The ID of the .
- ///
- [Required]
- public long? Id { get; set; }
+ ///
+ [RequestOptions(FieldPresence.Ignored)]
+ public override long? Id
+ {
+ get => base.Id;
+ set => base.Id = value;
+ }
///
- /// The for the
+ /// The for the user.
///
[Required]
public AdministrationRights? AdministrationRights { get; set; }
///
- /// The for the
+ /// The for the user.
///
[Required]
public InstanceManagerRights? InstanceManagerRights { get; set; }
diff --git a/src/Tgstation.Server.Api/Models/Repository.cs b/src/Tgstation.Server.Api/Models/Repository.cs
deleted file mode 100644
index a88dfe1c54..0000000000
--- a/src/Tgstation.Server.Api/Models/Repository.cs
+++ /dev/null
@@ -1,64 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-using Tgstation.Server.Api.Models.Internal;
-
-namespace Tgstation.Server.Api.Models
-{
- ///
- /// Represents a git repository
- ///
- public sealed class Repository : RepositorySettings, IGitRemoteInformation
- {
- ///
- /// The origin URL. If , the does not exist
- ///
- public Uri? Origin { get; set; }
-
- ///
- /// If submodules should be recursively cloned.
- ///
- public bool? RecurseSubmodules { get; set; }
-
- ///
- /// The commit HEAD should point to. Not populated in responses, use instead for retrieval
- ///
- [StringLength(Limits.MaximumCommitShaLength)]
- public string? CheckoutSha { get; set; }
-
- ///
- /// The current for the
- ///
- public RevisionInformation? RevisionInformation { get; set; }
-
- ///
- public RemoteGitProvider? RemoteGitProvider { get; set; }
-
- ///
- public string? RemoteRepositoryOwner { get; set; }
-
- ///
- public string? RemoteRepositoryName { get; set; }
-
- ///
- /// The started by the if any
- ///
- public Job? ActiveJob { get; set; }
-
- ///
- /// Do the equivalent of a git pull. Will attempt to merge unless is also specified in which case a hard reset will be performed after checking out
- ///
- public bool? UpdateFromOrigin { get; set; }
-
- ///
- /// The branch or tag HEAD points to
- ///
- [StringLength(Limits.MaximumStringLength)]
- public string? Reference { get; set; }
-
- ///
- /// for new s. Note that merges that conflict will not be performed
- ///
- public ICollection? NewTestMerges { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/Request/ByondVersionRequest.cs b/src/Tgstation.Server.Api/Models/Request/ByondVersionRequest.cs
new file mode 100644
index 0000000000..a7406a93f2
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/ByondVersionRequest.cs
@@ -0,0 +1,21 @@
+using System;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// A request to install a BYOND .
+ ///
+ public sealed class ByondVersionRequest
+ {
+ ///
+ /// The BYOND version to install.
+ ///
+ [RequestOptions(FieldPresence.Required)]
+ public Version? Version { get; set; }
+
+ ///
+ /// If a custom BYOND version is to be uploaded.
+ ///
+ public bool? UploadCustomZip { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/ChatBotCreateRequest.cs b/src/Tgstation.Server.Api/Models/Request/ChatBotCreateRequest.cs
new file mode 100644
index 0000000000..f3097a7107
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/ChatBotCreateRequest.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// Represents a request to update a chat bot.
+ ///
+ public sealed class ChatBotCreateRequest : ChatBotApiBase
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/ChatBotUpdateRequest.cs b/src/Tgstation.Server.Api/Models/Request/ChatBotUpdateRequest.cs
new file mode 100644
index 0000000000..e53c35fdbe
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/ChatBotUpdateRequest.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// Represents a request to update a chat bot.
+ ///
+ public class ChatBotUpdateRequest : ChatBotApiBase
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/ConfigurationFileRequest.cs b/src/Tgstation.Server.Api/Models/Request/ConfigurationFileRequest.cs
new file mode 100644
index 0000000000..37892f3484
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/ConfigurationFileRequest.cs
@@ -0,0 +1,15 @@
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// Represents a request to update a configuration file.
+ ///
+ public sealed class ConfigurationFileRequest : IConfigurationFile
+ {
+ ///
+ [RequestOptions(FieldPresence.Required)]
+ public string? Path { get; set; }
+
+ ///
+ public string? LastReadHash { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/DreamDaemonRequest.cs b/src/Tgstation.Server.Api/Models/Request/DreamDaemonRequest.cs
new file mode 100644
index 0000000000..eb2c729924
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/DreamDaemonRequest.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// A request to update .
+ ///
+ public sealed class DreamDaemonRequest : DreamDaemonApiBase
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/DreamMakerRequest.cs b/src/Tgstation.Server.Api/Models/Request/DreamMakerRequest.cs
new file mode 100644
index 0000000000..3523f01ab1
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/DreamMakerRequest.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// A request to the DreamMaker controller.
+ ///
+ public sealed class DreamMakerRequest : DreamMakerSettings
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/InstanceCreateRequest.cs b/src/Tgstation.Server.Api/Models/Request/InstanceCreateRequest.cs
new file mode 100644
index 0000000000..6194fe16cb
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/InstanceCreateRequest.cs
@@ -0,0 +1,9 @@
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// A request to create an .
+ ///
+ public sealed class InstanceCreateRequest : Instance
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/InstancePermissionSetRequest.cs b/src/Tgstation.Server.Api/Models/Request/InstancePermissionSetRequest.cs
new file mode 100644
index 0000000000..46d1781b00
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/InstancePermissionSetRequest.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// A request to update an instance permission set.
+ ///
+ public sealed class InstancePermissionSetRequest : InstancePermissionSet
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/InstanceUpdateRequest.cs b/src/Tgstation.Server.Api/Models/Request/InstanceUpdateRequest.cs
new file mode 100644
index 0000000000..49b8ac697e
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/InstanceUpdateRequest.cs
@@ -0,0 +1,9 @@
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// A request to update an .
+ ///
+ public class InstanceUpdateRequest : Instance
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/RepositoryCreateRequest.cs b/src/Tgstation.Server.Api/Models/Request/RepositoryCreateRequest.cs
new file mode 100644
index 0000000000..902fb2f896
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/RepositoryCreateRequest.cs
@@ -0,0 +1,22 @@
+using System;
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// Represents a request to clone the repository.
+ ///
+ public sealed class RepositoryCreateRequest : RepositoryApiBase
+ {
+ ///
+ /// The origin URL to clone.
+ ///
+ [RequestOptions(FieldPresence.Required)]
+ public Uri? Origin { get; set; }
+
+ ///
+ /// If submodules should be recursively cloned.
+ ///
+ public bool? RecurseSubmodules { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/RepositoryUpdateRequest.cs b/src/Tgstation.Server.Api/Models/Request/RepositoryUpdateRequest.cs
new file mode 100644
index 0000000000..a9cd63f3e1
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/RepositoryUpdateRequest.cs
@@ -0,0 +1,28 @@
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// Represents a request to change the repository.
+ ///
+ public sealed class RepositoryUpdateRequest : RepositoryApiBase
+ {
+ ///
+ /// The commit HEAD should point to.
+ ///
+ [StringLength(Limits.MaximumCommitShaLength)]
+ public string? CheckoutSha { get; set; }
+
+ ///
+ /// Do the equivalent of a git pull. Will attempt to merge unless is also specified in which case a hard reset will be performed after checking out
+ ///
+ public bool? UpdateFromOrigin { get; set; }
+
+ ///
+ /// for new s. Note that merges that conflict will not be performed
+ ///
+ public ICollection? NewTestMerges { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/UserCreateRequest.cs b/src/Tgstation.Server.Api/Models/Request/UserCreateRequest.cs
new file mode 100644
index 0000000000..697021e6fd
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/UserCreateRequest.cs
@@ -0,0 +1,10 @@
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// For creating a user.
+ ///
+ #pragma warning disable CA1501
+ public sealed class UserCreateRequest : UserUpdateRequest
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/UserGroupCreateRequest.cs b/src/Tgstation.Server.Api/Models/Request/UserGroupCreateRequest.cs
new file mode 100644
index 0000000000..0022a1f037
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/UserGroupCreateRequest.cs
@@ -0,0 +1,9 @@
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// Request to create a user group.
+ ///
+ public sealed class UserGroupCreateRequest : UserGroupUpdateRequest
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/UserGroupUpdateRequest.cs b/src/Tgstation.Server.Api/Models/Request/UserGroupUpdateRequest.cs
new file mode 100644
index 0000000000..cbd8d7d595
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/UserGroupUpdateRequest.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// Request to update a user group.
+ ///
+ public class UserGroupUpdateRequest : UserGroup
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Request/UserUpdateRequest.cs b/src/Tgstation.Server.Api/Models/Request/UserUpdateRequest.cs
new file mode 100644
index 0000000000..6513a546cf
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Request/UserUpdateRequest.cs
@@ -0,0 +1,17 @@
+using System.ComponentModel.DataAnnotations;
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Request
+{
+ ///
+ /// For editing a given user.
+ ///
+ public class UserUpdateRequest : UserApiBase
+ {
+ ///
+ /// Cleartext password of the user.
+ ///
+ [Required]
+ public string? Password { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/RequestOptionsAttribute.cs b/src/Tgstation.Server.Api/Models/RequestOptionsAttribute.cs
new file mode 100644
index 0000000000..26184bd666
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/RequestOptionsAttribute.cs
@@ -0,0 +1,30 @@
+using System;
+
+namespace Tgstation.Server.Api.Models
+{
+ ///
+ /// Indicates the for fields in models.
+ ///
+ [AttributeUsage(AttributeTargets.Property, AllowMultiple = true, Inherited = false)]
+ public sealed class RequestOptionsAttribute : Attribute
+ {
+ ///
+ /// The .
+ ///
+ public FieldPresence Presence { get; }
+
+ ///
+ /// If this only applies to HTTP PUT requests with the model.
+ ///
+ public bool PutOnly { get; set; }
+
+ ///
+ /// Initializes a new instance of the .
+ ///
+ /// The value of .
+ public RequestOptionsAttribute(FieldPresence presence)
+ {
+ Presence = presence;
+ }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Administration.cs b/src/Tgstation.Server.Api/Models/Response/AdministrationResponse.cs
similarity index 57%
rename from src/Tgstation.Server.Api/Models/Administration.cs
rename to src/Tgstation.Server.Api/Models/Response/AdministrationResponse.cs
index 918930f30a..301d87976f 100644
--- a/src/Tgstation.Server.Api/Models/Administration.cs
+++ b/src/Tgstation.Server.Api/Models/Response/AdministrationResponse.cs
@@ -1,11 +1,11 @@
using System;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Response
{
///
/// Represents administrative server information
///
- public sealed class Administration
+ public sealed class AdministrationResponse
{
///
/// The GitHub repository the server is built to recieve updates from
@@ -13,13 +13,8 @@ namespace Tgstation.Server.Api.Models
public Uri? TrackedRepositoryUrl { get; set; }
///
- /// The latest available version of the Tgstation.Server.Host assembly from the upstream repository. If is higher than 's the update cannot be applied due to API changes
+ /// The latest available version of the Tgstation.Server.Host assembly from the upstream repository. If is not equal to 4 the update cannot be applied due to API changes
///
public Version? LatestVersion { get; set; }
-
- ///
- /// Changes the version of Tgstation.Server.Host to the given version from the upstream repository
- ///
- public Version? NewVersion { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/Response/ByondInstallResponse.cs b/src/Tgstation.Server.Api/Models/Response/ByondInstallResponse.cs
new file mode 100644
index 0000000000..3cebc0a6a6
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/ByondInstallResponse.cs
@@ -0,0 +1,24 @@
+using System;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// Represents a BYOND installation. is used to upload custom BYOND version zip files, though must still be set.
+ ///
+ public sealed class ByondInstallResponse : FileTicketResponse
+ {
+ ///
+ /// The being used to install a new .
+ ///
+ [ResponseOptions]
+ public JobResponse? InstallJob { get; set; }
+
+ ///
+ [ResponseOptions]
+ public override string? FileTicket
+ {
+ get => base.FileTicket;
+ set => base.FileTicket = value;
+ }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Response/ByondResponse.cs b/src/Tgstation.Server.Api/Models/Response/ByondResponse.cs
new file mode 100644
index 0000000000..e54af87526
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/ByondResponse.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// Represents an installed BYOND .
+ ///
+ public sealed class ByondResponse
+ {
+ ///
+ /// The installed BYOND . If there is no BYOND version installed. Only considers the and numbers.
+ ///
+ [ResponseOptions]
+ public Version? Version { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Response/ChatBotResponse.cs b/src/Tgstation.Server.Api/Models/Response/ChatBotResponse.cs
new file mode 100644
index 0000000000..716f8deb80
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/ChatBotResponse.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// Represents a chat bot response.
+ ///
+ public sealed class ChatBotResponse : ChatBotApiBase
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/CompileJob.cs b/src/Tgstation.Server.Api/Models/Response/CompileJobResponse.cs
similarity index 55%
rename from src/Tgstation.Server.Api/Models/CompileJob.cs
rename to src/Tgstation.Server.Api/Models/Response/CompileJobResponse.cs
index d5a2c12d09..0739e58347 100644
--- a/src/Tgstation.Server.Api/Models/CompileJob.cs
+++ b/src/Tgstation.Server.Api/Models/Response/CompileJobResponse.cs
@@ -1,22 +1,22 @@
using System;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Response
{
///
- public sealed class CompileJob : Internal.CompileJob
+ public sealed class CompileJobResponse : Internal.CompileJob
{
///
- /// The relating to this job
+ /// The relating to this job.
///
- public Job? Job { get; set; }
+ public JobResponse? Job { get; set; }
///
- /// Git revision the compiler ran on. Not modifiable
+ /// Git revision the compiler ran on.
///
public RevisionInformation? RevisionInformation { get; set; }
///
- /// The the was made with
+ /// The the was made with.
///
public Version? ByondVersion { get; set; }
diff --git a/src/Tgstation.Server.Api/Models/Response/ConfigurationFileResponse.cs b/src/Tgstation.Server.Api/Models/Response/ConfigurationFileResponse.cs
new file mode 100644
index 0000000000..062c0de625
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/ConfigurationFileResponse.cs
@@ -0,0 +1,26 @@
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// Response when reading configuration files.
+ ///
+ public sealed class ConfigurationFileResponse : FileTicketResponse, IConfigurationFile
+ {
+ ///
+ public string? Path { get; set; }
+
+ ///
+ [ResponseOptions]
+ public string? LastReadHash { get; set; }
+
+ ///
+ /// If represents a directory
+ ///
+ public bool? IsDirectory { get; set; }
+
+ ///
+ /// If access to the file was denied for the operation
+ ///
+ [ResponseOptions]
+ public bool? AccessDenied { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Response/DreamDaemonResponse.cs b/src/Tgstation.Server.Api/Models/Response/DreamDaemonResponse.cs
new file mode 100644
index 0000000000..2fcbaa6189
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/DreamDaemonResponse.cs
@@ -0,0 +1,49 @@
+using System.ComponentModel.DataAnnotations;
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// Represents an instance of BYOND's DreamDaemon game server. Create action starts the server. Delete action shuts down the server
+ ///
+ public sealed class DreamDaemonResponse : DreamDaemonApiBase
+ {
+ ///
+ /// The live revision.
+ ///
+ [ResponseOptions]
+ public CompileJobResponse? ActiveCompileJob { get; set; }
+
+ ///
+ /// The next revision to go live.
+ ///
+ [ResponseOptions]
+ public CompileJobResponse? StagedCompileJob { get; set; }
+
+ ///
+ /// The current .
+ ///
+ [EnumDataType(typeof(WatchdogStatus))]
+ [ResponseOptions]
+ public WatchdogStatus? Status { get; set; }
+
+ ///
+ /// The current of . May be downgraded due to requirements of
+ ///
+ [EnumDataType(typeof(DreamDaemonSecurity))]
+ [ResponseOptions]
+ public DreamDaemonSecurity? CurrentSecurity { get; set; }
+
+ ///
+ /// The port the running instance is set to
+ ///
+ [ResponseOptions]
+ public ushort? CurrentPort { get; set; }
+
+ ///
+ /// The webclient status the running instance is set to
+ ///
+ [ResponseOptions]
+ public bool? CurrentAllowWebclient { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Response/DreamMakerResponse.cs b/src/Tgstation.Server.Api/Models/Response/DreamMakerResponse.cs
new file mode 100644
index 0000000000..d114c7a43e
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/DreamMakerResponse.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// A request to the DreamMaker controller.
+ ///
+ public sealed class DreamMakerResponse : DreamMakerSettings
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/ErrorMessage.cs b/src/Tgstation.Server.Api/Models/Response/ErrorMessageResponse.cs
similarity index 63%
rename from src/Tgstation.Server.Api/Models/ErrorMessage.cs
rename to src/Tgstation.Server.Api/Models/Response/ErrorMessageResponse.cs
index 099c49cdf7..7cb35319e9 100644
--- a/src/Tgstation.Server.Api/Models/ErrorMessage.cs
+++ b/src/Tgstation.Server.Api/Models/Response/ErrorMessageResponse.cs
@@ -1,46 +1,45 @@
-using System;
+using System;
using System.ComponentModel.DataAnnotations;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Response
{
///
/// Represents an error message returned by the server
///
- public sealed class ErrorMessage
+ public sealed class ErrorMessageResponse
{
///
/// The version of the API the server is using
///
- [Required]
public Version? ServerApiVersion { get; set; }
///
/// A human readable description of the error
///
- [Required]
public string? Message { get; set; }
///
/// Additional data associated with the error message.
///
+ [ResponseOptions]
public string? AdditionalData { get; set; }
///
- /// The of the .
+ /// The of the .
///
[EnumDataType(typeof(ErrorCode))]
public ErrorCode ErrorCode { get; set; }
///
- /// Initializes a new instance of the .
+ /// Initializes a new instance of the .
///
- public ErrorMessage() { }
+ public ErrorMessageResponse() { }
///
- /// Initializes a new instance of the .
+ /// Initializes a new instance of the .
///
- /// The .
- public ErrorMessage(ErrorCode errorCode)
+ /// The .
+ public ErrorMessageResponse(ErrorCode errorCode)
{
ErrorCode = errorCode;
Message = errorCode.Describe();
diff --git a/src/Tgstation.Server.Api/Models/FileTicketResult.cs b/src/Tgstation.Server.Api/Models/Response/FileTicketResponse.cs
similarity index 61%
rename from src/Tgstation.Server.Api/Models/FileTicketResult.cs
rename to src/Tgstation.Server.Api/Models/Response/FileTicketResponse.cs
index 87d22a78b2..1e94f65b5e 100644
--- a/src/Tgstation.Server.Api/Models/FileTicketResult.cs
+++ b/src/Tgstation.Server.Api/Models/Response/FileTicketResponse.cs
@@ -1,13 +1,13 @@
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Response
{
///
/// Response for when file transfers are necessary.
///
- public class FileTicketResult
+ public class FileTicketResponse
{
///
/// The ticket to use to access the controller.
///
- public string? FileTicket { get; set; }
+ public virtual string? FileTicket { get; set; }
}
}
diff --git a/src/Tgstation.Server.Api/Models/Response/InstancePermissionSetResponse.cs b/src/Tgstation.Server.Api/Models/Response/InstancePermissionSetResponse.cs
new file mode 100644
index 0000000000..811fef574e
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/InstancePermissionSetResponse.cs
@@ -0,0 +1,11 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// A response containing an instance permission set.
+ ///
+ public sealed class InstancePermissionSetResponse : InstancePermissionSet
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Response/InstanceResponse.cs b/src/Tgstation.Server.Api/Models/Response/InstanceResponse.cs
new file mode 100644
index 0000000000..9b5e9dd03d
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/InstanceResponse.cs
@@ -0,0 +1,15 @@
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// Server response for s.
+ ///
+ public sealed class InstanceResponse : Instance
+ {
+ ///
+ /// The representing a change of .
+ ///
+ /// Due to how s are children of s but moving one requires the to be offline, interactions with this are performed in a non-standard fashion. The is read by querying the again (either via list or ID lookup) and cancelled by making any sort of update to the . Once the comes back it can be queried like a normal job.
+ [ResponseOptions]
+ public JobResponse? MoveJob { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Response/JobResponse.cs b/src/Tgstation.Server.Api/Models/Response/JobResponse.cs
new file mode 100644
index 0000000000..38613ef26f
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/JobResponse.cs
@@ -0,0 +1,25 @@
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// Represents a long running job on the server. Model is read-only, updates attempt to cancel the job
+ ///
+ public sealed class JobResponse : Internal.Job
+ {
+ ///
+ /// The that started the job
+ ///
+ public UserName? StartedBy { get; set; }
+
+ ///
+ /// The that cancelled the job
+ ///
+ [ResponseOptions]
+ public UserName? CancelledBy { get; set; }
+
+ ///
+ /// Optional progress between 0 and 100 inclusive
+ ///
+ [ResponseOptions]
+ public int? Progress { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/LogFile.cs b/src/Tgstation.Server.Api/Models/Response/LogFileResponse.cs
similarity index 69%
rename from src/Tgstation.Server.Api/Models/LogFile.cs
rename to src/Tgstation.Server.Api/Models/Response/LogFileResponse.cs
index 873528fcb4..1bfa2f5030 100644
--- a/src/Tgstation.Server.Api/Models/LogFile.cs
+++ b/src/Tgstation.Server.Api/Models/Response/LogFileResponse.cs
@@ -1,16 +1,16 @@
using System;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Response
{
///
/// Represents a server log file.
///
- public sealed class LogFile : FileTicketResult
+ public sealed class LogFileResponse : FileTicketResponse
{
///
/// The name of the log file.
///
- public string Name { get; set; } = String.Empty;
+ public string? Name { get; set; }
///
/// The of when the log file was modified.
diff --git a/src/Tgstation.Server.Api/Models/Paginated.cs b/src/Tgstation.Server.Api/Models/Response/PaginatedResponse.cs
similarity index 87%
rename from src/Tgstation.Server.Api/Models/Paginated.cs
rename to src/Tgstation.Server.Api/Models/Response/PaginatedResponse.cs
index ba4e187494..fba3c698a6 100644
--- a/src/Tgstation.Server.Api/Models/Paginated.cs
+++ b/src/Tgstation.Server.Api/Models/Response/PaginatedResponse.cs
@@ -1,13 +1,13 @@
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Response
{
///
/// Represents a paginated set of models.
///
/// The of the returned model.
- public sealed class Paginated
+ public sealed class PaginatedResponse
{
///
/// The of the returned s.
diff --git a/src/Tgstation.Server.Api/Models/Response/RepositoryResponse.cs b/src/Tgstation.Server.Api/Models/Response/RepositoryResponse.cs
new file mode 100644
index 0000000000..14a9fe2f73
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/RepositoryResponse.cs
@@ -0,0 +1,41 @@
+using System;
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ /// Represents a git repository
+ ///
+ public sealed class RepositoryResponse : RepositoryApiBase, IGitRemoteInformation
+ {
+ ///
+ /// The origin URL. If , the git repository does not currently exist on the server.
+ ///
+ [ResponseOptions]
+ public Uri? Origin { get; set; }
+
+ ///
+ /// The current .
+ ///
+ [ResponseOptions]
+ public RevisionInformation? RevisionInformation { get; set; }
+
+ ///
+ [ResponseOptions]
+ public RemoteGitProvider? RemoteGitProvider { get; set; }
+
+ ///
+ [ResponseOptions]
+ public string? RemoteRepositoryOwner { get; set; }
+
+ ///
+ [ResponseOptions]
+ public string? RemoteRepositoryName { get; set; }
+
+ ///
+ /// The started by the request, if any.
+ ///
+ [ResponseOptions]
+ public JobResponse? ActiveJob { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/ServerInformation.cs b/src/Tgstation.Server.Api/Models/Response/ServerInformationResponse.cs
similarity index 81%
rename from src/Tgstation.Server.Api/Models/ServerInformation.cs
rename to src/Tgstation.Server.Api/Models/Response/ServerInformationResponse.cs
index ed0509d76b..0efe4dc4bc 100644
--- a/src/Tgstation.Server.Api/Models/ServerInformation.cs
+++ b/src/Tgstation.Server.Api/Models/Response/ServerInformationResponse.cs
@@ -1,12 +1,12 @@
using System;
using System.Collections.Generic;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Response
{
///
/// Represents basic server information.
///
- public sealed class ServerInformation : Internal.ServerInformation
+ public sealed class ServerInformationResponse : Internal.ServerInformationBase
{
///
/// The version of the host
@@ -34,9 +34,10 @@ namespace Tgstation.Server.Api.Models
public bool UpdateInProgress { get; set; }
///
- /// A of connected s.
+ /// A of connected s.
///
- public ICollection? SwarmServers { get; set; }
+ [ResponseOptions]
+ public ICollection? SwarmServers { get; set; }
///
/// Map of to the for them.
diff --git a/src/Tgstation.Server.Api/Models/Response/ServerUpdateResponse.cs b/src/Tgstation.Server.Api/Models/Response/ServerUpdateResponse.cs
new file mode 100644
index 0000000000..a3ff1e7159
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/ServerUpdateResponse.cs
@@ -0,0 +1,7 @@
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ public sealed class ServerUpdateResponse : ServerUpdate
+ {
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Response/SwarmServerResponse.cs b/src/Tgstation.Server.Api/Models/Response/SwarmServerResponse.cs
new file mode 100644
index 0000000000..1e11ad9b45
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/SwarmServerResponse.cs
@@ -0,0 +1,13 @@
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ public sealed class SwarmServerResponse : SwarmServer
+ {
+ ///
+ /// If the is the controller.
+ ///
+ public bool Controller { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Token.cs b/src/Tgstation.Server.Api/Models/Response/TokenResponse.cs
similarity index 64%
rename from src/Tgstation.Server.Api/Models/Token.cs
rename to src/Tgstation.Server.Api/Models/Response/TokenResponse.cs
index 4f73c1c28e..21a96b5388 100644
--- a/src/Tgstation.Server.Api/Models/Token.cs
+++ b/src/Tgstation.Server.Api/Models/Response/TokenResponse.cs
@@ -1,11 +1,11 @@
-using System;
+using System;
-namespace Tgstation.Server.Api.Models
+namespace Tgstation.Server.Api.Models.Response
{
///
/// Represents a JWT returned by the API
///
- public sealed class Token
+ public sealed class TokenResponse
{
///
/// The value of the JWT
@@ -13,7 +13,7 @@ namespace Tgstation.Server.Api.Models
public string? Bearer { get; set; }
///
- /// When the expires
+ /// When the expires
///
public DateTimeOffset ExpiresAt { get; set; }
}
diff --git a/src/Tgstation.Server.Api/Models/Response/UserGroupResponse.cs b/src/Tgstation.Server.Api/Models/Response/UserGroupResponse.cs
new file mode 100644
index 0000000000..d72f9eeaae
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/UserGroupResponse.cs
@@ -0,0 +1,14 @@
+using System.Collections.Generic;
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ public sealed class UserGroupResponse : UserGroup
+ {
+ ///
+ /// The s the has.
+ ///
+ public ICollection? Users { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/Response/UserResponse.cs b/src/Tgstation.Server.Api/Models/Response/UserResponse.cs
new file mode 100644
index 0000000000..09b0f03c8f
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/Response/UserResponse.cs
@@ -0,0 +1,15 @@
+using System.ComponentModel.DataAnnotations;
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models.Response
+{
+ ///
+ public class UserResponse : UserApiBase
+ {
+ ///
+ /// The who created this
+ ///
+ [Required]
+ public UserName? CreatedBy { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/ResponseOptionsAttribute.cs b/src/Tgstation.Server.Api/Models/ResponseOptionsAttribute.cs
new file mode 100644
index 0000000000..a8c42e0f4c
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/ResponseOptionsAttribute.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Tgstation.Server.Api.Models
+{
+ ///
+ /// Indicates the response of API fields. Changes it from to by default.
+ ///
+ [AttributeUsage(AttributeTargets.Property, AllowMultiple = false, Inherited = true)]
+ public sealed class ResponseOptionsAttribute : Attribute
+ {
+ ///
+ /// The .
+ ///
+ public FieldPresence Presence { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/RevisionInformation.cs b/src/Tgstation.Server.Api/Models/RevisionInformation.cs
index 8e115fb922..4c47bde70c 100644
--- a/src/Tgstation.Server.Api/Models/RevisionInformation.cs
+++ b/src/Tgstation.Server.Api/Models/RevisionInformation.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
namespace Tgstation.Server.Api.Models
{
@@ -8,6 +8,7 @@ namespace Tgstation.Server.Api.Models
///
/// The that was created with this
///
+ [ResponseOptions]
public TestMerge? PrimaryTestMerge { get; set; }
///
@@ -16,7 +17,7 @@ namespace Tgstation.Server.Api.Models
public ICollection? ActiveTestMerges { get; set; }
///
- /// The s made from the
+ /// The s made from the
///
public ICollection? CompileJobs { get; set; }
}
diff --git a/src/Tgstation.Server.Api/Models/ServerUpdate.cs b/src/Tgstation.Server.Api/Models/ServerUpdate.cs
new file mode 100644
index 0000000000..6af9e3251e
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/ServerUpdate.cs
@@ -0,0 +1,16 @@
+using System;
+
+namespace Tgstation.Server.Api.Models
+{
+ ///
+ /// Represents a request to update TGS.
+ ///
+ public abstract class ServerUpdate
+ {
+ ///
+ /// Changes the version of tgstation-server to the given version from the upstream repository.
+ ///
+ [RequestOptions(FieldPresence.Required)]
+ public Version? NewVersion { get; set; }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/SwarmServer.cs b/src/Tgstation.Server.Api/Models/SwarmServer.cs
deleted file mode 100644
index 392d055518..0000000000
--- a/src/Tgstation.Server.Api/Models/SwarmServer.cs
+++ /dev/null
@@ -1,11 +0,0 @@
-namespace Tgstation.Server.Api.Models
-{
- ///
- public sealed class SwarmServer : Internal.SwarmServer
- {
- ///
- /// If the is the controller.
- ///
- public bool Controller { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/TestMerge.cs b/src/Tgstation.Server.Api/Models/TestMerge.cs
index f9cdbcea75..5ab802f96f 100644
--- a/src/Tgstation.Server.Api/Models/TestMerge.cs
+++ b/src/Tgstation.Server.Api/Models/TestMerge.cs
@@ -1,11 +1,13 @@
-namespace Tgstation.Server.Api.Models
+using Tgstation.Server.Api.Models.Internal;
+
+namespace Tgstation.Server.Api.Models
{
///
- public sealed class TestMerge : Internal.TestMerge
+ public sealed class TestMerge : TestMergeApiBase
{
///
- /// The who created the
+ /// The of the user who created the .
///
- public User? MergedBy { get; set; }
+ public UserName? MergedBy { get; set; }
}
-}
\ No newline at end of file
+}
diff --git a/src/Tgstation.Server.Api/Models/TestMergeParameters.cs b/src/Tgstation.Server.Api/Models/TestMergeParameters.cs
index fbac15c974..f779a42d98 100644
--- a/src/Tgstation.Server.Api/Models/TestMergeParameters.cs
+++ b/src/Tgstation.Server.Api/Models/TestMergeParameters.cs
@@ -22,6 +22,7 @@ namespace Tgstation.Server.Api.Models
///
/// Optional comment about the test
///
+ [ResponseOptions]
[StringLength(Limits.MaximumStringLength)]
public string? Comment { get; set; }
}
diff --git a/src/Tgstation.Server.Api/Models/User.cs b/src/Tgstation.Server.Api/Models/User.cs
deleted file mode 100644
index 729e81383e..0000000000
--- a/src/Tgstation.Server.Api/Models/User.cs
+++ /dev/null
@@ -1,40 +0,0 @@
-using System.Collections.Generic;
-using System.ComponentModel.DataAnnotations;
-
-namespace Tgstation.Server.Api.Models
-{
- ///
- public class User : Internal.User
- {
- ///
- /// The name of the default admin user
- ///
- public static readonly string AdminName = "Admin";
-
- ///
- /// The default admin password
- ///
- public static readonly string DefaultAdminPassword = "ISolemlySwearToDeleteTheDataDirectory";
-
- ///
- /// The who created this
- ///
- [Required]
- public Internal.UserBase? CreatedBy { get; set; }
-
- ///
- /// List of s associated with the .
- ///
- public ICollection? OAuthConnections { get; set; }
-
- ///
- /// The directly associated with the .
- ///
- public PermissionSet? PermissionSet { get; set; }
-
- ///
- /// The asociated with the , if any.
- ///
- public Internal.UserGroup? Group { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/UserGroup.cs b/src/Tgstation.Server.Api/Models/UserGroup.cs
deleted file mode 100644
index cc9394395a..0000000000
--- a/src/Tgstation.Server.Api/Models/UserGroup.cs
+++ /dev/null
@@ -1,13 +0,0 @@
-using System.Collections.Generic;
-
-namespace Tgstation.Server.Api.Models
-{
- ///
- public sealed class UserGroup : Internal.UserGroup
- {
- ///
- /// The s the has.
- ///
- public ICollection? Users { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Models/UserName.cs b/src/Tgstation.Server.Api/Models/UserName.cs
new file mode 100644
index 0000000000..8044489a2d
--- /dev/null
+++ b/src/Tgstation.Server.Api/Models/UserName.cs
@@ -0,0 +1,33 @@
+namespace Tgstation.Server.Api.Models
+{
+ ///
+ /// Base class for user names.
+ ///
+ public class UserName : NamedEntity
+ {
+ ///
+ [RequestOptions(FieldPresence.Optional)]
+ public override string? Name
+ {
+ get => base.Name;
+ set => base.Name = value;
+ }
+
+ ///
+ /// Create a copy of the as a given .
+ ///
+ /// The child of to create.
+ /// A new copied from .
+ protected virtual TResultType CreateUserName() where TResultType : UserName, new() => new TResultType
+ {
+ Id = Id,
+ Name = Name
+ };
+
+ ///
+ /// Create a copy of the .
+ ///
+ /// A new copied from .
+ public UserName CreateUserName() => CreateUserName();
+ }
+}
diff --git a/src/Tgstation.Server.Api/Models/UserUpdate.cs b/src/Tgstation.Server.Api/Models/UserUpdate.cs
deleted file mode 100644
index dc35f3de24..0000000000
--- a/src/Tgstation.Server.Api/Models/UserUpdate.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-using System.ComponentModel.DataAnnotations;
-
-namespace Tgstation.Server.Api.Models
-{
- ///
- /// For editing a given . Will never be returned by the API
- ///
- public sealed class UserUpdate : User
- {
- ///
- /// Cleartext password of the
- ///
- [Required]
- public string? Password { get; set; }
- }
-}
diff --git a/src/Tgstation.Server.Api/Properties/ApiVersionAttribute.cs b/src/Tgstation.Server.Api/Properties/ApiVersionAttribute.cs
new file mode 100644
index 0000000000..87de47ad51
--- /dev/null
+++ b/src/Tgstation.Server.Api/Properties/ApiVersionAttribute.cs
@@ -0,0 +1,34 @@
+using System;
+using System.Reflection;
+
+namespace Tgstation.Server.Api.Properties
+{
+ ///
+ /// Attribute for bringing in the HTTP API version from MSBuild.
+ ///
+ [AttributeUsage(AttributeTargets.Assembly)]
+ sealed class ApiVersionAttribute : Attribute
+ {
+ ///
+ /// Return the 's instance of the .
+ ///
+ public static ApiVersionAttribute Instance => Assembly
+ .GetExecutingAssembly()
+ .GetCustomAttribute();
+
+ ///
+ /// The of the TGS API definition.
+ ///
+ public string RawApiVersion { get; }
+
+ ///
+ /// Initializes a new instance of the .
+ ///
+ /// The value of .
+ public ApiVersionAttribute(
+ string rawApiVersion)
+ {
+ RawApiVersion = rawApiVersion ?? throw new ArgumentNullException(nameof(rawApiVersion));
+ }
+ }
+}
diff --git a/src/Tgstation.Server.Api/Rights/AdministrationRights.cs b/src/Tgstation.Server.Api/Rights/AdministrationRights.cs
index f134c7d1c9..d0747d9f45 100644
--- a/src/Tgstation.Server.Api/Rights/AdministrationRights.cs
+++ b/src/Tgstation.Server.Api/Rights/AdministrationRights.cs
@@ -3,7 +3,7 @@ using System;
namespace Tgstation.Server.Api.Rights
{
///
- /// Rights for
+ /// Administration rights for the server.
///
[Flags]
public enum AdministrationRights : ulong
@@ -14,7 +14,7 @@ namespace Tgstation.Server.Api.Rights
None = 0,
///
- /// User has complete control over creating/editing s and s (and deleting in the case of the latter).
+ /// User has complete control over creating/editing s and s (and deleting in the case of the latter).
///
WriteUsers = 1,
@@ -24,7 +24,7 @@ namespace Tgstation.Server.Api.Rights
RestartHost = 2,
///
- /// User can read and upgrade/downgrade TGS through the API.
+ /// User can read and upgrade/downgrade TGS through the API.
///
ChangeVersion = 4,
@@ -39,12 +39,12 @@ namespace Tgstation.Server.Api.Rights
ReadUsers = 16,
///
- /// User can list and download s.
+ /// User can list and download s.
///
DownloadLogs = 32,
///
- /// User can modify their own .
+ /// User can modify their own .
///
EditOwnOAuthConnections = 64,
}
diff --git a/src/Tgstation.Server.Api/Rights/ByondRights.cs b/src/Tgstation.Server.Api/Rights/ByondRights.cs
index 3e54887103..100d64f2b7 100644
--- a/src/Tgstation.Server.Api/Rights/ByondRights.cs
+++ b/src/Tgstation.Server.Api/Rights/ByondRights.cs
@@ -3,7 +3,7 @@ using System;
namespace Tgstation.Server.Api.Rights
{
///
- /// Rights for
+ /// Rights for BYOND version management.
///
[Flags]
public enum ByondRights : ulong
diff --git a/src/Tgstation.Server.Api/Rights/ChatBotRights.cs b/src/Tgstation.Server.Api/Rights/ChatBotRights.cs
index b0bf961ed2..9deee84290 100644
--- a/src/Tgstation.Server.Api/Rights/ChatBotRights.cs
+++ b/src/Tgstation.Server.Api/Rights/ChatBotRights.cs
@@ -3,7 +3,7 @@ using System;
namespace Tgstation.Server.Api.Rights
{
///
- /// Rights for
+ /// Rights for chat bots.
///
[Flags]
public enum ChatBotRights : ulong
@@ -14,57 +14,57 @@ namespace Tgstation.Server.Api.Rights
None = 0,
///
- /// User can change .
+ /// User can change .
///
WriteEnabled = 1,
///
- /// User can change .
+ /// User can change .
///
WriteProvider = 2,
///
- /// User can change .
+ /// User can change .
///
WriteChannels = 4,
///
- /// User can change
+ /// User can change
///
WriteConnectionString = 8,
///
- /// User can read requires the permission.
+ /// User can read requires the permission.
///
ReadConnectionString = 16,
///
- /// User can read all properties except
+ /// User can read all chat bot properties except
///
Read = 32,
///
- /// User can create new s.
+ /// User can create new chat bots.
///
Create = 64,
///
- /// User can delete s.
+ /// User can delete chat bots.
///
Delete = 128,
///
- /// User can change .
+ /// User can change .
///
WriteName = 256,
///
- /// User can change .
+ /// User can change .
///
WriteReconnectionInterval = 512,
///
- /// User can change .
+ /// User can change .
///
WriteChannelLimit = 1024,
}
diff --git a/src/Tgstation.Server.Api/Rights/ConfigurationRights.cs b/src/Tgstation.Server.Api/Rights/ConfigurationRights.cs
index bc93c814e0..48a192fdcd 100644
--- a/src/Tgstation.Server.Api/Rights/ConfigurationRights.cs
+++ b/src/Tgstation.Server.Api/Rights/ConfigurationRights.cs
@@ -3,7 +3,7 @@ using System;
namespace Tgstation.Server.Api.Rights
{
///
- /// Rights for
+ /// Rights for s.
///
[Flags]
public enum ConfigurationRights : ulong
diff --git a/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs b/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs
index 0547c1400b..ad69c359c7 100644
--- a/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs
+++ b/src/Tgstation.Server.Api/Rights/DreamDaemonRights.cs
@@ -3,7 +3,7 @@ using System;
namespace Tgstation.Server.Api.Rights
{
///
- /// Rights for
+ /// Rights for managing DreamDaemon.
///
[Flags]
public enum DreamDaemonRights : ulong
@@ -14,7 +14,7 @@ namespace Tgstation.Server.Api.Rights
None = 0,
///
- /// User can read and
+ /// User can read and
///
ReadRevision = 1,
@@ -34,7 +34,7 @@ namespace Tgstation.Server.Api.Rights
SetSecurity = 8,
///
- /// User can read every propery of except and .
+ /// User can read every property of except and .
///
ReadMetadata = 16,
@@ -44,12 +44,12 @@ namespace Tgstation.Server.Api.Rights
SetWebClient = 32,
///
- /// User can change .
+ /// User can change .
///
SoftRestart = 64,
///
- /// User can change .
+ /// User can change .
///
SoftShutdown = 128,
diff --git a/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs b/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs
index 44d67495f5..680a609859 100644
--- a/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs
+++ b/src/Tgstation.Server.Api/Rights/DreamMakerRights.cs
@@ -3,7 +3,7 @@ using System;
namespace Tgstation.Server.Api.Rights
{
///
- /// Rights for
+ /// Rights for deployment.
///
[Flags]
public enum DreamMakerRights : ulong
@@ -14,7 +14,7 @@ namespace Tgstation.Server.Api.Rights
None = 0,
///
- /// User may read all properties of .
+ /// User may read all properties of .
///
Read = 1,
@@ -29,27 +29,27 @@ namespace Tgstation.Server.Api.Rights
CancelCompile = 4,
///
- /// User may modify .
+ /// User may modify .
///
SetDme = 8,
///
- /// User may modify .
+ /// User may modify .
///
SetApiValidationPort = 16,
///
- /// User may list and read all s.
+ /// User may list and read all s.
///
CompileJobs = 32,
///
- /// User may modify .
+ /// User may modify .
///
SetSecurityLevel = 64,
///
- /// User may modify .
+ /// User may modify .
///
SetApiValidationRequirement = 128,
}
diff --git a/src/Tgstation.Server.Api/Rights/InstanceManagerRights.cs b/src/Tgstation.Server.Api/Rights/InstanceManagerRights.cs
index b8700b9e30..e438734d90 100644
--- a/src/Tgstation.Server.Api/Rights/InstanceManagerRights.cs
+++ b/src/Tgstation.Server.Api/Rights/InstanceManagerRights.cs
@@ -14,7 +14,7 @@ namespace Tgstation.Server.Api.Rights
None = 0,
///
- /// User can view s which they have an for.
+ /// User can view s which they have an for.
///
Read = 1,
@@ -64,7 +64,7 @@ namespace Tgstation.Server.Api.Rights
SetChatBotLimit = 512,
///
- /// User can give themselves or their group full rights on ALL instances.
+ /// User can give themselves or their group full on ALL instances.
///
GrantPermissions = 1024,
}
diff --git a/src/Tgstation.Server.Api/Rights/InstancePermissionSetRights.cs b/src/Tgstation.Server.Api/Rights/InstancePermissionSetRights.cs
index 285411f32c..6b2dc5814d 100644
--- a/src/Tgstation.Server.Api/Rights/InstancePermissionSetRights.cs
+++ b/src/Tgstation.Server.Api/Rights/InstancePermissionSetRights.cs
@@ -14,17 +14,17 @@ namespace Tgstation.Server.Api.Rights
None = 0,
///
- /// Allow read access to all s in the .
+ /// Allow read access to all s in the .
///
Read = 1,
///
- /// Allow write and delete access to all for the .
+ /// Allow write and delete access to all for the .
///
Write = 2,
///
- /// Allow adding additional s to the .
+ /// Allow adding additional s to the .
///
Create = 4
}
diff --git a/src/Tgstation.Server.Api/Rights/RepositoryRights.cs b/src/Tgstation.Server.Api/Rights/RepositoryRights.cs
index a65ca17e0a..4d0d452287 100644
--- a/src/Tgstation.Server.Api/Rights/RepositoryRights.cs
+++ b/src/Tgstation.Server.Api/Rights/RepositoryRights.cs
@@ -3,7 +3,7 @@ using System;
namespace Tgstation.Server.Api.Rights
{
///
- /// Rights for a
+ /// Rights for the git repository.
///
[Flags]
public enum RepositoryRights : ulong
@@ -19,12 +19,12 @@ namespace Tgstation.Server.Api.Rights
CancelPendingChanges = 1,
///
- /// User may clone the if it does not exist.
+ /// User may clone the repository if it does not exist.
///
SetOrigin = 2,
///
- /// User may directly checkout a git SHA that the 's HEAD will point to.
+ /// User may directly checkout a git SHA that the repository's HEAD will point to.
///
SetSha = 4,
@@ -54,12 +54,12 @@ namespace Tgstation.Server.Api.Rights
ChangeCredentials = 128,
///
- /// User may set to another git branch or tag (not a SHA).
+ /// User may set to another git branch or tag (not a SHA).
///
SetReference = 256,
///
- /// User may read all fields in the with the exception of .
+ /// User may read repository information.
///
Read = 512,
@@ -69,7 +69,7 @@ namespace Tgstation.Server.Api.Rights
ChangeAutoUpdateSettings = 1024,
///
- /// User may delete the and allow it to be cloned again.
+ /// User may delete the repository and allow it to be cloned again.
///
Delete = 2048,
diff --git a/src/Tgstation.Server.Api/Routes.cs b/src/Tgstation.Server.Api/Routes.cs
index 99784db093..7825f1bb5d 100644
--- a/src/Tgstation.Server.Api/Routes.cs
+++ b/src/Tgstation.Server.Api/Routes.cs
@@ -14,44 +14,44 @@ namespace Tgstation.Server.Api
public const string Root = "/";
///
- /// The controller
+ /// The server administration controller.
///
- public const string Administration = Root + nameof(Models.Administration);
+ public const string Administration = Root + "Administration";
///
- /// The controller
+ /// The endpoint to download server logs.
///
public const string Logs = Administration + "/Logs";
///
- /// The controller
+ /// The user controller.
///
- public const string User = Root + nameof(Models.User);
+ public const string User = Root + "User";
///
- /// The controller.
+ /// The user group controller.
///
- public const string UserGroup = Root + nameof(Models.UserGroup);
+ public const string UserGroup = Root + "UserGroup";
///
- /// The controller
+ /// The controller.
///
- public const string InstanceManager = Root + nameof(Models.Instance);
+ public const string InstanceManager = Root + "Instance";
///
- /// The controller
+ /// The BYOND controller.
///
- public const string Byond = Root + nameof(Models.Byond);
+ public const string Byond = Root + "Byond";
///
- /// The controller
+ /// The git repository controller.
///
- public const string Repository = Root + nameof(Models.Repository);
+ public const string Repository = Root + "Repository";
///
- /// The controller
+ /// The DreamDaemon controller
///
- public const string DreamDaemon = Root + nameof(Models.DreamDaemon);
+ public const string DreamDaemon = Root + "DreamDaemon";
///
/// For accessing DD diagnostics
@@ -59,12 +59,12 @@ namespace Tgstation.Server.Api
public const string Diagnostics = DreamDaemon + "/Diagnostics";
///
- /// The controller
+ /// The configuration controller
///
public const string Configuration = Root + "Config";
///
- /// To be paired with for accessing s
+ /// To be paired with for accessing s.
///
public const string File = "File";
@@ -74,24 +74,24 @@ namespace Tgstation.Server.Api
public const string ConfigurationFile = Configuration + "/" + File;
///
- /// The controller
+ /// The instance permission set controller.
///
- public const string InstancePermissionSet = Root + nameof(Models.InstancePermissionSet);
+ public const string InstancePermissionSet = Root + "InstancePermissionSet";
///
- /// The controller
+ /// The chat bot controller
///
public const string Chat = Root + "Chat";
///
- /// The controller
+ /// The deployment controller
///
- public const string DreamMaker = Root + nameof(Models.DreamMaker);
+ public const string DreamMaker = Root + "DreamMaker";
///
- /// The controller
+ /// The jobs controller
///
- public const string Jobs = Root + nameof(Models.Job);
+ public const string Jobs = Root + "Job";
///
/// The transfer controller.
@@ -119,7 +119,7 @@ namespace Tgstation.Server.Api
public static string ListRoute(string route) => String.Format(CultureInfo.InvariantCulture, "{0}/{1}", route, List);
///
- /// Sanitize a path for use in a GET .
+ /// Sanitize a path for use in a GET .
///
/// The path to sanitize.
/// The sanitized path.
diff --git a/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj b/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj
index 933cb4cb6c..6a2f206421 100644
--- a/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj
+++ b/src/Tgstation.Server.Api/Tgstation.Server.Api.csproj
@@ -1,10 +1,10 @@
-
+netstandard2.1Full
- $(TgsApiVersion)
+ $(TgsApiLibraryVersion)trueCyberboss/tg/station 13
@@ -32,6 +32,19 @@
+
+
+
+ <_Parameter1>$(TgsApiVersion)
+
+
+
+
+
+
+
+
+
diff --git a/src/Tgstation.Server.Client/AdministrationClient.cs b/src/Tgstation.Server.Client/AdministrationClient.cs
index e941337ebf..ea044ba0bd 100644
--- a/src/Tgstation.Server.Client/AdministrationClient.cs
+++ b/src/Tgstation.Server.Client/AdministrationClient.cs
@@ -5,7 +5,8 @@ using System.Threading;
using System.Threading.Tasks;
using System.Web;
using Tgstation.Server.Api;
-using Tgstation.Server.Api.Models;
+using Tgstation.Server.Api.Models.Request;
+using Tgstation.Server.Api.Models.Response;
namespace Tgstation.Server.Client
{
@@ -21,22 +22,22 @@ namespace Tgstation.Server.Client
{ }
///
- public Task Read(CancellationToken cancellationToken) => ApiClient.Read(Routes.Administration, cancellationToken);
+ public Task Read(CancellationToken cancellationToken) => ApiClient.Read(Routes.Administration, cancellationToken);
///
- public Task Update(Administration administration, CancellationToken cancellationToken) => ApiClient.Update(Routes.Administration, administration ?? throw new ArgumentNullException(nameof(administration)), cancellationToken);
+ public Task Update(ServerUpdateRequest updateRequest, CancellationToken cancellationToken) => ApiClient.Update(Routes.Administration, updateRequest ?? throw new ArgumentNullException(nameof(updateRequest)), cancellationToken);
///
public Task Restart(CancellationToken cancellationToken) => ApiClient.Delete(Routes.Administration, cancellationToken);
///
- public Task> ListLogs(PaginationSettings? paginationSettings, CancellationToken cancellationToken)
- => ReadPaged(paginationSettings, Routes.Logs, null, cancellationToken);
+ public Task> ListLogs(PaginationSettings? paginationSettings, CancellationToken cancellationToken)
+ => ReadPaged(paginationSettings, Routes.Logs, null, cancellationToken);
///
- public async Task> GetLog(LogFile logFile, CancellationToken cancellationToken)
+ public async Task> GetLog(LogFileResponse logFile, CancellationToken cancellationToken)
{
- var resultFile = await ApiClient.Read(
+ var resultFile = await ApiClient.Read(
Routes.Logs + Routes.SanitizeGetPath(
HttpUtility.UrlEncode(
logFile?.Name ?? throw new ArgumentNullException(nameof(logFile)))),
diff --git a/src/Tgstation.Server.Client/ApiClient.cs b/src/Tgstation.Server.Client/ApiClient.cs
index 7c8460b27e..f1afee6b3f 100644
--- a/src/Tgstation.Server.Client/ApiClient.cs
+++ b/src/Tgstation.Server.Client/ApiClient.cs
@@ -15,6 +15,7 @@ using System.Threading.Tasks;
using System.Web;
using Tgstation.Server.Api;
using Tgstation.Server.Api.Models;
+using Tgstation.Server.Api.Models.Response;
namespace Tgstation.Server.Client
{
@@ -54,7 +55,7 @@ namespace Tgstation.Server.Client
readonly ApiHeaders? tokenRefreshHeaders;
///
- /// The for refreshes.
+ /// The for refreshes.
///
readonly SemaphoreSlim semaphoreSlim;
@@ -71,11 +72,11 @@ namespace Tgstation.Server.Client
static void HandleBadResponse(HttpResponseMessage response, string json)
{
- ErrorMessage? errorMessage = null;
+ ErrorMessageResponse? errorMessage = null;
try
{
// check if json serializes to an error message
- errorMessage = JsonConvert.DeserializeObject(json, GetSerializerSettings());
+ errorMessage = JsonConvert.DeserializeObject(json, GetSerializerSettings());
}
catch (JsonException) { }
@@ -271,7 +272,7 @@ namespace Tgstation.Server.Client
if (startingToken != headers.Token)
return true;
- var token = await RunRequest