commitAuth1
This commit is contained in:
@@ -7,9 +7,9 @@ using Untappd.Client.Net;
|
||||
|
||||
namespace Untappd.Net.Client
|
||||
{
|
||||
public class AuthenticatedUntappdCredentials : UnAuthenticatedUntappdCredentials
|
||||
public class AuthenticatedUntappdCredentials : UntappdCredentials, IAuthenticatedUntappdCredentials
|
||||
{
|
||||
internal string AccessToken { get; private set; }
|
||||
public string AccessToken { get; private set; }
|
||||
/// <summary>
|
||||
/// Pass your authenticated access token
|
||||
/// </summary>
|
||||
|
||||
@@ -7,28 +7,16 @@ using Untappd.Net.Client;
|
||||
|
||||
namespace Untappd.Client.Net
|
||||
{
|
||||
public class UnAuthenticatedUntappdCredentials : IUntappdCredentials
|
||||
public class UnAuthenticatedUntappdCredentials : UntappdCredentials, IUnAuthenticadedUntappdCredentials
|
||||
{
|
||||
public string ClientId { get; private set; }
|
||||
public string ClientSecret { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// UnAuthenticated request. Pass your API id and secret
|
||||
/// </summary>
|
||||
/// <param name="clientId"></param>
|
||||
/// <param name="clientSecret"></param>
|
||||
public UnAuthenticatedUntappdCredentials(string clientId, string clientSecret)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(clientId))
|
||||
{
|
||||
throw new ArgumentNullException("clientId");
|
||||
}
|
||||
if (string.IsNullOrWhiteSpace(clientSecret))
|
||||
{
|
||||
throw new ArgumentNullException("clientSecret");
|
||||
}
|
||||
ClientId = string.Copy(clientId);
|
||||
ClientSecret = string.Copy(clientSecret);
|
||||
: base(clientId, clientSecret)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.*")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
|
||||
@@ -14,9 +14,14 @@ namespace Untappd.Net.Request
|
||||
/// </summary>
|
||||
/// <param name="parameter"></param>
|
||||
/// <returns></returns>
|
||||
internal string EndPoint(string parameter)
|
||||
internal string EndPoint(string parameter = "")
|
||||
{
|
||||
return string.Format(_EndPoint, parameter);
|
||||
if (!String.IsNullOrEmpty(parameter))
|
||||
{
|
||||
parameter = string.Format("/{0}", parameter);
|
||||
return string.Format(_EndPoint, parameter);
|
||||
}
|
||||
return string.Format(_EndPoint, string.Empty);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Untappd.Net.Request
|
||||
/// <param name="urlParameter">this is the main parameter for a request. ie v4/user/checkins/urlParameter. Consult the untappd docs, this can be null for a few requests</param>
|
||||
/// <param name="bodyParameters">Any additional params you wish to add to the request</param>
|
||||
/// <returns></returns>
|
||||
public TResult Get<TResult> (IUntappdCredentials credentials, string urlParameter, IDictionary<string, string> bodyParameters = null)
|
||||
public TResult Get<TResult> (IUnAuthenticadedUntappdCredentials credentials, string urlParameter, IDictionary<string, string> bodyParameters = null)
|
||||
where TResult : UnAuthenticatedRequest,new()
|
||||
{
|
||||
// throw new NotImplementedException();
|
||||
@@ -40,10 +40,20 @@ namespace Untappd.Net.Request
|
||||
|
||||
}
|
||||
|
||||
public TResult Get<TResult>(IAuthenticatedUntappdCredentials credentials, string parameter)
|
||||
public TResult Get<TResult>(IAuthenticatedUntappdCredentials credentials, string parameter = "", IDictionary<string, string> bodyParameters = null)
|
||||
where TResult : AuthenticatedRequest, new()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
var result = new TResult();
|
||||
var client = new RestClient(Constants.BaseRequestString);
|
||||
var request = new RestRequest(result.EndPoint(parameter), Method.GET);
|
||||
request.AddParameter("access_token", credentials.AccessToken);
|
||||
if (bodyParameters != null)
|
||||
foreach (var param in bodyParameters)
|
||||
request.AddParameter(param.Key, param.Value);
|
||||
|
||||
var resp = client.Execute(request);
|
||||
var jsonresult = JsonConvert.DeserializeObject<TResult>(resp.Content);
|
||||
return jsonresult;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -159,7 +159,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public string BeerStyle { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
@@ -362,7 +362,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public string BeerStyle { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
@@ -623,7 +623,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public string BeerLabel { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
@@ -823,7 +823,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public Brewery Brewery { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
|
||||
@@ -70,7 +70,7 @@ namespace Untappd.Net.Responses.BeerSearch
|
||||
public string BeerStyle { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
@@ -196,7 +196,7 @@ namespace Untappd.Net.Responses.BeerSearch
|
||||
public string BeerStyle { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
|
||||
@@ -176,7 +176,7 @@ namespace Untappd.Net.Responses.BreweryInfo
|
||||
public string BeerStyle { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
@@ -364,7 +364,7 @@ namespace Untappd.Net.Responses.BreweryInfo
|
||||
public string BeerStyle { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
@@ -764,7 +764,7 @@ namespace Untappd.Net.Responses.BreweryInfo
|
||||
public string CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace Untappd.Net.Responses.Feeds
|
||||
public double BeerAbv { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace Untappd.Net.Responses.UserDistinctBeer
|
||||
public string CreatedAt { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
@@ -195,6 +195,28 @@ namespace Untappd.Net.Responses.UserDistinctBeer
|
||||
public IList<Item> Items { 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
|
||||
{
|
||||
|
||||
@@ -207,20 +229,16 @@ namespace Untappd.Net.Responses.UserDistinctBeer
|
||||
|
||||
public class UserDistinctBeers : UnAuthenticatedRequest
|
||||
{
|
||||
protected override string _EndPoint { get { return "v4/user/beers{0}"; } }
|
||||
|
||||
[JsonProperty("meta")]
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
public IList<object> Notifications { get; set; }
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
public Response Response { get; set; }
|
||||
|
||||
protected override string _EndPoint
|
||||
{
|
||||
get { return "v4/user/beers/{0}"; }
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,12 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
[JsonProperty("code")]
|
||||
public int Code { get; set; }
|
||||
|
||||
[JsonProperty("error_detail")]
|
||||
public string ErrorDetail { get; set; }
|
||||
|
||||
[JsonProperty("error_type")]
|
||||
public string ErrorType { get; set; }
|
||||
|
||||
[JsonProperty("response_time")]
|
||||
public ResponseTime ResponseTime { get; set; }
|
||||
|
||||
@@ -244,7 +250,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public double BeerAbv { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
@@ -722,6 +728,41 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public string Twitter { get; set; }
|
||||
}
|
||||
|
||||
public class Badge
|
||||
{
|
||||
[JsonProperty("badges_to_facebook")]
|
||||
public int BadgesToFacebook { get; set; }
|
||||
[JsonProperty("badges_to_twitter")]
|
||||
public int BadgesToTwitter { get; set; }
|
||||
}
|
||||
|
||||
public class Checkin
|
||||
{
|
||||
[JsonProperty("checkin_to_facebook")]
|
||||
public int CheckinToFacebook { get; set; }
|
||||
[JsonProperty("checkin_to_twitter")]
|
||||
public int CheckinToTwitter { get; set; }
|
||||
[JsonProperty("checkin_to_foursquare")]
|
||||
public int CheckinToFoursquare { get; set; }
|
||||
}
|
||||
|
||||
public class Navigation
|
||||
{
|
||||
[JsonProperty("default_to_checkin")]
|
||||
public int DefaultToCheckin { get; set; }
|
||||
}
|
||||
|
||||
public class Settings
|
||||
{
|
||||
[JsonProperty("badge")]
|
||||
public Badge Badge { get; set; }
|
||||
[JsonProperty("checkin")]
|
||||
public Checkin Checkin { get; set; }
|
||||
[JsonProperty("navigation")]
|
||||
public Navigation Navigation { get; set; }
|
||||
[JsonProperty("email_address")]
|
||||
public string EmailAddress { get; set; }
|
||||
}
|
||||
public class User
|
||||
{
|
||||
|
||||
@@ -795,7 +836,29 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public string DateJoined { get; set; }
|
||||
|
||||
[JsonProperty("settings")]
|
||||
public IList<object> 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
|
||||
@@ -807,12 +870,13 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
|
||||
public class UserInfo : UnAuthenticatedRequest
|
||||
{
|
||||
protected override string _EndPoint { get { return "v4/user/info/{0}"; } }
|
||||
protected override string _EndPoint { get { return "v4/user/info{0}"; } }
|
||||
|
||||
[JsonProperty("meta")]
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
public IList<object> Notifications { get; set; }
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
public Response Response { get; set; }
|
||||
|
||||
@@ -196,7 +196,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public string BeerStyle { get; set; }
|
||||
|
||||
[JsonProperty("auth_rating")]
|
||||
public int AuthRating { get; set; }
|
||||
public double AuthRating { get; set; }
|
||||
|
||||
[JsonProperty("wish_list")]
|
||||
public bool WishList { get; set; }
|
||||
|
||||
@@ -48,8 +48,10 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="Client\AuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Client\IAuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Client\IUnAuthenticadedUntappdCredentials.cs" />
|
||||
<Compile Include="Client\IUntappdCredentials.cs" />
|
||||
<Compile Include="Client\UnAuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Client\UntappdCredentials.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Request\AuthenticatedRequest.cs" />
|
||||
<Compile Include="Request\UnAuthenticatedRequest.cs" />
|
||||
|
||||
Reference in New Issue
Block a user