Giter Club home page Giter Club logo

api-javascript-client's Introduction

onfido

Onfido - JavaScript client for onfido The Onfido API is used to submit check requests. This SDK is automatically generated by the Swagger Codegen project:

  • API version: 2.0.0
  • Package version: 1.1.0
  • Build date: 2017-12-21T16:52:35.675Z
  • Build package: class io.swagger.codegen.languages.JavascriptClientCodegen

Installation

npm

To publish the library as a npm, please follow the procedure in "Publishing npm packages".

Then install it via:

npm install onfido --save

git

If the library is hosted at a git repository, e.g. https://github.com/onfido/api-javascript-client then install it via:

    npm install onfido/api-javascript-client --save

For browser

The library also works in the browser environment via npm and browserify. After following the above steps with Node.js and installing browserify with npm install -g browserify, perform the following (assuming main.js is your entry file):

browserify main.js > bundle.js

Then include bundle.js in the HTML pages.

Getting Started

Please follow the installation instruction and execute the following JS code:

var Onfido = require('onfido');

var defaultClient = Onfido.ApiClient.instance;

// Configure API key authorization: Token
var Token = defaultClient.authentications['Token'];
Token.apiKey = 'token=' + 'YOUR API KEY';
Token.apiKeyPrefix = 'Token';

var api = new Onfido.DefaultApi();

// setting applicant details
var applicant = new Onfido.Applicant();
applicant.first_name = 'John';
applicant.last_name = 'Smith';
applicant.dob = new Date('1980-01-22');
applicant.country = 'GBR';

var address = new Onfido.Address();
address.building_number = '100';
address.street = 'Main Street';
address.town = 'London';
address.postcode = 'SW4 6EH';
address.country = 'GBR';

applicant.addresses = [address];

// setting check request details
var check = new Onfido.CheckCreationRequest();
check.type = 'express';

var report = new Onfido.Report();
report.name = 'identity';

check.reports = [report];

var createApplicantCallback = function(error, data, response) {
  if (error) {
    console.error(error.response.body);
  } else {
    var applicantId = data.id;
    api.createCheck(applicantId, {'data': check}, createCheckCallback);
  }
};

var createCheckCallback = function(error, data, response) {
  if (error) {
    console.error(error.response.body);
  } else {
    console.log(data);
  }
};

api.createApplicant({'data': applicant}, createApplicantCallback);

Documentation for API Endpoints

All URIs are relative to https://api.onfido.com/v2

Class Method HTTP request Description
Onfido.DefaultApi cancelReport POST /checks/{check_id}/reports/{report_id}/cancel This endpoint is for cancelling individual paused reports.
Onfido.DefaultApi createApplicant POST /applicants Create Applicant
Onfido.DefaultApi createCheck POST /applicants/{applicant_id}/checks Create a check
Onfido.DefaultApi createWebhook POST /webhooks Create a webhook
Onfido.DefaultApi destroyApplicant DELETE /applicants/{applicant_id} Delete Applicant
Onfido.DefaultApi downloadDocument GET /applicants/{applicant_id}/documents/{document_id}/download Download a documents raw data
Onfido.DefaultApi downloadLivePhoto GET /live_photos/{live_photo_id}/download Download live photo
Onfido.DefaultApi findAddresses GET /addresses/pick Search for addresses by postcode
Onfido.DefaultApi findApplicant GET /applicants/{applicant_id} Retrieve Applicant
Onfido.DefaultApi findCheck GET /applicants/{applicant_id}/checks/{check_id} Retrieve a Check
Onfido.DefaultApi findDocument GET /applicants/{applicant_id}/documents/{document_id} A single document can be retrieved by calling this endpoint with the document’s unique identifier.
Onfido.DefaultApi findLivePhoto GET /live_photos/{live_photo_id} Retrieve live photo
Onfido.DefaultApi findReport GET /checks/{check_id}/reports/{report_id} A single report can be retrieved using this endpoint with the corresponding unique identifier.
Onfido.DefaultApi findReportTypeGroup GET /report_type_groups/{report_type_group_id} Retrieve single report type group object
Onfido.DefaultApi findWebhook GET /webhooks/{webhook_id} Retrieve a Webhook
Onfido.DefaultApi listApplicants GET /applicants List Applicants
Onfido.DefaultApi listChecks GET /applicants/{applicant_id}/checks Retrieve Checks
Onfido.DefaultApi listDocuments GET /applicants/{applicant_id}/documents List documents
Onfido.DefaultApi listLivePhotos GET /live_photos List live photos
Onfido.DefaultApi listReportTypeGroups GET /report_type_groups Retrieve all report type groups
Onfido.DefaultApi listReports GET /checks/{check_id}/reports All the reports belonging to a particular check can be listed from this endpoint.
Onfido.DefaultApi listWebhooks GET /webhooks List webhooks
Onfido.DefaultApi resumeCheck POST /checks/{check_id}/resume Resume a Check
Onfido.DefaultApi resumeReport POST /checks/{check_id}/reports/{report_id}/resume This endpoint is for resuming individual paused reports.
Onfido.DefaultApi updateApplicant PUT /applicants/{applicant_id} Update Applicant
Onfido.DefaultApi uploadDocument POST /applicants/{applicant_id}/documents Upload a document
Onfido.DefaultApi uploadLivePhoto POST /live_photos Upload live photo

Documentation for Models

api-javascript-client's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.