UPDATE: Since this API was fully based on the Picasa API and that API has been depreated, Therefore this API is being deprecated too unless we found a workaround to this.
This API is being deprecated and will be turned down in January 2019. Migrate to Google Photos Library API as soon as possible to avoid disruptions to your application.
Info Here
================================================================================
This is a utility written in Kotlin that consumes one public picasa endpoint to fetch the google profile picture for the email along with the nickname.
You can read this blog post to know how Pikmail Api works intenally.
This project uses the following libraries internally to work.
- Retrofit used to consume the Picasa api.
- Retrofit Gson Converter converter to deserialize JSON responses from the picasa api.
- RxJava2 async requests.
- Okhttp Logging Interceptor for logging http requests/responses for the Picasa api.
- Spek Used to write some integration tests as specs.
repositories {
...
maven { url 'https://jitpack.io' }
...
}
dependencies {
...
implementation "com.github.epool:pikmail:1.0.0"
...
}
Use it when blocking is safe to use like on web servers.
Profile profile = Pikmail.getProfile("[email protected]").blockingGet();
profile.getProfilePictureUrl();
profile.resizeProfilePictureUrl(500);
profile.getNickname();
// OR
Pikmail.getProfilePictureUrl("[email protected]", null).blockingGet();
Pikmail.getProfilePictureUrl("[email protected]", 500).blockingGet();
Pikmail.getProfileNickname("[email protected]").blockingGet();
val profile = Pikmail.getProfile("[email protected]").blockingGet()
profile.profilePictureUrl
profile.resizeProfilePictureUrl(500)
profile.nickname
// OR
Pikmail.getProfilePictureUrl(email).blockingGet()
Pikmail.getProfilePictureUrl(email, 500).blockingGet()
Pikmail.getProfileNickname(email).blockingGet()
Use it when blocking is not safe to use like on Android main thread.
Pikmail.getProfile("[email protected]")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread()) // In case you are using it on Android or use any other scheduler you need
.subscribe(
new Consumer<Profile>() {
@Override
public void accept(Profile profile) throws Exception {
System.out.println(profile.toString());
}
},
new Consumer<Throwable>() {
@Override
public void accept(Throwable throwable) throws Exception {
System.out.println(throwable.getCause().toString());
}
}
);
Pikmail.getProfile("[email protected]")
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(
{ println(it.toString()) },
{ println(it.cause.toString()) }
)
NOTE: If the profile is not found or if the gmail address is invalid you will receive a ProfileNotFountException. You could take a look on the integrations tests here to get a better idea about how to use the Pikmail api.