Permalink
Browse files

Implemented user-defined list operations

  • Loading branch information...
1 parent e99e209 commit 6eaacbf0a33730e337f22b74b9639c5f5aa7fcc7 @bbaia bbaia committed Jan 10, 2012
Showing with 3,864 additions and 26 deletions.
  1. +1,489 −0 src/Spring.Social.Twitter/Social/Twitter/Api/IListOperations.cs
  2. +5 −0 src/Spring.Social.Twitter/Social/Twitter/Api/ITwitter.cs
  3. +45 −0 src/Spring.Social.Twitter/Social/Twitter/Api/Impl/Json/CursoredUserListListDeserializer.cs
  4. +54 −0 src/Spring.Social.Twitter/Social/Twitter/Api/Impl/Json/UserListDeserializer.cs
  5. +895 −0 src/Spring.Social.Twitter/Social/Twitter/Api/Impl/ListTemplate.cs
  6. +12 −0 src/Spring.Social.Twitter/Social/Twitter/Api/Impl/TwitterTemplate.cs
  7. +82 −0 src/Spring.Social.Twitter/Social/Twitter/Api/UserList.cs
  8. +17 −4 src/Spring.Social.Twitter/Spring.Social.Twitter.2008-NET20.csproj
  9. +17 −4 src/Spring.Social.Twitter/Spring.Social.Twitter.2008-NET35.csproj
  10. +5 −0 src/Spring.Social.Twitter/Spring.Social.Twitter.2010-NET40.csproj
  11. +17 −4 src/Spring.Social.Twitter/Spring.Social.Twitter.2010-SL40.csproj
  12. +17 −4 src/Spring.Social.Twitter/Spring.Social.Twitter.2010-SL50.csproj
  13. +17 −4 src/Spring.Social.Twitter/Spring.Social.Twitter.2010-WP70.csproj
  14. +19 −6 src/Spring.Social.Twitter/Spring.Social.Twitter.2010-WP71.csproj
  15. +875 −0 test/Spring.Social.Twitter.Tests/Social/Twitter/Api/Impl/ListTemplateTests.cs
  16. +125 −0 test/Spring.Social.Twitter.Tests/Social/Twitter/Api/Impl/List_Members.json
  17. +110 −0 test/Spring.Social.Twitter.Tests/Social/Twitter/Api/Impl/List_Of_Lists.json
  18. +51 −0 test/Spring.Social.Twitter.Tests/Social/Twitter/Api/Impl/Single_List.json
  19. +4 −0 test/Spring.Social.Twitter.Tests/Spring.Social.Twitter.Tests.2008-NET20.csproj
  20. +4 −0 test/Spring.Social.Twitter.Tests/Spring.Social.Twitter.Tests.2008-NET35.csproj
  21. +4 −0 test/Spring.Social.Twitter.Tests/Spring.Social.Twitter.Tests.2010-NET40.csproj

Large diffs are not rendered by default.

Oops, something went wrong.
@@ -52,6 +52,11 @@ public interface ITwitter : IApiBinding
IGeoOperations GeoOperations { get; }
/// <summary>
+ /// Gets the portion of the Twitter API containing the user list operations.
+ /// </summary>
+ IListOperations ListOperations { get; }
+
+ /// <summary>
/// Gets the portion of the Twitter API containing the search operations.
/// </summary>
ISearchOperations SearchOperations { get; }
@@ -0,0 +1,45 @@
+#region License
+
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#endregion
+
+using System.Collections.Generic;
+
+using Spring.Json;
+
+namespace Spring.Social.Twitter.Api.Impl.Json
+{
+ /// <summary>
+ /// JSON deserializer for cursored list of user-defined lists.
+ /// </summary>
+ /// <author>Bruno Baia</author>
+ class CursoredUserListListDeserializer : IJsonDeserializer
+ {
+ public object Deserialize(JsonValue value, JsonMapper mapper)
+ {
+ CursoredList<UserList> userLists = new CursoredList<UserList>();
+ userLists.PreviousCursor = value.GetValue<long>("previous_cursor");
+ userLists.NextCursor = value.GetValue<long>("next_cursor");
+ foreach (JsonValue itemValue in value.GetValues("lists"))
+ {
+ userLists.Add(mapper.Deserialize<UserList>(itemValue));
+ }
+ return userLists;
+ }
+ }
+}
@@ -0,0 +1,54 @@
+#region License
+
+/*
+ * Copyright 2002-2012 the original author or authors.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#endregion
+
+using System;
+using System.Globalization;
+
+using Spring.Json;
+
+namespace Spring.Social.Twitter.Api.Impl.Json
+{
+ /// <summary>
+ /// JSON deserializer for user-defined lists.
+ /// </summary>
+ /// <author>Craig Walls</author>
+ /// <author>Bruno Baia (.NET)</author>
+ class UserListDeserializer : IJsonDeserializer
+ {
+ private const string DIRECT_MESSAGE_DATE_FORMAT = "ddd MMM dd HH:mm:ss zzz yyyy";
+
+ public object Deserialize(JsonValue json, JsonMapper mapper)
+ {
+ return new UserList()
+ {
+ ID = json.GetValue<long>("id"),
+ Name = json.GetValue<string>("name"),
+ FullName = json.GetValue<string>("full_name"),
+ UriPath = json.GetValue<string>("uri"),
+ Description = json.GetValue<string>("description"),
+ Slug = json.GetValue<string>("slug"),
+ IsPublic = (json.GetValue<string>("mode") == "public"),
+ IsFollowing = json.GetValue<bool>("following"),
+ MemberCount = json.GetValue<int>("member_count"),
+ SubscriberCount = json.GetValue<int>("subscriber_count")
+ };
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit 6eaacbf

Please sign in to comment.