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

com.sixestates.example.FAASExample Maven / Gradle / Ivy

Go to download

A Java SDK for communicating with the 6Estates Intelligent Document Processing(IDP) Platform

There is a newer version: 8.2.3
Show newest version
package com.sixestates.example;


import com.sixestates.Idp;
import com.sixestates.exception.ApiConnectionException;
import com.sixestates.exception.ApiException;
import com.sixestates.rest.v1.FAASSubmitter;
import com.sixestates.rest.v1.ResultExtractor;
import com.sixestates.type.FAASTaskInfo;
import com.sixestates.type.TaskDTO;
import com.sixestates.utils.Lists;

import java.io.File;

public class FAASExample {

    public static final String TOKEN = "XXXXXXX";
    public static final String FILE_PATH = "/Users/6e/Downloads/CBKS.pdf" ;

    /**
     * Example FAAS usage.
     *
     * @param  args command line args
     * @throws Exception if unable to generate InterruptedException or ApiException
     */
    public static void main(String[] args) throws Exception {

        Idp.init(TOKEN);

        // Submit a task
        TaskDTO taskDto = null;
        try {
            FAASTaskInfo taskInfo = FAASTaskInfo.builder()
                    .files(Lists.newArrayList(new File(FILE_PATH)))
                    .customerType("2")
                    .informationType(0)
                    .build();
            taskDto = FAASSubmitter.submitFAASTask(taskInfo);

            System.out.println("taskId: " + taskDto.getData());
        }catch (final ApiException | ApiConnectionException e) {
            System.err.println(e);
        }

        // Extract the result
        if(taskDto != null && taskDto.getStatus() == 200) {

            try {
                System.out.println(ResultExtractor.extractResultByTaskid(taskDto.getData()));
            }catch (ApiException e) {
                System.err.println(e);
            }
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy