Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get a specified number of post #39

Open
konigsoft opened this issue Sep 28, 2015 · 3 comments
Open

get a specified number of post #39

konigsoft opened this issue Sep 28, 2015 · 3 comments

Comments

@konigsoft
Copy link

Hi @yongjhih thank you for your lib.
I want to know how can i get a specified number of post with callback.
lokking forward to hearing from you.

best regards,

Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

@yongjhih
Copy link
Owner

Number of posts:

facebook.getPosts(new Callback<>() {
    @Override public void onCompleted(List<Post> posts) {
        System.out.println("number of posts: " + posts.size());
    }
    @Override public void onError(Throwable e) {
        // ...
    }
});

Retrieve a post by specific post id:

@RetroFacebook
abstract class Facebook {
    @GET("/{post-id}")
    abstract void getPost(@RetroFacebook.Path("post-id") String postId, Callback<Post> callback);
}
facebook.getPost(new Callback<>() {
    @Override public void onCompleted(List<Post> posts) {
        System.out.println("Post: " + posts.get(0));
    }
    @Override public void onError(Throwable e) {
        // ...
    }
});

@konigsoft
Copy link
Author

Hi @yongjhih
thank you very much for your reply. My question was not as explicite as it should.
Here is
I want to limit the number of post retrieve (by any paramater time, number etc etc) but i dont find how to do it ?

this piece of code

@RetroFacebook
abstract class Facebook {
@get("/{post-id}")
abstract void getPost(@RetroFacebook.Path("post-id") String postId, Callback callback);
}

where do it put it if i use gradle to import the code ?

@yongjhih
Copy link
Owner

  1. Sorry, Callback mode that's not supported to limit retrieved number of posts now. You should use Observable mode.
  2. Fork this repository, import Retrofacebook/retrofacebook as module into your project. And, add your API into Retrofacebook/retrofacebook/src/main/java/retrofacebook/Facebook.java.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants