Skip to content

Commit

Permalink
Merge branch 'release/2.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
roundrop committed Jul 10, 2015
2 parents 0bc6286 + 0da4b19 commit e373b62
Show file tree
Hide file tree
Showing 37 changed files with 1,612 additions and 91 deletions.
131 changes: 86 additions & 45 deletions facebook4j-core/src/main/java/facebook4j/FacebookImpl.java

Large diffs are not rendered by default.

63 changes: 61 additions & 2 deletions facebook4j-core/src/main/java/facebook4j/PagePhotoUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import facebook4j.internal.http.HttpParameter;

import java.net.URL;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
Expand All @@ -30,21 +31,31 @@ public class PagePhotoUpdate implements java.io.Serializable {
private static final long serialVersionUID = -2690799855513822140L;

private Media source;
private URL url;
private String message;
private String place;
private Boolean noStory;
private TargetingParameter targeting;
private FeedTargetingParameter feedTargeting;
private Boolean published;
private Integer scheduledPublishTime;

public PagePhotoUpdate(Media source) {
super();
this.source = source;
}

public PagePhotoUpdate(URL url) {
this.url = url;
}

public Media getSource() {
return source;
}

public URL getUrl() {
return url;
}

public String getMessage() {
return message;
}
Expand All @@ -58,6 +69,32 @@ public PagePhotoUpdate message(String message) {
return this;
}

public String getPlace() {
return place;
}

public void setPlace(String place) {
this.place = place;
}

public PagePhotoUpdate place(String place) {
setPlace(place);
return this;
}

public Boolean getNoStory() {
return noStory;
}

public void setNoStory(boolean noStory) {
this.noStory = noStory;
}

public PagePhotoUpdate noStory(boolean noStory) {
setNoStory(noStory);
return this;
}

public TargetingParameter getTargeting() {
return targeting;
}
Expand Down Expand Up @@ -122,10 +159,23 @@ public PagePhotoUpdate scheduledPublishTime(Date scheduledPublishTime) {

/*package*/ HttpParameter[] asHttpParameterArray() {
List<HttpParameter> params = new ArrayList<HttpParameter>();
params.add(new HttpParameter("source", source.getMediaFile()));
if (source != null) {
params.add(new HttpParameter("source", source.getMediaFile()));
}
if (url != null) {
params.add(new HttpParameter("url", url.toString()));
}
if (message != null) {
params.add(new HttpParameter("message", message));
}
if (place != null) {
params.add(new HttpParameter("place", place));
}
if (noStory != null) {
if (noStory) {
params.add(new HttpParameter("no_story", 1));
}
}
if (targeting != null) {
params.add(new HttpParameter("targeting", targeting.asJSONString()));
}
Expand All @@ -151,19 +201,25 @@ public boolean equals(Object o) {
if (feedTargeting != null ? !feedTargeting.equals(that.feedTargeting) : that.feedTargeting != null)
return false;
if (message != null ? !message.equals(that.message) : that.message != null) return false;
if (noStory != null ? !noStory.equals(that.noStory) : that.noStory != null) return false;
if (place != null ? !place.equals(that.place) : that.place != null) return false;
if (published != null ? !published.equals(that.published) : that.published != null) return false;
if (scheduledPublishTime != null ? !scheduledPublishTime.equals(that.scheduledPublishTime) : that.scheduledPublishTime != null)
return false;
if (source != null ? !source.equals(that.source) : that.source != null) return false;
if (targeting != null ? !targeting.equals(that.targeting) : that.targeting != null) return false;
if (url != null ? !url.equals(that.url) : that.url != null) return false;

return true;
}

@Override
public int hashCode() {
int result = source != null ? source.hashCode() : 0;
result = 31 * result + (url != null ? url.hashCode() : 0);
result = 31 * result + (message != null ? message.hashCode() : 0);
result = 31 * result + (place != null ? place.hashCode() : 0);
result = 31 * result + (noStory != null ? noStory.hashCode() : 0);
result = 31 * result + (targeting != null ? targeting.hashCode() : 0);
result = 31 * result + (feedTargeting != null ? feedTargeting.hashCode() : 0);
result = 31 * result + (published != null ? published.hashCode() : 0);
Expand All @@ -175,7 +231,10 @@ public int hashCode() {
public String toString() {
return "PagePhotoUpdate{" +
"source=" + source +
", url=" + url +
", message='" + message + '\'' +
", place='" + place + '\'' +
", noStory=" + noStory +
", targeting=" + targeting +
", feedTargeting=" + feedTargeting +
", published=" + published +
Expand Down
40 changes: 39 additions & 1 deletion facebook4j-core/src/main/java/facebook4j/PhotoUpdate.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import facebook4j.internal.http.HttpParameter;

import java.net.URL;
import java.util.ArrayList;
import java.util.List;

Expand All @@ -29,18 +30,28 @@ public class PhotoUpdate implements java.io.Serializable {
private static final long serialVersionUID = -2679992754222742305L;

private Media source;
private URL url;
private String message;
private String place;
private Boolean noStory;
private PrivacyParameter privacy;

public PhotoUpdate(Media source) {
this.source = source;
}

public PhotoUpdate(URL url) {
this.url = url;
}

public Media getSource() {
return source;
}

public URL getUrl() {
return url;
}

public String getMessage() {
return message;
}
Expand Down Expand Up @@ -80,9 +91,27 @@ public PhotoUpdate noStory(boolean noStory) {
return this;
}

public PrivacyParameter getPrivacy() {
return privacy;
}

public void setPrivacy(PrivacyParameter privacy) {
this.privacy = privacy;
}

public PhotoUpdate privacy(PrivacyParameter privacy) {
setPrivacy(privacy);
return this;
}

/*package*/ HttpParameter[] asHttpParameterArray() {
List<HttpParameter> params = new ArrayList<HttpParameter>();
params.add(source.asHttpParameter("source"));
if (source != null) {
params.add(source.asHttpParameter("source"));
}
if (url != null) {
params.add(new HttpParameter("url", url.toString()));
}
if (message != null) {
params.add(new HttpParameter("message", message));
}
Expand All @@ -94,6 +123,9 @@ public PhotoUpdate noStory(boolean noStory) {
params.add(new HttpParameter("no_story", 1));
}
}
if (privacy != null) {
params.add(new HttpParameter("privacy", privacy.asJSONString()));
}
return params.toArray(new HttpParameter[params.size()]);
}

Expand All @@ -107,27 +139,33 @@ public boolean equals(Object o) {
if (message != null ? !message.equals(that.message) : that.message != null) return false;
if (noStory != null ? !noStory.equals(that.noStory) : that.noStory != null) return false;
if (place != null ? !place.equals(that.place) : that.place != null) return false;
if (privacy != null ? !privacy.equals(that.privacy) : that.privacy != null) return false;
if (source != null ? !source.equals(that.source) : that.source != null) return false;
if (url != null ? !url.equals(that.url) : that.url != null) return false;

return true;
}

@Override
public int hashCode() {
int result = source != null ? source.hashCode() : 0;
result = 31 * result + (url != null ? url.hashCode() : 0);
result = 31 * result + (message != null ? message.hashCode() : 0);
result = 31 * result + (place != null ? place.hashCode() : 0);
result = 31 * result + (noStory != null ? noStory.hashCode() : 0);
result = 31 * result + (privacy != null ? privacy.hashCode() : 0);
return result;
}

@Override
public String toString() {
return "PhotoUpdate{" +
"source=" + source +
", url=" + url +
", message='" + message + '\'' +
", place='" + place + '\'' +
", noStory=" + noStory +
", privacy=" + privacy +
'}';
}
}
10 changes: 10 additions & 0 deletions facebook4j-core/src/main/java/facebook4j/PlaceTag.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package facebook4j;

import java.util.Date;

public interface PlaceTag extends FacebookResponse {
String getId();
Date getCreatedTime();
Place getPlaceTag();

}
8 changes: 8 additions & 0 deletions facebook4j-core/src/main/java/facebook4j/TaggableFriend.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package facebook4j;

public interface TaggableFriend {

String getToken();
String getName();
Picture getPicture();
}
2 changes: 1 addition & 1 deletion facebook4j-core/src/main/java/facebook4j/Version.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
* @author Ryuji Yamashita - roundrop at gmail.com
*/
public final class Version {
private static final String VERSION = "2.2.2";
private static final String VERSION = "2.3.0";
private static final String TITLE = "Facebook4J";

private Version() {
Expand Down
19 changes: 19 additions & 0 deletions facebook4j-core/src/main/java/facebook4j/api/FriendMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import facebook4j.Friendlist;
import facebook4j.Reading;
import facebook4j.ResponseList;
import facebook4j.TaggableFriend;

/**
* @author Ryuji Yamashita - roundrop at gmail.com
Expand Down Expand Up @@ -306,5 +307,23 @@ public interface FriendMethods {
* @see <a href="https://developers.facebook.com/docs/reference/api/user/#mutualfriends">User#mutualfriends - Facebook Developers</a>
*/
ResponseList<Friend> getMutualFriends(String userId1, String userId2, Reading reading) throws FacebookException;

/**
* Returns the list of friends of the current user.
* @return taggable friend's list
* @throws FacebookException when Facebook service or network is unavailable, and when taggable friends feature requires app review
* @see <a href="https://developers.facebook.com/docs/graph-api/reference/user/taggable_friends">User#taggablefriends - Facebook Developers</a>
*/
ResponseList<TaggableFriend> getTaggableFriends() throws FacebookException;

/**
* Returns the list of friends of the current user.
* @param reading optional reading parameters. see <a href="https://developers.facebook.com/docs/reference/api/#reading">Graph API#reading - Facebook Developers</a>
* @return taggable friend's list
* @throws FacebookException when Facebook service or network is unavailable,and when taggable friends feature requires app review
* @see <a href="https://developers.facebook.com/docs/graph-api/reference/user/taggable_friends">User#taggablefriends - Facebook Developers</a>
*/
ResponseList<TaggableFriend> getTaggableFriends(Reading reading) throws FacebookException;


}
37 changes: 37 additions & 0 deletions facebook4j-core/src/main/java/facebook4j/api/LocationMethods.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import facebook4j.FacebookException;
import facebook4j.Location;
import facebook4j.PlaceTag;
import facebook4j.Reading;
import facebook4j.ResponseList;

Expand Down Expand Up @@ -60,5 +61,41 @@ public interface LocationMethods {
* @see <a href="https://developers.facebook.com/docs/reference/api/user/">User - Facebook Developers</a> - Connections - locations
*/
ResponseList<Location> getLocations(String userId, Reading reading) throws FacebookException;

/**
* Returns a list of tags of this person at a place in a photo, video, post, status or link.
* @return a list of Place Tag objects
* @throws FacebookException when Facebook service or network is unavailable
* @see <a href="https://developers.facebook.com/docs/graph-api/reference/user/tagged_places">User - Facebook Developers</a> - Connections - tagged places
*/
ResponseList<PlaceTag> getTaggedPlaces() throws FacebookException;

/**
* Returns a list of tags of this person at a place in a photo, video, post, status or link.
* @param reading optional reading parameters. see <a href="https://developers.facebook.com/docs/reference/api/#reading">Graph API#reading - Facebook Developers</a>
* @return a list of Place Tag objects
* @throws FacebookException when Facebook service or network is unavailable
* @see <a href="https://developers.facebook.com/docs/graph-api/reference/user/tagged_places">User - Facebook Developers</a> - Connections - tagged places
*/
ResponseList<PlaceTag> getTaggedPlaces(Reading reading) throws FacebookException;

/**
* Returns a list of tags of this person at a place in a photo, video, post, status or link.
* @param userId the ID of a user
* @return a list of Place Tag objects
* @throws FacebookException when Facebook service or network is unavailable
* @see <a href="https://developers.facebook.com/docs/graph-api/reference/user/tagged_places">User - Facebook Developers</a> - Connections - tagged places
*/
ResponseList<PlaceTag> getTaggedPlaces(String userId) throws FacebookException;

/**
* Returns a list of tags of this person at a place in a photo, video, post, status or link.
* @param userId the ID of a user
* @param reading optional reading parameters. see <a href="https://developers.facebook.com/docs/reference/api/#reading">Graph API#reading - Facebook Developers</a>
* @return a list of Place Tag objects
* @throws FacebookException when Facebook service or network is unavailable
* @see <a href="https://developers.facebook.com/docs/graph-api/reference/user/tagged_places">User - Facebook Developers</a> - Connections - tagged places
*/
ResponseList<PlaceTag> getTaggedPlaces(String userId, Reading reading) throws FacebookException;

}
Loading

0 comments on commit e373b62

Please sign in to comment.