A Golang SDK for communicating with the 6Estates Intelligent Document Processing(IDP) Platform.
The documentation for the 6Estates IDP API can be found via https://idp-sea.6estates.com/docs
go get github.com/6estates/idp-golang/idp_sdk
6E API Access Token(Deprecated)
package main
import "github.com/6estates/idp-golang/idp_sdk"
func main(){
c:=idp_sdk.NewClient("your-token","your-region")
}
6E API Authorization based on oauth 2.0
package main
import "github.com/6estates/idp-golang/idp_sdk"
import "fmt"
func main(){
ret, err :=idp_sdk.OauthUtil("your-authorization","your-region")
if err != nil {
fmt.Println(err)
return
}
oauth:=ret["data"].(map[string]interface{})["value"].(string)
isOauth:=true
c:=idp_sdk.NewClient(oauth, "your-region", isOauth)
}
If you just need to do one file at a time
package main
import "github.com/6estates/idp-golang/idp_sdk"
import "fmt"
func main(){
c:=idp_sdk.NewClient("your-token","your-region")
params:=map[string]string{"fileType":"type-of-the-file"}
result,err:=c.RunSimpleTask(params,"path-to-the-file")
if err!=nil{
fmt.Println(err)
}
fmt.Println(result)
}
If you need to do a batch of files
package main
import "github.com/6estates/idp-golang/idp_sdk"
import "fmt"
func main(){
c:=idp_sdk.NewClient("your-token","your-region")
params:=map[string]string{"fileType":"type-of-the-file"}
task,err:=c.CreateTask(params,"path-to-the-file")
if err!=nil{
fmt.Println(err)
}
fmt.Println(c.Poll(task))
}