IW4M-Admin/Application/API/Master/IMasterApi.cs

68 lines
1.9 KiB
C#
Raw Normal View History

using System.Collections.Generic;
2018-04-18 16:46:53 -04:00
using System.Threading.Tasks;
using Newtonsoft.Json;
using RestEase;
using SharedLibraryCore.Helpers;
2018-04-18 16:46:53 -04:00
namespace IW4MAdmin.Application.API.Master
{
public class AuthenticationId
{
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; }
}
public class VersionInfo
{
[JsonProperty("current-version-stable")]
[JsonConverter(typeof(BuildNumberJsonConverter))]
public BuildNumber CurrentVersionStable { get; set; }
[JsonProperty("current-version-prerelease")]
[JsonConverter(typeof(BuildNumberJsonConverter))]
public BuildNumber CurrentVersionPrerelease { get; set; }
}
public class ResultMessage
{
[JsonProperty("message")]
public string Message { get; set; }
}
/// <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/")]
[AllowAnyStatusCode]
Task<Response<ResultMessage>> AddInstance([Body] ApiInstance instance);
2018-04-18 16:46:53 -04:00
[Put("instance/{id}")]
[AllowAnyStatusCode]
Task<Response<ResultMessage>> UpdateInstance([Path] string id, [Body] ApiInstance instance);
[Get("version/{apiVersion}")]
Task<VersionInfo> GetVersion([Path] int apiVersion);
[Get("localization")]
Task<List<SharedLibraryCore.Localization.Layout>> GetLocalization();
[Get("localization/{languageTag}")]
Task<SharedLibraryCore.Localization.Layout> GetLocalization([Path("languageTag")] string languageTag);
2018-04-18 16:46:53 -04:00
}
}