All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.fullcontact.apilib.enrich.Example Maven / Gradle / Ivy

There is a newer version: 4.0.0
Show newest version
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());
    }
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy