Package com.restfb

Examples of com.restfb.FacebookClient.fetchObject()


public class FacebookHelper {

  public static String getUsername(String accessToken) {
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    User user = facebookClient.fetchObject("me", User.class);
    if (user != null) {
      return user.getName();
    }
    return null;
  }
View Full Code Here


  }
 
  public static String getUserId(String accessToken) {
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    User user = facebookClient.fetchObject("me", User.class);
    if (user != null) {
      return user.getId();
    }
    return null;
  }
View Full Code Here

  }
 
  public static String getEmail(String accessToken) {
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    User user = facebookClient.fetchObject("me", User.class);
    if (user != null) {
      return user.getEmail();
    }
    return null;
  }
View Full Code Here

  }
 
  public static User getUser(String accessToken) {
   
    FacebookClient facebookClient = new DefaultFacebookClient(accessToken);
    User user = facebookClient.fetchObject("me", User.class);
    if (user != null) {
      return user;
    }
    return null;
  }
View Full Code Here

    return !connection.getData().isEmpty();
  }
 
  public User getProfile(String accessToken) {
    FacebookClient fb = createFacebookClient(accessToken);
    return fb.fetchObject(FB_ME, User.class);
  }
 
  public Boolean isFriend(String accessToken, String facebookId) {
    return getFriend(accessToken, facebookId) != null;
  }
View Full Code Here

    public Response facebookLogin(@QueryParam("access_token") String access_token) {
        String appId = env.get("facebook.appId");
        String appSecret = env.get("facebook.appSecret");
        try {
            FacebookClient facebookClient = new DefaultFacebookClient(access_token);
            User user = facebookClient.fetchObject("me", User.class);

            String me = "";
            try {
                me = gson.toJson(user);
            } catch (Exception e) {
View Full Code Here

    try {
      FacebookClient facebookClient = new DefaultFacebookClient();

      // You'll notice that logging statements from this call are bridged from java.util.logging to Log4j
      User user = facebookClient.fetchObject("btaylor", User.class);

      // ...and of course this goes straight to Log4j
      logger.debug(user);
    } finally {
      // Make sure to tear down when you're done using the bridge
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.