lucidiot/HabitSharp
lucidiot
/
HabitSharp
Archived
1
0
Fork 0

Handle URI parameter errors returned by the API

This commit is contained in:
Lucidiot 2018-09-01 16:11:48 +02:00
parent 337b0a183a
commit b0a61ddbdc
No known key found for this signature in database
GPG Key ID: AE3F7205692FA205
2 changed files with 33 additions and 0 deletions

22
ParamError.cs Normal file
View File

@ -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; }
}
}

View File

@ -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>> { }