Pikmail
DEPRECATED
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.
Libraries
This project uses the following libraries internally to work.
Development libraries
- 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.
Testing libraries
- Spek Used to write some integration tests as specs.
Usage
Dependency
repositories {
...
maven { url 'https://jitpack.io' }
...
}
dependencies {
...
implementation "com.github.epool:pikmail:1.0.0"
...
}Blocking
Use it when blocking is safe to use like on web servers.
Java
Profile profile = Pikmail.getProfile("eduardo.alejandro.pool.ake@gmail.com").blockingGet();
profile.getProfilePictureUrl();
profile.resizeProfilePictureUrl(500);
profile.getNickname();
// OR
Pikmail.getProfilePictureUrl("eduardo.alejandro.pool.ake@gmail.com", null).blockingGet();
Pikmail.getProfilePictureUrl("eduardo.alejandro.pool.ake@gmail.com", 500).blockingGet();
Pikmail.getProfileNickname("eduardo.alejandro.pool.ake@gmail.com").blockingGet();Kotlin
val profile = Pikmail.getProfile("eduardo.alejandro.pool.ake@gmail.com").blockingGet()
profile.profilePictureUrl
profile.resizeProfilePictureUrl(500)
profile.nickname
// OR
Pikmail.getProfilePictureUrl(email).blockingGet()
Pikmail.getProfilePictureUrl(email, 500).blockingGet()
Pikmail.getProfileNickname(email).blockingGet()Async
Use it when blocking is not safe to use like on Android main thread.
Java
Pikmail.getProfile("eduardo.alejandro.pool.ake@gmail.com")
.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());
}
}
);Kotlin
Pikmail.getProfile("eduardo.alejandro.pool.ake@gmail.com")
.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.