jumblr

Tumblr API v2 Java Client

  • 所有者: tumblr/jumblr
  • 平台:
  • 许可证: Apache License 2.0
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Jumblr.

Build Status

A pleasant and complete Java wrapper for the Tumblr V2 API.

Example

// Create a new client
JumblrClient client = new JumblrClient("consumer_key", "consumer_secret");
client.setToken("oauth_token", "oauth_token_secret");

// Write the user's name
User user = client.user();
System.out.println(user.getName());

// And list their blogs
for (Blog blog : user.getBlogs()) {
	System.out.println("\t" + blog.getTitle());
}

// Like the most recent "lol" tag
client.tagged("lol").get(0).like();

Basic Usage

User

Information about the authenticating user

User user = client.user();
System.out.println(user.getName());

What blogs the user is following

List<Blog> blogs = client.userFollowing();
for (Blog blog : blogs) {
	System.out.println(blog.getTitle());
}

Dashboard posts for the user?

List<Post> posts = client.userDashboard();

Or the things we like:

List<Post> posts = client.userLikes();

Blog

Get information about a given blog

Blog blog = client.blogInfo("seejohnrun.tumblr.com");
blog.getTitle();

And then you can use either the client approach, or make calls on the blog.
These two are equivelant:

List<User> users = client.blogFollowers();
List<User> users = blog.followers();

Same with likes, etc:

// All return List<Post>
blog.posts();
blog.queuedPosts();
blog.draftPosts();
blog.submissions();

It's easy to get get the avatar of a blog too:

blog.avatar(); // String

And follow/unfollow blogs:

blog.follow();
blog.unfollow();

Post

Again:

post.like();
post.unlike();

// or
client.postLike(postId, reblogKey);
client.postUnlike(postId, reblogKey);

Maybe you want to delete a post, or reblog it?

// Delete
post.delete();

// Reblog
post.reblog();

And editing posts is equally easy:

post.setTitle("hello");
post.save();

// or if you like..
Map<String, String> detail = new HashMap<String, String>();
detail.put("title", "hello");
client.postEdit(blogName, postId, detail);

Just as easy as creating them:

QuotePost post = client.newPost(blogName, QuotePost.class);
post.setQuote("hello world");
post.save();

// or if you like...
Map<String, String> detail = new HashMap<String, String>();
detail.put("quote", "hello world");
detail.put("type", "quote");
client.postCreate(blogName, detail);

Tagged

All of the posts tagged a given thing:

for (Post post : client.tagged("lol")) {
  post.getId();
}

Pagination

Pagination and additional options are on most calls, and you can just pass them
to the overloaded form:

Map<String, Integer> options = new HashMap<String, Integer>();
options.put("limit", 2);
options.put("offset", 5);
List<Post> posts = blog.posts(options);

Errors

Any connection errors will raise a JumblrException, which you can get more
information from:

catch (JumblrException ex) {
	System.out.println("(" + ex.getResponseCode().toString() + ") " + ex.getMessage());
}

Gradle

compile 'com.tumblr:jumblr:0.0.13'

Maven

<dependency>
  <groupId>com.tumblr</groupId>
  <artifactId>jumblr</artifactId>
  <version>0.0.13</version>
</dependency>

Runnings Tests

mvn test

More detail?

Pop out that JavaDoc - full documentation awaits.

Or you can use our hosted copy at:
http://tumblr.github.io/jumblr/javadoc/

Also see the documentation for the
Tumblr API itself.

Builds

We supply some JAR builds you can use if you're not a fan of mvn.
You can grab them with (or without) dependencies from
the project page.

Reporting issues

Please refer to the GitHub issue tracker at:
https://github.com/tumblr/jumblr/issues

Copyright 2015 Tumblr, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not
use this work except in compliance with the License. You may obtain a copy of
the License in the LICENSE file, or at:

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
License for the specific language governing permissions and limitations.

主要指标

概览
名称与所有者tumblr/jumblr
主编程语言Java
编程语言Java (语言数: 1)
平台
许可证Apache License 2.0
所有者活动
创建于2013-02-19 15:39:24
推送于2019-05-01 16:12:48
最后一次提交2018-10-25 01:24:44
发布数14
最新版本名称jumblr-0.0.13 (发布于 )
第一版名称jumblr-0.0.1 (发布于 2013-05-06 15:29:04)
用户参与
星数274
关注者数56
派生数107
提交数238
已启用问题?
问题数85
打开的问题数35
拉请求数31
打开的拉请求数10
关闭的拉请求数5
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?