Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/giautm/vvn-go
https://github.com/giautm/vvn-go
Last synced: 3 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/giautm/vvn-go
- Owner: giautm
- License: apache-2.0
- Created: 2022-06-23T20:23:26.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-11-07T07:29:33.000Z (about 2 years ago)
- Last Synced: 2024-10-13T07:44:33.611Z (about 1 month ago)
- Language: Go
- Size: 218 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# vvn-go
> Unofficial client for VVN AI EKYC
This package uses [ogen](https://github.com/ogen-go/ogen) to generate the client from the VVN AI APIs specification.
Install:
```
go get -u giautm.dev/vvn@main
```See the example from test:
```go
package vvn_testimport (
"context"
"os"
"testing""giautm.dev/vvn"
"giautm.dev/vvn/api"
"github.com/google/uuid"
"github.com/ogen-go/ogen/http"
"github.com/stretchr/testify/require"
)func TestNewOCRRecognition_integration(t *testing.T) {
apiKey := os.Getenv("VVN_API_KEY")
if apiKey == "" {
t.Skip("VVN_API_KEY is not set")
}
documentFile := os.Getenv("VVN_DOCUMENT_FILE")
if documentFile == "" {
t.Skip("VVN_DOCUMENT_FILE is not set")
}r := require.New(t)
c, err := api.NewClient(vvn.ServerProduction, vvn.StaticKey(apiKey))
r.NoError(err)f, err := os.OpenFile(documentFile, os.O_RDONLY, 0666)
r.NoError(err)res, err := c.NewOCRRecognition(context.Background(), api.OCRInputForm{
RequestID: uuid.NewString(),
Image: http.MultipartFile{
Name: "random_name_abc.jpeg",
File: f,
},
IDFullThr: api.NewOptFloat32(0.8),
})
r.NoError(err)result, ok := res.(*api.OCRResult)
r.Equal(ok, true)
r.NotEmpty(result.ID.Value)
r.Equal(result.IDCheck.Value, api.OCRResultIDCheckREAL)
}
```