mirror of
https://github.com/Tribufu/ServerManagers
synced 2026-08-09 04:31:06 +00:00
Web APi
This commit is contained in:
parent
f6ae6364a9
commit
2e8596e0b7
16 changed files with 588 additions and 1 deletions
|
|
@ -0,0 +1,16 @@
|
|||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ServerManager.WebApplication.Models.ApiVersion1
|
||||
{
|
||||
public class ErrorResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// List of errors.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("List of errors.")]
|
||||
public ICollection<string> Errors { get; set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,15 @@
|
|||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace ServerManager.WebApplication.Models.ApiVersion1
|
||||
{
|
||||
public class ServerStatusResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// True if the server is available; otherwise false.
|
||||
/// </summary>
|
||||
[Required]
|
||||
[Description("True if the server is available; otherwise false.")]
|
||||
public string Available { get; set; } = false.ToString();
|
||||
}
|
||||
}
|
||||
13
src/ServerManager.WebApplication/Models/Data/ManagerCode.cs
Normal file
13
src/ServerManager.WebApplication/Models/Data/ManagerCode.cs
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ServerManager.WebApplication.Models.Data
|
||||
{
|
||||
[DataContract]
|
||||
public class ManagerCode
|
||||
{
|
||||
[DataMember]
|
||||
public string Name { get; set; } = string.Empty;
|
||||
[DataMember]
|
||||
public string Code { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace ServerManager.WebApplication.Models
|
||||
{
|
||||
public class ServerManagerApiException : Exception
|
||||
{
|
||||
public ServerManagerApiException() : base()
|
||||
{ }
|
||||
|
||||
public ServerManagerApiException(int statusCode, ICollection<string> messages) : base()
|
||||
{
|
||||
StatusCode = statusCode;
|
||||
Messages = messages;
|
||||
}
|
||||
|
||||
public ServerManagerApiException(int statusCode, ICollection<string> messages, Exception innerException) : base(null, innerException)
|
||||
{
|
||||
StatusCode = statusCode;
|
||||
Messages = messages;
|
||||
}
|
||||
|
||||
protected ServerManagerApiException(SerializationInfo info, StreamingContext context) : base(info, context)
|
||||
{ }
|
||||
|
||||
public int StatusCode { get; private set; } = 0;
|
||||
|
||||
public ICollection<string> Messages { get; private set; } = new List<string>();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue