Skip to content

uakihir0/bsky4j

Repository files navigation

If you are using this library on the JVM platform, especially with Kotlin, we recommend that you migrate to kbsky. This library is being migrated to maintenance only.

bsky4j

Java client library for the Bluesky/ATProtocol API. This can compile with google/j2objc to Objective-C library. (for iOS and Mac OS)

How to use

It is available with jitpack.io.

allprojects {
  repositories {
    maven { url 'https://jitpack.io' }
  }
}

dependencies {
  compile 'com.github.uakihir0:bsky4j:x.y.z'
}

CreateSession

Response<ServerCreateSessionResponse> response = BlueskyFactory
        .getInstance(Service.BSKY_SOCIAL.getUri())
        .server().createSession(
                ServerCreateSessionRequest.builder()
                        .identifier("HANDLE")
                        .password("PASSWORD")
                        .build()
        );

String accessJwt = response.get().getAccessJwt();

SendFeed

Response<FeedPostResponse> response = BlueskyFactory
        .getInstance(Service.BSKY_SOCIAL.getUri())
        .feed().post(
                FeedPostRequest.builder()
                        .accessJwt(accessJwt)
                        .text("Hello World!!")
                        .build()
        );

PLC Directory

Response<DIDDetails> response = PLCDirectoryFactory
        .getInstance().getDIDDetails(did);

System.out.println(response.get().getAlsoKnownAs().get(0));

Author

License

This software is released under the MIT License, see LICENSE.txt.