2020-10-24 16:02:38 -04:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2018-04-18 16:46:53 -04:00
|
|
|
|
using System.Threading.Tasks;
|
2020-11-11 18:31:26 -05:00
|
|
|
|
using IW4MAdmin.Application.Misc;
|
2018-04-18 16:46:53 -04:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using RestEase;
|
2020-01-11 21:32:27 -05:00
|
|
|
|
using SharedLibraryCore.Helpers;
|
2018-04-18 16:46:53 -04:00
|
|
|
|
|
|
|
|
|
namespace IW4MAdmin.Application.API.Master
|
|
|
|
|
{
|
|
|
|
|
public class AuthenticationId
|
2018-05-20 22:35:56 -04:00
|
|
|
|
{
|
2018-04-18 16:46:53 -04:00
|
|
|
|
[JsonProperty("id")]
|
|
|
|
|
public string Id { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class TokenId
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("access_token")]
|
|
|
|
|
public string AccessToken { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-19 01:48:14 -04:00
|
|
|
|
public class VersionInfo
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("current-version-stable")]
|
2020-01-11 21:32:27 -05:00
|
|
|
|
[JsonConverter(typeof(BuildNumberJsonConverter))]
|
|
|
|
|
public BuildNumber CurrentVersionStable { get; set; }
|
|
|
|
|
|
2018-04-19 01:48:14 -04:00
|
|
|
|
[JsonProperty("current-version-prerelease")]
|
2020-01-11 21:32:27 -05:00
|
|
|
|
[JsonConverter(typeof(BuildNumberJsonConverter))]
|
|
|
|
|
public BuildNumber CurrentVersionPrerelease { get; set; }
|
2018-04-19 01:48:14 -04:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ResultMessage
|
|
|
|
|
{
|
|
|
|
|
[JsonProperty("message")]
|
|
|
|
|
public string Message { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-24 16:02:38 -04:00
|
|
|
|
public class PluginSubscriptionContent
|
|
|
|
|
{
|
|
|
|
|
public string Content { get; set; }
|
|
|
|
|
public PluginType Type { get; set; }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
2020-01-11 21:32:27 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Defines the capabilities of the master API
|
|
|
|
|
/// </summary>
|
2018-04-18 16:46:53 -04:00
|
|
|
|
[Header("User-Agent", "IW4MAdmin-RestEase")]
|
|
|
|
|
public interface IMasterApi
|
|
|
|
|
{
|
|
|
|
|
[Header("Authorization")]
|
|
|
|
|
string AuthorizationToken { get; set; }
|
|
|
|
|
|
|
|
|
|
[Post("authenticate")]
|
|
|
|
|
Task<TokenId> Authenticate([Body] AuthenticationId Id);
|
|
|
|
|
|
|
|
|
|
[Post("instance/")]
|
2020-01-11 21:32:27 -05:00
|
|
|
|
[AllowAnyStatusCode]
|
|
|
|
|
Task<Response<ResultMessage>> AddInstance([Body] ApiInstance instance);
|
2018-04-18 16:46:53 -04:00
|
|
|
|
|
|
|
|
|
[Put("instance/{id}")]
|
2020-01-11 21:32:27 -05:00
|
|
|
|
[AllowAnyStatusCode]
|
|
|
|
|
Task<Response<ResultMessage>> UpdateInstance([Path] string id, [Body] ApiInstance instance);
|
2018-04-19 01:48:14 -04:00
|
|
|
|
|
2020-01-11 21:32:27 -05:00
|
|
|
|
[Get("version/{apiVersion}")]
|
|
|
|
|
Task<VersionInfo> GetVersion([Path] int apiVersion);
|
2018-05-08 00:58:46 -04:00
|
|
|
|
|
|
|
|
|
[Get("localization")]
|
2018-05-20 22:35:56 -04:00
|
|
|
|
Task<List<SharedLibraryCore.Localization.Layout>> GetLocalization();
|
|
|
|
|
|
|
|
|
|
[Get("localization/{languageTag}")]
|
|
|
|
|
Task<SharedLibraryCore.Localization.Layout> GetLocalization([Path("languageTag")] string languageTag);
|
2020-10-24 16:02:38 -04:00
|
|
|
|
|
|
|
|
|
[Get("plugin_subscriptions")]
|
|
|
|
|
Task<IEnumerable<PluginSubscriptionContent>> GetPluginSubscription([Query("instance_id")] Guid instanceId, [Query("subscription_id")] string subscription_id);
|
2018-04-18 16:46:53 -04:00
|
|
|
|
}
|
|
|
|
|
}
|