Step 1. Add the JitPack repository to your build file
Add it in your root settings.gradle at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url 'https://jitpack.io' }
}
}
Add it in your settings.gradle.kts at the end of repositories:
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
mavenCentral()
maven { url = uri("https://jitpack.io") }
}
}
Add to pom.xml
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add it in your build.sbt at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add it in your project.clj at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Step 2. Add the dependency
dependencies {
implementation 'com.github.epool:pikmail:1.0.2'
}
dependencies {
implementation("com.github.epool:pikmail:1.0.2")
}
<dependency>
<groupId>com.github.epool</groupId>
<artifactId>pikmail</artifactId>
<version>1.0.2</version>
</dependency>
libraryDependencies += "com.github.epool" % "pikmail" % "1.0.2"
:dependencies [[com.github.epool/pikmail "1.0.2"]]
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.
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("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();
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()
Use it when blocking is not safe to use like on Android main thread.
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());
}
}
);
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.