PeopleDoc
PeopleDoc API client.
Instanciate client
var peopleDoc = uri: 'https://api.url.com/v1/' apiKey: "YOUR-API-KEY";
peopledoc
instance provides a few models which consumes PeopleDoc API.
Each Model embeds some static functions which are usable directly from the models and some methods wich are usable from the instances of the models. Both statics and methods handle promises and callback patterns.
Model properties depends on PeopleDoc official documentation.
Example of statics:
peopleDocEmployee ;
Example of methods:
var user = 'lastname': 'MARTIN' 'firstname': 'Paul' // ... ; user ;
Employee
Consume Employee API.
Statics
- RegistrationReference: Model
- findById: function (technical_id)
- register: function (technical_id, registration)
- unregister: function (technical_id, organization_code, registration_number)
- leave: function (technical_id)
- returns: returns(technical_id)
Methods
- save: function ()
- register: function (registration)
- unregister: function (registration)
- leave: function ()
- returns: function ()
Document
Consume Document API.
Statics
- download: function (document_id)
Methods
- save: function (file)
Signature
Consume Signature API.
Statics
- find: function (query)
- findById: function (id)
Methods
- send: function (file)
Example
Saving a new user
var user = 'lastname': 'MARTIN' 'firstname': 'Paul' 'email': 'mpaul@example.com' 'technical_id': 'internal056' 'registration_references': 'organization_code': 'FSUD1' 'registration_number': 'BYUIE5685678' 'active': true 'organization_code': 'FSUD2' 'registration_number': 'BYUIE5685677' 'active': false 'departure_date': '2014-12-31' 'dob': '1985-04-12' 'address1': '34 rue du général' 'zip_code': '75016' 'city': 'Paris' 'country': 'FR' 'mobile_phone_number': '0033645764425' 'filters': 'nh': '4' 'title': 'directeur' ; user;
Searching then registering a user
peopleDocEmployee ;
Signing a document
var signature = 'external_id': '00000005' 'signature_type': 'delegation' 'document_type': 'contrat-de-travail' 'document_type_metas': 'date-de-debut-de-contrat': '2016-08-16' 'title': 'Contrat de travail Paul' 'reason': 'Contrat de travail CDD' 'location': 'Paris' 'requestor_description': 'Natalie Dupond' 'expiration_date': '2016-07-14T19:20+01:00' 'auto_archive': true 'callback_url': 'https://your-domain.com/signing_callback/' 'signers': 'type': 'employee' 'technical_id': 'internal002' 'email_address': 'jbdemonte@gmail.com' 'phone_number': '0033626216032' 'signing_order': 2 'pdf_sign_field': 'FIELD_1' 'generate_pdf_sign_field': 'page': 1 'llx':250 'lly':100 'urx':350 'ury':150 'with_sms_notification': true 'with_sms_authentication': true ; signature;
signature.send also accepts a readable stream instead of the file path.
Finding available signatures
peopleDocSignature; peopleDocSignature;
Saving a document
var document = 'external_unique_id': "6789678GKVGHKVGHJM" 'title': "Sample PDF" 'document_type_code': "contrat-de-travail" 'date': "2013-01-24" 'document_type_metas': 'date-de-debut-de-contrat': "2016-07-30" 'employee_technical_id': "internal056" 'organization_codes': 'FSUD1' 'FSUD2' 'api_uploader_name': "Mike Doug"; document;
Downloading a document
peopleDocDocument;