v1.0 release

This commit is contained in:
Cameron
2024-08-27 03:29:38 -05:00
parent a4403ce17b
commit ef7c3f9dbd
38 changed files with 1172 additions and 73 deletions

View File

@@ -1,18 +1,29 @@
namespace ComiServ.Models
{
public class RequestError
{
using System.Collections;
namespace ComiServ.Models
{
public class RequestError : IEnumerable<string>
{
public static RequestError InvalidHandle => new("Invalid handle");
public static RequestError ComicNotFound => new("Comic not found");
public static RequestError CoverNotFound => new("Cover not found");
public static RequestError PageNotFound => new("Page not found");
public static RequestError FileNotFound => new("File not found");
public static RequestError ThumbnailNotFound => new("Thumbnail not found");
public static RequestError NotAuthenticated => new("Not authenticated");
public static RequestError NoAccess => new("User does not have access to this resource");
public static RequestError UserNotFound => new("User not found");
public static RequestError ComicFileExists => new("Comic file exists so comic not deleted");
public static RequestError UserSpecificEndpoint => new("Endpoint is user-specific, requires login");
public string[] Errors { get; }
public RequestError(string ErrorMessage)
{
Errors = [ErrorMessage];
}
public RequestError()
{
Errors = [];
}
public RequestError(IEnumerable<string> ErrorMessages)
{
Errors = ErrorMessages.ToArray();
@@ -27,8 +38,15 @@
}
public RequestError And(IEnumerable<string> other)
{
return new RequestError(Errors.Concat(other))
;
return new RequestError(Errors.Concat(other));
}
public IEnumerator<string> GetEnumerator()
{
return ((IEnumerable<string>)Errors).GetEnumerator();
}
IEnumerator IEnumerable.GetEnumerator()
{
return GetEnumerator();
}
}
}