Documentation ¶
Overview ¶
Package glair provides common objects that can be used across all GLAIR Vision Go SDK packages
This package serves as the entrypoint to interact with the GLAIR Vision SDK
Index ¶
- func Int(num int) *int
- func String(str string) *string
- type ActiveLivenessInput
- type BPKBInput
- type BasicVerificationInput
- type Config
- func (c *Config) GetEndpointURL(service string, endpoint string) string
- func (c *Config) WithBaseURL(url string) *Config
- func (c *Config) WithClient(client HTTPClient) *Config
- func (c *Config) WithCredentials(username string, password string, apiKey string) *Config
- func (c *Config) WithLogger(logger Logger) *Config
- func (c *Config) WithVersion(version string) *Config
- type Error
- type ErrorCode
- type FaceMatchingInput
- type FaceVerificationInput
- type HTTPClient
- type LeveledLogger
- type LogLevel
- type Logger
- type OCRInput
- type PassiveLivenessInput
- type Response
- type Session
- type SessionsInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActiveLivenessInput ¶
type ActiveLivenessInput struct { // RequestID represents request identifier for debugging purposes RequestID string // Image represents the input image that will be processed by GLAIR // Vision Face Matching API. // // Image must be provided as a string that represents a path to the // image or an object that implements *os.Image Image interface{} // GestureCode represents gesture idenfification code that will // be used to determine which gesture should be used to detect // liveness from the image. // // Please refer to https://docs.glair.ai/vision/active-liveness // for the list of all supported gesture codes GestureCode string }
ActiveLivenessInput stores parameters for active liveness requests
type BPKBInput ¶
type BPKBInput struct { // RequestID represents request identifier for debugging purposes RequestID string // Image represents the input image that will be processed by GLAIR // Vision OCR API. // // Image must be provided as a string that represents a path to the // image or an object that implements *os.Image Image interface{} // Page represents specific page number to be read from the BPKB // image file. If this argument is omitted, the API will read // all pages. // // Page is optional Page *int }
BPKBInput stores parameters for BPKB requests
type BasicVerificationInput ¶
type BasicVerificationInput struct { // RequestID represents request identifier for debugging purposes RequestID string // Nik represents single identification number of the // person to be verified Nik string // Name represents the name of the person to be verified // // Name is optional Name *string // DateOfBirth represents date of birth of the person to // be verified // // DateOfBirth must be provided as a time.Time instance // or as a string in dd-mm-yyyy format // // DateOfBirth is optional DateOfBirth interface{} // NoKk represents family registration number of the person // // NoKk is optional NoKk *string // MotherMaidenName represents identity holder's mother // maiden name // // MotherMaidenName is optional MotherMaidenName *string // PlaceOfBirth represents place of birth of the identity holder // in their KTP // // PlaceOfBirth is optional PlaceOfBirth *string // Address represents address of the identity holder // in their KTP // // Address is optional Address *string // Gender represents gender of the identity holder // in their KTP // // Gender is optional Gender *string // MaritalStatus represents marital status of the identity holder // in their KTP // // MaritalStatus is optional MaritalStatus *string // JobType represents job of the identity holder // in their KTP // // JobType is optional JobType *string // Province represents the province of residence of the identity holder // in their KTP // // Province is optional Province *string // City represents the city of residence of the identity holder // in their KTP // // City is optional City *string // District represents the district of residence of the identity holder // in their KTP // // District is optional District *string // Subdistrict represents the subdistrict of residence of the identity holder // in their KTP // // Subdistrict is optional Subdistrict *string // Rt represents the RT of residence of the identity holder // in their KTP // // Rt is optional Rt *string // Rw represents the RW of residence of the identity holder // in their KTP // // Rw is optional Rw *string }
BasicVerificationInput stores parameters for basic identity verification request
type Config ¶
type Config struct { // Username represents username to be used for basic authentication // with GLAIR Vision API Username string // Password represents password to be used for basic authentication // with GLAIR Vision API Password string // API key represents API key to be used for authentication // with GLAIR Vision API ApiKey string // BaseUrl represents base URL path for GLAIR Vision API // endpoints. Defaults to "https://api.vision.glair.ai" BaseUrl string // ApiVersion represents GLAIR Vision API version to // be called. Defaults to "v1" ApiVersion string // Client represents the HTTP client that is used // to call the HTTP endpoints of GLAIR Vision API. // Defaults to the default HTTP client of Go Client HTTPClient // Logger represents the logger to be used by // GLAIR Vision Go SDK to log necessary informations. // Defaults to no log Logger Logger }
Config provides configuration for a client instance, including credentials and API configuration such as base URL and API version.
func NewConfig ¶
NewConfig creates a new configuration object with default values for base URL and API Version.
func (*Config) GetEndpointURL ¶
GetEndpointURL creates service URL with base URL and API version
func (*Config) WithBaseURL ¶
WithBaseURL sets base API URL for the configuration object
func (*Config) WithClient ¶
func (c *Config) WithClient(client HTTPClient) *Config
WithClient sets HTTP client for the configuration object that will be used for calling GLAIR Vision API endpoints
func (*Config) WithCredentials ¶
WithCredentials sets user credentials for the configuration object
func (*Config) WithLogger ¶
WithLogger sets the logger to be used by client instances
func (*Config) WithVersion ¶
WithVersion sets API version for the configuration object
type Error ¶
type Error struct { // Code represents unique code to quickly distinguish errors from // GLAIR Vision SDK Code ErrorCode // Message represents human-readable error object related // to the error Message string // Err is the original error object that is returned by the SDK Err error // Response represents response returned by GLAIR Vision API // if response is available Response Response }
Error is an extended error object used by GLAIR Vision SDK
Whenever error is returned, it is recommended to assert the error to this type
type ErrorCode ¶
type ErrorCode string
ErrorCode is unique code to quickly distinguish errors from GLAIR Vision SDK
const ( // ErrorCodeFileError is returned when the SDK fails // to read or parse the given input file ErrorCodeFileError ErrorCode = "FILE_ERROR" // ErrorCodeNetworkError is returned when the SDK is unable to // complete the HTTP request to GLAIR Vision API with the given // HTTP client ErrorCodeNetworkError ErrorCode = "NETWORK_ERROR" // ErrorCodeTimeout is returned when the HTTP request sent // by the SDK has timed out // // To solve this problem, you can increase the timeout // value from the context or remove the timeout entirely ErrorCodeTimeout ErrorCode = "TIMEOUT" // ErrorCodeForbidden is returned when the provided credentials // have insufficient access rights to the requested endpoint // // If you think this is a mistake, please contact us ErrorCodeForbidden ErrorCode = "FORBIDDEN" // ErrorCodeAPIError is returned when GLAIR Vision API // returns a non-OK response. In this case, please // check the Body property for more details on the error ErrorCodeAPIError ErrorCode = "API_ERROR" // ErrorCodeInvalidResponse is returned when GLAIR Vision API // returns an unexpected response // // Generally, this error is impossible to be returned. // If you encounter this error, please contact us ErrorCodeInvalidResponse ErrorCode = "INVALID_RESPONSE" )
type FaceMatchingInput ¶
type FaceMatchingInput struct { // RequestID represents request identifier for debugging purposes RequestID string // StoredImage represents the stored image that will be used // as a base for face matching // // StoredImage must be provided as a string that represents a path to the // image or an object that implements *os.File StoredImage interface{} // CapturedImage represents the captured image that will be compared // to the stored image. // // CapturedImage must be provided as a string that represents a path to the // image or an object that implements *os.File CapturedImage interface{} }
OCRInput stores parameters for Face Matching request
type FaceVerificationInput ¶
type FaceVerificationInput struct { // RequestID represents request identifier for debugging purposes RequestID string // Nik represents single identification number of the // person to be verified Nik string // FaceImage represents the input image that will be used // to verify the identity of the identity card // // FaceImage must be provided as a string that represents a path to the // image or an object that implements *os.File FaceImage interface{} // Name represents the name of the person to be verified Name string // DateOfBirth represents date of birth of the person to // be verified // // DateOfBirth must be provided as a string with dd-mm-yyyy // format or as an instance of *time.Time DateOfBirth interface{} }
FaceVerificationInput stores parameters for identity verification request with face
type HTTPClient ¶
HTTPClient is an interface that users can implement to customize HTTP calls behavior when interacting with GLAIR Vision API
type LeveledLogger ¶
type LeveledLogger struct {
Level LogLevel
}
LeveledLogger represents logger instance that will be used by GLAIR Vision Go SDK
func (*LeveledLogger) Debugf ¶
func (l *LeveledLogger) Debugf(format string, val ...interface{})
func (*LeveledLogger) Errorf ¶
func (l *LeveledLogger) Errorf(format string, val ...interface{})
func (*LeveledLogger) Infof ¶
func (l *LeveledLogger) Infof(format string, val ...interface{})
func (*LeveledLogger) Warnf ¶
func (l *LeveledLogger) Warnf(format string, val ...interface{})
type LogLevel ¶
type LogLevel int
LogLevel represents logging level of GLAIR Vision SDK
const ( // LevelNone sets the logger to disables logging entirely LevelNone LogLevel = 0 // LevelError sets the logger to show only error messages LevelError LogLevel = 1 // LevelWarn sets the logger to show warning and error messages LevelWarn LogLevel = 2 // LevelInfo sets the logger to show information, warning, and error messages LevelInfo LogLevel = 3 // LevelDebug sets the logger to display any messages, including debugging statements LevelDebug LogLevel = 4 )
type Logger ¶
type Logger interface { // Debugf prints debug message with the provided format to stdout Debugf(format string, val ...interface{}) // Infof prints informational message with the provided format to stdout Infof(format string, val ...interface{}) // Warnf prints warning message with the provided format to stdout Warnf(format string, val ...interface{}) // Errorf prints error message with the provided format to stderr Errorf(format string, val ...interface{}) }
Logger represents base contract for logging functionalities
type OCRInput ¶
type OCRInput struct { // RequestID represents request identifier for debugging purposes RequestID string // Image represents the input image that will be processed by GLAIR // Vision OCR API. // // Image must be provided as a string that represents a path to the // image or an object that implements *os.Image Image interface{} }
OCRInput stores parameters for OCR requests
type PassiveLivenessInput ¶
type PassiveLivenessInput struct { // RequestID represents request identifier for debugging purposes RequestID string // Image represents the input image that will be processed by GLAIR // Vision Face Matching API. // // Image must be provided as a string that represents a path to the // image or an object that implements *os.Image Image interface{} }
PassiveLivenessInput stores parameters for passive liveness requests
type Response ¶
type Response struct { Status int `json:"status,omitempty"` Body map[string]interface{} `json:"body"` }
Response represents the response returned by GLAIR Vision API if request returned an error
type Session ¶
type Session struct { Status string `json:"status"` SuccessURL string `json:"success_url"` CancelURL string `json:"cancel_url"` URL string `json:"url"` }
Session stores session data from any GLAIR Vision session requests
type SessionsInput ¶
type SessionsInput struct { // SuccessURL represents redirection URL // when the session is concluded successfully // // SuccessURL is required SuccessURL string // CancelURL represents redirection URL // when user presses the back button during // the session or the session encountered an // error when processing the request // // CancelURL is optional CancelURL *string }
SessionsInput stores sessions request input
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package client provides API client that can be used to interact with GLAIR Vision products
|
Package client provides API client that can be used to interact with GLAIR Vision products |
examples
|
|
Package face is a collection of functions and objects that interacts with GLAIR Vision Face Biometrics API and its results
|
Package face is a collection of functions and objects that interacts with GLAIR Vision Face Biometrics API and its results |
Package identity is a collection of functions and objects that interacts with GLAIR Vision identity verification API and its results
|
Package identity is a collection of functions and objects that interacts with GLAIR Vision identity verification API and its results |
Package ocr is a collection of functions and objects that interacts with GLAIR Vision OCR products and its results
|
Package ocr is a collection of functions and objects that interacts with GLAIR Vision OCR products and its results |