com.tumblr.jumblr
Class JumblrClient

java.lang.Object
  extended by com.tumblr.jumblr.JumblrClient

public class JumblrClient
extends Object

This is the base JumblrClient that is used to make requests to the Tumblr API. All calls that can be made from other Resource(s) can be made from here.

Author:
jc

Constructor Summary
JumblrClient()
           
JumblrClient(String consumerKey, String consumerSecret)
          Instantiate a new Jumblr Client with no token
JumblrClient(String consumerKey, String consumerSecret, String token, String tokenSecret)
          Instantiate a new Jumblr Client
 
Method Summary
 String blogAvatar(String blogName)
           
 String blogAvatar(String blogName, Integer size)
          Get a specific size avatar for a given blog
 List<Post> blogDraftPosts(String blogName)
           
 List<Post> blogDraftPosts(String blogName, Map<String,?> options)
          Get the draft posts for a given blog
 List<User> blogFollowers(String blogName)
           
 List<User> blogFollowers(String blogName, Map<String,?> options)
          Get the followers for a given blog
 Blog blogInfo(String blogName)
          Get the blog info for a given blog
 List<Post> blogLikes(String blogName)
           
 List<Post> blogLikes(String blogName, Map<String,?> options)
          Get the public likes for a given blog
 Post blogPost(String blogName, Long postId)
          Get an individual post by id
 List<Post> blogPosts(String blogName)
           
 List<Post> blogPosts(String blogName, Map<String,?> options)
          Get the posts for a given blog
 List<Post> blogQueuedPosts(String blogName)
           
 List<Post> blogQueuedPosts(String blogName, Map<String,?> options)
          Get the queued posts for a given blog
 List<Post> blogSubmissions(String blogName)
           
 List<Post> blogSubmissions(String blogName, Map<String,?> options)
          Get the submissions for a given blog
 void follow(String blogName)
          Follow a given blog
 void like(Long postId, String reblogKey)
          Like a given post
<T extends Post>
T
newPost(String blogName, Class<T> klass)
          Set up a new post of a given type
 Long postCreate(String blogName, Map<String,?> detail)
          Create a post
 void postDelete(String blogName, Long postId)
          Delete a given post
 void postEdit(String blogName, Long id, Map<String,?> detail)
          Save edits for a given post
 Post postReblog(String blogName, Long postId, String reblogKey)
           
 Post postReblog(String blogName, Long postId, String reblogKey, Map<String,?> options)
          Reblog a given post
 void setRequestBuilder(RequestBuilder builder)
           
 void setToken(String token, String tokenSecret)
          Set the token for this client
 List<Post> tagged(String tag)
           
 List<Post> tagged(String tag, Map<String,?> options)
          Tagged posts
 void unfollow(String blogName)
          Unfollow a given blog
 void unlike(Long postId, String reblogKey)
          Unlike a given post
 User user()
          Get the user info for the authenticated User
 List<Post> userDashboard()
           
 List<Post> userDashboard(Map<String,?> options)
          Get the user dashboard for the authenticated User
 List<Blog> userFollowing()
           
 List<Blog> userFollowing(Map<String,?> options)
          Get the blogs the given user is following
 List<Post> userLikes()
           
 List<Post> userLikes(Map<String,?> options)
          Get the likes for the authenticated user
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JumblrClient

public JumblrClient()

JumblrClient

public JumblrClient(String consumerKey,
                    String consumerSecret)
Instantiate a new Jumblr Client with no token

Parameters:
consumerKey - The consumer key for the client
consumerSecret - The consumer secret for the client

JumblrClient

public JumblrClient(String consumerKey,
                    String consumerSecret,
                    String token,
                    String tokenSecret)
Instantiate a new Jumblr Client

Parameters:
consumerKey - The consumer key for the client
consumerSecret - The consumer secret for the client
token - The token for the client
tokenSecret - The token secret for the client
Method Detail

setToken

public void setToken(String token,
                     String tokenSecret)
Set the token for this client

Parameters:
token - The token for the client
tokenSecret - The token secret for the client

user

public User user()
Get the user info for the authenticated User

Returns:
The authenticated user

userDashboard

public List<Post> userDashboard(Map<String,?> options)
Get the user dashboard for the authenticated User

Parameters:
options - the options for the call (or null)
Returns:
A List of posts

userDashboard

public List<Post> userDashboard()

userFollowing

public List<Blog> userFollowing(Map<String,?> options)
Get the blogs the given user is following

Returns:
a List of blogs

userFollowing

public List<Blog> userFollowing()

tagged

public List<Post> tagged(String tag,
                         Map<String,?> options)
Tagged posts

Parameters:
tag - the tag to search
options - the options for the call (or null)
Returns:
a list of posts

tagged

public List<Post> tagged(String tag)

blogInfo

public Blog blogInfo(String blogName)
Get the blog info for a given blog

Parameters:
blogName - the Name of the blog
Returns:
The Blog object for this blog

blogFollowers

public List<User> blogFollowers(String blogName,
                                Map<String,?> options)
Get the followers for a given blog

Parameters:
blogName - the name of the blog
Returns:
the blog object for this blog

blogFollowers

public List<User> blogFollowers(String blogName)

blogLikes

public List<Post> blogLikes(String blogName,
                            Map<String,?> options)
Get the public likes for a given blog

Parameters:
blogName - the name of the blog
options - the options for this call (or null)
Returns:
a List of posts

blogLikes

public List<Post> blogLikes(String blogName)

blogPosts

public List<Post> blogPosts(String blogName,
                            Map<String,?> options)
Get the posts for a given blog

Parameters:
blogName - the name of the blog
options - the options for this call (or null)
Returns:
a List of posts

blogPosts

public List<Post> blogPosts(String blogName)

blogPost

public Post blogPost(String blogName,
                     Long postId)
Get an individual post by id

Parameters:
blogName - the name of the blog
postId - the id of the post to get
Returns:
the Post or null

blogQueuedPosts

public List<Post> blogQueuedPosts(String blogName,
                                  Map<String,?> options)
Get the queued posts for a given blog

Parameters:
blogName - the name of the blog
options - the options for this call (or null)
Returns:
a List of posts

blogQueuedPosts

public List<Post> blogQueuedPosts(String blogName)

blogDraftPosts

public List<Post> blogDraftPosts(String blogName,
                                 Map<String,?> options)
Get the draft posts for a given blog

Parameters:
blogName - the name of the blog
options - the options for this call (or null)
Returns:
a List of posts

blogDraftPosts

public List<Post> blogDraftPosts(String blogName)

blogSubmissions

public List<Post> blogSubmissions(String blogName,
                                  Map<String,?> options)
Get the submissions for a given blog

Parameters:
blogName - the name of the blog
options - the options for this call (or null)
Returns:
a List of posts

blogSubmissions

public List<Post> blogSubmissions(String blogName)

userLikes

public List<Post> userLikes(Map<String,?> options)
Get the likes for the authenticated user

Parameters:
options - the options for this call (or null)
Returns:
a List of posts

userLikes

public List<Post> userLikes()

blogAvatar

public String blogAvatar(String blogName,
                         Integer size)
Get a specific size avatar for a given blog

Parameters:
blogName - the avatar URL of the blog
size - The size requested
Returns:
a string representing the URL of the avatar

blogAvatar

public String blogAvatar(String blogName)

like

public void like(Long postId,
                 String reblogKey)
Like a given post

Parameters:
postId - the ID of the post to like
reblogKey - The reblog key for the post

unlike

public void unlike(Long postId,
                   String reblogKey)
Unlike a given post

Parameters:
postId - the ID of the post to unlike
reblogKey - The reblog key for the post

follow

public void follow(String blogName)
Follow a given blog

Parameters:
blogName - The name of the blog to follow

unfollow

public void unfollow(String blogName)
Unfollow a given blog

Parameters:
blogName - the name of the blog to unfollow

postDelete

public void postDelete(String blogName,
                       Long postId)
Delete a given post

Parameters:
blogName - the name of the blog the post is in
postId - the id of the post to delete

postReblog

public Post postReblog(String blogName,
                       Long postId,
                       String reblogKey,
                       Map<String,?> options)
Reblog a given post

Parameters:
blogName - the name of the blog the post is in
postId - the id of the post
reblogKey - the reblog_key of the post
options - Additional options (or null)

postReblog

public Post postReblog(String blogName,
                       Long postId,
                       String reblogKey)

postEdit

public void postEdit(String blogName,
                     Long id,
                     Map<String,?> detail)
              throws IOException
Save edits for a given post

Parameters:
blogName - The blog name of the post
id - the Post id
detail - The detail to save
Throws:
IOException

postCreate

public Long postCreate(String blogName,
                       Map<String,?> detail)
                throws IOException
Create a post

Parameters:
blogName - The blog name for the post
detail - the detail to save
Throws:
IOException

newPost

public <T extends Post> T newPost(String blogName,
                                  Class<T> klass)
                       throws IllegalAccessException,
                              InstantiationException
Set up a new post of a given type

Parameters:
blogName - the name of the blog for this post (or null)
klass - the type of Post to instantiate
Returns:
the new post with the client set
Throws:
IllegalAccessException
InstantiationException

setRequestBuilder

public void setRequestBuilder(RequestBuilder builder)


Copyright © 2013. All Rights Reserved.