Skip to content

sypht-team/sypht-kotlin-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Sypht Kotlin Client

This repository is a Kotlin reference client implementation for working with the Sypht API. Docs

About Sypht

Sypht is a SaaS API which extracts key fields from documents. For example, you can upload an image or pdf of a bill or invoice and extract the amount due, due date, invoice number and biller information.

Getting started

To get started you'll need API credentials, i.e. a <client_id> and <client_secret>, which can be obtained by registering for an account

Prerequisites

  • Install Java 8 JDK or upward
brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8
brew install kotlin

Installation

Sypht Kotlin Client is available on maven central

Maven

<dependency>
  <groupId>com.sypht</groupId>
  <artifactId>sypht-kotlin-client</artifactId>
  <version>1.0</version>
</dependency>

Gradle

// https://mvnrepository.com/artifact/com.sypht/sypht-kotlin-client
compile group: 'com.sypht', name: 'sypht-kotlin-client', version: '1.0'

Usage

Populate these system environment variables with the credentials generated above:

SYPHT_API_KEY="<client_id>:<client_secret>"

or

OAUTH_CLIENT_ID="<client_id>"
OAUTH_CLIENT_SECRET="<client_secret>"

You can also set the Http Request Timeout using the optional property:

REQUEST_TIMEOUT="<value_in_seconds>"

then invoke the client with a file of your choice:

val client = SyphtClient()
        println(
                client.result(
                        client.upload(
                                File("receipt.pdf"))))

Testing

Open pom.xml and add the below line inside <environmentVariables> </environmentVariables> with the credentials generated above:

<OAUTH_CLIENT_ID>client_id</OAUTH_CLIENT_ID>
<OAUTH_CLIENT_SECRET>client_secret</OAUTH_CLIENT_SECRET>
<SYPHT_API_KEY>client_id:client_secret</SYPHT_API_KEY>

then run

mvn test

License

The software in this repository is available as open source under the terms of the Apache License.

Code of Conduct

Everyone interacting in the project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.