/go-onfido

Golang client for the Onfido API

Primary LanguageShell

Go API client for openapi

The Onfido API (v3.6)

Overview

This API client was generated by the OpenAPI Generator project. By using the OpenAPI-spec from a remote server, you can easily generate an API client.

  • API version: v3.6
  • Package version: 1.0.0
  • Generator version: 7.9.0-SNAPSHOT
  • Build package: org.openapitools.codegen.languages.GoClientCodegen For more information, please visit https://public.support.onfido.com

Installation

Install the following dependencies:

go get github.com/stretchr/testify/assert
go get golang.org/x/net/context

Put the package under your project folder and add the following in import:

import openapi "github.com/dhia-gharsallaoui/go-onfido"

To use a proxy, set the environment variable HTTP_PROXY:

os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port")

Configuration of Server URL

Default configuration comes with Servers field that contains server objects as defined in the OpenAPI specification.

Select Server Configuration

For using other server than the one defined on index 0 set context value openapi.ContextServerIndex of type int.

ctx := context.WithValue(context.Background(), openapi.ContextServerIndex, 1)

Templated Server URL

Templated server URL is formatted using default variables from configuration or from context value openapi.ContextServerVariables of type map[string]string.

ctx := context.WithValue(context.Background(), openapi.ContextServerVariables, map[string]string{
	"basePath": "v2",
})

Note, enum values are always validated and all unused variables are silently ignored.

URLs Configuration per Operation

Each operation can use different server URL defined using OperationServers map in the Configuration. An operation is uniquely identified by "{classname}Service.{nickname}" string. Similar rules for overriding default operation server index and variables applies by using openapi.ContextOperationServerIndices and openapi.ContextOperationServerVariables context maps.

ctx := context.WithValue(context.Background(), openapi.ContextOperationServerIndices, map[string]int{
	"{classname}Service.{nickname}": 2,
})
ctx = context.WithValue(context.Background(), openapi.ContextOperationServerVariables, map[string]map[string]string{
	"{classname}Service.{nickname}": {
		"port": "8443",
	},
})

Documentation for API Endpoints

All URIs are relative to https://api.eu.onfido.com/v3.6

Class Method HTTP request Description
DefaultAPI CancelReport Post /reports/{report_id}/cancel Cancel report
DefaultAPI CompleteTask Post /workflow_runs/{workflow_run_id}/tasks/{task_id}/complete Complete Task
DefaultAPI CreateApplicant Post /applicants Create Applicant
DefaultAPI CreateCheck Post /checks Create a check
DefaultAPI CreateTimelineFile Post /workflow_runs/{workflow_run_id}/timeline_file Create Timeline File for Workflow Run
DefaultAPI CreateWatchlistMonitor Post /watchlist_monitors Create monitor
DefaultAPI CreateWebhook Post /webhooks Register webhook
DefaultAPI CreateWorkflowRun Post /workflow_runs Create a Workflow Run
DefaultAPI DeleteApplicant Delete /applicants/{applicant_id} Delete Applicant
DefaultAPI DeleteWatchlistMonitor Delete /watchlist_monitors/{monitor_id} Delete monitor
DefaultAPI DeleteWebhook Delete /webhooks/{webhook_id} Delete a webhook
DefaultAPI DownloadCheck Get /checks/{check_id}/download Download check
DefaultAPI DownloadDocument Get /documents/{document_id}/download Download document
DefaultAPI DownloadDocumentVideo Get /documents/{document_id}/video/download Download document video
DefaultAPI DownloadIdPhoto Get /id_photos/{id_photo_id}/download Download ID photo
DefaultAPI DownloadLivePhoto Get /live_photos/{live_photo_id}/download Download live photo
DefaultAPI DownloadLiveVideo Get /live_videos/{live_video_id}/download Download live video
DefaultAPI DownloadLiveVideoFrame Get /live_videos/{live_video_id}/frame Download live video frame
DefaultAPI DownloadMotionCapture Get /motion_captures/{motion_capture_id}/download Download motion capture
DefaultAPI DownloadMotionCaptureFrame Get /motion_captures/{motion_capture_id}/frame Download motion capture frame
DefaultAPI DownloadQesDocument Get /qualified_electronic_signature/documents Retrieves the signed document or application form
DefaultAPI DownloadSignedEvidenceFile Get /workflow_runs/{workflow_run_id}/signed_evidence_file Retrieve Workflow Run Evidence Summary File
DefaultAPI Extract Post /extractions Autofill
DefaultAPI FindAddresses Get /addresses/pick Address Picker
DefaultAPI FindApplicant Get /applicants/{applicant_id} Retrieve Applicant
DefaultAPI FindCheck Get /checks/{check_id} Retrieve a Check
DefaultAPI FindDocument Get /documents/{document_id} Retrieve document
DefaultAPI FindIdPhoto Get /id_photos/{id_photo_id} Retrieve ID photo
DefaultAPI FindLivePhoto Get /live_photos/{live_photo_id} Retrieve live photo
DefaultAPI FindLiveVideo Get /live_videos/{live_video_id} Retrieve live video
DefaultAPI FindMotionCapture Get /motion_captures/{motion_capture_id} Retrieve motion capture
DefaultAPI FindReport Get /reports/{report_id} Retrieve report
DefaultAPI FindTask Get /workflow_runs/{workflow_run_id}/tasks/{task_id} Retrieve Task
DefaultAPI FindTimelineFile Get /workflow_runs/{workflow_run_id}/timeline_file/{timeline_file_id} Retrieve Timeline File for Workflow Run
DefaultAPI FindWatchlistMonitor Get /watchlist_monitors/{monitor_id} Retrieve monitor
DefaultAPI FindWebhook Get /webhooks/{webhook_id} Retrieve a Webhook
DefaultAPI FindWorkflowRun Get /workflow_runs/{workflow_run_id} Retrieve Workflow Run
DefaultAPI ForceReportCreationFromWatchlistMonitor Post /watchlist_monitors/{monitor_id}/new_report Force new report creation (BETA)
DefaultAPI GenerateSdkToken Post /sdk_token Generate a SDK token
DefaultAPI ListApplicants Get /applicants List Applicants
DefaultAPI ListChecks Get /checks Retrieve Checks
DefaultAPI ListDocuments Get /documents List documents
DefaultAPI ListIdPhotos Get /id_photos List ID photos
DefaultAPI ListLivePhotos Get /live_photos List live photos
DefaultAPI ListLiveVideos Get /live_videos List live videos
DefaultAPI ListMotionCaptures Get /motion_captures List motion captures
DefaultAPI ListRepeatAttempts Get /repeat_attempts/{report_id} Retrieve repeat attempts
DefaultAPI ListReports Get /reports List reports
DefaultAPI ListTasks Get /workflow_runs/{workflow_run_id}/tasks List Tasks
DefaultAPI ListWatchlistMonitorMatches Get /watchlist_monitors/{monitor_id}/matches List matches (BETA)
DefaultAPI ListWatchlistMonitors Get /watchlist_monitors List monitors
DefaultAPI ListWebhooks Get /webhooks List webhooks
DefaultAPI ListWorkflowRuns Get /workflow_runs List Workflow Runs
DefaultAPI Ping Get /ping Ping
DefaultAPI PostResultsFeedback Post /results_feedback Fraud reporting (ALPHA)
DefaultAPI ResendWebhooks Post /webhooks/resend Resends webhooks
DefaultAPI RestoreApplicant Post /applicants/{applicant_id}/restore Restore Applicant
DefaultAPI ResumeCheck Post /checks/{check_id}/resume Resume a Check
DefaultAPI ResumeReport Post /reports/{report_id}/resume Resume report
DefaultAPI UpdateApplicant Put /applicants/{applicant_id} Update Applicant
DefaultAPI UpdateWatchlistMonitorMatch Patch /watchlist_monitors/{monitor_id}/matches Set match status (BETA)
DefaultAPI UpdateWebhook Put /webhooks/{webhook_id} Edit a webhook
DefaultAPI UploadDocument Post /documents Upload a document
DefaultAPI UploadIdPhoto Post /id_photos Upload ID photo
DefaultAPI UploadLivePhoto Post /live_photos Upload live photo

Documentation For Models

Documentation For Authorization

Authentication schemes defined for the API:

Token

  • Type: API key
  • API key parameter name: Authorization
  • Location: HTTP header

Note, each API key must be added to a map of map[string]APIKey where the key is: Token and passed in as the auth context for each request.

Example

auth := context.WithValue(
		context.Background(),
		openapi.ContextAPIKeys,
		map[string]openapi.APIKey{
			"Token": {Key: "API_KEY_STRING"},
		},
	)
r, err := client.Service.Operation(auth, args)

Documentation for Utility Methods

Due to the fact that model structure members are all pointers, this package contains a number of utility functions to easily obtain pointers to values of basic types. Each of these functions takes a value of the given basic type and returns a pointer to it:

  • PtrBool
  • PtrInt
  • PtrInt32
  • PtrInt64
  • PtrFloat
  • PtrFloat32
  • PtrFloat64
  • PtrString
  • PtrTime

Author