diff --git a/src/Tgstation.Server.Client/Components/IByondClient.cs b/src/Tgstation.Server.Client/Components/IByondClient.cs index 9f9d8421c6..8ddbe011f2 100644 --- a/src/Tgstation.Server.Client/Components/IByondClient.cs +++ b/src/Tgstation.Server.Client/Components/IByondClient.cs @@ -1,29 +1,27 @@ -using System; -using System.Threading; +using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Api.Models; -using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Client.Components { /// /// For managing the installation /// - public interface IByondClient : IRightsClient + public interface IByondClient { /// - /// Get the represented by the + /// Get the information /// /// The for the operation - /// A resulting in the represented by the + /// A resulting in the information Task Read(CancellationToken cancellationToken); /// /// Updates the installed BYOND /// - /// The to set to active + /// The information to update /// The for the operation - /// A representing the running operation - Task SetActiveVersion(Version version, CancellationToken cancellationToken); + /// A resulting in the updated information + Task Update(Byond byond, CancellationToken cancellationToken); } } diff --git a/src/Tgstation.Server.Client/Components/IChatSettingsClient.cs b/src/Tgstation.Server.Client/Components/IChatSettingsClient.cs index d8ad100b18..c0654a6dc2 100644 --- a/src/Tgstation.Server.Client/Components/IChatSettingsClient.cs +++ b/src/Tgstation.Server.Client/Components/IChatSettingsClient.cs @@ -1,28 +1,44 @@ -using System.Threading; +using System.Collections.Generic; +using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Api.Models; -using Tgstation.Server.Api.Rights; namespace Tgstation.Server.Client.Components { /// /// For managing the chat bots /// - public interface IChatSettingsClient : IRightsClient + public interface IChatSettingsClient { /// - /// Get the represented by the + /// List the /// /// The for the operation - /// A resulting in the represented by the - Task Read(CancellationToken cancellationToken); + /// A resulting in a of the of the server + Task> List(CancellationToken cancellationToken); /// - /// Updates the setttings + /// Create a /// - /// The to update + /// The to create + /// The for the operation + /// A resulting in the new + Task Create(ChatSettings settings, CancellationToken cancellationToken); + + /// + /// Updates a setttings + /// + /// The to update + /// The for the operation + /// A resulting in the updated + Task Update(ChatSettings settings, CancellationToken cancellationToken); + + /// + /// Delete a + /// + /// The to delete /// The for the operation /// A representing the running operation - Task Update(ChatSettings chat, CancellationToken cancellationToken); + Task Delete(ChatSettings settings, CancellationToken cancellationToken); } } diff --git a/src/Tgstation.Server.Client/Components/IInstanceClient.cs b/src/Tgstation.Server.Client/Components/IInstanceClient.cs index 36b5b605f5..e806263fe8 100644 --- a/src/Tgstation.Server.Client/Components/IInstanceClient.cs +++ b/src/Tgstation.Server.Client/Components/IInstanceClient.cs @@ -1,5 +1,4 @@ -using System.Threading; -using System.Threading.Tasks; +using System; using Tgstation.Server.Api.Models; namespace Tgstation.Server.Client.Components @@ -7,8 +6,13 @@ namespace Tgstation.Server.Client.Components /// /// For managing a single /// - public interface IInstanceClient + public interface IInstanceClient : IDisposable { + /// + /// The used to create the + /// + Instance Metadata { get; } + /// /// Access the /// @@ -19,10 +23,10 @@ namespace Tgstation.Server.Client.Components /// IRepositoryClient Repository { get; } - /// - /// Access the - /// - IDreamDaemonClient DreamDaemon { get; } + /// + /// Access the + /// + IDreamDaemonClient DreamDaemon { get; } /// /// Access the @@ -38,17 +42,15 @@ namespace Tgstation.Server.Client.Components /// Access the /// IChatSettingsClient Chat { get; } - + /// /// Access the /// IDreamMakerClient DreamMaker { get; } /// - /// Get the represented by the + /// Access the /// - /// The for the operation - /// A resulting in the represented by the - Task Read(CancellationToken cancellationToken); + IJobsClient Jobs { get; } } } \ No newline at end of file diff --git a/src/Tgstation.Server.Client/Components/IAdministrationClient.cs b/src/Tgstation.Server.Client/IAdministrationClient.cs similarity index 87% rename from src/Tgstation.Server.Client/Components/IAdministrationClient.cs rename to src/Tgstation.Server.Client/IAdministrationClient.cs index a68aeb5cfe..d420563fce 100644 --- a/src/Tgstation.Server.Client/Components/IAdministrationClient.cs +++ b/src/Tgstation.Server.Client/IAdministrationClient.cs @@ -1,14 +1,13 @@ using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Api.Models; -using Tgstation.Server.Api.Rights; -namespace Tgstation.Server.Client.Components +namespace Tgstation.Server.Client { /// /// For managing server administration /// - public interface IAdministrationClient : IRightsClient + public interface IAdministrationClient { /// /// Get the represented by the diff --git a/src/Tgstation.Server.Client/Components/IInstanceManagerClient.cs b/src/Tgstation.Server.Client/IInstanceManagerClient.cs similarity index 60% rename from src/Tgstation.Server.Client/Components/IInstanceManagerClient.cs rename to src/Tgstation.Server.Client/IInstanceManagerClient.cs index edc8fb393a..eadc471c0d 100644 --- a/src/Tgstation.Server.Client/Components/IInstanceManagerClient.cs +++ b/src/Tgstation.Server.Client/IInstanceManagerClient.cs @@ -2,37 +2,37 @@ using System.Threading; using System.Threading.Tasks; using Tgstation.Server.Api.Models; -using Tgstation.Server.Api.Rights; +using Tgstation.Server.Client.Components; -namespace Tgstation.Server.Client.Components +namespace Tgstation.Server.Client { /// /// For managing s /// - public interface IInstanceManagerClient : IRightsClient + public interface IInstanceManagerClient { /// /// Get all s for s the user can view /// /// The for the operation - /// A resulting in a of all s for s the user can view - Task> Read(CancellationToken cancellationToken); + /// A resulting in a of all s the user can view + Task> List(CancellationToken cancellationToken); /// /// Create an /// /// The to create. will be ignored /// The for the operation - /// A resulting in for the created - Task Create(Instance instance, CancellationToken cancellationToken); + /// A resulting in the created + Task Create(Instance instance, CancellationToken cancellationToken); /// /// Relocates, renamed, and/or on/offlines an /// /// The to update /// The for the operation - /// A representing the running operation - Task Update(Instance instance, CancellationToken cancellationToken); + /// A resulting in the updated + Task Update(Instance instance, CancellationToken cancellationToken); /// /// Deletes an @@ -41,5 +41,12 @@ namespace Tgstation.Server.Client.Components /// The for the operation /// A representing the running operation Task Delete(Instance instance, CancellationToken cancellationToken); + + /// + /// Create an for a given + /// + /// The to create an for + /// A new + IInstanceClient CreateClient(Instance instance); } } diff --git a/src/Tgstation.Server.Client/IRightsClient.cs b/src/Tgstation.Server.Client/IRightsClient.cs deleted file mode 100644 index bc32b24a35..0000000000 --- a/src/Tgstation.Server.Client/IRightsClient.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System.Threading; -using System.Threading.Tasks; - -namespace Tgstation.Server.Client -{ - /// - /// client that has a bitset - /// - /// The for the - public interface IRightsClient - { - /// - /// Get the for the - /// - /// The for the operation - /// A resulting in the for the - Task Rights(CancellationToken cancellationToken); - } -} diff --git a/src/Tgstation.Server.Client/IServerClient.cs b/src/Tgstation.Server.Client/IServerClient.cs index 510d609aeb..b72a2b80bb 100644 --- a/src/Tgstation.Server.Client/IServerClient.cs +++ b/src/Tgstation.Server.Client/IServerClient.cs @@ -1,7 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; -using Tgstation.Server.Client.Components; +using Tgstation.Server.Api.Models; namespace Tgstation.Server.Client { @@ -10,26 +10,21 @@ namespace Tgstation.Server.Client /// public interface IServerClient : IDisposable { + /// + /// The being used to access the server + /// + Token Token { get; } + /// /// The of the /// - Version Version { get; } + Task Version(CancellationToken cancellationToken); /// - /// The connection timeout in milliseconds. Defaults to 10000 + /// The connection timeout in milliseconds /// int Timeout { get; set; } - /// - /// How long to return initially cached models for in seconds. Defaults to 60 - /// - int CacheExpiry { get; set; } - - /// - /// The requery rate for job updates in milliseconds. Defaults to 5000 - /// - int RequeryRate { get; set; } - /// /// Access the /// @@ -41,15 +36,17 @@ namespace Tgstation.Server.Client IAdministrationClient Administration { get; } /// - /// These generally shouldn't be used in favor of the based polling and s other clients use. However, this is the only way to access jobs the client didn't start in it's current session + /// Access the /// - IJobsClient Jobs { get; } + IUsersClient Users { get; } /// - /// The of the connected server + /// Creates a that completes when a given is completed /// - /// A resulting in the of the connected server - /// Note that if the differs from the 's API functionality will most likely be compromised - Task GetServerVersion(CancellationToken cancellationToken); + /// The to create a for + /// The rate in seconds to poll the server for results + /// The which will trigger the cancellation of the + /// A resulting in a complete + Task CreateTaskFromJob(Job job, int requeryRate, CancellationToken cancellationToken); } } diff --git a/src/Tgstation.Server.Client/IServerClientFactory.cs b/src/Tgstation.Server.Client/IServerClientFactory.cs index b3b3ecb506..a3e1663eaf 100644 --- a/src/Tgstation.Server.Client/IServerClientFactory.cs +++ b/src/Tgstation.Server.Client/IServerClientFactory.cs @@ -1,5 +1,6 @@ using System.Threading; using System.Threading.Tasks; +using Tgstation.Server.Api.Models; namespace Tgstation.Server.Client { @@ -24,11 +25,11 @@ namespace Tgstation.Server.Client /// Create a /// /// The URL to access tgstation-server at - /// The to access the API with + /// The to access the API with /// The initial timeout for the connection /// The for the operation /// A resulting in a new /// If the invalid - Task CreateServerClient(string hostname, string token, int timeout, CancellationToken cancellationToken); + Task CreateServerClient(string hostname, Token token, int timeout, CancellationToken cancellationToken); } } diff --git a/src/Tgstation.Server.Client/IUsersClient.cs b/src/Tgstation.Server.Client/IUsersClient.cs new file mode 100644 index 0000000000..6ea5e5fe31 --- /dev/null +++ b/src/Tgstation.Server.Client/IUsersClient.cs @@ -0,0 +1,35 @@ +using System.Threading; +using System.Threading.Tasks; +using Tgstation.Server.Api.Models; + +namespace Tgstation.Server.Client +{ + /// + /// For managing s + /// + public interface IUsersClient + { + /// + /// Read the current user's information and general rights + /// + /// The for the operation + /// + Task Read(CancellationToken cancellationToken); + + /// + /// Create a new + /// + /// The used to create the new + /// The for the operation + /// The new + Task Create(UserUpdate user, CancellationToken cancellationToken); + + /// + /// Update a + /// + /// The used to update the + /// The for the operation + /// The updated + Task Update(UserUpdate user, CancellationToken cancellationToken); + } +} \ No newline at end of file diff --git a/src/Tgstation.Server.Client/ServerClientFactory.cs b/src/Tgstation.Server.Client/ServerClientFactory.cs index 1d4af06329..bcd8d7db35 100644 --- a/src/Tgstation.Server.Client/ServerClientFactory.cs +++ b/src/Tgstation.Server.Client/ServerClientFactory.cs @@ -1,6 +1,7 @@ using System; using System.Threading; using System.Threading.Tasks; +using Tgstation.Server.Api.Models; namespace Tgstation.Server.Client { @@ -11,6 +12,6 @@ namespace Tgstation.Server.Client public Task CreateServerClient(string hostname, string username, string password, int timeout, CancellationToken cancellationToken) => throw new NotImplementedException(); /// - public Task CreateServerClient(string hostname, string token, int timeout, CancellationToken cancellationToken) => throw new NotImplementedException(); + public Task CreateServerClient(string hostname, Token token, int timeout, CancellationToken cancellationToken) => throw new NotImplementedException(); } }