2
.gitignore
vendored
2
.gitignore
vendored
@@ -11,6 +11,8 @@
|
||||
*.userprefs
|
||||
|
||||
**/.settings
|
||||
NDependOut
|
||||
*.ndproj
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
version: 0.3.{build}
|
||||
version: 0.4.{build}
|
||||
configuration: Release
|
||||
notifications:
|
||||
- provider: Webhook
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Untappd.Net.Authentication;
|
||||
using Untappd.Net.Client;
|
||||
using Untappd.Net.OAuth;
|
||||
|
||||
namespace Untappd.Net.UnitTests.Authentication
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Untappd.Net.Client;
|
||||
using Untappd.Net.Authentication;
|
||||
|
||||
namespace Untappd.Net.UnitTests.Client
|
||||
{
|
||||
@@ -21,7 +21,7 @@ namespace Untappd.Net.UnitTests.Client
|
||||
Assert.AreEqual(token, "awesome");
|
||||
token = "newString";
|
||||
//Make sure the reference is not copied over
|
||||
Assert.AreEqual("awesome", t.AccessToken);
|
||||
Assert.AreEqual("awesome", t.AuthenticationData["access_token"]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using Untappd.Net.Client;
|
||||
using Untappd.Net.Authentication;
|
||||
|
||||
namespace Untappd.Net.UnitTests.Client
|
||||
{
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Threading.Tasks;
|
||||
using Moq;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using RestSharp;
|
||||
using Untappd.Net.Client;
|
||||
using Untappd.Net.Request;
|
||||
using Untappd.Net.Responses.BeerInfo;
|
||||
using Untappd.Net.Responses.Actions;
|
||||
using System.IO;
|
||||
using Untappd.Net.Authentication;
|
||||
|
||||
namespace Untappd.Net.UnitTests.Request
|
||||
{
|
||||
@@ -18,8 +20,11 @@ namespace Untappd.Net.UnitTests.Request
|
||||
public void ConfirmRequestWorks()
|
||||
{
|
||||
var mockCreds = new Mock<IUnAuthenticatedUntappdCredentials>();
|
||||
mockCreds.Setup(a => a.ClientId).Returns("id");
|
||||
mockCreds.Setup(a => a.ClientSecret).Returns("secret");
|
||||
mockCreds.Setup(a => a.AuthenticationData).Returns(new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
|
||||
{
|
||||
{"client_id", "id"},
|
||||
{"client_secret", "secret"}
|
||||
}));
|
||||
var bodyParam = new Dictionary<string, object> {{"key", "value"}};
|
||||
var client = new Mock<IRestClient>();
|
||||
var request = new Mock<IRestRequest>();
|
||||
@@ -27,8 +32,7 @@ namespace Untappd.Net.UnitTests.Request
|
||||
request.Setup(a => a.AddParameter(It.IsAny<string>(), It.IsAny<string>()));
|
||||
|
||||
var response = new Mock<IRestResponse>();
|
||||
var obj = JsonConvert.SerializeObject(new BeerInfo());
|
||||
response.Setup(a => a.Content).Returns(obj);
|
||||
response.Setup(a => a.Content).Returns(File.ReadAllText("../../Responses/json/BeerInfo.json"));
|
||||
client.Setup(a => a.Execute(It.IsAny<IRestRequest>())).Callback(() =>
|
||||
{
|
||||
}).Returns(response.Object);
|
||||
@@ -38,16 +42,19 @@ namespace Untappd.Net.UnitTests.Request
|
||||
var repository = new Repository(client.Object, request.Object);
|
||||
|
||||
repository.Get<BeerInfo>(mockCreds.Object, "awesome", bodyParam);
|
||||
request.Verify(a => a.AddParameter("client_id", mockCreds.Object.ClientId));
|
||||
request.Verify(a => a.AddParameter("client_secret", mockCreds.Object.ClientSecret));
|
||||
request.Verify(a => a.AddParameter("client_id", mockCreds.Object.AuthenticationData["client_id"]));
|
||||
request.Verify(a => a.AddParameter("client_secret", mockCreds.Object.AuthenticationData["client_secret"]));
|
||||
request.Verify(a => a.AddParameter("key", "value"));
|
||||
repository.GetAsync<BeerInfo>(mockCreds.Object, "awesome", bodyParam).Wait();
|
||||
request.Verify(a => a.AddParameter("client_id", mockCreds.Object.ClientId));
|
||||
request.Verify(a => a.AddParameter("client_secret", mockCreds.Object.ClientSecret));
|
||||
request.Verify(a => a.AddParameter("client_id", mockCreds.Object.AuthenticationData["client_id"]));
|
||||
request.Verify(a => a.AddParameter("client_secret", mockCreds.Object.AuthenticationData["client_secret"]));
|
||||
request.Verify(a => a.AddParameter("key", "value"));
|
||||
|
||||
var mockAuthCreds = new Mock<IAuthenticatedUntappdCredentials>();
|
||||
mockAuthCreds.Setup(a => a.AccessToken).Returns("accessToken");
|
||||
mockAuthCreds.Setup(a => a.AuthenticationData).Returns(new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
|
||||
{
|
||||
{"access_token", "accessToken"}
|
||||
}));
|
||||
|
||||
repository.Get<BeerInfo>(mockAuthCreds.Object, "awesome", bodyParam);
|
||||
request.Verify(a => a.AddParameter("key", "value"));
|
||||
@@ -56,12 +63,18 @@ namespace Untappd.Net.UnitTests.Request
|
||||
request.Verify(a => a.AddParameter("key", "value"));
|
||||
request.Verify(a => a.AddParameter("access_token", "accessToken"));
|
||||
|
||||
mockAuthCreds.Setup(a => a.AccessToken).Returns("PostaccessToken");
|
||||
mockAuthCreds.Setup(a => a.AuthenticationData).Returns(new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
|
||||
{
|
||||
{"access_token", "PostaccessToken"}
|
||||
}));
|
||||
var checkin = new CheckIn("-5", "EST", 1044097) { Shout = "Awesome Brew", Rating = 4 };
|
||||
repository.Post(mockAuthCreds.Object, checkin);
|
||||
request.Verify(a => a.AddParameter("access_token", "PostaccessToken"));
|
||||
|
||||
mockAuthCreds.Setup(a => a.AccessToken).Returns("PostAsyncaccessToken");
|
||||
mockAuthCreds.Setup(a => a.AuthenticationData).Returns(new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
|
||||
{
|
||||
{"access_token", "PostAsyncaccessToken"}
|
||||
}));
|
||||
repository.PostAsync(mockAuthCreds.Object, checkin).Wait();
|
||||
request.Verify(a => a.AddParameter("access_token", "PostAsyncaccessToken"));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using NUnit.Framework;
|
||||
using Untappd.Net.Client;
|
||||
using Untappd.Net.Authentication;
|
||||
using Untappd.Net.Request;
|
||||
using Untappd.Net.Responses.BeerInfo;
|
||||
using Untappd.Net.Responses.BeerSearch;
|
||||
|
||||
@@ -1,23 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Untappd.Net.Client
|
||||
namespace Untappd.Net.Authentication
|
||||
{
|
||||
public class AuthenticatedUntappdCredentials : UntappdCredentials, IAuthenticatedUntappdCredentials
|
||||
{
|
||||
public string AccessToken { get; private set; }
|
||||
/// <summary>
|
||||
/// Pass your authenticated access token
|
||||
/// </summary>
|
||||
/// <param name="accessToken"></param>
|
||||
/// <param name="clientId"></param>
|
||||
/// <param name="clientSecret"></param>
|
||||
public AuthenticatedUntappdCredentials(string accessToken)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(accessToken))
|
||||
{
|
||||
throw new ArgumentNullException("accessToken");
|
||||
}
|
||||
AccessToken = string.Copy(accessToken);
|
||||
AuthenticationData = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
|
||||
{
|
||||
{"access_token", accessToken}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
namespace Untappd.Net.Client
|
||||
namespace Untappd.Net.Authentication
|
||||
{
|
||||
public interface IAuthenticatedUntappdCredentials : IUntappdCredentials
|
||||
{
|
||||
string AccessToken { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
|
||||
namespace Untappd.Net.Client
|
||||
namespace Untappd.Net.Authentication
|
||||
{
|
||||
public interface IUnAuthenticatedUntappdCredentials : IUntappdCredentials
|
||||
{
|
||||
9
src/Untappd.Net/Authentication/IUntappdCredentials.cs
Normal file
9
src/Untappd.Net/Authentication/IUntappdCredentials.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Untappd.Net.Authentication
|
||||
{
|
||||
public interface IUntappdCredentials
|
||||
{
|
||||
IReadOnlyDictionary<string, string> AuthenticationData { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,22 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
|
||||
namespace Untappd.Net.Client
|
||||
namespace Untappd.Net.Authentication
|
||||
{
|
||||
public abstract class UntappdCredentials : IUntappdCredentials
|
||||
public class UnAuthenticatedUntappdCredentials : UntappdCredentials, IUnAuthenticatedUntappdCredentials
|
||||
{
|
||||
public string ClientId { get; private set; }
|
||||
public string ClientSecret { get; private set; }
|
||||
|
||||
protected UntappdCredentials()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// UnAuthenticated request. Pass your API id and secret
|
||||
/// </summary>
|
||||
/// <param name="clientId"></param>
|
||||
/// <param name="clientSecret"></param>
|
||||
protected UntappdCredentials(string clientId, string clientSecret)
|
||||
public UnAuthenticatedUntappdCredentials(string clientId, string clientSecret)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(clientId))
|
||||
{
|
||||
@@ -26,8 +21,10 @@ namespace Untappd.Net.Client
|
||||
{
|
||||
throw new ArgumentNullException("clientSecret");
|
||||
}
|
||||
ClientId = string.Copy(clientId);
|
||||
ClientSecret = string.Copy(clientSecret);
|
||||
AuthenticationData = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
|
||||
{
|
||||
{"client_id", clientId}, {"client_secret", clientSecret}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
9
src/Untappd.Net/Authentication/UntappdCredentials.cs
Normal file
9
src/Untappd.Net/Authentication/UntappdCredentials.cs
Normal file
@@ -0,0 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Untappd.Net.Authentication
|
||||
{
|
||||
public abstract class UntappdCredentials : IUntappdCredentials
|
||||
{
|
||||
public IReadOnlyDictionary<string, string> AuthenticationData { get; protected set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
namespace Untappd.Net.Client
|
||||
{
|
||||
public interface IUntappdCredentials
|
||||
{
|
||||
string ClientId { get; }
|
||||
string ClientSecret { get; }
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
namespace Untappd.Net.Client
|
||||
{
|
||||
public class UnAuthenticatedUntappdCredentials : UntappdCredentials, IUnAuthenticatedUntappdCredentials
|
||||
{
|
||||
/// <summary>
|
||||
/// UnAuthenticated request. Pass your API id and secret
|
||||
/// </summary>
|
||||
/// <param name="clientId"></param>
|
||||
/// <param name="clientSecret"></param>
|
||||
public UnAuthenticatedUntappdCredentials(string clientId, string clientSecret)
|
||||
: base(clientId, clientSecret)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
38
src/Untappd.Net/Exception/HttpErrorException.cs
Normal file
38
src/Untappd.Net/Exception/HttpErrorException.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
|
||||
namespace Untappd.Net.Exception
|
||||
{
|
||||
public sealed class HttpErrorException : BaseUntappdException
|
||||
{
|
||||
public override string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
return _message;
|
||||
}
|
||||
}
|
||||
|
||||
private readonly string _message;
|
||||
public HttpErrorException(IRestRequest request, IRestResponse response)
|
||||
{
|
||||
var code = (int) response.StatusCode;
|
||||
if (code == 200)
|
||||
{
|
||||
throw new BaseUntappdException(
|
||||
"HttpError is being throw with a 200 error. Something has gone horribly wrong");
|
||||
}
|
||||
|
||||
_message = string.Format("HttpError {0} was returned with Message: {1}{2}", code, Environment.NewLine,
|
||||
response.ErrorMessage);
|
||||
Data.Add("Request Object", JsonConvert.SerializeObject(request));
|
||||
Data.Add("Response Object", JsonConvert.SerializeObject(response));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using Untappd.Net.Client;
|
||||
using Untappd.Net.Authentication;
|
||||
|
||||
namespace Untappd.Net.Authentication
|
||||
namespace Untappd.Net.OAuth
|
||||
{
|
||||
public static class AuthenticationHelper
|
||||
{
|
||||
@@ -24,7 +24,7 @@ namespace Untappd.Net.Authentication
|
||||
}
|
||||
|
||||
return string.Format("{0}/?client_id={1}&response_type=code&redirect_url={2}", Constants.BaseRequestString,
|
||||
credentials.ClientId, redirectUrl);
|
||||
credentials.AuthenticationData["client_id"], redirectUrl);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -51,8 +51,8 @@ namespace Untappd.Net.Authentication
|
||||
}
|
||||
return string.Format("{0}/?client_id={1}&client_secret={2}&response_type=code&redirect_url={3}&code={4}",
|
||||
Constants.OAuthTokenEndPoint,
|
||||
credentials.ClientId,
|
||||
credentials.ClientSecret,
|
||||
credentials.AuthenticationData["client_id"],
|
||||
credentials.AuthenticationData["client_secret"],
|
||||
redirectUrl,
|
||||
code);
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
using RestSharp;
|
||||
using Untappd.Net.Exception;
|
||||
using System;
|
||||
using Untappd.Net.Authentication;
|
||||
|
||||
namespace Untappd.Net.Request
|
||||
{
|
||||
@@ -9,43 +14,105 @@ namespace Untappd.Net.Request
|
||||
{
|
||||
internal IRestClient Client;
|
||||
internal IRestRequest Request;
|
||||
private bool FailFast { get; set; }
|
||||
/// <summary>
|
||||
/// Event to listen to when failFast is set to false
|
||||
/// This allows you to capture the excpetion, before its swallowed
|
||||
/// </summary>
|
||||
public event UnhandledExceptionEventHandler OnExceptionThrown;
|
||||
|
||||
public Repository()
|
||||
/// <summary>
|
||||
/// Make a repository
|
||||
/// </summary>
|
||||
/// <param name="failFast">Should we throw exceptions? or just return null</param>
|
||||
public Repository(bool failFast = true)
|
||||
{
|
||||
Client = new RestClient(Constants.BaseRequestString);
|
||||
Request = new RestRequest();
|
||||
FailFast = failFast;
|
||||
}
|
||||
|
||||
[Obsolete("This constructor is used for mocking purposes only", false)]
|
||||
internal Repository(IRestClient client, IRestRequest request)
|
||||
{
|
||||
Client = client;
|
||||
Request = request;
|
||||
}
|
||||
|
||||
internal void ConfigureRequest(string endPoint, IDictionary<string, object> bodyParameters = null , Method webMethod = Method.GET)
|
||||
internal Repository ConfigureRequest(string endPoint, IDictionary<string, object> bodyParameters = null, Method webMethod = Method.GET)
|
||||
{
|
||||
Request.Resource = endPoint;
|
||||
Request.Method = webMethod;
|
||||
if (Request.Parameters != null) Request.Parameters.Clear();
|
||||
if (Request.Parameters != null && Request.Parameters.Count > 0)
|
||||
{
|
||||
Request.Parameters.Clear();
|
||||
}
|
||||
|
||||
if (bodyParameters == null) return;
|
||||
if (bodyParameters == null) return this;
|
||||
foreach (var param in bodyParameters)
|
||||
{
|
||||
Request.AddParameter(param.Key, param.Value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
internal Repository ConfigureRequest(IUntappdCredentials credentials, string endPoint, IDictionary<string, object> bodyParameters = null, Method webMethod = Method.GET)
|
||||
{
|
||||
ConfigureRequest(endPoint, bodyParameters, webMethod);
|
||||
foreach (var untappdCredential in credentials.AuthenticationData)
|
||||
{
|
||||
Request.AddParameter(untappdCredential.Key, untappdCredential.Value);
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
private TResult ExecuteRequest<TResult>()
|
||||
where TResult : class
|
||||
{
|
||||
var response = Client.Execute(Request);
|
||||
return JsonConvert.DeserializeObject<TResult>(response.Content);
|
||||
return ProcessExecution<TResult>(Client.Execute(Request));
|
||||
}
|
||||
|
||||
private async Task<TResult> ExecuteRequestAsync<TResult>()
|
||||
where TResult : class
|
||||
{
|
||||
return ProcessExecution<TResult>(await Client.ExecuteTaskAsync(Request));
|
||||
}
|
||||
|
||||
private TResult ProcessExecution<TResult>(IRestResponse response)
|
||||
where TResult : class
|
||||
{
|
||||
//if the return type is not 200 throw errors
|
||||
if (response.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
var excpetion = new HttpErrorException(Request, response);
|
||||
if (OnExceptionThrown != null)
|
||||
{
|
||||
OnExceptionThrown(this, new UnhandledExceptionEventArgs(excpetion, FailFast));
|
||||
}
|
||||
if (FailFast)
|
||||
{
|
||||
throw excpetion;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
//try to deserialize
|
||||
try
|
||||
{
|
||||
var response = await Client.ExecuteTaskAsync(Request);
|
||||
return JsonConvert.DeserializeObject<TResult>(response.Content);
|
||||
}
|
||||
catch(System.Exception e)
|
||||
{
|
||||
if (OnExceptionThrown != null)
|
||||
{
|
||||
OnExceptionThrown(this, new UnhandledExceptionEventArgs(e, FailFast));
|
||||
}
|
||||
if (FailFast)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Untappd.Net.Client;
|
||||
using Untappd.Net.Authentication;
|
||||
using Untappd.Net.Exception;
|
||||
|
||||
namespace Untappd.Net.Request
|
||||
{
|
||||
@@ -13,15 +14,14 @@ namespace Untappd.Net.Request
|
||||
/// <param name="credentials">Pass in a credentials object</param>
|
||||
/// <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>
|
||||
/// <exception cref="HttpErrorException"></exception>
|
||||
/// <returns></returns>
|
||||
public TResult Get<TResult>(IUnAuthenticatedUntappdCredentials credentials, string urlParameter, IDictionary<string, object> bodyParameters = null)
|
||||
where TResult : IUnAuthenticatedRequest, new()
|
||||
where TResult : class, IUnAuthenticatedRequest, new()
|
||||
{
|
||||
var result = new TResult();
|
||||
ConfigureRequest(result.EndPoint(urlParameter), bodyParameters);
|
||||
Request.AddParameter("client_id", credentials.ClientId);
|
||||
Request.AddParameter("client_secret", credentials.ClientSecret);
|
||||
return ExecuteRequest<TResult>();
|
||||
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
|
||||
.ExecuteRequest<TResult>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -31,15 +31,14 @@ namespace Untappd.Net.Request
|
||||
/// <param name="credentials"></param>
|
||||
/// <param name="urlParameter"></param>
|
||||
/// <param name="bodyParameters"></param>
|
||||
/// <exception cref="HttpErrorException"></exception>
|
||||
/// <returns></returns>
|
||||
public Task<TResult> GetAsync<TResult>(IUnAuthenticatedUntappdCredentials credentials, string urlParameter, IDictionary<string, object> bodyParameters = null)
|
||||
where TResult : IUnAuthenticatedRequest, new()
|
||||
where TResult : class, IUnAuthenticatedRequest, new()
|
||||
{
|
||||
var result = new TResult();
|
||||
ConfigureRequest(result.EndPoint(urlParameter), bodyParameters);
|
||||
Request.AddParameter("client_id", credentials.ClientId);
|
||||
Request.AddParameter("client_secret", credentials.ClientSecret);
|
||||
return ExecuteRequestAsync<TResult>();
|
||||
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
|
||||
.ExecuteRequestAsync<TResult>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -49,14 +48,14 @@ namespace Untappd.Net.Request
|
||||
/// <param name="credentials">Pass in a credentials object</param>
|
||||
/// <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>
|
||||
/// <exception cref="HttpErrorException"></exception>
|
||||
/// <returns></returns>
|
||||
public TResult Get<TResult>(IAuthenticatedUntappdCredentials credentials, string urlParameter = "", IDictionary<string, object> bodyParameters = null)
|
||||
where TResult : IAuthenticatedRequest, new()
|
||||
where TResult : class,IAuthenticatedRequest, new()
|
||||
{
|
||||
var result = new TResult();
|
||||
ConfigureRequest(result.EndPoint(urlParameter), bodyParameters);
|
||||
Request.AddParameter("access_token", credentials.AccessToken);
|
||||
return ExecuteRequest<TResult>();
|
||||
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
|
||||
.ExecuteRequest<TResult>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -66,14 +65,14 @@ namespace Untappd.Net.Request
|
||||
/// <param name="credentials"></param>
|
||||
/// <param name="urlParameter"></param>
|
||||
/// <param name="bodyParameters"></param>
|
||||
/// <exception cref="HttpErrorException"></exception>
|
||||
/// <returns></returns>
|
||||
public Task<TResult> GetAsync<TResult>(IAuthenticatedUntappdCredentials credentials, string urlParameter = "", IDictionary<string, object> bodyParameters = null)
|
||||
where TResult : IAuthenticatedRequest, new()
|
||||
where TResult : class,IAuthenticatedRequest, new()
|
||||
{
|
||||
var result = new TResult();
|
||||
ConfigureRequest(result.EndPoint(urlParameter), bodyParameters);
|
||||
Request.AddParameter("access_token", credentials.AccessToken);
|
||||
return ExecuteRequestAsync<TResult>();
|
||||
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
|
||||
.ExecuteRequestAsync<TResult>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using System.Threading.Tasks;
|
||||
using Untappd.Net.Client;
|
||||
using Untappd.Net.Authentication;
|
||||
|
||||
namespace Untappd.Net.Request
|
||||
{
|
||||
@@ -13,9 +13,8 @@ namespace Untappd.Net.Request
|
||||
/// <returns>returns dynamic since often the return doesn't matter</returns>
|
||||
public dynamic Post(IAuthenticatedUntappdCredentials credentials, IAction action)
|
||||
{
|
||||
ConfigureRequest(action.EndPoint, action.BodyParameters, action.RequestMethod);
|
||||
Request.AddParameter("access_token", credentials.AccessToken);
|
||||
return ExecuteRequest<dynamic>();
|
||||
return ConfigureRequest(credentials, action.EndPoint, action.BodyParameters, action.RequestMethod)
|
||||
.ExecuteRequest<dynamic>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -26,9 +25,8 @@ namespace Untappd.Net.Request
|
||||
/// <returns>returns dynamic since often the return doesn't matter</returns>
|
||||
public Task<dynamic> PostAsync(IAuthenticatedUntappdCredentials credentials, IAction action)
|
||||
{
|
||||
ConfigureRequest(action.EndPoint, action.BodyParameters, action.RequestMethod);
|
||||
Request.AddParameter("access_token", credentials.AccessToken);
|
||||
return ExecuteRequestAsync<dynamic>();
|
||||
return ConfigureRequest(credentials, action.EndPoint, action.BodyParameters, action.RequestMethod)
|
||||
.ExecuteRequestAsync<dynamic>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -128,6 +128,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public string CountryName { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact>))]
|
||||
public Contact Contact { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
@@ -241,6 +242,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public string CountryName { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact2>))]
|
||||
public Contact2 Contact { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
@@ -350,6 +352,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public int IsPrivate { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact>))]
|
||||
public object Contact { get; set; }
|
||||
}
|
||||
|
||||
@@ -444,6 +447,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public string CountryName { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact3>))]
|
||||
public Contact3 Contact { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
@@ -758,6 +762,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public string CountryName { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact4>))]
|
||||
public Contact4 Contact { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
@@ -910,6 +915,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public Media Media { get; set; }
|
||||
|
||||
[JsonProperty("checkins")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
|
||||
public Checkins Checkins { get; set; }
|
||||
|
||||
[JsonProperty("similar")]
|
||||
@@ -937,6 +943,7 @@ namespace Untappd.Net.Responses.BeerInfo
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -264,6 +264,7 @@ namespace Untappd.Net.Responses.BeerSearch
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -892,6 +892,7 @@ namespace Untappd.Net.Responses.BreweryInfo
|
||||
public Media Media { get; set; }
|
||||
|
||||
[JsonProperty("checkins")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
|
||||
public Checkins Checkins { get; set; }
|
||||
|
||||
[JsonProperty("beer_list")]
|
||||
@@ -913,6 +914,7 @@ namespace Untappd.Net.Responses.BreweryInfo
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -152,6 +152,7 @@ namespace Untappd.Net.Responses.BrewerySearch
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -502,6 +502,7 @@ namespace Untappd.Net.Responses.Feeds.ActivityFeed
|
||||
public bool Mg { get; set; }
|
||||
|
||||
[JsonProperty("checkins")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
|
||||
public Checkins Checkins { get; set; }
|
||||
|
||||
[JsonProperty("pagination")]
|
||||
|
||||
@@ -472,6 +472,7 @@ namespace Untappd.Net.Responses.Feeds.UserActivityFeed
|
||||
public Pagination Pagination { get; set; }
|
||||
|
||||
[JsonProperty("checkins")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
|
||||
public Checkins Checkins { get; set; }
|
||||
}
|
||||
|
||||
|
||||
@@ -213,6 +213,7 @@ namespace Untappd.Net.Responses.UserBadges
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -231,6 +231,7 @@ namespace Untappd.Net.Responses.UserDistinctBeer
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -142,6 +142,7 @@ namespace Untappd.Net.Responses.UserFriends
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -5,7 +5,7 @@ using Untappd.Net.Request;
|
||||
namespace Untappd.Net.Responses.UserInfo
|
||||
{
|
||||
|
||||
public sealed class ResponseTime
|
||||
public class ResponseTime
|
||||
{
|
||||
|
||||
[JsonProperty("time")]
|
||||
@@ -31,12 +31,6 @@ 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; }
|
||||
|
||||
@@ -44,6 +38,35 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
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
|
||||
{
|
||||
|
||||
@@ -182,9 +205,6 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
|
||||
[JsonProperty("facebook")]
|
||||
public int Facebook { get; set; }
|
||||
|
||||
[JsonProperty("twitter")]
|
||||
public string Twitter { get; set; }
|
||||
}
|
||||
|
||||
public class User2
|
||||
@@ -215,7 +235,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public string Bio { get; set; }
|
||||
|
||||
[JsonProperty("relationship")]
|
||||
public object Relationship { get; set; }
|
||||
public string Relationship { get; set; }
|
||||
|
||||
[JsonProperty("user_avatar")]
|
||||
public string UserAvatar { get; set; }
|
||||
@@ -315,6 +335,118 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
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
|
||||
{
|
||||
|
||||
@@ -359,10 +491,10 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public string AccountType { get; set; }
|
||||
|
||||
[JsonProperty("brewery_details")]
|
||||
public object BreweryDetails { get; set; }
|
||||
public IList<object> BreweryDetails { get; set; }
|
||||
}
|
||||
|
||||
public class Item3
|
||||
public class Item4
|
||||
{
|
||||
|
||||
[JsonProperty("uid")]
|
||||
@@ -391,10 +523,10 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public int Count { get; set; }
|
||||
|
||||
[JsonProperty("auth_toast")]
|
||||
public object AuthToast { get; set; }
|
||||
public bool AuthToast { get; set; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public IList<Item3> Items { get; set; }
|
||||
public IList<Item4> Items { get; set; }
|
||||
}
|
||||
|
||||
public class Photo
|
||||
@@ -413,7 +545,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public string PhotoImgOg { get; set; }
|
||||
}
|
||||
|
||||
public class Item4
|
||||
public class Item5
|
||||
{
|
||||
|
||||
[JsonProperty("photo_id")]
|
||||
@@ -430,7 +562,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public int Count { get; set; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public IList<Item4> Items { get; set; }
|
||||
public IList<Item5> Items { get; set; }
|
||||
}
|
||||
|
||||
public class Source
|
||||
@@ -456,7 +588,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public string Lg { get; set; }
|
||||
}
|
||||
|
||||
public class Item5
|
||||
public class Item6
|
||||
{
|
||||
|
||||
[JsonProperty("badge_id")]
|
||||
@@ -485,7 +617,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public int Count { get; set; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public IList<Item5> Items { get; set; }
|
||||
public IList<Item6> Items { get; set; }
|
||||
}
|
||||
|
||||
public class Item2
|
||||
@@ -513,7 +645,8 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public Brewery2 Brewery { get; set; }
|
||||
|
||||
[JsonProperty("venue")]
|
||||
public object Venue { get; set; }
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Venue>))]
|
||||
public Venue Venue { get; set; }
|
||||
|
||||
[JsonProperty("comments")]
|
||||
public Comments Comments { get; set; }
|
||||
@@ -616,7 +749,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public bool WishList { get; set; }
|
||||
}
|
||||
|
||||
public class Contact4
|
||||
public class Contact5
|
||||
{
|
||||
|
||||
[JsonProperty("twitter")]
|
||||
@@ -632,7 +765,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public string Url { get; set; }
|
||||
}
|
||||
|
||||
public class Location3
|
||||
public class Location4
|
||||
{
|
||||
|
||||
[JsonProperty("brewery_city")]
|
||||
@@ -667,16 +800,128 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public string CountryName { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
public Contact4 Contact { get; set; }
|
||||
public Contact5 Contact { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
public Location3 Location { get; set; }
|
||||
public Location4 Location { get; set; }
|
||||
|
||||
[JsonProperty("brewery_active")]
|
||||
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")]
|
||||
@@ -701,7 +946,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public Brewery3 Brewery { get; set; }
|
||||
|
||||
[JsonProperty("venue")]
|
||||
public object Venue { get; set; }
|
||||
public Venue2 Venue { get; set; }
|
||||
}
|
||||
|
||||
public class Media2
|
||||
@@ -711,54 +956,63 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public int Count { get; set; }
|
||||
|
||||
[JsonProperty("items")]
|
||||
public IList<Item6> Items { get; set; }
|
||||
public IList<Item7> Items { get; set; }
|
||||
}
|
||||
|
||||
public class Contact5
|
||||
public class Contact7
|
||||
{
|
||||
|
||||
[JsonProperty("facebook")]
|
||||
public int Facebook { get; set; }
|
||||
|
||||
[JsonProperty("twitter")]
|
||||
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")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Checkin>))]
|
||||
public Checkin Checkin { get; set; }
|
||||
|
||||
[JsonProperty("navigation")]
|
||||
public Navigation Navigation { get; set; }
|
||||
|
||||
[JsonProperty("email_address")]
|
||||
public string EmailAddress { get; set; }
|
||||
}
|
||||
|
||||
public class User
|
||||
{
|
||||
|
||||
@@ -805,7 +1059,7 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public int IsSupporter { get; set; }
|
||||
|
||||
[JsonProperty("relationship")]
|
||||
public object Relationship { get; set; }
|
||||
public string Relationship { get; set; }
|
||||
|
||||
[JsonProperty("untappd_url")]
|
||||
public string UntappdUrl { get; set; }
|
||||
@@ -820,13 +1074,14 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
public RecentBrews RecentBrews { get; set; }
|
||||
|
||||
[JsonProperty("checkins")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
|
||||
public Checkins Checkins { get; set; }
|
||||
|
||||
[JsonProperty("media")]
|
||||
public Media2 Media { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
public Contact5 Contact { get; set; }
|
||||
public Contact7 Contact { get; set; }
|
||||
|
||||
[JsonProperty("date_joined")]
|
||||
public string DateJoined { get; set; }
|
||||
@@ -835,28 +1090,6 @@ namespace Untappd.Net.Responses.UserInfo
|
||||
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
|
||||
{
|
||||
|
||||
|
||||
@@ -223,6 +223,7 @@ namespace Untappd.Net.Responses.UserWishlist
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -271,6 +271,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public string CountryName { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact2>))]
|
||||
public Contact2 Contact { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
@@ -405,6 +406,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public Location3 Location { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact3>))]
|
||||
public Contact3 Contact { get; set; }
|
||||
|
||||
[JsonProperty("public_venue")]
|
||||
@@ -562,6 +564,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public string CountryName { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact4>))]
|
||||
public Contact4 Contact { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
@@ -671,6 +674,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public Location5 Location { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact5>))]
|
||||
public Contact5 Contact { get; set; }
|
||||
|
||||
[JsonProperty("public_venue")]
|
||||
@@ -1074,6 +1078,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public string CountryName { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact6>))]
|
||||
public Contact6 Contact { get; set; }
|
||||
|
||||
[JsonProperty("location")]
|
||||
@@ -1162,6 +1167,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public Location Location { get; set; }
|
||||
|
||||
[JsonProperty("contact")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Contact>))]
|
||||
public Contact Contact { get; set; }
|
||||
|
||||
[JsonProperty("foursquare")]
|
||||
@@ -1171,6 +1177,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public Media Media { get; set; }
|
||||
|
||||
[JsonProperty("checkins")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
|
||||
public Checkins Checkins { get; set; }
|
||||
|
||||
[JsonProperty("top_beers")]
|
||||
@@ -1192,6 +1199,7 @@ namespace Untappd.Net.Responses.VenueInfo
|
||||
public Meta Meta { get; set; }
|
||||
|
||||
[JsonProperty("notifications")]
|
||||
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
|
||||
public Notifications Notifications { get; set; }
|
||||
|
||||
[JsonProperty("response")]
|
||||
|
||||
@@ -46,7 +46,8 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Authentication\AuthenticationHelper.cs" />
|
||||
<Compile Include="OAuth\AuthenticationHelper.cs" />
|
||||
<Compile Include="Exception\HttpErrorException.cs" />
|
||||
<Compile Include="Request\IAction.cs" />
|
||||
<Compile Include="Request\RepositoryGet.cs" />
|
||||
<Compile Include="Request\RepositoryPost.cs" />
|
||||
@@ -60,12 +61,12 @@
|
||||
<Compile Include="Responses\Actions\AddFriend.cs" />
|
||||
<Compile Include="Responses\Actions\ToastUntoast.cs" />
|
||||
<Compile Include="SingleObjectArrayConverter.cs" />
|
||||
<Compile Include="Client\AuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Client\IAuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Client\IUnAuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Client\IUntappdCredentials.cs" />
|
||||
<Compile Include="Client\UnAuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Client\UntappdCredentials.cs" />
|
||||
<Compile Include="Authentication\AuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Authentication\IAuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Authentication\IUnAuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Authentication\IUntappdCredentials.cs" />
|
||||
<Compile Include="Authentication\UnAuthenticatedUntappdCredentials.cs" />
|
||||
<Compile Include="Authentication\UntappdCredentials.cs" />
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Exception\BaseUntappdException.cs" />
|
||||
<Compile Include="Exception\EndpointConfigurationException.cs" />
|
||||
|
||||
Reference in New Issue
Block a user