# README
gini-api-go
Go client to interact with Gini's information extraction API. Visit godoc for more implementation details.
Usage example
package giniapi_test
import (
"fmt"
"github.com/dkerwin/gini-api-go"
"log"
"os"
"time"
)
// Very simplistic example. You shoud have a lot more error handling in place
func ExampleNewClient() {
//////////////////////////////////
// Oauth2
//////////////////////////////////
// Setup api connection
api, err := giniapi.NewClient(&giniapi.Config{
ClientID: "MY_CLIENT_ID",
ClientSecret: "********",
Username: "user1",
Password: "secret",
Authentication: giniapi.UseOauth2,
})
if err != nil {
log.Panicf("Gini API login failed: %s", err)
}
// Read a PDF document
document, _ := os.Open("/tmp/invoice.pdf")
// Upload document to gini without doctype hint and user identifier
doc, _ := api.Upload(document, giniapi.UploadOptions{FileName: "invoice.pdf", PollTimeout: 10 * time.Second})
// Get extractions from our uploaded document
extractions, _ := doc.GetExtractions(false)
// Print IBAN
fmt.Printf("IBAN has been found: %s Woohoo!\n", extractions.GetValue("iban"))
//////////////////////////////////
// basic Auth
//////////////////////////////////
// Setup api connection
api, err = giniapi.NewClient(&giniapi.Config{
ClientID: "MY_CLIENT_ID",
ClientSecret: "********",
Authentication: giniapi.UseBasicAuth,
})
if err != nil {
log.Panicf("Gini API login failed: %s", err)
}
// Read a PDF document
document, _ = os.Open("/tmp/invoice.pdf")
// Upload document to gini without doctype hint and user identifier
doc, _ = api.Upload(document, giniapi.UploadOptions{FileName: "invoice.pdf", UserIdentifier: "user123", PollTimeout: 10 * time.Second})
// Get extractions from our uploaded document
extractions, _ = doc.GetExtractions(false)
// Print IBAN
fmt.Printf("IBAN has been found: %s Woohoo!\n", extractions.GetValue("iban"))
}
# Functions
NewClient validates your Config parameters and returns a APIClient object with a matching http client included.
# Constants
VERSION is the API client version.
# Variables
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
Handy vars to simplify the initialization in a new API clients.
Handy vars to simplify the initialization in a new API clients.
# Structs
APIClient is the main interface for the user.
APIError provides additional error information.
No description provided by the author
BasicAuthTransport is a net/http transport that automatically adds a matching authorization header for Gini's basic auth system.
Box struct.
Config to setup Gini API connection.
Document contains all informations about a single document.
DocumentSet is a list of documents with the total count.
Endpoints to access API and Usercenter.
Extraction struct.
Document extractions struct.
No description provided by the author
No description provided by the author
Links contains the links to a documents resources.
ListOptions specify parameters to the List function.
No description provided by the author
Page describes a documents pages.
No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author
SearchOptions specify parameters to the List function.
No description provided by the author
Timing struct.
UploadOptions specify parameters to the Upload function.
No description provided by the author
# Interfaces
APIAuthScheme interface simplifies the addition of new auth mechanisms.