Export to GitHub

java-twitter - issue #9

Ability to pass username parameter


Posted on Jul 24, 2009 by Swift Horse

I was not able to find a way to pass a "from username" parameter to a SearchRequest.Builder object (actual Twitter format is "from=<username>". I checked out the source and created a new method, similar to the .page method, which appends a parameter to the URL as above. I tested to the best of my ability (the new method appears to have worked, and didn't appear to have broken anything). Here's the patch if you'd like to check it back in to the code:

Eclipse Workspace Patch 1.0

P java-twitter

Index: src/main/java/net/unto/twitter/methods/SearchRequest.java

--- src/main/java/net/unto/twitter/methods/SearchRequest.java (revision 157) +++ src/main/java/net/unto/twitter/methods/SearchRequest.java (working copy) @@ -69,6 +69,16 @@ assert (page >= 1); return parameter("page", Integer.toString(page)); } +
+
/********************************************************************** + * The originating user name whose results to retrieve. + * @param UserName The Twitter user name. + * @return Builder + */ + public Builder fromuser(String UserName) { + assert (UserName.length() > 0); + return parameter("from",UserName); + }

 public Builder geocode(Geocode geocode) {
   return parameter(&quot;geocode&quot;, String.format(&quot;%s,%s,%s%s&quot;, geocode

Thanks, Josh

Comment #1

Posted on Jul 26, 2009 by Massive Camel

Fixed in r158. Please verify.

Status: Fixed

Labels:
Type-Defect Priority-Medium