Handle URI parameter errors returned by the API
This commit is contained in:
parent
337b0a183a
commit
b0a61ddbdc
|
@ -0,0 +1,22 @@
|
|||
|
||||
namespace HabitSharp {
|
||||
/// <summary>
|
||||
/// Describes a Habitica request parameter error.
|
||||
/// </summary>
|
||||
public class ParamError {
|
||||
/// <summary>
|
||||
/// The problematic URI parameter name.
|
||||
/// </summary>
|
||||
public string Param { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The given parameter value.
|
||||
/// </summary>
|
||||
public string Value { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// A message describing the nature of the parameter error.
|
||||
/// </summary>
|
||||
public string Message { get; set; }
|
||||
}
|
||||
}
|
11
Result.cs
11
Result.cs
|
@ -1,10 +1,21 @@
|
|||
using System.Collections.Generic;
|
||||
using RestSharp.Deserializers;
|
||||
|
||||
namespace HabitSharp {
|
||||
public class Result<T> {
|
||||
public bool Success { get; set; }
|
||||
|
||||
public T Data { get; set; }
|
||||
|
||||
public List<Notification> Notifications { get; set; }
|
||||
|
||||
public string Error { get; set; }
|
||||
|
||||
[DeserializeAs(Name="message")]
|
||||
public string ErrorMessage { get; set; }
|
||||
|
||||
[DeserializeAs(Name="errors")]
|
||||
public List<ParamError> ParamErrors { get; set; }
|
||||
}
|
||||
|
||||
public class ListResult<T> : Result<List<T>> { }
|
||||
|
|
Reference in New Issue