com.fullcontact.apilib.enrich.Example Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java8 Show documentation
Show all versions of java8 Show documentation
Client libraries for FullContact v3 APIs
package com.fullcontact.apilib.enrich;
import com.fullcontact.apilib.FullContactException;
import com.fullcontact.apilib.auth.CredentialsProvider;
import com.fullcontact.apilib.auth.StaticApiKeyCredentialProvider;
import com.fullcontact.apilib.models.Request.PersonRequest;
import com.fullcontact.apilib.models.Request.ResolveRequest;
import com.fullcontact.apilib.models.Response.ResolveResponse;
import java.util.concurrent.CompletableFuture;
public class Example {
public static void main(String[] args) {
try {
CredentialsProvider staticCredentialsProvider =
new StaticApiKeyCredentialProvider("0zhzXUjQb8w6qUhuPPRTiloBb6njDhr8");
// Building FullContact client
FullContact fcClient =
FullContact.builder().credentialsProvider(staticCredentialsProvider).build();
// Person Enrich: Request Build
ResolveRequest resolveRequest =
FullContact.buildResolveRequest()
.email("[email protected]")
.recordId("customer123")
.build();
CompletableFuture mapResponse = fcClient.identityMap(resolveRequest);
mapResponse.thenAccept(
response -> {
System.out.println("map " + response.toString());
});
Thread.sleep(3000);
CompletableFuture resolveResponse = fcClient.identityResolve(resolveRequest);
resolveResponse.thenAccept(
response -> {
System.out.println("resolve " + response.toString());
});
Thread.sleep(3000);
CompletableFuture deleteResponse = fcClient.identityDelete(resolveRequest);
deleteResponse.thenAccept(
response -> {
System.out.println("delete " + response.toString());
});
Thread.sleep(3000);
mapResponse.join();
resolveResponse.join();
deleteResponse.join();
fcClient.close();
} catch (FullContactException | InterruptedException e) {
e.printStackTrace();
System.out.println(e.getMessage());
}
}
}