Golang wrapper for NADRA's Nishan APIs.
go get -u github.com/IamFaizanKhalid/nishan-go
package main
import (
"fmt"
"github.com/IamFaizanKhalid/nishan-go"
"github.com/IamFaizanKhalid/nishan-go/errors"
)
func main() {
api, err := nishan.NewClient("your_company", "your_api_key")
if err != nil {
panic(err)
}
response := api.KnowYourCustomer(nishan.Request{
CitizenNo: "1234567890124",
Fingerprint: "/9j/4AAQSkZJRgABAQEAYABgAAD/2wBDAA...",
FingerIndex: 6,
})
if response.ErrCode != errors.Nil {
switch response.ErrCode {
case errors.FingerprintMismatch:
panic("fingerprint didn't match")
case errors.FingerIndexUnavailable:
panic(fmt.Sprintf("data available only for following finger indexes: %v", response.FingerList))
default:
panic(response.ErrMessage)
}
}
fmt.Printf("Welcome %s %s!", response.PersonalData.Name, response.PersonalData.FatherName)
}
© 2023-time.Now() Faizan Khalid
Released under the MIT License