Awesome
mastodon4j
Java library for the Mastodon API. It's from hecateball/mastodon4j. This can complie with google/j2objc to Objective-C library. (for iOS and Mac OS)
It also supports PixelFed and Pleroma, which are built similarly to the Mastodon API. (However, you need to specify the service at the time of instantiation because some processes are different for each service.)
How to use
It is available with jitpack.io.
allprojects {
repositories {
maven { url 'https://jitpack.io' }
}
}
dependencies {
compile 'com.github.uakihir0:mastodon4j:0.2'
}
VerifyCredentials
Get user object for the authenticated account.
// Make Mastodon instance.
Mastodon mastodon = MastodonFactory.getInstance(
Service.MASTODON,
MastodonHost,
AccessToken
);
// Request
Response<Account> me = mastodon.verifyCredentials();
// Print user's name
System.out.println(me.get().getDisplayName());
to use more functions, please see Mastodon.java.
License
This software is released under the MIT License, see LICENSE.txt.