diff options
author | Andrew Arnott <andrewarnott@gmail.com> | 2010-06-08 22:38:46 -0700 |
---|---|---|
committer | Andrew Arnott <andrewarnott@gmail.com> | 2010-06-08 22:38:46 -0700 |
commit | c604f25eaf5cd4fce2a73e00bfe8b27fe97b86d0 (patch) | |
tree | e37f874cfe3a0937059e4acf1090254ce0b3dba6 /samples/DotNetOpenAuth.ApplicationBlock | |
parent | b3a35b9ae0823dda35bb07b404c9c09fec09402a (diff) | |
parent | 436da522dcab28df4e19b212b49270c5211ff92b (diff) | |
download | DotNetOpenAuth-c604f25eaf5cd4fce2a73e00bfe8b27fe97b86d0.zip DotNetOpenAuth-c604f25eaf5cd4fce2a73e00bfe8b27fe97b86d0.tar.gz DotNetOpenAuth-c604f25eaf5cd4fce2a73e00bfe8b27fe97b86d0.tar.bz2 |
Merge branch 'v3.4' into oauth2
Conflicts:
src/DotNetOpenAuth/Configuration/MessagingElement.cs
src/DotNetOpenAuth/Messaging/Reflection/MessagePart.cs
Diffstat (limited to 'samples/DotNetOpenAuth.ApplicationBlock')
-rw-r--r-- | samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs b/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs index 4d3ce13..2add642 100644 --- a/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs +++ b/samples/DotNetOpenAuth.ApplicationBlock/GoogleConsumer.cs @@ -8,6 +8,7 @@ namespace DotNetOpenAuth.ApplicationBlock { using System; using System.Collections.Generic; using System.Diagnostics; + using System.Globalization; using System.IO; using System.Linq; using System.Net; @@ -208,13 +209,20 @@ namespace DotNetOpenAuth.ApplicationBlock { /// </summary> /// <param name="consumer">The Google consumer previously constructed using <see cref="CreateWebConsumer"/> or <see cref="CreateDesktopConsumer"/>.</param> /// <param name="accessToken">The access token previously retrieved.</param> + /// <param name="maxResults">The maximum number of entries to return. If you want to receive all of the contacts, rather than only the default maximum, you can specify a very large number here.</param> + /// <param name="startIndex">The 1-based index of the first result to be retrieved (for paging).</param> /// <returns>An XML document returned by Google.</returns> - public static XDocument GetContacts(ConsumerBase consumer, string accessToken) { + public static XDocument GetContacts(ConsumerBase consumer, string accessToken, int maxResults = 25, int startIndex = 1) { if (consumer == null) { throw new ArgumentNullException("consumer"); } - var response = consumer.PrepareAuthorizedRequestAndSend(GetContactsEndpoint, accessToken); + var extraData = new Dictionary<string, string>() { + { "start-index", startIndex.ToString(CultureInfo.InvariantCulture) }, + { "max-results", maxResults.ToString(CultureInfo.InvariantCulture) }, + }; + var request = consumer.PrepareAuthorizedRequest(GetContactsEndpoint, accessToken, extraData); + var response = consumer.Channel.WebRequestHandler.GetResponse(request); string body = response.GetResponseReader().ReadToEnd(); XDocument result = XDocument.Parse(body); return result; |