Package com.restfb

Examples of com.restfb.DefaultLegacyFacebookClient


  // You need to provide your access token here.
  // Instructions are available on http://restfb.com.
  private static final String MY_ACCESS_TOKEN = "";

  public static void main(String[] args) {
    LegacyFacebookClient facebookClient = new DefaultLegacyFacebookClient(MY_ACCESS_TOKEN);

    // Last parameter specifies that this API call's result should be returned
    // to us as a Long value.
    Long uid = facebookClient.execute("users.getLoggedInUser", Long.class);

    System.out.println("My UID is " + uid);

    // FQL query which asks Facebook for your friends' names, profile picture
    // URLs, and network affiliations
    String query =
        "SELECT name, pic_big, affiliations FROM user "
            + "WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=" + uid + ")";

    // Executes an API call with result mapped to a list of classes we've
    // defined. Note that you can pass in an arbitrary number of Parameters -
    // here we send along the query as well as the "give me HTTPS URLs" flag
    List<User> users =
        facebookClient.executeForList("fql.query", User.class,
          Parameter.with("query", query), Parameter.with(
            "return_ssl_resources", "true"));

    System.out.println("My friends and their affiliations:");
View Full Code Here


  // You need to provide your access token here.
  // Instructions are available on http://restfb.com.
  private static final String MY_ACCESS_TOKEN = "";

  public static void main(String[] args) {
    LegacyFacebookClient facebookClient = new DefaultLegacyFacebookClient(MY_ACCESS_TOKEN);

    ActionLink category = new ActionLink();
    category.href = "http://bit.ly/KYbaN";
    category.text = "humor";

    Properties properties = new Properties();
    properties.category = category;
    properties.ratings = "5 stars";

    Medium medium = new Medium();
    medium.href = "http://bit.ly/187gO1";
    medium.src = "http://bit.ly/GaTlC";
    medium.type = "image";

    Attachment attachment = new Attachment();
    attachment.name = "i'm bursting with joy";
    attachment.href = "http://bit.ly/187gO1";
    attachment.caption = "{*actor*} rated the lolcat 5 stars";
    attachment.description = "a funny looking cat";
    attachment.properties = properties;
    attachment.media = Collections.singletonList(medium);

    // Send the request to Facebook.
    // We specify the session key to use to make the call, the fact that we're
    // expecting a String response, and the attachment (defined above).
    String postId =
        facebookClient.execute("stream.publish", String.class,
          Parameter.with("attachment", attachment));

    System.out.println("Post ID is " + postId);
  }
View Full Code Here

    new LegacyExample(args[0]).runEverything();
  }

  LegacyExample(String accessToken) {
    facebookClient = new DefaultLegacyFacebookClient(accessToken);
  }
View Full Code Here

TOP

Related Classes of com.restfb.DefaultLegacyFacebookClient

Copyright © 2018 www.massapicom. 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.