Coder Social home page Coder Social logo

batchfb's Introduction

batchfb

BatchFB is a Java library that provides a power-user's interface to Facebook's Graph API.

  • Automatically groups requests into the minimum number of remote calls to Facebook:
    • FQL queries are combined into a single multiquery.
    • FQL and Graph requests are combined into a single Graph Batch API request.
  • Provides a unified, coherent, and programmer-friendly set of exceptions from Graph and FQL calls.
  • Deeply integrates with Jackson to map Facebook results to your typesafe objects.

Additional bonus for Google App Engine users: Oversized batches are automatically split and executed in parallel, rather than serially. GAE is not required to use BatchFB.

Before you read the UserGuide, here is a quick example:

/** You write your own Jackson user mapping for the pieces you care about */
public class User {
    long uid;
    @JsonProperty("first_name") String firstName;
    String pic_square;
    String timezone;
}

Batcher batcher = new FacebookBatcher(accessToken);

Later<User> me = batcher.graph("me", User.class);
Later<User> mark = batcher.graph("markzuckerberg", User.class);
Later<List<User>> myFriends = batcher.query(
    "SELECT uid, first_name, pic_square FROM user WHERE uid IN" +
    "(SELECT uid2 FROM friend WHERE uid1 = " + myId + ")", User.class);
Later<User> bob = batcher.queryFirst("SELECT timezone FROM user WHERE uid = " + bobsId, User.class);
PagedLater<Post> feed = batcher.paged("me/feed", Post.class);

// No calls to Facebook have been made yet.  The following get() will execute the
// whole batch as a single Facebook call.
String timezone = bob.get().timezone;

// You can just get simple values forcing immediate execution of the batch at any time.
User ivan = batcher.graph("ivan", User.class).get();

Note: BatchFB requires that you understand both the Facebook API and Jackson's annotation-based configuration. For a more novice-friendly Java interface to Facebook, try RestFB.

Now, read the UserGuide.

You may also be interested in the ReleaseNotes.

batchfb's People

Contributors

stickfigure avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.