Skip to main content

Java

Java FDK Client Installation Guide

  1. Create a new Maven project or use an existing one. Open the project's pom.xml file and add the following dependency to the <dependencies> section:

    <dependency>
    <groupId>com.github.gofynd</groupId>
    <artifactId>fdk-client-java</artifactId>
    <version>v1.0.6</version>
    </dependency>

    Make sure to check the available version list on jitpack and use the appropriate version number.

  1. Add the Jitpack repository to your project's pom.xml file. Place the following code snippet at the end of the <repositories> section:

    <repositories>
    <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
    </repository>
    </repositories>
  2. Now you can start integrating the Java FDK Clients into your app. Below are two sample usage scenarios demonstrating how to use the ApplicationClient and PlatformClient classes.

Sample Usage - ApplicationClient

ApplicationConfig applicationConfig = null;
try {
applicationConfig = new ApplicationConfig(
"YOUR_APPLICATION_ID",
"YOUR_APPLICATION_TOKEN"
);
if(Objects.nonNull(applicationConfig)) {
ApplicationClient applicationClient = new ApplicationClient(applicationConfig);
return applicationClient.catalog.getProductDetailBySlug("product-slug");
}
} catch (Exception e) {
System.out.println(e.getMessage());
}

Sample Usage - PlatformClient

PlatformConfig platformConfig = null;
try {
platformConfig = new PlatformConfig(
"COMPANY_ID",
"API_KEY",
"API_SECRET",
"DOMAIN"
);
if(Objects.nonNull(platformConfig)) {
PlatformClient platformClient = new PlatformClient(platformConfig);
return platformClient.catalog.getCompanyDetail("COMPANY_ID");
}
} catch (Exception e) {
System.out.println(e.getMessage());
}