Merge pull request #34 from tparnell8/moreConverter

more singleObjectConvert is required
This commit is contained in:
Tommy Parnell
2015-05-10 10:00:41 -04:00
16 changed files with 336 additions and 70 deletions

View File

@@ -8,6 +8,7 @@ using Untappd.Net.Client;
using Untappd.Net.Request; using Untappd.Net.Request;
using Untappd.Net.Responses.BeerInfo; using Untappd.Net.Responses.BeerInfo;
using Untappd.Net.Responses.Actions; using Untappd.Net.Responses.Actions;
using System.IO;
namespace Untappd.Net.UnitTests.Request namespace Untappd.Net.UnitTests.Request
{ {
@@ -27,8 +28,7 @@ namespace Untappd.Net.UnitTests.Request
request.Setup(a => a.AddParameter(It.IsAny<string>(), It.IsAny<string>())); request.Setup(a => a.AddParameter(It.IsAny<string>(), It.IsAny<string>()));
var response = new Mock<IRestResponse>(); var response = new Mock<IRestResponse>();
var obj = JsonConvert.SerializeObject(new BeerInfo()); response.Setup(a => a.Content).Returns(File.ReadAllText("../../Responses/json/BeerInfo.json"));
response.Setup(a => a.Content).Returns(obj);
client.Setup(a => a.Execute(It.IsAny<IRestRequest>())).Callback(() => client.Setup(a => a.Execute(It.IsAny<IRestRequest>())).Callback(() =>
{ {
}).Returns(response.Object); }).Returns(response.Object);

View File

@@ -2,6 +2,7 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using Newtonsoft.Json; using Newtonsoft.Json;
using RestSharp; using RestSharp;
using Untappd.Net.Client;
namespace Untappd.Net.Request namespace Untappd.Net.Request
{ {
@@ -36,6 +37,20 @@ namespace Untappd.Net.Request
} }
internal void ConfigureRequest(IUnAuthenticatedUntappdCredentials credentials, string endPoint, IDictionary<string, object> bodyParameters = null, Method webMethod = Method.GET)
{
ConfigureRequest(endPoint, bodyParameters, webMethod);
Request.AddParameter("client_id", credentials.ClientId);
Request.AddParameter("client_secret", credentials.ClientSecret);
}
internal void ConfigureRequest(IAuthenticatedUntappdCredentials credentials, string endPoint, IDictionary<string, object> bodyParameters = null, Method webMethod = Method.GET)
{
ConfigureRequest(endPoint, bodyParameters, webMethod);
Request.AddParameter("access_token", credentials.AccessToken);
}
private TResult ExecuteRequest<TResult>() private TResult ExecuteRequest<TResult>()
{ {
var response = Client.Execute(Request); var response = Client.Execute(Request);

View File

@@ -18,9 +18,7 @@ namespace Untappd.Net.Request
where TResult : IUnAuthenticatedRequest, new() where TResult : IUnAuthenticatedRequest, new()
{ {
var result = new TResult(); var result = new TResult();
ConfigureRequest(result.EndPoint(urlParameter), bodyParameters); ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters);
Request.AddParameter("client_id", credentials.ClientId);
Request.AddParameter("client_secret", credentials.ClientSecret);
return ExecuteRequest<TResult>(); return ExecuteRequest<TResult>();
} }
@@ -36,9 +34,7 @@ namespace Untappd.Net.Request
where TResult : IUnAuthenticatedRequest, new() where TResult : IUnAuthenticatedRequest, new()
{ {
var result = new TResult(); var result = new TResult();
ConfigureRequest(result.EndPoint(urlParameter), bodyParameters); ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters);
Request.AddParameter("client_id", credentials.ClientId);
Request.AddParameter("client_secret", credentials.ClientSecret);
return ExecuteRequestAsync<TResult>(); return ExecuteRequestAsync<TResult>();
} }
@@ -54,8 +50,7 @@ namespace Untappd.Net.Request
where TResult : IAuthenticatedRequest, new() where TResult : IAuthenticatedRequest, new()
{ {
var result = new TResult(); var result = new TResult();
ConfigureRequest(result.EndPoint(urlParameter), bodyParameters); ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters);
Request.AddParameter("access_token", credentials.AccessToken);
return ExecuteRequest<TResult>(); return ExecuteRequest<TResult>();
} }

View File

@@ -13,8 +13,7 @@ namespace Untappd.Net.Request
/// <returns>returns dynamic since often the return doesn't matter</returns> /// <returns>returns dynamic since often the return doesn't matter</returns>
public dynamic Post(IAuthenticatedUntappdCredentials credentials, IAction action) public dynamic Post(IAuthenticatedUntappdCredentials credentials, IAction action)
{ {
ConfigureRequest(action.EndPoint, action.BodyParameters, action.RequestMethod); ConfigureRequest(credentials, action.EndPoint, action.BodyParameters, action.RequestMethod);
Request.AddParameter("access_token", credentials.AccessToken);
return ExecuteRequest<dynamic>(); return ExecuteRequest<dynamic>();
} }
@@ -26,8 +25,7 @@ namespace Untappd.Net.Request
/// <returns>returns dynamic since often the return doesn't matter</returns> /// <returns>returns dynamic since often the return doesn't matter</returns>
public Task<dynamic> PostAsync(IAuthenticatedUntappdCredentials credentials, IAction action) public Task<dynamic> PostAsync(IAuthenticatedUntappdCredentials credentials, IAction action)
{ {
ConfigureRequest(action.EndPoint, action.BodyParameters, action.RequestMethod); ConfigureRequest(credentials, action.EndPoint, action.BodyParameters, action.RequestMethod);
Request.AddParameter("access_token", credentials.AccessToken);
return ExecuteRequestAsync<dynamic>(); return ExecuteRequestAsync<dynamic>();
} }
} }

View File

@@ -128,6 +128,7 @@ namespace Untappd.Net.Responses.BeerInfo
public string CountryName { get; set; } public string CountryName { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact>))]
public Contact Contact { get; set; } public Contact Contact { get; set; }
[JsonProperty("location")] [JsonProperty("location")]
@@ -241,6 +242,7 @@ namespace Untappd.Net.Responses.BeerInfo
public string CountryName { get; set; } public string CountryName { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact2>))]
public Contact2 Contact { get; set; } public Contact2 Contact { get; set; }
[JsonProperty("location")] [JsonProperty("location")]
@@ -350,6 +352,7 @@ namespace Untappd.Net.Responses.BeerInfo
public int IsPrivate { get; set; } public int IsPrivate { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact>))]
public object Contact { get; set; } public object Contact { get; set; }
} }
@@ -444,6 +447,7 @@ namespace Untappd.Net.Responses.BeerInfo
public string CountryName { get; set; } public string CountryName { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact3>))]
public Contact3 Contact { get; set; } public Contact3 Contact { get; set; }
[JsonProperty("location")] [JsonProperty("location")]
@@ -758,6 +762,7 @@ namespace Untappd.Net.Responses.BeerInfo
public string CountryName { get; set; } public string CountryName { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact4>))]
public Contact4 Contact { get; set; } public Contact4 Contact { get; set; }
[JsonProperty("location")] [JsonProperty("location")]
@@ -910,6 +915,7 @@ namespace Untappd.Net.Responses.BeerInfo
public Media Media { get; set; } public Media Media { get; set; }
[JsonProperty("checkins")] [JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; } public Checkins Checkins { get; set; }
[JsonProperty("similar")] [JsonProperty("similar")]
@@ -937,6 +943,7 @@ namespace Untappd.Net.Responses.BeerInfo
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]

View File

@@ -264,6 +264,7 @@ namespace Untappd.Net.Responses.BeerSearch
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]

View File

@@ -892,6 +892,7 @@ namespace Untappd.Net.Responses.BreweryInfo
public Media Media { get; set; } public Media Media { get; set; }
[JsonProperty("checkins")] [JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; } public Checkins Checkins { get; set; }
[JsonProperty("beer_list")] [JsonProperty("beer_list")]
@@ -913,6 +914,7 @@ namespace Untappd.Net.Responses.BreweryInfo
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]

View File

@@ -152,6 +152,7 @@ namespace Untappd.Net.Responses.BrewerySearch
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]

View File

@@ -502,6 +502,7 @@ namespace Untappd.Net.Responses.Feeds.ActivityFeed
public bool Mg { get; set; } public bool Mg { get; set; }
[JsonProperty("checkins")] [JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; } public Checkins Checkins { get; set; }
[JsonProperty("pagination")] [JsonProperty("pagination")]

View File

@@ -472,6 +472,7 @@ namespace Untappd.Net.Responses.Feeds.UserActivityFeed
public Pagination Pagination { get; set; } public Pagination Pagination { get; set; }
[JsonProperty("checkins")] [JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; } public Checkins Checkins { get; set; }
} }

View File

@@ -213,6 +213,7 @@ namespace Untappd.Net.Responses.UserBadges
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]

View File

@@ -231,6 +231,7 @@ namespace Untappd.Net.Responses.UserDistinctBeer
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]

View File

@@ -142,6 +142,7 @@ namespace Untappd.Net.Responses.UserFriends
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]

View File

@@ -5,7 +5,7 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.UserInfo namespace Untappd.Net.Responses.UserInfo
{ {
public sealed class ResponseTime public class ResponseTime
{ {
[JsonProperty("time")] [JsonProperty("time")]
@@ -31,12 +31,6 @@ namespace Untappd.Net.Responses.UserInfo
[JsonProperty("code")] [JsonProperty("code")]
public int Code { get; set; } public int Code { get; set; }
[JsonProperty("error_detail")]
public string ErrorDetail { get; set; }
[JsonProperty("error_type")]
public string ErrorType { get; set; }
[JsonProperty("response_time")] [JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; } public ResponseTime ResponseTime { get; set; }
@@ -44,6 +38,35 @@ namespace Untappd.Net.Responses.UserInfo
public InitTime InitTime { get; set; } public InitTime InitTime { get; set; }
} }
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
public class Stats public class Stats
{ {
@@ -182,9 +205,6 @@ namespace Untappd.Net.Responses.UserInfo
[JsonProperty("facebook")] [JsonProperty("facebook")]
public int Facebook { get; set; } public int Facebook { get; set; }
[JsonProperty("twitter")]
public string Twitter { get; set; }
} }
public class User2 public class User2
@@ -215,7 +235,7 @@ namespace Untappd.Net.Responses.UserInfo
public string Bio { get; set; } public string Bio { get; set; }
[JsonProperty("relationship")] [JsonProperty("relationship")]
public object Relationship { get; set; } public string Relationship { get; set; }
[JsonProperty("user_avatar")] [JsonProperty("user_avatar")]
public string UserAvatar { get; set; } public string UserAvatar { get; set; }
@@ -315,6 +335,118 @@ namespace Untappd.Net.Responses.UserInfo
public int BreweryActive { get; set; } public int BreweryActive { get; set; }
} }
public class Item3
{
[JsonProperty("category_name")]
public string CategoryName { get; set; }
[JsonProperty("category_id")]
public string CategoryId { get; set; }
[JsonProperty("is_primary")]
public bool IsPrimary { get; set; }
}
public class Categories
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("items")]
public IList<Item3> Items { get; set; }
}
public class Location3
{
[JsonProperty("venue_address")]
public string VenueAddress { get; set; }
[JsonProperty("venue_city")]
public string VenueCity { get; set; }
[JsonProperty("venue_state")]
public string VenueState { get; set; }
[JsonProperty("venue_country")]
public string VenueCountry { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("lng")]
public double Lng { get; set; }
}
public class Contact4
{
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("venue_url")]
public string VenueUrl { get; set; }
}
public class Foursquare
{
[JsonProperty("foursquare_id")]
public string FoursquareId { get; set; }
[JsonProperty("foursquare_url")]
public string FoursquareUrl { get; set; }
}
public class VenueIcon
{
[JsonProperty("sm")]
public string Sm { get; set; }
[JsonProperty("md")]
public string Md { get; set; }
[JsonProperty("lg")]
public string Lg { get; set; }
}
public class Venue
{
[JsonProperty("venue_id")]
public int VenueId { get; set; }
[JsonProperty("venue_name")]
public string VenueName { get; set; }
[JsonProperty("primary_category")]
public string PrimaryCategory { get; set; }
[JsonProperty("parent_category_id")]
public string ParentCategoryId { get; set; }
[JsonProperty("categories")]
public Categories Categories { get; set; }
[JsonProperty("location")]
public Location3 Location { get; set; }
[JsonProperty("contact")]
public Contact4 Contact { get; set; }
[JsonProperty("public_venue")]
public bool PublicVenue { get; set; }
[JsonProperty("foursquare")]
public Foursquare Foursquare { get; set; }
[JsonProperty("venue_icon")]
public VenueIcon VenueIcon { get; set; }
}
public class Comments public class Comments
{ {
@@ -359,10 +491,10 @@ namespace Untappd.Net.Responses.UserInfo
public string AccountType { get; set; } public string AccountType { get; set; }
[JsonProperty("brewery_details")] [JsonProperty("brewery_details")]
public object BreweryDetails { get; set; } public IList<object> BreweryDetails { get; set; }
} }
public class Item3 public class Item4
{ {
[JsonProperty("uid")] [JsonProperty("uid")]
@@ -391,10 +523,10 @@ namespace Untappd.Net.Responses.UserInfo
public int Count { get; set; } public int Count { get; set; }
[JsonProperty("auth_toast")] [JsonProperty("auth_toast")]
public object AuthToast { get; set; } public bool AuthToast { get; set; }
[JsonProperty("items")] [JsonProperty("items")]
public IList<Item3> Items { get; set; } public IList<Item4> Items { get; set; }
} }
public class Photo public class Photo
@@ -413,7 +545,7 @@ namespace Untappd.Net.Responses.UserInfo
public string PhotoImgOg { get; set; } public string PhotoImgOg { get; set; }
} }
public class Item4 public class Item5
{ {
[JsonProperty("photo_id")] [JsonProperty("photo_id")]
@@ -430,7 +562,7 @@ namespace Untappd.Net.Responses.UserInfo
public int Count { get; set; } public int Count { get; set; }
[JsonProperty("items")] [JsonProperty("items")]
public IList<Item4> Items { get; set; } public IList<Item5> Items { get; set; }
} }
public class Source public class Source
@@ -456,7 +588,7 @@ namespace Untappd.Net.Responses.UserInfo
public string Lg { get; set; } public string Lg { get; set; }
} }
public class Item5 public class Item6
{ {
[JsonProperty("badge_id")] [JsonProperty("badge_id")]
@@ -485,7 +617,7 @@ namespace Untappd.Net.Responses.UserInfo
public int Count { get; set; } public int Count { get; set; }
[JsonProperty("items")] [JsonProperty("items")]
public IList<Item5> Items { get; set; } public IList<Item6> Items { get; set; }
} }
public class Item2 public class Item2
@@ -513,7 +645,8 @@ namespace Untappd.Net.Responses.UserInfo
public Brewery2 Brewery { get; set; } public Brewery2 Brewery { get; set; }
[JsonProperty("venue")] [JsonProperty("venue")]
public object Venue { get; set; } [JsonConverter(typeof(SingleObjectArrayConverter<Venue>))]
public Venue Venue { get; set; }
[JsonProperty("comments")] [JsonProperty("comments")]
public Comments Comments { get; set; } public Comments Comments { get; set; }
@@ -616,7 +749,7 @@ namespace Untappd.Net.Responses.UserInfo
public bool WishList { get; set; } public bool WishList { get; set; }
} }
public class Contact4 public class Contact5
{ {
[JsonProperty("twitter")] [JsonProperty("twitter")]
@@ -632,7 +765,7 @@ namespace Untappd.Net.Responses.UserInfo
public string Url { get; set; } public string Url { get; set; }
} }
public class Location3 public class Location4
{ {
[JsonProperty("brewery_city")] [JsonProperty("brewery_city")]
@@ -667,16 +800,128 @@ namespace Untappd.Net.Responses.UserInfo
public string CountryName { get; set; } public string CountryName { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
public Contact4 Contact { get; set; } public Contact5 Contact { get; set; }
[JsonProperty("location")] [JsonProperty("location")]
public Location3 Location { get; set; } public Location4 Location { get; set; }
[JsonProperty("brewery_active")] [JsonProperty("brewery_active")]
public int BreweryActive { get; set; } public int BreweryActive { get; set; }
} }
public class Item6 public class Item8
{
[JsonProperty("category_name")]
public string CategoryName { get; set; }
[JsonProperty("category_id")]
public string CategoryId { get; set; }
[JsonProperty("is_primary")]
public bool IsPrimary { get; set; }
}
public class Categories2
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("items")]
public IList<Item8> Items { get; set; }
}
public class Location5
{
[JsonProperty("venue_address")]
public string VenueAddress { get; set; }
[JsonProperty("venue_city")]
public string VenueCity { get; set; }
[JsonProperty("venue_state")]
public string VenueState { get; set; }
[JsonProperty("venue_country")]
public string VenueCountry { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("lng")]
public double Lng { get; set; }
}
public class Contact6
{
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("venue_url")]
public string VenueUrl { get; set; }
}
public class Foursquare2
{
[JsonProperty("foursquare_id")]
public string FoursquareId { get; set; }
[JsonProperty("foursquare_url")]
public string FoursquareUrl { get; set; }
}
public class VenueIcon2
{
[JsonProperty("sm")]
public string Sm { get; set; }
[JsonProperty("md")]
public string Md { get; set; }
[JsonProperty("lg")]
public string Lg { get; set; }
}
public class Venue2
{
[JsonProperty("venue_id")]
public int VenueId { get; set; }
[JsonProperty("venue_name")]
public string VenueName { get; set; }
[JsonProperty("primary_category")]
public string PrimaryCategory { get; set; }
[JsonProperty("parent_category_id")]
public string ParentCategoryId { get; set; }
[JsonProperty("categories")]
public Categories2 Categories { get; set; }
[JsonProperty("location")]
public Location5 Location { get; set; }
[JsonProperty("contact")]
public Contact6 Contact { get; set; }
[JsonProperty("public_venue")]
public bool PublicVenue { get; set; }
[JsonProperty("foursquare")]
public Foursquare2 Foursquare { get; set; }
[JsonProperty("venue_icon")]
public VenueIcon2 VenueIcon { get; set; }
}
public class Item7
{ {
[JsonProperty("photo_id")] [JsonProperty("photo_id")]
@@ -701,7 +946,7 @@ namespace Untappd.Net.Responses.UserInfo
public Brewery3 Brewery { get; set; } public Brewery3 Brewery { get; set; }
[JsonProperty("venue")] [JsonProperty("venue")]
public object Venue { get; set; } public Venue2 Venue { get; set; }
} }
public class Media2 public class Media2
@@ -711,54 +956,63 @@ namespace Untappd.Net.Responses.UserInfo
public int Count { get; set; } public int Count { get; set; }
[JsonProperty("items")] [JsonProperty("items")]
public IList<Item6> Items { get; set; } public IList<Item7> Items { get; set; }
} }
public class Contact5 public class Contact7
{ {
[JsonProperty("facebook")] [JsonProperty("facebook")]
public int Facebook { get; set; } public int Facebook { get; set; }
[JsonProperty("twitter")]
public string Twitter { get; set; }
} }
public class Badge public class Badge
{ {
[JsonProperty("badges_to_facebook")] [JsonProperty("badges_to_facebook")]
public int BadgesToFacebook { get; set; } public int BadgesToFacebook { get; set; }
[JsonProperty("badges_to_twitter")] [JsonProperty("badges_to_twitter")]
public int BadgesToTwitter { get; set; } public int BadgesToTwitter { get; set; }
} }
public class Checkin public class Checkin
{ {
[JsonProperty("checkin_to_facebook")] [JsonProperty("checkin_to_facebook")]
public int CheckinToFacebook { get; set; } public int CheckinToFacebook { get; set; }
[JsonProperty("checkin_to_twitter")] [JsonProperty("checkin_to_twitter")]
public int CheckinToTwitter { get; set; } public int CheckinToTwitter { get; set; }
[JsonProperty("checkin_to_foursquare")] [JsonProperty("checkin_to_foursquare")]
public int CheckinToFoursquare { get; set; } public int CheckinToFoursquare { get; set; }
} }
public class Navigation public class Navigation
{ {
[JsonProperty("default_to_checkin")] [JsonProperty("default_to_checkin")]
public int DefaultToCheckin { get; set; } public int DefaultToCheckin { get; set; }
} }
public class Settings public class Settings
{ {
[JsonProperty("badge")] [JsonProperty("badge")]
public Badge Badge { get; set; } public Badge Badge { get; set; }
[JsonProperty("checkin")] [JsonProperty("checkin")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkin>))]
public Checkin Checkin { get; set; } public Checkin Checkin { get; set; }
[JsonProperty("navigation")] [JsonProperty("navigation")]
public Navigation Navigation { get; set; } public Navigation Navigation { get; set; }
[JsonProperty("email_address")] [JsonProperty("email_address")]
public string EmailAddress { get; set; } public string EmailAddress { get; set; }
} }
public class User public class User
{ {
@@ -805,7 +1059,7 @@ namespace Untappd.Net.Responses.UserInfo
public int IsSupporter { get; set; } public int IsSupporter { get; set; }
[JsonProperty("relationship")] [JsonProperty("relationship")]
public object Relationship { get; set; } public string Relationship { get; set; }
[JsonProperty("untappd_url")] [JsonProperty("untappd_url")]
public string UntappdUrl { get; set; } public string UntappdUrl { get; set; }
@@ -820,13 +1074,14 @@ namespace Untappd.Net.Responses.UserInfo
public RecentBrews RecentBrews { get; set; } public RecentBrews RecentBrews { get; set; }
[JsonProperty("checkins")] [JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; } public Checkins Checkins { get; set; }
[JsonProperty("media")] [JsonProperty("media")]
public Media2 Media { get; set; } public Media2 Media { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
public Contact5 Contact { get; set; } public Contact7 Contact { get; set; }
[JsonProperty("date_joined")] [JsonProperty("date_joined")]
public string DateJoined { get; set; } public string DateJoined { get; set; }
@@ -835,28 +1090,6 @@ namespace Untappd.Net.Responses.UserInfo
public Settings Settings { get; set; } public Settings Settings { get; set; }
} }
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("news")]
public int news { get; set; }
}
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
public class Response public class Response
{ {

View File

@@ -223,6 +223,7 @@ namespace Untappd.Net.Responses.UserWishlist
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]

View File

@@ -271,6 +271,7 @@ namespace Untappd.Net.Responses.VenueInfo
public string CountryName { get; set; } public string CountryName { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact2>))]
public Contact2 Contact { get; set; } public Contact2 Contact { get; set; }
[JsonProperty("location")] [JsonProperty("location")]
@@ -405,6 +406,7 @@ namespace Untappd.Net.Responses.VenueInfo
public Location3 Location { get; set; } public Location3 Location { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact3>))]
public Contact3 Contact { get; set; } public Contact3 Contact { get; set; }
[JsonProperty("public_venue")] [JsonProperty("public_venue")]
@@ -562,6 +564,7 @@ namespace Untappd.Net.Responses.VenueInfo
public string CountryName { get; set; } public string CountryName { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact4>))]
public Contact4 Contact { get; set; } public Contact4 Contact { get; set; }
[JsonProperty("location")] [JsonProperty("location")]
@@ -671,6 +674,7 @@ namespace Untappd.Net.Responses.VenueInfo
public Location5 Location { get; set; } public Location5 Location { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact5>))]
public Contact5 Contact { get; set; } public Contact5 Contact { get; set; }
[JsonProperty("public_venue")] [JsonProperty("public_venue")]
@@ -1074,6 +1078,7 @@ namespace Untappd.Net.Responses.VenueInfo
public string CountryName { get; set; } public string CountryName { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact6>))]
public Contact6 Contact { get; set; } public Contact6 Contact { get; set; }
[JsonProperty("location")] [JsonProperty("location")]
@@ -1162,6 +1167,7 @@ namespace Untappd.Net.Responses.VenueInfo
public Location Location { get; set; } public Location Location { get; set; }
[JsonProperty("contact")] [JsonProperty("contact")]
[JsonConverter(typeof(SingleObjectArrayConverter<Contact>))]
public Contact Contact { get; set; } public Contact Contact { get; set; }
[JsonProperty("foursquare")] [JsonProperty("foursquare")]
@@ -1171,6 +1177,7 @@ namespace Untappd.Net.Responses.VenueInfo
public Media Media { get; set; } public Media Media { get; set; }
[JsonProperty("checkins")] [JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; } public Checkins Checkins { get; set; }
[JsonProperty("top_beers")] [JsonProperty("top_beers")]
@@ -1192,6 +1199,7 @@ namespace Untappd.Net.Responses.VenueInfo
public Meta Meta { get; set; } public Meta Meta { get; set; }
[JsonProperty("notifications")] [JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; } public Notifications Notifications { get; set; }
[JsonProperty("response")] [JsonProperty("response")]