veriff

package module
v0.7.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2024 License: BSD-3-Clause Imports: 11 Imported by: 0

README

veriff-api-client-go

Go Reference Go Report Card Maintainability Test Coverage

Veriff API Client for Go

Installation

go get github.com/brokeyourbike/veriff-api-client-go

Usage

client := veriff.NewClient("veriff.com", "token")
client.CreateSession(context.TODO(), veriff.CreateSessionPayload{})

Authors

License

BSD-3-Clause License

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewClient

func NewClient(baseURL, token, secret string, options ...ClientOption) *client

func NewRequest

func NewRequest(r *http.Request) *request

func SignPayload added in v0.5.0

func SignPayload(secret, payload string) string

Types

type Client

type Client interface {
	CreateSession(ctx context.Context, payload CreateSessionPayload) (CreateSessionResponse, error)
	SessionDecision(ctx context.Context, sessionID string) (SessionDecisionResponse, error)
	SessionMedia(ctx context.Context, sessionID string) (SessionMediaResponse, error)
	DownloadMedia(ctx context.Context, mediaID string, dst io.Writer) error
}

type ClientOption

type ClientOption func(*client)

ClientOption is a function that configures a Client.

func WithHTTPClient

func WithHTTPClient(c HttpClient) ClientOption

WithHTTPClient sets the HTTP client for the paystack API client.

func WithLogger

func WithLogger(l *logrus.Logger) ClientOption

WithLogger sets the *logrus.Logger for the paystack API client.

type CreateSessionPayload

type CreateSessionPayload struct {
	Verification struct {
		Person struct {
			FirstName   string `json:"firstName,omitempty"`
			LastName    string `json:"lastName,omitempty"`
			DateOfBirth string `json:"dateOfBirth,omitempty"`
			Gender      string `json:"gender,omitempty"`
		} `json:"person"`
		Callback   string `json:"callback,omitempty"`
		VendorData string `json:"vendorData"`
	} `json:"verification"`
}

type CreateSessionResponse

type CreateSessionResponse struct {
	Status       string `json:"status"`
	Verification struct {
		ID           string `json:"id"`
		URL          string `json:"url"`
		VendorData   string `json:"vendorData"`
		Host         string `json:"host"`
		Status       string `json:"status"`
		SessionToken string `json:"sessionToken"`
	} `json:"verification"`
}

type HttpClient

type HttpClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type SessionDecisionResponse added in v0.4.0

type SessionDecisionResponse struct {
	Status       string `json:"status"`
	Verification struct {
		ID     string `json:"id"`
		Code   int    `json:"code"`
		Status string `json:"status"`
		Person struct {
			FirstName   string `json:"firstName"`
			LastName    string `json:"lastName"`
			DateOfBirth *Time  `json:"dateOfBirth"`
			Nationality string `json:"nationality"`
		} `json:"person"`
		Document struct {
			Type       string `json:"type"`
			Number     string `json:"number"`
			Remarks    string `json:"remarks"`
			Country    string `json:"country"`
			State      string `json:"state"`
			ValidFrom  *Time  `json:"validFrom"`
			ValidUntil *Time  `json:"validUntil"`
		} `json:"document"`
	} `json:"verification"`
}

type SessionMediaResponse added in v0.4.0

type SessionMediaResponse struct {
	Status string `json:"status"`
	Videos []struct {
		ID        string  `json:"id"`
		SessionID string  `json:"sessionId"`
		Context   string  `json:"context"`
		Duration  float64 `json:"duration"`
		Mimetype  string  `json:"mimetype"`
		Name      string  `json:"name"`
		Size      int64   `json:"size"`
		URL       string  `json:"url"`
	} `json:"videos"`
	Images []struct {
		ID        string `json:"id"`
		SessionID string `json:"sessionId"`
		Context   string `json:"context"`
		Mimetype  string `json:"mimetype"`
		Name      string `json:"name"`
		URL       string `json:"url"`
		Size      int64  `json:"size"`
	} `json:"images"`
}

type Time added in v0.4.0

type Time struct {
	time.Time
}

func (*Time) UnmarshalJSON added in v0.4.0

func (t *Time) UnmarshalJSON(b []byte) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL