Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #52 from sconno05/develop

Adding additional search result properties to TwitterSearchResultCollect...
  • Loading branch information...
commit c49e722d3a90b0a3cb9249bf58dfb8968b440266 2 parents c8337fb + c8dc604
@DigitallyBorn DigitallyBorn authored
View
7 Twitterizer2.TestCases/TwitterSearchTests.cs
@@ -26,6 +26,13 @@ public static void Search()
Assert.That(request.Result == RequestResult.Success, request.ErrorMessage);
Assert.IsNotNull(request.ResponseObject);
+ Assert.Greater(request.ResponseObject.MaxId, 0);
+ Assert.Greater(request.ResponseObject.CompletedIn, 0);
+ Assert.IsNotNullOrEmpty(request.ResponseObject.MaxIdStr);
+ Assert.IsNotNullOrEmpty(request.ResponseObject.NextPage);
+ Assert.Greater(request.ResponseObject.Page, 0);
+ Assert.AreEqual("twitter", request.ResponseObject.Query);
+ Assert.IsNotNullOrEmpty(request.ResponseObject.RefreshUrl);
}
[Test]
View
60 Twitterizer2/Methods/Search/TwitterSearchResultCollection.cs
@@ -49,6 +49,55 @@ namespace Twitterizer
public class TwitterSearchResultCollection : Core.TwitterCollection<TwitterSearchResult>, ITwitterObject
{
/// <summary>
+ /// Gets or sets the completed_in.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns></returns>
+ public double CompletedIn { get; internal set; }
+
+ /// <summary>
+ /// Gets or sets the max_id.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns></returns>
+ public long MaxId { get; internal set; }
+
+ /// <summary>
+ /// Gets or sets the max_id as a string.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns></returns>
+ public string MaxIdStr { get; internal set; }
+
+ /// <summary>
+ /// Gets or sets the next_page.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns></returns>
+ public string NextPage { get; internal set; }
+
+ /// <summary>
+ /// Gets or sets the page.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns></returns>
+ public int Page { get; internal set; }
+
+ /// <summary>
+ /// Gets or sets the query.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns></returns>
+ public string Query { get; internal set; }
+
+ /// <summary>
+ /// Gets or sets the refresh URL.
+ /// </summary>
+ /// <param name="value">The value.</param>
+ /// <returns></returns>
+ public string RefreshUrl { get; internal set; }
+
+ /// <summary>
/// Deserializes the specified value.
/// </summary>
/// <param name="value">The value.</param>
@@ -58,7 +107,16 @@ internal static TwitterSearchResultCollection Deserialize(JObject value)
if (value == null || value["results"] == null)
return null;
- return JsonConvert.DeserializeObject<TwitterSearchResultCollection>(value["results"].ToString());
+ TwitterSearchResultCollection result = JsonConvert.DeserializeObject<TwitterSearchResultCollection>(value["results"].ToString());
+ result.CompletedIn = value.SelectToken("completed_in").Value<double>();
+ result.MaxId = value.SelectToken("max_id").Value<long>();
+ result.MaxIdStr = value.SelectToken("max_id_str").Value<string>();
+ result.NextPage = value.SelectToken("next_page").Value<string>();
+ result.Page = value.SelectToken("page").Value<int>();
+ result.Query = value.SelectToken("query").Value<string>();
+ result.RefreshUrl = value.SelectToken("refresh_url").Value<string>();
+
+ return result;
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.