37 lines
1.1 KiB
C#
37 lines
1.1 KiB
C#
using Newtonsoft.Json;
|
|
using System.Collections.Generic;
|
|
|
|
namespace Knoks.Api.Entities
|
|
{
|
|
public enum ApiErrorType : int
|
|
{
|
|
Undefined = -1,
|
|
InvalidApiIdentifier = 1,
|
|
ApiConsumerIsDisabled = 2,
|
|
InvalidUsernameOrPassword = 3,
|
|
InvalidPinCode = 4,
|
|
Validation = 5,
|
|
Authorization = 6,
|
|
PasswordIsNotStrong = 7,
|
|
UserNameAlreadyExists = 8,
|
|
UserEmailAlreadyExists = 9,
|
|
UserEmailDoesNotExist = 10
|
|
}
|
|
|
|
public class ApiError
|
|
{
|
|
public ApiErrorType Id { get; }
|
|
public string Msg { get; }
|
|
[JsonIgnore]
|
|
public IDictionary<string, string> Errors { get; }
|
|
[JsonProperty("errors", NullValueHandling = NullValueHandling.Ignore)]
|
|
internal PropertyDictionary<string> _Errors { get { return Errors == null ? null : new PropertyDictionary<string>(Errors); } }
|
|
public ApiError(ApiErrorType id, string msg, IDictionary<string, string> errors = null)
|
|
{
|
|
Id = id;
|
|
Msg = msg;
|
|
Errors = errors;
|
|
}
|
|
}
|
|
}
|