11 Commits

Author SHA1 Message Date
Tommy Parnell
4c6b62ec30 oops 2016-11-07 08:03:28 -05:00
Tommy Parnell
1f3e83073d whitespace 2016-06-29 11:18:19 -07:00
Tommy Parnell
cc56b8cc73 add comment 2015-09-05 13:07:47 -04:00
Tommy Parnell
ea03c9ff1f Merge pull request #50 from tparnell8/addTimeout
add a timeout
2015-09-05 13:06:06 -04:00
Tommy Parnell
28ab574234 add a timeout 2015-09-05 12:44:39 -04:00
Tommy Parnell
d44f504046 Merge pull request #49 from tparnell8/fixSrc
format the code so its less crappy looking
2015-09-05 12:36:07 -04:00
Tommy Parnell
6cb1d99da6 format the code so its less crappy looking 2015-09-05 12:32:14 -04:00
Tommy Parnell
c6e2115849 Merge pull request #48 from tparnell8/fixRake
fix rake file
2015-09-05 12:16:06 -04:00
Tommy Parnell
de595043ed fix my rake file 2015-09-05 12:08:22 -04:00
Tommy Parnell
7745e95be5 Merge pull request #47 from rodkings/master
updated readme
2015-07-27 00:15:43 -04:00
Rodrigo P Reis
2f0f51ab60 updated readme with correct example to create a new AuthenticatedUntappdCredentials. 2015-07-26 15:38:44 -06:00
60 changed files with 5566 additions and 5899 deletions

View File

@@ -69,7 +69,7 @@ For Authenticated requests:
```csharp
var ts = new AuthenticatedUntappdCredentials("token", "key", "secret");
var ts = new AuthenticatedUntappdCredentials("token");
var t = new Repository().Get<ActivityFeed>(ts);
```
@@ -79,7 +79,7 @@ For Actions (usually post requests). Note: Actions return a dynamic object. Usua
```csharp
var ts = new AuthenticatedUntappdCredentials("token", "key", "secret");
var ts = new AuthenticatedUntappdCredentials("token");
var checkin = new CheckIn("-5", "EST", 1044097) { Shout = "Awesome Brew", Rating = 4 };
var response = repository.Post(ts, checkin);
@@ -96,3 +96,4 @@ var response = repository.Post(ts, checkin);
Current contributors:
* Tommy James Parnell (https://github.com/tparnell8)
* Rodrigo P Reis (https://github.com/rodkings)

View File

@@ -25,7 +25,7 @@ task :lint => [:build, :cs_lint]
desc 'Retrieve, Build, Test'
task :preflight => [:clean, :retrieve, :build, :test, :lint]
throw "oops"
desc 'cleans up artifacts'
task :clean do
puts 'cleaning artifacts from directory'

View File

@@ -1,4 +1,4 @@
version: 0.4.{build}
version: 0.5.{build}
configuration: Release
notifications:
- provider: Webhook

View File

@@ -1,25 +1,28 @@
require 'openssl'
namespace :tools do
# If we don't have a copy of nuget, download it
task :nuget_bootstrap do
puts 'Ensuring NuGet exists in tools/NuGet'
# If we don't have a copy of nuget, download it
task :nuget_bootstrap do
puts 'Ensuring NuGet exists in tools/NuGet'
if !FileTest.exist?("#{NUGET}/nuget.exe")
puts 'Downloading nuget from nuget.org'
if !FileTest.exist?("#{NUGET}/nuget.exe")
puts 'Downloading nuget from nuget.org'
begin
FileUtils.mkdir_p("#{NUGET}")
File.open("#{NUGET}/nuget.exe", "wb") do |file|
file.write open('https://nuget.org/nuget.exe').read
begin
FileUtils.mkdir_p("#{NUGET}")
File.open("#{NUGET}/nuget.exe", "wb") do |file|
file.write open('http://nuget.org/nuget.exe', {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read
end
rescue
FileUtils.rm_rf("#{NUGET}/nuget.exe")
File.open("#{NUGET}/nuget.exe", "wb") do |file|
file.write open('https://nuget.org/nuget.exe', {ssl_verify_mode: OpenSSL::SSL::VERIFY_NONE}).read
end
end
rescue
FileUtils.rm_rf("#{NUGET}/nuget.exe")
File.open("#{NUGET}/nuget.exe", "wb") do |file|
file.write open('http://nuget.org/nuget.exe').read
end
end
end
end
# Fetch nuget dependencies for all packages
task :nuget_fetch => :nuget_bootstrap do

View File

@@ -4,24 +4,25 @@ using Untappd.Net.Authentication;
namespace Untappd.Net.UnitTests.Authentication
{
[TestFixture]
public class TestAuthenticatedUntappdCredentials
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void ExpectException()
{
var t = new AuthenticatedUntappdCredentials(null);
}
[Test]
public void ExpectValid()
{
var token = "awesome";
var t = new AuthenticatedUntappdCredentials(token);
Assert.AreEqual(token, "awesome");
token = "newString";
//Make sure the reference is not copied over
Assert.AreEqual("awesome", t.AuthenticationData["access_token"]);
}
}
[TestFixture]
public class TestAuthenticatedUntappdCredentials
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void ExpectException()
{
var t = new AuthenticatedUntappdCredentials(null);
}
[Test]
public void ExpectValid()
{
var token = "awesome";
var t = new AuthenticatedUntappdCredentials(token);
Assert.AreEqual(token, "awesome");
token = "newString";
//Make sure the reference is not copied over
Assert.AreEqual("awesome", t.AuthenticationData["access_token"]);
}
}
}

View File

@@ -5,60 +5,56 @@ using Untappd.Net.OAuth;
namespace Untappd.Net.UnitTests.Authentication
{
[TestFixture]
public class TestAuthenticationHelper
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestRedirectUserToException1()
{
[TestFixture]
public class TestAuthenticationHelper
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestRedirectUserToException1()
{
AuthenticationHelper.RedirectUserTo(null, "url");
}
AuthenticationHelper.RedirectUserTo(null, "url");
}
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestRedirectUserToException2()
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestRedirectUserToException2()
{
AuthenticationHelper.RedirectUserTo(new UnAuthenticatedUntappdCredentials("d", "d"), string.Empty);
}
AuthenticationHelper.RedirectUserTo(new UnAuthenticatedUntappdCredentials("d", "d"), string.Empty);
}
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestTokenUrlException1()
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestTokenUrlException1()
{
AuthenticationHelper.TokenUrl(null, "some", "code");
}
AuthenticationHelper.TokenUrl(null, "some", "code");
}
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestTokenUrlException2()
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestTokenUrlException2()
{
AuthenticationHelper.TokenUrl(new UnAuthenticatedUntappdCredentials("d", "d"), string.Empty, "code");
}
AuthenticationHelper.TokenUrl(new UnAuthenticatedUntappdCredentials("d", "d"), string.Empty, "code");
}
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestTokenUrlException3()
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void TestTokenUrlException3()
{
AuthenticationHelper.TokenUrl(new UnAuthenticatedUntappdCredentials("d", "d"), "ds", string.Empty);
}
AuthenticationHelper.TokenUrl(new UnAuthenticatedUntappdCredentials("d", "d"), "ds", string.Empty);
}
[Test]
public void TestTokenUrl()
{
var s = AuthenticationHelper.TokenUrl(new UnAuthenticatedUntappdCredentials("d", "d"), "ds", "code");
Assert.AreEqual(s, Constants.OAuthTokenEndPoint + "/?client_id=d&client_secret=d&response_type=code&redirect_url=ds&code=code");
}
[Test]
public void TestTokenUrl()
{
var s = AuthenticationHelper.TokenUrl(new UnAuthenticatedUntappdCredentials("d", "d"), "ds", "code");
Assert.AreEqual(s, Constants.OAuthTokenEndPoint + "/?client_id=d&client_secret=d&response_type=code&redirect_url=ds&code=code");
}
[Test]
public void TestRedirectUrl()
{
var s = AuthenticationHelper.RedirectUserTo(new UnAuthenticatedUntappdCredentials("d", "d"), "ds");
Assert.AreEqual(s, Constants.BaseRequestString + "/?client_id=d&response_type=code&redirect_url=ds");
}
}
[Test]
public void TestRedirectUrl()
{
var s = AuthenticationHelper.RedirectUserTo(new UnAuthenticatedUntappdCredentials("d", "d"), "ds");
Assert.AreEqual(s, Constants.BaseRequestString + "/?client_id=d&response_type=code&redirect_url=ds");
}
}
}

View File

@@ -4,20 +4,21 @@ using Untappd.Net.Authentication;
namespace Untappd.Net.UnitTests.Authentication
{
[TestFixture]
public class TestUnAuthenticatedUntappdCredentials
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void ExpectClientIdException()
{
var t = new UnAuthenticatedUntappdCredentials(string.Empty, "t");
}
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void ExpectClientSecretException()
{
var t = new UnAuthenticatedUntappdCredentials("t", string.Empty);
}
}
[TestFixture]
public class TestUnAuthenticatedUntappdCredentials
{
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void ExpectClientIdException()
{
var t = new UnAuthenticatedUntappdCredentials(string.Empty, "t");
}
[Test]
[ExpectedException(typeof(ArgumentNullException))]
public void ExpectClientSecretException()
{
var t = new UnAuthenticatedUntappdCredentials("t", string.Empty);
}
}
}

View File

@@ -1,29 +1,30 @@
using NUnit.Framework;
using Untappd.Net.Exception;
namespace Untappd.Net.UnitTests.Exception
{
[TestFixture]
public class TestBaseUntappdException
{
[ExpectedException(typeof (BaseUntappdException))]
[Test]
public void TestStandardException()
{
throw new BaseUntappdException();
}
[ExpectedException(typeof(BaseUntappdException), ExpectedMessage = "messageHere")]
[Test]
public void TestStandardExceptionWithMessage()
{
throw new BaseUntappdException("messageHere");
}
[ExpectedException(typeof(BaseUntappdException), ExpectedMessage = "messageHere")]
[Test]
public void TestStandardExceptionWithInner()
{
throw new BaseUntappdException("messageHere", new System.Exception("innerException!"));
}
[TestFixture]
public class TestBaseUntappdException
{
[ExpectedException(typeof(BaseUntappdException))]
[Test]
public void TestStandardException()
{
throw new BaseUntappdException();
}
[ExpectedException(typeof(BaseUntappdException), ExpectedMessage = "messageHere")]
[Test]
public void TestStandardExceptionWithMessage()
{
throw new BaseUntappdException("messageHere");
}
}
[ExpectedException(typeof(BaseUntappdException), ExpectedMessage = "messageHere")]
[Test]
public void TestStandardExceptionWithInner()
{
throw new BaseUntappdException("messageHere", new System.Exception("innerException!"));
}
}
}

View File

@@ -3,15 +3,14 @@ using Untappd.Net.Exception;
namespace Untappd.Net.UnitTests.Exception
{
[TestFixture]
public class TestEndpointConfigurationException
{
[Test]
[ExpectedException(typeof(EndpointConfigurationException), ExpectedMessage = "Invalid endpoint configured")]
public void TestThrownExeption()
{
throw new EndpointConfigurationException();
}
}
[TestFixture]
public class TestEndpointConfigurationException
{
[Test]
[ExpectedException(typeof(EndpointConfigurationException), ExpectedMessage = "Invalid endpoint configured")]
public void TestThrownExeption()
{
throw new EndpointConfigurationException();
}
}
}

View File

@@ -1,32 +1,30 @@
using System;
using NUnit.Framework;
using Untappd.Net.Exception;
using Moq;
using NUnit.Framework;
using RestSharp;
using Untappd.Net.Exception;
namespace Untappd.Net.UnitTests.Exception
{
[TestFixture]
public class TestHttpErrorException
{
[Test]
public void ConfirmNullExceptions()
{
var mockRequest = new Mock<IRestRequest>();
var mockResponse = new Mock<IRestResponse>();
[TestFixture]
public class TestHttpErrorException
{
[Test]
public void ConfirmNullExceptions()
{
var mockRequest = new Mock<IRestRequest>();
var mockResponse = new Mock<IRestResponse>();
Assert.Throws<ArgumentNullException>(()=>{
var t = new HttpErrorException(mockRequest.Object, null);
Console.WriteLine(t);
});
Assert.Throws<ArgumentNullException>(()=>{
var t = new HttpErrorException(null, mockResponse.Object);
Console.WriteLine(t);
});
}
}
Assert.Throws<ArgumentNullException>(() =>
{
var t = new HttpErrorException(mockRequest.Object, null);
Console.WriteLine(t);
});
Assert.Throws<ArgumentNullException>(() =>
{
var t = new HttpErrorException(null, mockResponse.Object);
Console.WriteLine(t);
});
}
}
}

View File

@@ -6,102 +6,113 @@ using Moq;
using NUnit.Framework;
using RestSharp;
using Untappd.Net.Authentication;
using Untappd.Net.Exception;
using Untappd.Net.Request;
using Untappd.Net.Responses.Actions;
using Untappd.Net.Responses.BeerInfo;
using Untappd.Net.Exception;
namespace Untappd.Net.UnitTests.Request
{
[TestFixture]
public class TestRepository
{
[Test]
public void ConfirmRequestWorks()
{
var mockCreds = new Mock<IUnAuthenticatedUntappdCredentials>();
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>();
request.Setup(a => a.AddParameter(It.IsAny<string>(), It.IsAny<string>()));
request.Setup(a => a.AddParameter(It.IsAny<string>(), It.IsAny<string>()));
[TestFixture]
public class TestRepository
{
[Test]
public void ConfirmRequestWorks()
{
var mockCreds = new Mock<IUnAuthenticatedUntappdCredentials>();
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>();
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>();
response.Setup(a => a.Content).Returns(File.ReadAllText("../../Responses/Json/BeerInfo.json"));
client.Setup(a => a.Execute(It.IsAny<IRestRequest>())).Callback(() =>
{
}).Returns(response.Object);
client.Setup(a => a.ExecuteTaskAsync(It.IsAny<IRestRequest>())).Callback(() =>
{
}).Returns(Task.Run(()=> response.Object));
var repository = new Repository(client.Object, request.Object);
var response = new Mock<IRestResponse>();
response.Setup(a => a.Content).Returns(File.ReadAllText("../../Responses/Json/BeerInfo.json"));
client.Setup(a => a.Execute(It.IsAny<IRestRequest>())).Callback(() =>
{
}).Returns(response.Object);
client.Setup(a => a.ExecuteTaskAsync(It.IsAny<IRestRequest>())).Callback(() =>
{
}).Returns(Task.Run(() => response.Object));
#pragma warning disable CS0618 // Type or member is obsolete Using as intended
var repository = new Repository(client.Object, request.Object);
#pragma warning restore CS0618 // Type or member is obsolete
repository.Get<BeerInfo>(mockCreds.Object, "awesome", bodyParam);
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.AuthenticationData["client_id"]));
request.Verify(a => a.AddParameter("client_secret", mockCreds.Object.AuthenticationData["client_secret"]));
request.Verify(a => a.AddParameter("key", "value"));
repository.Get<BeerInfo>(mockCreds.Object, "awesome", bodyParam);
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.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.AuthenticationData).Returns(new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
{
{"access_token", "accessToken"}
}));
var mockAuthCreds = new Mock<IAuthenticatedUntappdCredentials>();
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"));
request.Verify(a => a.AddParameter("access_token", "accessToken"));
repository.GetAsync<BeerInfo>(mockAuthCreds.Object, "awesome", bodyParam).Wait();
request.Verify(a => a.AddParameter("key", "value"));
request.Verify(a => a.AddParameter("access_token", "accessToken"));
repository.Get<BeerInfo>(mockAuthCreds.Object, "awesome", bodyParam);
request.Verify(a => a.AddParameter("key", "value"));
request.Verify(a => a.AddParameter("access_token", "accessToken"));
repository.GetAsync<BeerInfo>(mockAuthCreds.Object, "awesome", bodyParam).Wait();
request.Verify(a => a.AddParameter("key", "value"));
request.Verify(a => a.AddParameter("access_token", "accessToken"));
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.FailFast = true;
repository.OnExceptionThrown += (sender, e) =>
{
Assert.IsNotNull(sender);
Assert.IsNotNull(e);
};
Assert.Throws<HttpErrorException>(()=>repository.Post(mockAuthCreds.Object, checkin));
repository.FailFast = false;
repository.Post(mockAuthCreds.Object, checkin);
request.Verify(a => a.AddParameter("access_token", "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.FailFast = true;
repository.OnExceptionThrown += (sender, e) =>
{
Assert.IsNotNull(sender);
Assert.IsNotNull(e);
};
Assert.Throws<HttpErrorException>(() => repository.Post(mockAuthCreds.Object, checkin));
repository.FailFast = false;
repository.Post(mockAuthCreds.Object, checkin);
request.Verify(a => a.AddParameter("access_token", "PostaccessToken"));
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"));
}
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"));
}
[Test]
public void ConfirmBasicConstructorWorks()
{
var constructorTest = new Repository();
Assert.IsTrue(constructorTest.Client != null);
Assert.IsTrue(constructorTest.Request != null);
}
[Test]
public void ConfirmConfigureGetRequestClearsParams()
{
var constructorTest = new Repository();
constructorTest.Request.Parameters.Add(new Parameter {Name = "param"});
Assert.IsTrue(constructorTest.Request.Parameters.Count > 0);
constructorTest.ConfigureRequest("endpoint");
Assert.IsTrue(constructorTest.Request.Parameters.Count == 0);
}
}
[Test]
public void ConfirmBasicConstructorWorks()
{
var constructorTest = new Repository();
Assert.IsTrue(constructorTest.Client != null);
Assert.IsTrue(constructorTest.Request != null);
}
[Test]
public void TimeoutShouldGetPassedIn()
{
var timeout = 100;
var repo = new Repository(timeout: timeout);
Assert.AreEqual(repo.Request.Timeout, timeout);
}
[Test]
public void ConfirmConfigureGetRequestClearsParams()
{
var constructorTest = new Repository();
constructorTest.Request.Parameters.Add(new Parameter { Name = "param" });
Assert.IsTrue(constructorTest.Request.Parameters.Count > 0);
constructorTest.ConfigureRequest("endpoint");
Assert.IsTrue(constructorTest.Request.Parameters.Count == 0);
}
}
}

View File

@@ -4,58 +4,54 @@ using Untappd.Net.Responses.Actions;
namespace Untappd.Net.UnitTests.Responses.Actions
{
[TestFixture]
public class TestCheckInAction
{
[Test]
public void TestAccessors()
{
Assert.Throws<ArgumentNullException>(() => { new CheckIn(string.Empty, "timezone", 1); });
Assert.Throws<ArgumentNullException>(() => { new CheckIn("1", string.Empty, 1); });
var checkin = new CheckIn("offset", "timezone", 1);
Assert.IsNotNullOrEmpty(checkin.RequestMethod.ToString());
Assert.Throws<ArgumentOutOfRangeException>(() => { checkin.Rating = -1; });
Assert.Throws<ArgumentOutOfRangeException>(() => { checkin.Rating = 6; });
Assert.Throws<ArgumentOutOfRangeException>(() => { checkin.Shout = new String('d', 141); });
checkin.Rating = 3;
Assert.AreEqual(3, checkin.Rating);
var t = "tst";
checkin.Shout = t;
Assert.IsNotNullOrEmpty(checkin.EndPoint);
Assert.AreEqual(checkin.Shout, t);
}
[TestFixture]
public class TestCheckInAction
{
[Test]
public void TestAccessors()
{
Assert.Throws<ArgumentNullException>(() => { new CheckIn(string.Empty, "timezone", 1); });
Assert.Throws<ArgumentNullException>(() => { new CheckIn("1", string.Empty, 1); });
var checkin = new CheckIn("offset", "timezone", 1);
Assert.IsNotNullOrEmpty(checkin.RequestMethod.ToString());
Assert.Throws<ArgumentOutOfRangeException>(() => { checkin.Rating = -1; });
Assert.Throws<ArgumentOutOfRangeException>(() => { checkin.Rating = 6; });
Assert.Throws<ArgumentOutOfRangeException>(() => { checkin.Shout = new String('d', 141); });
checkin.Rating = 3;
Assert.AreEqual(3, checkin.Rating);
var t = "tst";
checkin.Shout = t;
Assert.IsNotNullOrEmpty(checkin.EndPoint);
Assert.AreEqual(checkin.Shout, t);
}
[Test]
public void TestDictionaryGeneration()
{
var checkin = new CheckIn("offset", "timezone", 1);
Assert.AreEqual(checkin.BodyParameters["gmt_offset"], "offset");
Assert.AreEqual(checkin.BodyParameters["timezone"], "timezone");
Assert.AreEqual(checkin.BodyParameters["bid"], 1);
[Test]
public void TestDictionaryGeneration()
{
var checkin = new CheckIn("offset", "timezone", 1);
Assert.AreEqual(checkin.BodyParameters["gmt_offset"], "offset");
Assert.AreEqual(checkin.BodyParameters["timezone"], "timezone");
Assert.AreEqual(checkin.BodyParameters["bid"], 1);
Assert.IsFalse(checkin.BodyParameters.ContainsKey("geolat"));
checkin.Geolat = 4;
Assert.IsTrue(checkin.BodyParameters.ContainsKey("geolat"));
Assert.AreEqual(checkin.BodyParameters["geolat"], 4);
Assert.IsFalse(checkin.BodyParameters.ContainsKey("geolat"));
checkin.Geolat = 4;
Assert.IsTrue(checkin.BodyParameters.ContainsKey("geolat"));
Assert.AreEqual(checkin.BodyParameters["geolat"], 4);
Assert.IsFalse(checkin.BodyParameters.ContainsKey("geolng"));
checkin.Geolng = 4;
Assert.IsTrue(checkin.BodyParameters.ContainsKey("geolng"));
Assert.AreEqual(checkin.BodyParameters["geolng"], 4);
Assert.IsFalse(checkin.BodyParameters.ContainsKey("geolng"));
checkin.Geolng = 4;
Assert.IsTrue(checkin.BodyParameters.ContainsKey("geolng"));
Assert.AreEqual(checkin.BodyParameters["geolng"], 4);
Assert.IsFalse(checkin.BodyParameters.ContainsKey("shout"));
checkin.Shout = "shout";
Assert.IsTrue(checkin.BodyParameters.ContainsKey("shout"));
Assert.AreEqual(checkin.BodyParameters["shout"], "shout");
Assert.IsFalse(checkin.BodyParameters.ContainsKey("shout"));
checkin.Shout = "shout";
Assert.IsTrue(checkin.BodyParameters.ContainsKey("shout"));
Assert.AreEqual(checkin.BodyParameters["shout"], "shout");
Assert.IsFalse(checkin.BodyParameters.ContainsKey("rating"));
checkin.Rating = 2;
Assert.IsTrue(checkin.BodyParameters.ContainsKey("rating"));
Assert.AreEqual(checkin.BodyParameters["rating"], 2);
}
}
Assert.IsFalse(checkin.BodyParameters.ContainsKey("rating"));
checkin.Rating = 2;
Assert.IsTrue(checkin.BodyParameters.ContainsKey("rating"));
Assert.AreEqual(checkin.BodyParameters["rating"], 2);
}
}
}

View File

@@ -4,74 +4,73 @@ using Untappd.Net.Responses.Actions;
namespace Untappd.Net.UnitTests.Responses.Actions
{
[TestFixture]
public class TestSimpleActions
{
[Test]
public void TestFriends()
{
var accept = new AcceptFriend("targetid");
Assert.IsNotNullOrEmpty(accept.RequestMethod.ToString());
Assert.IsTrue(accept.EndPoint.Contains("targetid"));
Assert.IsNotNull(accept.BodyParameters);
[TestFixture]
public class TestSimpleActions
{
[Test]
public void TestFriends()
{
var accept = new AcceptFriend("targetid");
Assert.IsNotNullOrEmpty(accept.RequestMethod.ToString());
Assert.IsTrue(accept.EndPoint.Contains("targetid"));
Assert.IsNotNull(accept.BodyParameters);
var add = new AddFriend("targetid");
Assert.IsNotNullOrEmpty(add.RequestMethod.ToString());
Assert.IsTrue(add.EndPoint.Contains("targetid"));
Assert.IsNotNull(add.BodyParameters);
var add = new AddFriend("targetid");
Assert.IsNotNullOrEmpty(add.RequestMethod.ToString());
Assert.IsTrue(add.EndPoint.Contains("targetid"));
Assert.IsNotNull(add.BodyParameters);
var toast = new ToastUntoast("targetid");
Assert.IsNotNullOrEmpty(toast.RequestMethod.ToString());
Assert.IsTrue(toast.EndPoint.Contains("targetid"));
Assert.IsNotNull(toast.BodyParameters);
var toast = new ToastUntoast("targetid");
Assert.IsNotNullOrEmpty(toast.RequestMethod.ToString());
Assert.IsTrue(toast.EndPoint.Contains("targetid"));
Assert.IsNotNull(toast.BodyParameters);
var remove = new RemoveFriend("targetid");
Assert.IsNotNullOrEmpty(remove.RequestMethod.ToString());
Assert.IsTrue(remove.EndPoint.Contains("targetid"));
Assert.IsNotNull(remove.BodyParameters);
var remove = new RemoveFriend("targetid");
Assert.IsNotNullOrEmpty(remove.RequestMethod.ToString());
Assert.IsTrue(remove.EndPoint.Contains("targetid"));
Assert.IsNotNull(remove.BodyParameters);
var removeWish = new RemoveFromWishList(1);
Assert.IsNotNullOrEmpty(removeWish.RequestMethod.ToString());
Assert.IsNotNullOrEmpty(removeWish.EndPoint);
Assert.AreEqual(removeWish.BodyParameters["bid"], 1);
var removeWish = new RemoveFromWishList(1);
Assert.IsNotNullOrEmpty(removeWish.RequestMethod.ToString());
Assert.IsNotNullOrEmpty(removeWish.EndPoint);
Assert.AreEqual(removeWish.BodyParameters["bid"], 1);
var addWish = new AddToWishList(1);
Assert.IsNotNullOrEmpty(addWish.RequestMethod.ToString());
Assert.IsNotNullOrEmpty(addWish.EndPoint);
Assert.AreEqual(addWish.BodyParameters["bid"], 1);
var addWish = new AddToWishList(1);
Assert.IsNotNullOrEmpty(addWish.RequestMethod.ToString());
Assert.IsNotNullOrEmpty(addWish.EndPoint);
Assert.AreEqual(addWish.BodyParameters["bid"], 1);
var comment = new AddComment("checkin", "shout");
Assert.IsNotNullOrEmpty(comment.RequestMethod.ToString());
Assert.IsTrue(comment.EndPoint.Contains("checkin"));
Assert.AreEqual(comment.BodyParameters["shout"], "shout");
}
var comment = new AddComment("checkin", "shout");
Assert.IsNotNullOrEmpty(comment.RequestMethod.ToString());
Assert.IsTrue(comment.EndPoint.Contains("checkin"));
Assert.AreEqual(comment.BodyParameters["shout"], "shout");
}
[Test]
public void TestPendingFriends()
{
var pending = new PendingFriends();
Assert.IsNotNullOrEmpty(pending.RequestMethod.ToString());
Assert.IsNotNullOrEmpty(pending.EndPoint);
Assert.IsNotNull(pending.BodyParameters);
Assert.IsFalse(pending.BodyParameters.ContainsKey("limit"));
pending.Limit = 1;
Assert.IsTrue(pending.BodyParameters.ContainsKey("limit"));
Assert.IsFalse(pending.BodyParameters.ContainsKey("offset"));
pending.Offset = 1;
Assert.IsTrue(pending.BodyParameters.ContainsKey("offset"));
}
[Test]
public void TestPendingFriends()
{
var pending = new PendingFriends();
Assert.IsNotNullOrEmpty(pending.RequestMethod.ToString());
Assert.IsNotNullOrEmpty(pending.EndPoint);
Assert.IsNotNull(pending.BodyParameters);
Assert.IsFalse(pending.BodyParameters.ContainsKey("limit"));
pending.Limit = 1;
Assert.IsTrue(pending.BodyParameters.ContainsKey("limit"));
Assert.IsFalse(pending.BodyParameters.ContainsKey("offset"));
pending.Offset = 1;
Assert.IsTrue(pending.BodyParameters.ContainsKey("offset"));
}
[Test]
public void TestArgumentNull()
{
Assert.Throws<ArgumentNullException>(() => { new AcceptFriend(string.Empty); });
Assert.Throws<ArgumentNullException>(() => { new AddFriend(string.Empty); });
Assert.Throws<ArgumentNullException>(() => { new RemoveFriend(string.Empty); });
Assert.Throws<ArgumentNullException>(() => { new ToastUntoast(string.Empty); });
Assert.Throws<ArgumentNullException>(() => { new AddComment(string.Empty, "ds"); });
Assert.Throws<ArgumentNullException>(() => { new AddComment("ds", string.Empty); });
Assert.Throws<ArgumentOutOfRangeException>(() => { new AddComment("ds", new String('d', 141)); });
}
}
[Test]
public void TestArgumentNull()
{
Assert.Throws<ArgumentNullException>(() => { new AcceptFriend(string.Empty); });
Assert.Throws<ArgumentNullException>(() => { new AddFriend(string.Empty); });
Assert.Throws<ArgumentNullException>(() => { new RemoveFriend(string.Empty); });
Assert.Throws<ArgumentNullException>(() => { new ToastUntoast(string.Empty); });
Assert.Throws<ArgumentNullException>(() => { new AddComment(string.Empty, "ds"); });
Assert.Throws<ArgumentNullException>(() => { new AddComment("ds", string.Empty); });
Assert.Throws<ArgumentOutOfRangeException>(() => { new AddComment("ds", new String('d', 141)); });
}
}
}

View File

@@ -20,121 +20,121 @@ using UserWishList = Untappd.Net.Responses.UserWishlist;
namespace Untappd.Net.UnitTests.Responses
{
[TestFixture]
public class TestDeserializer
{
private static string ResponsePath = "../../Responses/Json/{0}";
[TestFixture]
public class TestDeserializer
{
private static string ResponsePath = "../../Responses/Json/{0}";
[Test]
[Ignore]
public void GetActualJsonRequest()
{
var credentials = new AuthenticatedUntappdCredentials("");
[Test]
[Ignore]
public void GetActualJsonRequest()
{
var credentials = new AuthenticatedUntappdCredentials("");
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("q", "wild rose");
Dictionary<string, object> parameters = new Dictionary<string, object>();
parameters.Add("q", "wild rose");
var repo = new Repository();
//var resp = repo.Get<ActivityFeed.ActivityFeed>(credentials);
var resp3 = repo.Get<BrewerySearch>(credentials, "", parameters);
var resp2 = repo.Get<UserActivityFeed>(credentials);
}
var repo = new Repository();
//var resp = repo.Get<ActivityFeed.ActivityFeed>(credentials);
var resp3 = repo.Get<BrewerySearch>(credentials, "", parameters);
var resp2 = repo.Get<UserActivityFeed>(credentials);
}
[Test]
public void TestJsonDeserializeUserBadges()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserBadges.json"));
var jsonresult = JsonConvert.DeserializeObject<UserBadges>(json);
}
[Test]
public void TestJsonDeserializeUserBadges()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserBadges.json"));
var jsonresult = JsonConvert.DeserializeObject<UserBadges>(json);
}
[Test]
public void TestJsonDeserializerBeerInfo()
{
var json = File.ReadAllText(string.Format(ResponsePath, "BeerInfo.json"));
var jsonresult = JsonConvert.DeserializeObject<BeerInfo>(json);
}
[Test]
public void TestJsonDeserializerBeerInfo()
{
var json = File.ReadAllText(string.Format(ResponsePath, "BeerInfo.json"));
var jsonresult = JsonConvert.DeserializeObject<BeerInfo>(json);
}
[Test]
public void TestJsonDeserializerBeerSearch()
{
var json = File.ReadAllText(string.Format(ResponsePath, "BeerSearch.json"));
var jsonresult = JsonConvert.DeserializeObject<BeerSearch>(json);
}
[Test]
public void TestJsonDeserializerBeerSearch()
{
var json = File.ReadAllText(string.Format(ResponsePath, "BeerSearch.json"));
var jsonresult = JsonConvert.DeserializeObject<BeerSearch>(json);
}
[Test]
public void TestJsonDeserializerBreweryInfo()
{
var json = File.ReadAllText(string.Format(ResponsePath, "BreweryInfo.json"));
var jsonresult = JsonConvert.DeserializeObject<BreweryInfo>(json);
}
[Test]
public void TestJsonDeserializerBreweryInfo()
{
var json = File.ReadAllText(string.Format(ResponsePath, "BreweryInfo.json"));
var jsonresult = JsonConvert.DeserializeObject<BreweryInfo>(json);
}
[Test]
public void TestJsonDeserializerBrewerySearch()
{
var json = File.ReadAllText(string.Format(ResponsePath, "BrewerySearch.json"));
var jsonresult = JsonConvert.DeserializeObject<BrewerySearch>(json);
}
[Test]
public void TestJsonDeserializerBrewerySearch()
{
var json = File.ReadAllText(string.Format(ResponsePath, "BrewerySearch.json"));
var jsonresult = JsonConvert.DeserializeObject<BrewerySearch>(json);
}
[Test]
public void TestJsonDeserializerUserDistinctBeers()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserDistinctBeers.json"));
var jsonresult = JsonConvert.DeserializeObject<UserDistinctBeers.UserDistinctBeers>(json);
}
[Test]
public void TestJsonDeserializerUserDistinctBeers()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserDistinctBeers.json"));
var jsonresult = JsonConvert.DeserializeObject<UserDistinctBeers.UserDistinctBeers>(json);
}
[Test]
public void TestJsonDeserializerUserFriends()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserFriends.json"));
var jsonresult = JsonConvert.DeserializeObject<UserFriends>(json);
}
[Test]
public void TestJsonDeserializerUserFriends()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserFriends.json"));
var jsonresult = JsonConvert.DeserializeObject<UserFriends>(json);
}
[Test]
public void TestJsonDeserializerUserInfo()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserInfo.json"));
var jsonresult = JsonConvert.DeserializeObject<UserInfo>(json);
}
[Test]
public void TestJsonDeserializerUserInfo()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserInfo.json"));
var jsonresult = JsonConvert.DeserializeObject<UserInfo>(json);
}
[Test]
public void TestJsonDeserializerUserWishList()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserWishList.json"));
var jsonresult = JsonConvert.DeserializeObject<UserWishList.UserWishList>(json);
}
[Test]
public void TestJsonDeserializerUserWishList()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserWishList.json"));
var jsonresult = JsonConvert.DeserializeObject<UserWishList.UserWishList>(json);
}
[Test]
public void TestJsonDeserializerVenueInfo()
{
var json = File.ReadAllText(string.Format(ResponsePath, "VenueInfo.json"));
var jsonresult = JsonConvert.DeserializeObject<VenueInfo>(json);
}
[Test]
public void TestJsonDeserializerVenueInfo()
{
var json = File.ReadAllText(string.Format(ResponsePath, "VenueInfo.json"));
var jsonresult = JsonConvert.DeserializeObject<VenueInfo>(json);
}
[Test]
public void TestJsonDeserializerActivityFeed()
{
var json = File.ReadAllText(string.Format(ResponsePath, "ActivityFeed.json"));
var jsonresult = JsonConvert.DeserializeObject<ActivityFeed>(json);
}
[Test]
public void TestJsonDeserializerActivityFeed()
{
var json = File.ReadAllText(string.Format(ResponsePath, "ActivityFeed.json"));
var jsonresult = JsonConvert.DeserializeObject<ActivityFeed>(json);
}
[Test]
public void TestJsonDeserializerUserActivityFeed()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserActivityFeed.json"));
var jsonresult = JsonConvert.DeserializeObject<UserActivityFeed>(json);
}
[Test]
public void TestJsonDeserializerUserActivityFeed()
{
var json = File.ReadAllText(string.Format(ResponsePath, "UserActivityFeed.json"));
var jsonresult = JsonConvert.DeserializeObject<UserActivityFeed>(json);
}
[Test]
[ExpectedException(typeof(NotImplementedException))]
public void testNotImplementedException()
{
new SingleObjectArrayConverter<UserActivityFeed>().WriteJson(null, null, null);
}
[Test]
[ExpectedException(typeof(NotImplementedException))]
public void testNotImplementedException()
{
new SingleObjectArrayConverter<UserActivityFeed>().WriteJson(null, null, null);
}
[Test]
public void testTypeValid()
{
Assert.IsTrue(new SingleObjectArrayConverter<UserActivityFeed>().CanConvert(typeof(UserActivityFeed)));
}
}
[Test]
public void testTypeValid()
{
Assert.IsTrue(new SingleObjectArrayConverter<UserActivityFeed>().CanConvert(typeof(UserActivityFeed)));
}
}
}

View File

@@ -6,33 +6,31 @@ using Untappd.Net.Request;
namespace Untappd.Net.UnitTests.Responses
{
[TestFixture]
public class TestResponseEndpoints
{
[TestFixture]
public class TestResponseEndpoints
{
/// <summary>
/// Run through all the endpoints to make sure they all atleast do not error out.
/// This is so we can get a high code coverage, while also covering new types that get added.
/// </summary>
[Test]
public void RunAllEndpoints()
{
var objects = Assembly.GetAssembly(typeof(IRequest)).GetTypes().Where(myType =>
myType.IsClass
&& !myType.IsAbstract
&& myType.GetInterface("IRequest") != null).Select(type => (IRequest)Activator.CreateInstance(type)).ToList();
objects.ForEach(a => Assert.IsNotNullOrEmpty(a.EndPoint("t")));
}
/// <summary>
/// Run through all the endpoints to make sure they all atleast do not error out.
/// This is so we can get a high code coverage, while also covering new types that get added.
/// </summary>
[Test]
public void RunAllEndpoints()
{
var objects = Assembly.GetAssembly(typeof (IRequest)).GetTypes().Where(myType =>
myType.IsClass
&& !myType.IsAbstract
&& myType.GetInterface("IRequest") != null).Select(type => (IRequest) Activator.CreateInstance(type)).ToList();
objects.ForEach(a=>Assert.IsNotNullOrEmpty(a.EndPoint("t")));
}
[Test]
public void RunAllEndpointsWithEmptyString()
{
var objects = Assembly.GetAssembly(typeof (IRequest)).GetTypes().Where(myType =>
myType.IsClass
&& !myType.IsAbstract
&& myType.GetInterface("IRequest") != null).Select(type => (IRequest) Activator.CreateInstance(type)).ToList();
objects.ForEach(a=>Assert.IsNotNullOrEmpty(a.EndPoint(string.Empty)));
}
}
[Test]
public void RunAllEndpointsWithEmptyString()
{
var objects = Assembly.GetAssembly(typeof(IRequest)).GetTypes().Where(myType =>
myType.IsClass
&& !myType.IsAbstract
&& myType.GetInterface("IRequest") != null).Select(type => (IRequest)Activator.CreateInstance(type)).ToList();
objects.ForEach(a => Assert.IsNotNullOrEmpty(a.EndPoint(string.Empty)));
}
}
}

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Moq" version="4.2.1502.0911" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="NUnitTestAdapter" version="1.2" targetFramework="net45" />
<package id="RestSharp" version="105.0.1" targetFramework="net45" />
<package id="Moq" version="4.2.1502.0911" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="NUnitTestAdapter" version="1.2" targetFramework="net45" />
<package id="RestSharp" version="105.0.1" targetFramework="net45" />
</packages>

View File

@@ -4,22 +4,22 @@ using System.Collections.ObjectModel;
namespace Untappd.Net.Authentication
{
public sealed class AuthenticatedUntappdCredentials : UntappdCredentials, IAuthenticatedUntappdCredentials
{
/// <summary>
/// Pass your authenticated access token
/// </summary>
/// <param name="accessToken"></param>
public AuthenticatedUntappdCredentials(string accessToken)
{
if (string.IsNullOrWhiteSpace(accessToken))
{
throw new ArgumentNullException("accessToken");
}
AuthenticationData = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
{
{"access_token", accessToken}
});
}
}
public sealed class AuthenticatedUntappdCredentials : UntappdCredentials, IAuthenticatedUntappdCredentials
{
/// <summary>
/// Pass your authenticated access token
/// </summary>
/// <param name="accessToken"></param>
public AuthenticatedUntappdCredentials(string accessToken)
{
if (string.IsNullOrWhiteSpace(accessToken))
{
throw new ArgumentNullException("accessToken");
}
AuthenticationData = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
{
{"access_token", accessToken}
});
}
}
}

View File

@@ -1,6 +1,6 @@
namespace Untappd.Net.Authentication
{
public interface IAuthenticatedUntappdCredentials : IUntappdCredentials
{
}
public interface IAuthenticatedUntappdCredentials : IUntappdCredentials
{
}
}

View File

@@ -1,7 +1,6 @@
namespace Untappd.Net.Authentication
namespace Untappd.Net.Authentication
{
public interface IUnAuthenticatedUntappdCredentials : IUntappdCredentials
{
}
public interface IUnAuthenticatedUntappdCredentials : IUntappdCredentials
{
}
}

View File

@@ -2,8 +2,8 @@
namespace Untappd.Net.Authentication
{
public interface IUntappdCredentials
{
IReadOnlyDictionary<string, string> AuthenticationData { get; }
}
public interface IUntappdCredentials
{
IReadOnlyDictionary<string, string> AuthenticationData { get; }
}
}

View File

@@ -4,27 +4,27 @@ using System.Collections.ObjectModel;
namespace Untappd.Net.Authentication
{
public sealed 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)
{
if (string.IsNullOrWhiteSpace(clientId))
{
throw new ArgumentNullException("clientId");
}
if (string.IsNullOrWhiteSpace(clientSecret))
{
throw new ArgumentNullException("clientSecret");
}
AuthenticationData = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
{
{"client_id", clientId}, {"client_secret", clientSecret}
});
}
}
public sealed 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)
{
if (string.IsNullOrWhiteSpace(clientId))
{
throw new ArgumentNullException("clientId");
}
if (string.IsNullOrWhiteSpace(clientSecret))
{
throw new ArgumentNullException("clientSecret");
}
AuthenticationData = new ReadOnlyDictionary<string, string>(new Dictionary<string, string>()
{
{"client_id", clientId}, {"client_secret", clientSecret}
});
}
}
}

View File

@@ -2,8 +2,8 @@
namespace Untappd.Net.Authentication
{
public abstract class UntappdCredentials : IUntappdCredentials
{
public IReadOnlyDictionary<string, string> AuthenticationData { get; protected set; }
}
public abstract class UntappdCredentials : IUntappdCredentials
{
public IReadOnlyDictionary<string, string> AuthenticationData { get; protected set; }
}
}

View File

@@ -1,8 +1,8 @@
namespace Untappd.Net
{
public struct Constants
{
public const string BaseRequestString = "https://api.untappd.com";
public const string OAuthTokenEndPoint = "https://untappd.com/oauth/authorize";
}
public struct Constants
{
public const string BaseRequestString = "https://api.untappd.com";
public const string OAuthTokenEndPoint = "https://untappd.com/oauth/authorize";
}
}

View File

@@ -2,19 +2,19 @@
namespace Untappd.Net.Exception
{
[Serializable]
public class BaseUntappdException : System.Exception
{
public BaseUntappdException()
{
}
[Serializable]
public class BaseUntappdException : System.Exception
{
public BaseUntappdException()
{
}
public BaseUntappdException(string message) : base(message)
{
}
public BaseUntappdException(string message) : base(message)
{
}
public BaseUntappdException(string message, System.Exception inner) : base(message, inner)
{
}
}
public BaseUntappdException(string message, System.Exception inner) : base(message, inner)
{
}
}
}

View File

@@ -2,17 +2,16 @@
namespace Untappd.Net.Exception
{
[Serializable]
public sealed class EndpointConfigurationException : BaseUntappdException
{
/// <summary>
/// Called when a class has an empty endpoint
/// </summary>
/// <param name="type"></param>
public EndpointConfigurationException()
:base("Invalid endpoint configured")
{
}
}
[Serializable]
public sealed class EndpointConfigurationException : BaseUntappdException
{
/// <summary>
/// Called when a class has an empty endpoint
/// </summary>
/// <param name="type"></param>
public EndpointConfigurationException()
: base("Invalid endpoint configured")
{
}
}
}

View File

@@ -4,39 +4,40 @@ using RestSharp;
namespace Untappd.Net.Exception
{
[Serializable]
public sealed class HttpErrorException : BaseUntappdException
{
public override string Message
{
get
{
return _message;
}
}
[Serializable]
public sealed class HttpErrorException : BaseUntappdException
{
public override string Message
{
get
{
return _message;
}
}
private readonly string _message;
public HttpErrorException(IRestRequest request, IRestResponse response)
{
if(request == null)
{
throw new ArgumentNullException("request");
}
if (response == null)
{
throw new ArgumentNullException("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");
}
private readonly string _message;
_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));
}
}
public HttpErrorException(IRestRequest request, IRestResponse response)
{
if (request == null)
{
throw new ArgumentNullException("request");
}
if (response == null)
{
throw new ArgumentNullException("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));
}
}
}

View File

@@ -3,58 +3,58 @@ using Untappd.Net.Authentication;
namespace Untappd.Net.OAuth
{
public static class AuthenticationHelper
{
/// <summary>
/// Redirect the user to this string.
/// </summary>
/// <param name="credentials"></param>
/// <param name="redirectUrl">The URL to redirect back to your application. Should listen on code as a string param</param>
/// <returns></returns>
public static string RedirectUserTo(IUnAuthenticatedUntappdCredentials credentials, string redirectUrl)
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
public static class AuthenticationHelper
{
/// <summary>
/// Redirect the user to this string.
/// </summary>
/// <param name="credentials"></param>
/// <param name="redirectUrl">The URL to redirect back to your application. Should listen on code as a string param</param>
/// <returns></returns>
public static string RedirectUserTo(IUnAuthenticatedUntappdCredentials credentials, string redirectUrl)
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
if (string.IsNullOrWhiteSpace(redirectUrl))
{
throw new ArgumentNullException("redirectUrl");
}
if (string.IsNullOrWhiteSpace(redirectUrl))
{
throw new ArgumentNullException("redirectUrl");
}
return string.Format("{0}/?client_id={1}&response_type=code&redirect_url={2}", Constants.BaseRequestString,
credentials.AuthenticationData["client_id"], redirectUrl);
}
return string.Format("{0}/?client_id={1}&response_type=code&redirect_url={2}", Constants.BaseRequestString,
credentials.AuthenticationData["client_id"], redirectUrl);
}
/// <summary>
/// Url to get the OAuth token.
/// </summary>
/// <param name="credentials"></param>
/// <param name="redirectUrl"></param>
/// <param name="code">Data returned by the initial request(see: RedirectUserTo)</param>
/// <returns></returns>
public static string TokenUrl(IUnAuthenticatedUntappdCredentials credentials, string redirectUrl, string code)
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
/// <summary>
/// Url to get the OAuth token.
/// </summary>
/// <param name="credentials"></param>
/// <param name="redirectUrl"></param>
/// <param name="code">Data returned by the initial request(see: RedirectUserTo)</param>
/// <returns></returns>
public static string TokenUrl(IUnAuthenticatedUntappdCredentials credentials, string redirectUrl, string code)
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
if (string.IsNullOrWhiteSpace(redirectUrl))
{
throw new ArgumentNullException("redirectUrl");
}
if (string.IsNullOrWhiteSpace(code))
{
throw new ArgumentNullException("code");
}
return string.Format("{0}/?client_id={1}&client_secret={2}&response_type=code&redirect_url={3}&code={4}",
Constants.OAuthTokenEndPoint,
credentials.AuthenticationData["client_id"],
credentials.AuthenticationData["client_secret"],
redirectUrl,
code);
}
}
if (string.IsNullOrWhiteSpace(redirectUrl))
{
throw new ArgumentNullException("redirectUrl");
}
if (string.IsNullOrWhiteSpace(code))
{
throw new ArgumentNullException("code");
}
return string.Format("{0}/?client_id={1}&client_secret={2}&response_type=code&redirect_url={3}&code={4}",
Constants.OAuthTokenEndPoint,
credentials.AuthenticationData["client_id"],
credentials.AuthenticationData["client_secret"],
redirectUrl,
code);
}
}
}

View File

@@ -1,12 +1,10 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
using System;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
[assembly: AssemblyTitle("Untappd.Net")]
[assembly: AssemblyDescription("C# Untappd Wrapper")]

View File

@@ -2,22 +2,23 @@
namespace Untappd.Net.Request
{
public abstract class BasicRequest
{
protected abstract string EndPointWithConfiguration { get; }
/// <summary>
/// Pass in the parameter into the request...ie username, brewery, etc.
/// </summary>
/// <param name="parameter"></param>
/// <returns></returns>
public string EndPoint(string parameter = "")
{
if (!String.IsNullOrEmpty(parameter))
{
parameter = string.Format("/{0}", parameter);
return string.Format(EndPointWithConfiguration, parameter);
}
return string.Format(EndPointWithConfiguration, string.Empty);
}
}
public abstract class BasicRequest
{
protected abstract string EndPointWithConfiguration { get; }
/// <summary>
/// Pass in the parameter into the request...ie username, brewery, etc.
/// </summary>
/// <param name="parameter"></param>
/// <returns></returns>
public string EndPoint(string parameter = "")
{
if (!String.IsNullOrEmpty(parameter))
{
parameter = string.Format("/{0}", parameter);
return string.Format(EndPointWithConfiguration, parameter);
}
return string.Format(EndPointWithConfiguration, string.Empty);
}
}
}

View File

@@ -3,10 +3,10 @@ using RestSharp;
namespace Untappd.Net.Request
{
public interface IAction
{
Method RequestMethod { get; }
string EndPoint { get; }
IDictionary<string, object> BodyParameters { get; }
}
public interface IAction
{
Method RequestMethod { get; }
string EndPoint { get; }
IDictionary<string, object> BodyParameters { get; }
}
}

View File

@@ -1,6 +1,6 @@
namespace Untappd.Net.Request
{
public interface IAuthenticatedRequest : IRequest
{
}
public interface IAuthenticatedRequest : IRequest
{
}
}

View File

@@ -1,7 +1,7 @@
namespace Untappd.Net.Request
{
public interface IRequest
{
string EndPoint(string parameter);
}
public interface IRequest
{
string EndPoint(string parameter);
}
}

View File

@@ -1,6 +1,6 @@
namespace Untappd.Net.Request
{
public interface IUnAuthenticatedRequest : IRequest
{
}
public interface IUnAuthenticatedRequest : IRequest
{
}
}

View File

@@ -14,6 +14,7 @@ namespace Untappd.Net.Request
internal IRestClient Client;
internal IRestRequest Request;
public 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
@@ -24,10 +25,14 @@ namespace Untappd.Net.Request
/// Make a repository
/// </summary>
/// <param name="failFast">Should we throw exceptions? or just return null</param>
public Repository(bool failFast = true)
/// <param name="timeout">Set a timeout in milliseconds</param>
public Repository(bool failFast = true, int timeout = 0)
{
Client = new RestClient(Constants.BaseRequestString);
Request = new RestRequest();
Request = new RestRequest
{
Timeout = timeout
};
FailFast = failFast;
}
@@ -65,19 +70,19 @@ namespace Untappd.Net.Request
return this;
}
TResult ExecuteRequest<TResult>()
private TResult ExecuteRequest<TResult>()
where TResult : class
{
return ProcessExecution<TResult>(Client.Execute(Request));
}
async Task<TResult> ExecuteRequestAsync<TResult>()
private async Task<TResult> ExecuteRequestAsync<TResult>()
where TResult : class
{
return ProcessExecution<TResult>(await Client.ExecuteTaskAsync(Request));
}
TResult ProcessExecution<TResult>(IRestResponse response)
private TResult ProcessExecution<TResult>(IRestResponse response)
where TResult : class
{
//if the return type is not 200 throw errors
@@ -101,13 +106,13 @@ namespace Untappd.Net.Request
{
return JsonConvert.DeserializeObject<TResult>(response.Content);
}
catch(System.Exception e)
catch (System.Exception e)
{
var eventThrow = OnExceptionThrown;
if (eventThrow != null)
{
eventThrow(this, new UnhandledExceptionEventArgs(e, FailFast));
eventThrow(this, new UnhandledExceptionEventArgs(e, FailFast));
}
if (FailFast)
{

View File

@@ -1,78 +1,77 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using Untappd.Net.Authentication;
using Untappd.Net.Exception;
namespace Untappd.Net.Request
{
public sealed partial class Repository
{
/// <summary>
/// Get the things!
/// </summary>
/// <typeparam name="TResult">What you want to request</typeparam>
/// <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 : class, IUnAuthenticatedRequest, new()
{
var result = new TResult();
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
.ExecuteRequest<TResult>();
}
public sealed partial class Repository
{
/// <summary>
/// Get the things!
/// </summary>
/// <typeparam name="TResult">What you want to request</typeparam>
/// <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 : class, IUnAuthenticatedRequest, new()
{
var result = new TResult();
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
.ExecuteRequest<TResult>();
}
/// <summary>
/// Get the things! Async!
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <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 : class, IUnAuthenticatedRequest, new()
{
var result = new TResult();
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
.ExecuteRequestAsync<TResult>();
}
/// <summary>
/// Get the things! Async!
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <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 : class, IUnAuthenticatedRequest, new()
{
var result = new TResult();
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
.ExecuteRequestAsync<TResult>();
}
/// <summary>
/// Get the things! authenticated!
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <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 : class,IAuthenticatedRequest, new()
{
var result = new TResult();
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
.ExecuteRequest<TResult>();
}
/// <summary>
/// Get the things! authenticated!
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <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 : class, IAuthenticatedRequest, new()
{
var result = new TResult();
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
.ExecuteRequest<TResult>();
}
/// <summary>
/// Get the things Authenticated! Async!!
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <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 : class,IAuthenticatedRequest, new()
{
var result = new TResult();
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
.ExecuteRequestAsync<TResult>();
}
}
/// <summary>
/// Get the things Authenticated! Async!!
/// </summary>
/// <typeparam name="TResult"></typeparam>
/// <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 : class, IAuthenticatedRequest, new()
{
var result = new TResult();
return ConfigureRequest(credentials, result.EndPoint(urlParameter), bodyParameters)
.ExecuteRequestAsync<TResult>();
}
}
}

View File

@@ -1,51 +1,51 @@
using System.Threading.Tasks;
using System;
using System.Threading.Tasks;
using Untappd.Net.Authentication;
using System;
namespace Untappd.Net.Request
{
public sealed partial class Repository
{
/// <summary>
/// do a post with actions
/// </summary>
/// <param name="credentials"></param>
/// <param name="action"></param>
/// <returns>returns dynamic since often the return doesn't matter</returns>
public dynamic Post(IAuthenticatedUntappdCredentials credentials, IAction action)
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
if (action == null)
{
throw new ArgumentNullException("action");
}
public sealed partial class Repository
{
/// <summary>
/// do a post with actions
/// </summary>
/// <param name="credentials"></param>
/// <param name="action"></param>
/// <returns>returns dynamic since often the return doesn't matter</returns>
public dynamic Post(IAuthenticatedUntappdCredentials credentials, IAction action)
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
if (action == null)
{
throw new ArgumentNullException("action");
}
return ConfigureRequest(credentials, action.EndPoint, action.BodyParameters, action.RequestMethod)
.ExecuteRequest<dynamic>();
}
return ConfigureRequest(credentials, action.EndPoint, action.BodyParameters, action.RequestMethod)
.ExecuteRequest<dynamic>();
}
/// <summary>
/// do a post with actions, Async!
/// </summary>
/// <param name="credentials"></param>
/// <param name="action"></param>
/// <returns>returns dynamic since often the return doesn't matter</returns>
public Task<dynamic> PostAsync(IAuthenticatedUntappdCredentials credentials, IAction action)
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
if (action == null)
{
throw new ArgumentNullException("action");
}
/// <summary>
/// do a post with actions, Async!
/// </summary>
/// <param name="credentials"></param>
/// <param name="action"></param>
/// <returns>returns dynamic since often the return doesn't matter</returns>
public Task<dynamic> PostAsync(IAuthenticatedUntappdCredentials credentials, IAction action)
{
if (credentials == null)
{
throw new ArgumentNullException("credentials");
}
if (action == null)
{
throw new ArgumentNullException("action");
}
return ConfigureRequest(credentials, action.EndPoint, action.BodyParameters, action.RequestMethod)
.ExecuteRequestAsync<dynamic>();
}
}
return ConfigureRequest(credentials, action.EndPoint, action.BodyParameters, action.RequestMethod)
.ExecuteRequestAsync<dynamic>();
}
}
}

View File

@@ -5,18 +5,19 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class AcceptFriend : IAction
{
public Method RequestMethod { get { return Method.GET; } }
public string EndPoint { get; private set; }
public IDictionary<string, object> BodyParameters { get { return new Dictionary<string, object>(); } }
public AcceptFriend(string target_id)
{
if (string.IsNullOrWhiteSpace(target_id))
{
throw new ArgumentNullException("target_id");
}
EndPoint = string.Format("v4/friend/accept/{0}", target_id);
}
}
public class AcceptFriend : IAction
{
public Method RequestMethod { get { return Method.GET; } }
public string EndPoint { get; private set; }
public IDictionary<string, object> BodyParameters { get { return new Dictionary<string, object>(); } }
public AcceptFriend(string target_id)
{
if (string.IsNullOrWhiteSpace(target_id))
{
throw new ArgumentNullException("target_id");
}
EndPoint = string.Format("v4/friend/accept/{0}", target_id);
}
}
}

View File

@@ -5,28 +5,28 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class AddComment : IAction
{
public Method RequestMethod { get {return Method.POST;} }
public string EndPoint { get; private set; }
public IDictionary<string, object> BodyParameters { get; private set; }
public AddComment(string checkinId, string shout)
{
if (string.IsNullOrWhiteSpace(checkinId))
{
throw new ArgumentNullException("checkinId");
}
if (string.IsNullOrWhiteSpace(shout))
{
throw new ArgumentNullException("shout");
}
if (shout.Length > 140)
{
throw new ArgumentOutOfRangeException("shout", shout, "Shout cannot be more than 140 characters");
}
EndPoint = string.Format("v4/checkin/addcomment/{0}", checkinId);
BodyParameters = new Dictionary<string, object> {{shout, shout}};
public class AddComment : IAction
{
public Method RequestMethod { get { return Method.POST; } }
public string EndPoint { get; private set; }
public IDictionary<string, object> BodyParameters { get; private set; }
}
}
public AddComment(string checkinId, string shout)
{
if (string.IsNullOrWhiteSpace(checkinId))
{
throw new ArgumentNullException("checkinId");
}
if (string.IsNullOrWhiteSpace(shout))
{
throw new ArgumentNullException("shout");
}
if (shout.Length > 140)
{
throw new ArgumentOutOfRangeException("shout", shout, "Shout cannot be more than 140 characters");
}
EndPoint = string.Format("v4/checkin/addcomment/{0}", checkinId);
BodyParameters = new Dictionary<string, object> { { shout, shout } };
}
}
}

View File

@@ -5,18 +5,19 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class AddFriend : IAction
{
public Method RequestMethod { get{return Method.GET;} }
public string EndPoint { get; private set; }
public IDictionary<string, object> BodyParameters { get{ return new Dictionary<string, object>();} }
public AddFriend(string target_id)
{
if (string.IsNullOrWhiteSpace(target_id))
{
throw new ArgumentNullException("target_id");
}
EndPoint = string.Format("v4/friend/request/{0}", target_id);
}
}
public class AddFriend : IAction
{
public Method RequestMethod { get { return Method.GET; } }
public string EndPoint { get; private set; }
public IDictionary<string, object> BodyParameters { get { return new Dictionary<string, object>(); } }
public AddFriend(string target_id)
{
if (string.IsNullOrWhiteSpace(target_id))
{
throw new ArgumentNullException("target_id");
}
EndPoint = string.Format("v4/friend/request/{0}", target_id);
}
}
}

View File

@@ -4,15 +4,15 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class AddToWishList : IAction
{
public Method RequestMethod { get {return Method.GET;} }
public string EndPoint { get { return "v4/user/wishlist/add"; } }
public IDictionary<string, object> BodyParameters { get; private set; }
public AddToWishList(int beerId)
{
BodyParameters = new Dictionary<string, object>() { { "bid", beerId } };
public class AddToWishList : IAction
{
public Method RequestMethod { get { return Method.GET; } }
public string EndPoint { get { return "v4/user/wishlist/add"; } }
public IDictionary<string, object> BodyParameters { get; private set; }
}
}
public AddToWishList(int beerId)
{
BodyParameters = new Dictionary<string, object>() { { "bid", beerId } };
}
}
}

View File

@@ -5,93 +5,92 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class CheckIn : IAction
{
private short _rating;
private string _shout;
public Method RequestMethod { get{ return Method.POST;} }
public string EndPoint { get { return "v4/checkin/add"; } }
public class CheckIn : IAction
{
private short _rating;
private string _shout;
public Method RequestMethod { get { return Method.POST; } }
public string EndPoint { get { return "v4/checkin/add"; } }
public IDictionary<string, object> BodyParameters
{
get
{
var dict = new Dictionary<string, object>
{
{"gmt_offset", GmtOffset},
{"timezone", Timezone},
{"bid", Bid}
};
if (Geolat.HasValue)
{
dict.Add("geolat", Geolat.Value);
}
if (Geolng.HasValue)
{
dict.Add("geolng", Geolng.Value);
}
if (!string.IsNullOrWhiteSpace(Shout) && Shout.Length <= 140)
{
dict.Add("shout", Shout);
}
if (Rating > 0 && Rating < 6)
{
dict.Add("rating", Rating);
}
return dict;
}
}
public IDictionary<string, object> BodyParameters
{
get
{
var dict = new Dictionary<string, object>
{
{"gmt_offset", GmtOffset},
{"timezone", Timezone},
{"bid", Bid}
};
if (Geolat.HasValue)
{
dict.Add("geolat", Geolat.Value);
}
if (Geolng.HasValue)
{
dict.Add("geolng", Geolng.Value);
}
if (!string.IsNullOrWhiteSpace(Shout) && Shout.Length <= 140)
{
dict.Add("shout", Shout);
}
if (Rating > 0 && Rating < 6)
{
dict.Add("rating", Rating);
}
return dict;
}
}
public string GmtOffset { get; private set; }
public string Timezone { get; private set; }
public int Bid { get; private set; }
public int? Geolat { get; set; }
public int? Geolng { get; set; }
public string GmtOffset { get; private set; }
public string Timezone { get; private set; }
public int Bid { get; private set; }
public int? Geolat { get; set; }
public int? Geolng { get; set; }
public string Shout
{
get { return _shout; }
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (value.Length > 140)
{
throw new ArgumentOutOfRangeException("value", value,"Shout can be no more than 140 characters");
}
_shout = string.Copy(value);
}
}
public string Shout
{
get { return _shout; }
set
{
if (value == null)
{
throw new ArgumentNullException("value");
}
if (value.Length > 140)
{
throw new ArgumentOutOfRangeException("value", value, "Shout can be no more than 140 characters");
}
_shout = string.Copy(value);
}
}
public short Rating
{
get { return _rating; }
set
{
if (value < 1 || value > 5)
{
throw new ArgumentOutOfRangeException("value", value, "Ratings should be between 1 and 5");
}
_rating = value;
}
}
public short Rating
{
get { return _rating; }
set
{
if (value < 1 || value > 5)
{
throw new ArgumentOutOfRangeException("value", value, "Ratings should be between 1 and 5");
}
_rating = value;
}
}
public CheckIn(string gmtOffset, string timezone, int bid)
{
if (string.IsNullOrWhiteSpace(gmtOffset))
{
throw new ArgumentNullException("gmtOffset");
}
if (string.IsNullOrWhiteSpace(timezone))
{
throw new ArgumentNullException("timezone");
}
GmtOffset = string.Copy(gmtOffset);
Timezone = string.Copy(timezone);
Bid = bid;
}
}
public CheckIn(string gmtOffset, string timezone, int bid)
{
if (string.IsNullOrWhiteSpace(gmtOffset))
{
throw new ArgumentNullException("gmtOffset");
}
if (string.IsNullOrWhiteSpace(timezone))
{
throw new ArgumentNullException("timezone");
}
GmtOffset = string.Copy(gmtOffset);
Timezone = string.Copy(timezone);
Bid = bid;
}
}
}

View File

@@ -4,29 +4,29 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class PendingFriends : IAction
{
public Method RequestMethod { get {return Method.GET;} }
public string EndPoint { get { return "v4/user/pending"; }}
public class PendingFriends : IAction
{
public Method RequestMethod { get { return Method.GET; } }
public string EndPoint { get { return "v4/user/pending"; } }
public IDictionary<string, object> BodyParameters
{
get
{
var dict = new Dictionary<string, object>();
if (Offset.HasValue)
{
dict.Add("offset", Offset.Value);
}
if (Limit.HasValue)
{
dict.Add("limit", Limit.Value);
}
return dict;
}
}
public IDictionary<string, object> BodyParameters
{
get
{
var dict = new Dictionary<string, object>();
if (Offset.HasValue)
{
dict.Add("offset", Offset.Value);
}
if (Limit.HasValue)
{
dict.Add("limit", Limit.Value);
}
return dict;
}
}
public int? Offset { get; set; }
public int? Limit { get; set; }
}
public int? Offset { get; set; }
public int? Limit { get; set; }
}
}

View File

@@ -5,18 +5,19 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class RemoveFriend : IAction
{
public Method RequestMethod { get { return Method.GET; } }
public string EndPoint { get; private set; }
public IDictionary<string, object> BodyParameters { get { return new Dictionary<string, object>(); } }
public RemoveFriend(string target_id)
{
if (string.IsNullOrWhiteSpace(target_id))
{
throw new ArgumentNullException("target_id");
}
EndPoint = string.Format("v4/friend/reject/{0}", target_id);
}
}
public class RemoveFriend : IAction
{
public Method RequestMethod { get { return Method.GET; } }
public string EndPoint { get; private set; }
public IDictionary<string, object> BodyParameters { get { return new Dictionary<string, object>(); } }
public RemoveFriend(string target_id)
{
if (string.IsNullOrWhiteSpace(target_id))
{
throw new ArgumentNullException("target_id");
}
EndPoint = string.Format("v4/friend/reject/{0}", target_id);
}
}
}

View File

@@ -4,15 +4,15 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class RemoveFromWishList : IAction
{
public Method RequestMethod { get {return Method.GET;} }
public string EndPoint { get { return "v4/user/wishlist/delete"; } }
public IDictionary<string, object> BodyParameters { get; private set; }
public RemoveFromWishList(int beerId)
{
BodyParameters = new Dictionary<string, object>() { { "bid", beerId } };
public class RemoveFromWishList : IAction
{
public Method RequestMethod { get { return Method.GET; } }
public string EndPoint { get { return "v4/user/wishlist/delete"; } }
public IDictionary<string, object> BodyParameters { get; private set; }
}
}
public RemoveFromWishList(int beerId)
{
BodyParameters = new Dictionary<string, object>() { { "bid", beerId } };
}
}
}

View File

@@ -5,23 +5,24 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Actions
{
public class ToastUntoast : IAction
{
public Method RequestMethod { get { return Method.POST; } }
public IDictionary<string, object> BodyParameters { get { return new Dictionary<string, object>(); } }
public string EndPoint { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="checkinId"></param>
/// <exception cref="ArgumentNullException"></exception>
public ToastUntoast(string checkinId)
{
if (string.IsNullOrWhiteSpace(checkinId))
{
throw new ArgumentNullException("checkinId");
}
EndPoint = string.Format("v4/checkin/toast/{0}", checkinId);
}
}
public class ToastUntoast : IAction
{
public Method RequestMethod { get { return Method.POST; } }
public IDictionary<string, object> BodyParameters { get { return new Dictionary<string, object>(); } }
public string EndPoint { get; private set; }
/// <summary>
///
/// </summary>
/// <param name="checkinId"></param>
/// <exception cref="ArgumentNullException"></exception>
public ToastUntoast(string checkinId)
{
if (string.IsNullOrWhiteSpace(checkinId))
{
throw new ArgumentNullException("checkinId");
}
EndPoint = string.Format("v4/checkin/toast/{0}", checkinId);
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,270 +4,255 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.BeerSearch
{
public class ResponseTime
{
[JsonProperty("time")]
public double Time { get; set; }
public class ResponseTime
{
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("time")]
public double Time { get; set; }
public class InitTime
{
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("measure")]
public string Measure { get; set; }
}
public class InitTime
{
public class Meta
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
public class Meta
{
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("messages")]
public int Messages { get; set; }
public class UnreadCount
{
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("comments")]
public int Comments { get; set; }
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("friends")]
public int Friends { get; set; }
public class Beer
{
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
public class Notifications
{
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("beer_ibu")]
public int BeerIbu { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("beer_description")]
public string BeerDescription { get; set; }
public class Beer
{
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("in_production")]
public int InProduction { get; set; }
}
[JsonProperty("beer_ibu")]
public int BeerIbu { get; set; }
public class Contact
{
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("beer_description")]
public string BeerDescription { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
public class Location
{
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("in_production")]
public int InProduction { get; set; }
}
[JsonProperty("lat")]
public double Lat { get; set; }
public class Contact
{
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("twitter")]
public string Twitter { get; set; }
public class Brewery
{
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
public class Location
{
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
[JsonProperty("lng")]
public double Lng { get; set; }
}
public class Item
{
[JsonProperty("checkin_count")]
public int CheckinCount { get; set; }
public class Brewery
{
[JsonProperty("have_had")]
public bool HaveHad { get; set; }
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("your_count")]
public int YourCount { get; set; }
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
}
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
public class Beers
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("contact")]
public Contact Contact { get; set; }
public class Homebrew
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
public class Breweries
{
[JsonProperty("items")]
public IList<object> Items { get; set; }
public class Item
{
[JsonProperty("count")]
public int Count { get; set; }
}
[JsonProperty("checkin_count")]
public int CheckinCount { get; set; }
public class Response
{
[JsonProperty("message")]
public string Message { get; set; }
[JsonProperty("have_had")]
public bool HaveHad { get; set; }
[JsonProperty("brewery_id")]
public bool BreweryId { get; set; }
[JsonProperty("your_count")]
public int YourCount { get; set; }
[JsonProperty("search_type")]
public string SearchType { get; set; }
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("type_id")]
public int TypeId { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
}
[JsonProperty("search_version")]
public int SearchVersion { get; set; }
public class Beers
{
[JsonProperty("found")]
public int Found { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("offset")]
public int Offset { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("limit")]
public int Limit { get; set; }
public class Homebrew
{
[JsonProperty("term")]
public string Term { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("parsed_term")]
public string ParsedTerm { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
[JsonProperty("beers")]
public Beers Beers { get; set; }
public class Breweries
{
[JsonProperty("homebrew")]
public Homebrew Homebrew { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
[JsonProperty("breweries")]
public Breweries Breweries { get; set; }
}
[JsonProperty("count")]
public int Count { get; set; }
}
public class BeerSearch : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/search/beer"; } }
public class Response
{
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("message")]
public string Message { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("brewery_id")]
public bool BreweryId { get; set; }
[JsonProperty("search_type")]
public string SearchType { get; set; }
[JsonProperty("type_id")]
public int TypeId { get; set; }
[JsonProperty("search_version")]
public int SearchVersion { get; set; }
[JsonProperty("found")]
public int Found { get; set; }
[JsonProperty("offset")]
public int Offset { get; set; }
[JsonProperty("limit")]
public int Limit { get; set; }
[JsonProperty("term")]
public string Term { get; set; }
[JsonProperty("parsed_term")]
public string ParsedTerm { get; set; }
[JsonProperty("beers")]
public Beers Beers { get; set; }
[JsonProperty("homebrew")]
public Homebrew Homebrew { get; set; }
[JsonProperty("breweries")]
public Breweries Breweries { get; set; }
}
public class BeerSearch : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/search/beer"; } }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
[JsonProperty("response")]
public Response Response { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,158 +4,147 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.BrewerySearch
{
public class ResponseTime
{
[JsonProperty("time")]
public double Time { get; set; }
public class ResponseTime
{
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("time")]
public double Time { get; set; }
public class InitTime
{
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("measure")]
public string Measure { get; set; }
}
public class InitTime
{
public class Meta
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
public class Meta
{
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("messages")]
public int Messages { get; set; }
public class UnreadCount
{
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("comments")]
public int Comments { get; set; }
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("friends")]
public int Friends { get; set; }
public class Location
{
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("lat")]
public int Lat { get; set; }
public class Notifications
{
[JsonProperty("lng")]
public int Lng { get; set; }
}
[JsonProperty("type")]
public string Type { get; set; }
public class Brewery2
{
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("beer_count")]
public int BeerCount { get; set; }
public class Location
{
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("lat")]
public int Lat { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
}
[JsonProperty("lng")]
public int Lng { get; set; }
}
public class Item
{
[JsonProperty("brewery")]
public Brewery2 Brewery { get; set; }
}
public class Brewery2
{
public class Brewery
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("beer_count")]
public int BeerCount { get; set; }
public class Response
{
[JsonProperty("search_type")]
public string SearchType { get; set; }
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("sort")]
public string Sort { get; set; }
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
[JsonProperty("term")]
public string Term { get; set; }
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("key")]
public string Key { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
}
[JsonProperty("found")]
public int Found { get; set; }
public class Item
{
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
}
[JsonProperty("brewery")]
public Brewery2 Brewery { get; set; }
}
public class BrewerySearch : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/search/brewery"; } }
public class Brewery
{
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
public class Response
{
[JsonProperty("search_type")]
public string SearchType { get; set; }
[JsonProperty("sort")]
public string Sort { get; set; }
[JsonProperty("term")]
public string Term { get; set; }
[JsonProperty("key")]
public string Key { get; set; }
[JsonProperty("found")]
public int Found { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
}
public class BrewerySearch : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/search/brewery"; } }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
[JsonProperty("response")]
public Response Response { get; set; }
}
}

View File

@@ -4,523 +4,496 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Feeds.ActivityFeed
{
public class ResponseTime
{
public class ResponseTime
{
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("measure")]
public string Measure { get; set; }
}
public class InitTime
{
[JsonProperty("time")]
public double Time { get; set; }
public class InitTime
{
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("time")]
public double Time { get; set; }
public class Meta
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
public class Meta
{
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("code")]
public int Code { get; set; }
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("friends")]
public int Friends { get; set; }
public class UnreadCount
{
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("toasts")]
public int Toasts { get; set; }
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("messages")]
public int Messages { get; set; }
public class User
{
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("user_name")]
public string UserName { get; set; }
public class Notifications
{
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("location")]
public string Location { get; set; }
public class User
{
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("is_supporter")]
public int IsSupporter { get; set; }
[JsonProperty("user_name")]
public string UserName { get; set; }
[JsonProperty("relationship")]
public string Relationship { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
}
[JsonProperty("location")]
public string Location { get; set; }
public class Beer
{
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("is_supporter")]
public int IsSupporter { get; set; }
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
[JsonProperty("relationship")]
public string Relationship { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
}
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
public class Beer
{
[JsonProperty("wish_list")]
public bool WishList { get; set; }
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("beer_active")]
public int BeerActive { get; set; }
}
[JsonProperty("beer_name")]
public string BeerName { get; set; }
public class Contact
{
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
public class Location
{
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("beer_active")]
public int BeerActive { get; set; }
}
[JsonProperty("lat")]
public double Lat { get; set; }
public class Contact
{
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("twitter")]
public string Twitter { get; set; }
public class Brewery
{
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
public class Location
{
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
[JsonProperty("lng")]
public double Lng { get; set; }
}
public class User2
{
[JsonProperty("uid")]
public int Uid { get; set; }
public class Brewery
{
[JsonProperty("user_name")]
public string UserName { get; set; }
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
[JsonProperty("location")]
public string Location { get; set; }
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("relationship")]
public string Relationship { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
[JsonProperty("is_supporter")]
public int IsSupporter { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
[JsonProperty("user_link")]
public string UserLink { get; set; }
public class User2
{
[JsonProperty("account_type")]
public string AccountType { get; set; }
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("brewery_details")]
public IList<object> BreweryDetails { get; set; }
}
[JsonProperty("user_name")]
public string UserName { get; set; }
public class Item2
{
[JsonProperty("user")]
public User2 User { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("comment_id")]
public int CommentId { get; set; }
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("comment_owner")]
public bool CommentOwner { get; set; }
[JsonProperty("location")]
public string Location { get; set; }
[JsonProperty("comment_editor")]
public bool CommentEditor { get; set; }
[JsonProperty("relationship")]
public string Relationship { get; set; }
[JsonProperty("comment")]
public string Comment { get; set; }
[JsonProperty("is_supporter")]
public int IsSupporter { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
[JsonProperty("comment_source")]
public string CommentSource { get; set; }
}
[JsonProperty("user_link")]
public string UserLink { get; set; }
public class Comments
{
[JsonProperty("total_count")]
public int TotalCount { get; set; }
[JsonProperty("account_type")]
public string AccountType { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("brewery_details")]
public IList<object> BreweryDetails { get; set; }
}
[JsonProperty("items")]
public IList<Item2> Items { get; set; }
}
public class Item2
{
public class User3
{
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("user")]
public User2 User { get; set; }
[JsonProperty("user_name")]
public string UserName { get; set; }
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("comment_id")]
public int CommentId { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("comment_owner")]
public bool CommentOwner { get; set; }
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("comment_editor")]
public bool CommentEditor { get; set; }
[JsonProperty("location")]
public string Location { get; set; }
[JsonProperty("comment")]
public string Comment { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("user_link")]
public string UserLink { get; set; }
[JsonProperty("comment_source")]
public string CommentSource { get; set; }
}
[JsonProperty("account_type")]
public string AccountType { get; set; }
public class Comments
{
[JsonProperty("brewery_details")]
public IList<object> BreweryDetails { get; set; }
}
[JsonProperty("total_count")]
public int TotalCount { get; set; }
public class Item3
{
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("user")]
public User3 User { get; set; }
[JsonProperty("items")]
public IList<Item2> Items { get; set; }
}
[JsonProperty("like_id")]
public int LikeId { get; set; }
public class User3
{
[JsonProperty("like_owner")]
public bool LikeOwner { get; set; }
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
}
[JsonProperty("user_name")]
public string UserName { get; set; }
public class Toasts
{
[JsonProperty("total_count")]
public int TotalCount { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("auth_toast", NullValueHandling = NullValueHandling.Ignore)]
public bool AuthToast { get; set; }
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("items")]
public IList<Item3> Items { get; set; }
}
[JsonProperty("location")]
public string Location { get; set; }
public class Photo
{
[JsonProperty("photo_img_sm")]
public string PhotoImgSm { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
[JsonProperty("photo_img_md")]
public string PhotoImgMd { get; set; }
[JsonProperty("user_link")]
public string UserLink { get; set; }
[JsonProperty("photo_img_lg")]
public string PhotoImgLg { get; set; }
[JsonProperty("account_type")]
public string AccountType { get; set; }
[JsonProperty("photo_img_og")]
public string PhotoImgOg { get; set; }
}
[JsonProperty("brewery_details")]
public IList<object> BreweryDetails { get; set; }
}
public class Item4
{
[JsonProperty("photo_id")]
public int PhotoId { get; set; }
public class Item3
{
[JsonProperty("photo")]
public Photo Photo { get; set; }
}
[JsonProperty("uid")]
public int Uid { get; set; }
public class Media
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("user")]
public User3 User { get; set; }
[JsonProperty("items")]
public IList<Item4> Items { get; set; }
}
[JsonProperty("like_id")]
public int LikeId { get; set; }
public class Source
{
[JsonProperty("app_name")]
public string AppName { get; set; }
[JsonProperty("like_owner")]
public bool LikeOwner { get; set; }
[JsonProperty("app_website")]
public string AppWebsite { get; set; }
}
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
}
public class BadgeImage
{
[JsonProperty("sm")]
public string Sm { get; set; }
public class Toasts
{
[JsonProperty("md")]
public string Md { get; set; }
[JsonProperty("total_count")]
public int TotalCount { get; set; }
[JsonProperty("lg")]
public string Lg { get; set; }
}
[JsonProperty("count")]
public int Count { get; set; }
public class Item5
{
[JsonProperty("badge_id")]
public int BadgeId { get; set; }
[JsonProperty("auth_toast", NullValueHandling = NullValueHandling.Ignore)]
public bool AuthToast { get; set; }
[JsonProperty("user_badge_id")]
public int UserBadgeId { get; set; }
[JsonProperty("items")]
public IList<Item3> Items { get; set; }
}
[JsonProperty("badge_name")]
public string BadgeName { get; set; }
public class Photo
{
[JsonProperty("badge_description")]
public string BadgeDescription { get; set; }
[JsonProperty("photo_img_sm")]
public string PhotoImgSm { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("photo_img_md")]
public string PhotoImgMd { get; set; }
[JsonProperty("badge_image")]
public BadgeImage BadgeImage { get; set; }
}
[JsonProperty("photo_img_lg")]
public string PhotoImgLg { get; set; }
public class Badges
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("photo_img_og")]
public string PhotoImgOg { get; set; }
}
[JsonProperty("items")]
public IList<Item5> Items { get; set; }
}
public class Item4
{
public class Item
{
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("photo_id")]
public int PhotoId { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("photo")]
public Photo Photo { get; set; }
}
[JsonProperty("checkin_comment")]
public string CheckinComment { get; set; }
public class Media
{
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("items")]
public IList<Item4> Items { get; set; }
}
[JsonProperty("beer")]
public Beer Beer { get; set; }
public class Source
{
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
[JsonProperty("app_name")]
public string AppName { get; set; }
[JsonProperty("venue")]
public object Venue { get; set; }
[JsonProperty("app_website")]
public string AppWebsite { get; set; }
}
[JsonProperty("comments")]
public Comments Comments { get; set; }
public class BadgeImage
{
[JsonProperty("toasts")]
public Toasts Toasts { get; set; }
[JsonProperty("sm")]
public string Sm { get; set; }
[JsonProperty("media")]
public Media Media { get; set; }
[JsonProperty("md")]
public string Md { get; set; }
[JsonProperty("source")]
public Source Source { get; set; }
[JsonProperty("lg")]
public string Lg { get; set; }
}
[JsonProperty("badges")]
public Badges Badges { get; set; }
}
public class Item5
{
public class Checkins
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("badge_id")]
public int BadgeId { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("user_badge_id")]
public int UserBadgeId { get; set; }
public class Pagination
{
[JsonProperty("next_url")]
public string NextUrl { get; set; }
[JsonProperty("badge_name")]
public string BadgeName { get; set; }
[JsonProperty("max_id")]
public int MaxId { get; set; }
[JsonProperty("badge_description")]
public string BadgeDescription { get; set; }
[JsonProperty("since_url")]
public string SinceUrl { get; set; }
}
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
public class Response
{
[JsonProperty("mg")]
public bool Mg { get; set; }
[JsonProperty("badge_image")]
public BadgeImage BadgeImage { get; set; }
}
[JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; }
public class Badges
{
[JsonProperty("pagination")]
public Pagination Pagination { get; set; }
}
[JsonProperty("count")]
public int Count { get; set; }
public class ActivityFeed : BasicRequest, IAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "/v4/checkin/recent"; } }
[JsonProperty("items")]
public IList<Item5> Items { get; set; }
}
[JsonProperty("meta")]
public Meta Meta { get; set; }
public class Item
{
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("checkin_comment")]
public string CheckinComment { get; set; }
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
[JsonProperty("venue")]
public object Venue { get; set; }
[JsonProperty("comments")]
public Comments Comments { get; set; }
[JsonProperty("toasts")]
public Toasts Toasts { get; set; }
[JsonProperty("media")]
public Media Media { get; set; }
[JsonProperty("source")]
public Source Source { get; set; }
[JsonProperty("badges")]
public Badges Badges { get; set; }
}
public class Checkins
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
public class Pagination
{
[JsonProperty("next_url")]
public string NextUrl { get; set; }
[JsonProperty("max_id")]
public int MaxId { get; set; }
[JsonProperty("since_url")]
public string SinceUrl { get; set; }
}
public class Response
{
[JsonProperty("mg")]
public bool Mg { get; set; }
[JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; }
[JsonProperty("pagination")]
public Pagination Pagination { get; set; }
}
public class ActivityFeed : BasicRequest, IAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "/v4/checkin/recent"; } }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
[JsonProperty("response")]
public Response Response { get; set; }
}
}

View File

@@ -4,490 +4,461 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.Feeds.UserActivityFeed
{
public class ResponseTime
{
public class ResponseTime
{
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("measure")]
public string Measure { get; set; }
}
public class InitTime
{
[JsonProperty("time")]
public double Time { get; set; }
public class InitTime
{
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("time")]
public double Time { get; set; }
public class Meta
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
public class Meta
{
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("code")]
public int Code { get; set; }
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("friends")]
public int Friends { get; set; }
public class UnreadCount
{
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("toasts")]
public int Toasts { get; set; }
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("messages")]
public int Messages { get; set; }
public class Pagination
{
[JsonProperty("since_url")]
public string SinceUrl { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("next_url")]
public string NextUrl { get; set; }
public class Notifications
{
[JsonProperty("max_id")]
public int MaxId { get; set; }
}
[JsonProperty("type")]
public string Type { get; set; }
public class Contact
{
[JsonProperty("facebook")]
public string Facebook { get; set; }
}
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
public class User
{
[JsonProperty("uid")]
public int Uid { get; set; }
public class Pagination
{
[JsonProperty("user_name")]
public string UserName { get; set; }
[JsonProperty("since_url")]
public string SinceUrl { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("next_url")]
public string NextUrl { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("max_id")]
public int MaxId { get; set; }
}
[JsonProperty("location")]
public string Location { get; set; }
public class Contact
{
[JsonProperty("is_supporter")]
public int IsSupporter { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
}
[JsonProperty("url")]
public string Url { get; set; }
public class User
{
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("relationship")]
public string Relationship { get; set; }
[JsonProperty("user_name")]
public string UserName { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("is_private")]
public int IsPrivate { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
}
[JsonProperty("location")]
public string Location { get; set; }
public class Beer
{
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("is_supporter")]
public int IsSupporter { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("relationship")]
public string Relationship { get; set; }
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
[JsonProperty("is_private")]
public int IsPrivate { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
}
[JsonProperty("beer_active")]
public int BeerActive { get; set; }
}
public class Beer
{
public class Contact2
{
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
public class Location
{
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("beer_active")]
public int BeerActive { get; set; }
}
public class Brewery
{
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
public class Contact2
{
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("contact")]
public Contact2 Contact { get; set; }
public class Location
{
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
public class Item2
{
[JsonProperty("category_name")]
public string CategoryName { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("category_id")]
public string CategoryId { get; set; }
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("is_primary")]
public bool IsPrimary { get; set; }
}
public class Brewery
{
public class Categories
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("items")]
public IList<Item2> Items { get; set; }
}
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
public class Location2
{
[JsonProperty("venue_address")]
public string VenueAddress { get; set; }
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("venue_city")]
public string VenueCity { get; set; }
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
[JsonProperty("venue_state")]
public string VenueState { get; set; }
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("venue_country")]
public string VenueCountry { get; set; }
[JsonProperty("contact")]
public Contact2 Contact { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
public class Contact3
{
[JsonProperty("twitter")]
public string Twitter { get; set; }
public class Item2
{
[JsonProperty("venue_url")]
public string VenueUrl { get; set; }
}
[JsonProperty("category_name")]
public string CategoryName { get; set; }
public class Foursquare
{
[JsonProperty("foursquare_id")]
public string FoursquareId { get; set; }
[JsonProperty("category_id")]
public string CategoryId { get; set; }
[JsonProperty("foursquare_url")]
public string FoursquareUrl { get; set; }
}
[JsonProperty("is_primary")]
public bool IsPrimary { get; set; }
}
public class VenueIcon
{
[JsonProperty("sm")]
public string Sm { get; set; }
public class Categories
{
[JsonProperty("md")]
public string Md { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("lg")]
public string Lg { get; set; }
}
[JsonProperty("items")]
public IList<Item2> Items { get; set; }
}
public class Venue
{
[JsonProperty("venue_id")]
public int VenueId { get; set; }
public class Location2
{
[JsonProperty("venue_name")]
public string VenueName { get; set; }
[JsonProperty("venue_address")]
public string VenueAddress { get; set; }
[JsonProperty("primary_category")]
public string PrimaryCategory { get; set; }
[JsonProperty("venue_city")]
public string VenueCity { get; set; }
[JsonProperty("parent_category_id")]
public string ParentCategoryId { get; set; }
[JsonProperty("venue_state")]
public string VenueState { get; set; }
[JsonProperty("categories")]
public Categories Categories { get; set; }
[JsonProperty("venue_country")]
public string VenueCountry { get; set; }
[JsonProperty("location")]
public Location2 Location { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("contact")]
public Contact3 Contact { get; set; }
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("public_venue")]
public bool PublicVenue { get; set; }
public class Contact3
{
[JsonProperty("foursquare")]
public Foursquare Foursquare { get; set; }
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("venue_icon")]
public VenueIcon VenueIcon { get; set; }
}
[JsonProperty("venue_url")]
public string VenueUrl { get; set; }
}
public class Comments
{
[JsonProperty("total_count")]
public int TotalCount { get; set; }
public class Foursquare
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("foursquare_id")]
public string FoursquareId { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
[JsonProperty("foursquare_url")]
public string FoursquareUrl { get; set; }
}
public class Toasts
{
[JsonProperty("total_count")]
public int TotalCount { get; set; }
public class VenueIcon
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("sm")]
public string Sm { get; set; }
[JsonProperty("auth_toast", NullValueHandling = NullValueHandling.Ignore)]
public bool AuthToast { get; set; }
[JsonProperty("md")]
public string Md { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
[JsonProperty("lg")]
public string Lg { get; set; }
}
public class Photo
{
[JsonProperty("photo_img_sm")]
public string PhotoImgSm { get; set; }
public class Venue
{
[JsonProperty("photo_img_md")]
public string PhotoImgMd { get; set; }
[JsonProperty("venue_id")]
public int VenueId { get; set; }
[JsonProperty("photo_img_lg")]
public string PhotoImgLg { get; set; }
[JsonProperty("venue_name")]
public string VenueName { get; set; }
[JsonProperty("photo_img_og")]
public string PhotoImgOg { get; set; }
}
[JsonProperty("primary_category")]
public string PrimaryCategory { get; set; }
public class Item3
{
[JsonProperty("photo_id")]
public int PhotoId { get; set; }
[JsonProperty("parent_category_id")]
public string ParentCategoryId { get; set; }
[JsonProperty("photo")]
public Photo Photo { get; set; }
}
[JsonProperty("categories")]
public Categories Categories { get; set; }
public class Media
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("location")]
public Location2 Location { get; set; }
[JsonProperty("items")]
public IList<Item3> Items { get; set; }
}
[JsonProperty("contact")]
public Contact3 Contact { get; set; }
public class Source
{
[JsonProperty("app_name")]
public string AppName { get; set; }
[JsonProperty("public_venue")]
public bool PublicVenue { get; set; }
[JsonProperty("app_website")]
public string AppWebsite { get; set; }
}
[JsonProperty("foursquare")]
public Foursquare Foursquare { get; set; }
public class Badges
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("venue_icon")]
public VenueIcon VenueIcon { get; set; }
}
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
public class Comments
{
public class Item
{
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("total_count")]
public int TotalCount { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("checkin_comment")]
public string CheckinComment { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
public class Toasts
{
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("total_count")]
public int TotalCount { get; set; }
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
[JsonProperty("auth_toast", NullValueHandling = NullValueHandling.Ignore)]
public bool AuthToast { get; set; }
[JsonProperty("venue")]
[JsonConverter(typeof(SingleObjectArrayConverter<Venue>))]
public Venue Venue { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
[JsonProperty("comments")]
public Comments Comments { get; set; }
public class Photo
{
[JsonProperty("toasts")]
public Toasts Toasts { get; set; }
[JsonProperty("photo_img_sm")]
public string PhotoImgSm { get; set; }
[JsonProperty("media")]
public Media Media { get; set; }
[JsonProperty("photo_img_md")]
public string PhotoImgMd { get; set; }
[JsonProperty("source")]
public Source Source { get; set; }
[JsonProperty("photo_img_lg")]
public string PhotoImgLg { get; set; }
[JsonProperty("badges")]
public Badges Badges { get; set; }
}
[JsonProperty("photo_img_og")]
public string PhotoImgOg { get; set; }
}
public class Checkins
{
[JsonProperty("count")]
public int Count { get; set; }
public class Item3
{
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("photo_id")]
public int PhotoId { get; set; }
public class Response
{
[JsonProperty("pagination")]
public Pagination Pagination { get; set; }
[JsonProperty("photo")]
public Photo Photo { get; set; }
}
[JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; }
}
public class Media
{
public class UserActivityFeed : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/user/checkins{0}"; } }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("items")]
public IList<Item3> Items { get; set; }
}
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
public class Source
{
[JsonProperty("app_name")]
public string AppName { get; set; }
[JsonProperty("app_website")]
public string AppWebsite { get; set; }
}
public class Badges
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
public class Item
{
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("checkin_comment")]
public string CheckinComment { get; set; }
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
[JsonProperty("venue")]
[JsonConverter(typeof(SingleObjectArrayConverter<Venue>))]
public Venue Venue { get; set; }
[JsonProperty("comments")]
public Comments Comments { get; set; }
[JsonProperty("toasts")]
public Toasts Toasts { get; set; }
[JsonProperty("media")]
public Media Media { get; set; }
[JsonProperty("source")]
public Source Source { get; set; }
[JsonProperty("badges")]
public Badges Badges { get; set; }
}
public class Checkins
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
public class Response
{
[JsonProperty("pagination")]
public Pagination Pagination { get; set; }
[JsonProperty("checkins")]
[JsonConverter(typeof(SingleObjectArrayConverter<Checkins>))]
public Checkins Checkins { get; set; }
}
public class UserActivityFeed : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/user/checkins{0}"; } }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
[JsonProperty("response")]
public Response Response { get; set; }
}
}

View File

@@ -4,225 +4,215 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.UserBadges
{
public class ResponseTime
{
[JsonProperty("time")]
public double Time { get; set; }
public class ResponseTime
{
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("time")]
public double Time { get; set; }
public class InitTime
{
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("measure")]
public string Measure { get; set; }
}
public class InitTime
{
public class Meta
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
public class Meta
{
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("messages")]
public int Messages { get; set; }
public class UnreadCount
{
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("comments")]
public int Comments { get; set; }
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("friends")]
public int Friends { get; set; }
public class Media
{
[JsonProperty("badge_image_sm")]
public string BadgeImageSm { get; set; }
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("badge_image_md")]
public string BadgeImageMd { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("badge_image_lg")]
public string BadgeImageLg { get; set; }
}
public class Notifications
{
public class BadgePackProgress
{
[JsonProperty("completed")]
public int Completed { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("total")]
public int Total { get; set; }
}
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
public class BadgeLevel
{
[JsonProperty("actual_badge_id")]
public int ActualBadgeId { get; set; }
public class Media
{
[JsonProperty("badge_id")]
public int BadgeId { get; set; }
[JsonProperty("badge_image_sm")]
public string BadgeImageSm { get; set; }
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("badge_image_md")]
public string BadgeImageMd { get; set; }
[JsonProperty("badge_name")]
public string BadgeName { get; set; }
[JsonProperty("badge_image_lg")]
public string BadgeImageLg { get; set; }
}
[JsonProperty("badge_description")]
public string BadgeDescription { get; set; }
public class BadgePackProgress
{
[JsonProperty("badge_hint")]
public string BadgeHint { get; set; }
[JsonProperty("completed")]
public int Completed { get; set; }
[JsonProperty("badge_active_status")]
public int BadgeActiveStatus { get; set; }
[JsonProperty("total")]
public int Total { get; set; }
}
[JsonProperty("media")]
public Media Media { get; set; }
public class BadgeLevel
{
[JsonProperty("actual_badge_id")]
public int ActualBadgeId { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
}
[JsonProperty("badge_id")]
public int BadgeId { get; set; }
public class Levels
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("items")]
public IList<BadgeLevel> Items { get; set; }
}
[JsonProperty("badge_name")]
public string BadgeName { get; set; }
public class Item
{
[JsonProperty("user_badge_id")]
public int UserBadgeId { get; set; }
[JsonProperty("badge_description")]
public string BadgeDescription { get; set; }
[JsonProperty("badge_id")]
public int BadgeId { get; set; }
[JsonProperty("badge_hint")]
public string BadgeHint { get; set; }
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("badge_active_status")]
public int BadgeActiveStatus { get; set; }
[JsonProperty("badge_name")]
public string BadgeName { get; set; }
[JsonProperty("media")]
public Media Media { get; set; }
[JsonProperty("badge_description")]
public string BadgeDescription { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
}
[JsonProperty("badge_hint")]
public string BadgeHint { get; set; }
public class Levels
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("badge_active_status")]
public int BadgeActiveStatus { get; set; }
[JsonProperty("items")]
public IList<BadgeLevel> Items { get; set; }
}
[JsonProperty("media")]
public Media Media { get; set; }
public class Item
{
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("user_badge_id")]
public int UserBadgeId { get; set; }
[JsonProperty("is_level")]
public bool IsLevel { get; set; }
[JsonProperty("badge_id")]
public int BadgeId { get; set; }
[JsonProperty("badge_type")]
public string BadgeType { get; set; }
[JsonProperty("checkin_id")]
public int CheckinId { get; set; }
[JsonProperty("has_badge")]
public bool HasBadge { get; set; }
[JsonProperty("badge_name")]
public string BadgeName { get; set; }
[JsonProperty("category_id")]
public int CategoryId { get; set; }
[JsonProperty("badge_description")]
public string BadgeDescription { get; set; }
/// <summary>
/// Issue with bad json responses
/// levels might come as object levels : { ... }
/// or an empty array levels : []
/// </summary>
[JsonProperty(PropertyName = "levels")]
[JsonConverter(typeof(SingleObjectArrayConverter<Levels>))]
public Levels Levels { get; set; }
[JsonProperty("badge_hint")]
public string BadgeHint { get; set; }
[JsonProperty("badge_pack")]
public bool BadgePack { get; set; }
[JsonProperty("badge_active_status")]
public int BadgeActiveStatus { get; set; }
[JsonProperty("badge_pack_name")]
public bool BadgePackName { get; set; }
[JsonProperty("media")]
public Media Media { get; set; }
[JsonProperty("badge_pack_progress")]
public BadgePackProgress BadgePackProgress { get; set; }
}
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
public class Response
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("is_level")]
public bool IsLevel { get; set; }
[JsonProperty("sort")]
public string Sort { get; set; }
[JsonProperty("badge_type")]
public string BadgeType { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("has_badge")]
public bool HasBadge { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("category_id")]
public int CategoryId { get; set; }
/// <summary>
/// jsonutils.com fails to parse Untappd response for this requests
/// It fails getting the badge levels.
/// added manually.
/// </summary>
public class UserBadges : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/user/badges{0}"; } }
/// <summary>
/// Issue with bad json responses
/// levels might come as object levels : { ... }
/// or an empty array levels : []
/// </summary>
[JsonProperty(PropertyName = "levels")]
[JsonConverter(typeof(SingleObjectArrayConverter<Levels>))]
public Levels Levels { get; set; }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("badge_pack")]
public bool BadgePack { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("badge_pack_name")]
public bool BadgePackName { get; set; }
[JsonProperty("badge_pack_progress")]
public BadgePackProgress BadgePackProgress { get; set; }
}
public class Response
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("sort")]
public string Sort { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
/// <summary>
/// jsonutils.com fails to parse Untappd response for this requests
/// It fails getting the badge levels.
/// added manually.
/// </summary>
public class UserBadges : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/user/badges{0}"; } }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
[JsonProperty("response")]
public Response Response { get; set; }
}
}

View File

@@ -4,238 +4,231 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.UserDistinctBeer
{
public sealed class ResponseTime
{
[JsonProperty("time")]
public double Time { get; set; }
public sealed class ResponseTime
{
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("time")]
public double Time { get; set; }
public class InitTime
{
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("measure")]
public string Measure { get; set; }
}
public class InitTime
{
public class Meta
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
public class Meta
{
public class Beer
{
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
public class Beer
{
[JsonProperty("beer_ibu")]
public int BeerIbu { get; set; }
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("beer_slug")]
public string BeerSlug { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
[JsonProperty("beer_description")]
public string BeerDescription { get; set; }
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("beer_ibu")]
public int BeerIbu { get; set; }
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
[JsonProperty("beer_slug")]
public string BeerSlug { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
[JsonProperty("beer_description")]
public string BeerDescription { get; set; }
[JsonProperty("rating_count")]
public int RatingCount { get; set; }
}
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
public class Contact
{
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("rating_count")]
public int RatingCount { get; set; }
}
public class Location
{
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
public class Contact
{
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("instagram")]
public string Instagram { get; set; }
public class Brewery
{
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
public class Location
{
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("location")]
public Location Location { get; set; }
public class Brewery
{
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
public class Item
{
[JsonProperty("first_checkin_id")]
public int FirstCheckinId { get; set; }
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("first_created_at")]
public string FirstCreatedAt { get; set; }
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("recent_checkin_id")]
public int RecentCheckinId { get; set; }
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
[JsonProperty("recent_created_at")]
public string RecentCreatedAt { get; set; }
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("recent_created_at_timezone")]
public string RecentCreatedAtTimezone { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("first_had")]
public string FirstHad { get; set; }
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
[JsonProperty("count")]
public int Count { get; set; }
public class Item
{
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("first_checkin_id")]
public int FirstCheckinId { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
}
[JsonProperty("first_created_at")]
public string FirstCreatedAt { get; set; }
public class Beers
{
[JsonProperty("sort")]
public string Sort { get; set; }
[JsonProperty("recent_checkin_id")]
public int RecentCheckinId { get; set; }
[JsonProperty("sort_english")]
public string SortEnglish { get; set; }
[JsonProperty("recent_created_at")]
public string RecentCreatedAt { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("recent_created_at_timezone")]
public string RecentCreatedAtTimezone { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("first_had")]
public string FirstHad { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
}
[JsonProperty("news")]
public int news { get; set; }
}
public class Beers
{
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("sort")]
public string Sort { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("sort_english")]
public string SortEnglish { get; set; }
public class Response
{
[JsonProperty("is_search")]
public bool IsSearch { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("beers")]
public Beers Beers { get; set; }
}
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
public class UserDistinctBeers : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/user/beers{0}"; } }
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; }
}
[JsonProperty("meta")]
public Meta Meta { get; set; }
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
public class Response
{
[JsonProperty("is_search")]
public bool IsSearch { get; set; }
[JsonProperty("beers")]
public Beers Beers { get; set; }
}
public class UserDistinctBeers : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/user/beers{0}"; } }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
}

View File

@@ -4,148 +4,138 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.UserFriends
{
public class ResponseTime
{
[JsonProperty("time")]
public double Time { get; set; }
public class ResponseTime
{
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("time")]
public double Time { get; set; }
public class InitTime
{
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("measure")]
public string Measure { get; set; }
}
public class InitTime
{
public class Meta
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
public class Meta
{
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("messages")]
public int Messages { get; set; }
public class UnreadCount
{
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("comments")]
public int Comments { get; set; }
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("friends")]
public int Friends { get; set; }
public class User
{
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("user_name")]
public string UserName { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("location")]
public string Location { get; set; }
public class Notifications
{
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("is_supporter")]
public int IsSupporter { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("first_name")]
public string FirstName { get; set; }
public class User
{
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("uid")]
public int Uid { get; set; }
[JsonProperty("relationship")]
public string Relationship { get; set; }
[JsonProperty("user_name")]
public string UserName { get; set; }
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
}
[JsonProperty("location")]
public string Location { get; set; }
public class MutualFriends
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("bio")]
public string Bio { get; set; }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
[JsonProperty("is_supporter")]
public int IsSupporter { get; set; }
public class Item
{
[JsonProperty("friendship_hash")]
public string FriendshipHash { get; set; }
[JsonProperty("first_name")]
public string FirstName { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("last_name")]
public string LastName { get; set; }
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("relationship")]
public string Relationship { get; set; }
[JsonProperty("mutual_friends")]
public MutualFriends MutualFriends { get; set; }
}
[JsonProperty("user_avatar")]
public string UserAvatar { get; set; }
}
public class Response
{
[JsonProperty("count")]
public int Count { get; set; }
public class MutualFriends
{
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("count")]
public int Count { get; set; }
public class UserFriends : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/user/friends{0}"; } }
[JsonProperty("items")]
public IList<object> Items { get; set; }
}
[JsonProperty("meta")]
public Meta Meta { get; set; }
public class Item
{
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("friendship_hash")]
public string FriendshipHash { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("user")]
public User User { get; set; }
[JsonProperty("mutual_friends")]
public MutualFriends MutualFriends { get; set; }
}
public class Response
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
public class UserFriends : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "v4/user/friends{0}"; } }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
[JsonProperty("response")]
public Response Response { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -4,229 +4,216 @@ using Untappd.Net.Request;
namespace Untappd.Net.Responses.UserWishlist
{
public class ResponseTime
{
[JsonProperty("time")]
public double Time { get; set; }
public class ResponseTime
{
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("time")]
public double Time { get; set; }
public class InitTime
{
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("measure")]
public string Measure { get; set; }
}
public class InitTime
{
public class Meta
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("time")]
public double Time { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("measure")]
public string Measure { get; set; }
}
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
public class Meta
{
public class UnreadCount
{
[JsonProperty("comments")]
public int Comments { get; set; }
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("response_time")]
public ResponseTime ResponseTime { get; set; }
[JsonProperty("friends")]
public int Friends { get; set; }
[JsonProperty("init_time")]
public InitTime InitTime { get; set; }
}
[JsonProperty("messages")]
public int Messages { get; set; }
public class UnreadCount
{
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("comments")]
public int Comments { get; set; }
public class Notifications
{
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("toasts")]
public int Toasts { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("friends")]
public int Friends { get; set; }
public class Beer
{
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("messages")]
public int Messages { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("news")]
public int News { get; set; }
}
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
public class Notifications
{
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("type")]
public string Type { get; set; }
[JsonProperty("beer_ibu")]
public int BeerIbu { get; set; }
[JsonProperty("unread_count")]
public UnreadCount UnreadCount { get; set; }
}
[JsonProperty("beer_slug")]
public string BeerSlug { get; set; }
public class Beer
{
[JsonProperty("beer_description")]
public string BeerDescription { get; set; }
[JsonProperty("bid")]
public int Bid { get; set; }
[JsonProperty("is_in_production")]
public int IsInProduction { get; set; }
[JsonProperty("beer_name")]
public string BeerName { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("beer_label")]
public string BeerLabel { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("beer_abv")]
public double BeerAbv { get; set; }
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
[JsonProperty("beer_ibu")]
public int BeerIbu { get; set; }
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
[JsonProperty("beer_slug")]
public string BeerSlug { get; set; }
[JsonProperty("rating_count")]
public int RatingCount { get; set; }
[JsonProperty("beer_description")]
public string BeerDescription { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
}
[JsonProperty("is_in_production")]
public int IsInProduction { get; set; }
public class Contact
{
[JsonProperty("twitter")]
public string Twitter { get; set; }
[JsonProperty("beer_style")]
public string BeerStyle { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("auth_rating")]
public double AuthRating { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("rating_score")]
public double RatingScore { get; set; }
public class Location
{
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("rating_count")]
public int RatingCount { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("wish_list")]
public bool WishList { get; set; }
}
[JsonProperty("lat")]
public double Lat { get; set; }
public class Contact
{
[JsonProperty("lng")]
public double Lng { get; set; }
}
[JsonProperty("twitter")]
public string Twitter { get; set; }
public class Brewery
{
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("facebook")]
public string Facebook { get; set; }
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("instagram")]
public string Instagram { get; set; }
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
[JsonProperty("url")]
public string Url { get; set; }
}
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
public class Location
{
[JsonProperty("country_name")]
public string CountryName { get; set; }
[JsonProperty("brewery_city")]
public string BreweryCity { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
[JsonProperty("brewery_state")]
public string BreweryState { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("lat")]
public double Lat { get; set; }
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
[JsonProperty("lng")]
public double Lng { get; set; }
}
public class Item
{
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
public class Brewery
{
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("brewery_id")]
public int BreweryId { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
[JsonProperty("brewery_name")]
public string BreweryName { get; set; }
[JsonProperty("friends")]
public IList<object> Friends { get; set; }
}
[JsonProperty("brewery_slug")]
public string BrewerySlug { get; set; }
public class Beers
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("brewery_label")]
public string BreweryLabel { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
[JsonProperty("country_name")]
public string CountryName { get; set; }
public class Response
{
[JsonProperty("sort")]
public string Sort { get; set; }
[JsonProperty("contact")]
public Contact Contact { get; set; }
[JsonProperty("sort_english")]
public string SortEnglish { get; set; }
[JsonProperty("location")]
public Location Location { get; set; }
[JsonProperty("type_id")]
public int TypeId { get; set; }
[JsonProperty("brewery_active")]
public int BreweryActive { get; set; }
}
[JsonProperty("beers")]
public Beers Beers { get; set; }
}
public class Item
{
public class UserWishList : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "/v4/user/wishlist{0}"; } }
[JsonProperty("created_at")]
public string CreatedAt { get; set; }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("beer")]
public Beer Beer { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("brewery")]
public Brewery Brewery { get; set; }
[JsonProperty("friends")]
public IList<object> Friends { get; set; }
}
public class Beers
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("items")]
public IList<Item> Items { get; set; }
}
public class Response
{
[JsonProperty("sort")]
public string Sort { get; set; }
[JsonProperty("sort_english")]
public string SortEnglish { get; set; }
[JsonProperty("type_id")]
public int TypeId { get; set; }
[JsonProperty("beers")]
public Beers Beers { get; set; }
}
public class UserWishList : BasicRequest, IAuthenticatedRequest, IUnAuthenticatedRequest
{
protected override string EndPointWithConfiguration { get { return "/v4/user/wishlist{0}"; } }
[JsonProperty("meta")]
public Meta Meta { get; set; }
[JsonProperty("notifications")]
[JsonConverter(typeof(SingleObjectArrayConverter<Notifications>))]
public Notifications Notifications { get; set; }
[JsonProperty("response")]
public Response Response { get; set; }
}
[JsonProperty("response")]
public Response Response { get; set; }
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -3,44 +3,44 @@ using Newtonsoft.Json;
namespace Untappd.Net
{
/// <summary>
/// Created to fix bad json results.
/// Object expected but sometimes it comes as an empty array.
///
/// Deserialize json as T if json schema defines an object.
/// </summary>
/// <typeparam name="T"></typeparam>
internal sealed class SingleObjectArrayConverter<T> : JsonConverter
where T : new()
{
public override bool CanConvert(Type objectType)
{
return true;
/// <summary>
/// Created to fix bad json results.
/// Object expected but sometimes it comes as an empty array.
///
/// Deserialize json as T if json schema defines an object.
/// </summary>
/// <typeparam name="T"></typeparam>
internal sealed class SingleObjectArrayConverter<T> : JsonConverter
where T : new()
{
public override bool CanConvert(Type objectType)
{
return true;
}
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var retval = new object();
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
var retval = new object();
switch (reader.TokenType)
{
case JsonToken.StartObject:
var instance = (T)serializer.Deserialize(reader, typeof(T));
retval = instance;
break;
switch (reader.TokenType)
{
case JsonToken.StartObject:
var instance = (T)serializer.Deserialize(reader, typeof(T));
retval = instance;
break;
case JsonToken.StartArray:
reader.Read();
retval = new T();
break;
}
case JsonToken.StartArray:
reader.Read();
retval = new T();
break;
}
return retval;
}
return retval;
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
throw new NotImplementedException();
}
}
}

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="RestSharp" version="105.0.1" targetFramework="net45" />
<package id="Newtonsoft.Json" version="6.0.8" targetFramework="net45" />
<package id="RestSharp" version="105.0.1" targetFramework="net45" />
</packages>